Skip to content

Commit

Permalink
Deploy Blast (#316)
Browse files Browse the repository at this point in the history
* Deploy & verify Legacy Multsiig

* Non-AMM Base Bridge Deploys

* Add USDB / WETH predeploys to deployments/

* Base AMM Deployments, nUSD & nETH Pools, SwapETHWrapper

* deploy SwapETHWrapper (Missed in last commit)

* Fix Blast url

* Deploy/blast synapse router (#317)

* Add blast settings

* Deploy aux contracts

* Prep for Router deployment

* Deploy QuoterV2 and RouterV1

* Save blast configs

* Deploy: blast fb router (#318)

* Add Blast deployment of FastBridge

* Deploy FB Router

---------

Co-authored-by: ChiTimesChi <[email protected]>
  • Loading branch information
aureliusbtc and ChiTimesChi authored Mar 5, 2024
1 parent 5d46220 commit 47fe6e8
Show file tree
Hide file tree
Showing 54 changed files with 22,881 additions and 2 deletions.
1 change: 1 addition & 0 deletions deploy/000_check_Multisig.ts
Original file line number Diff line number Diff line change
Expand Up @@ -364,6 +364,7 @@ const func: DeployFunction = async function (hre: HardhatRuntimeEnvironment) {
CHAIN_ID.KLATYN,
CHAIN_ID.CANTO,
CHAIN_ID.DOGECHAIN,
CHAIN_ID.BLAST,
],
await getChainId()
)
Expand Down
1 change: 1 addition & 0 deletions deploy/011_deploy_nETH.ts
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@ const func: DeployFunction = async function (hre: HardhatRuntimeEnvironment) {
CHAIN_ID.CANTO,
CHAIN_ID.BASE,
CHAIN_ID.ZKEVM,
CHAIN_ID.BLAST,
],
await getChainId()
)
Expand Down
2 changes: 1 addition & 1 deletion deploy/amm/005_deploy_SwapDeployer.ts
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ const func: DeployFunction = async function (hre: HardhatRuntimeEnvironment) {
const currentOwner = await read("SwapDeployer", "owner");
const multisig = (await get("DevMultisig")).address;

if ((await getChainId()) == "1" && currentOwner != multisig) {
if (currentOwner != multisig) {
await execute("SwapDeployer", { from: deployer, log: true }, "transferOwnership", multisig);
}
}
Expand Down
6 changes: 6 additions & 0 deletions deploy/amm/100_deploy_nUSDV3Pool.ts
Original file line number Diff line number Diff line change
Expand Up @@ -102,6 +102,12 @@ const func: DeployFunction = async function (hre: HardhatRuntimeEnvironment) {
INITIAL_A = 800;
}

if ((await getChainId()) === CHAIN_ID.BLAST) {
TOKEN_ADDRESSES = [(await get("nUSD")).address, (await get("USDB")).address];
TOKEN_DECIMALS = [18, 18];
INITIAL_A = 500;
}

// if (await getChainId() === CHAIN_ID.OPTIMISM) {
// TOKEN_ADDRESSES = [
// (await get("nUSD")).address,
Expand Down
64 changes: 64 additions & 0 deletions deploy/blast/012_deploy_nETHPool.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,64 @@
import { HardhatRuntimeEnvironment } from "hardhat/types";
import { DeployFunction } from "hardhat-deploy/types";
import { CHAIN_ID } from "../../utils/network";

const func: DeployFunction = async function (hre: HardhatRuntimeEnvironment) {
const { deployments, getNamedAccounts, getChainId } = hre;
const { execute, get, getOrNull, log, read, save } = deployments;
const { deployer } = await getNamedAccounts();

// Manually check if the pool is already deployed
let ETHPool = await getOrNull("ETHPool");
if (ETHPool) {
log(`reusing "ETHPool" at ${ETHPool.address}`);
} else if ((await getChainId()) != CHAIN_ID.BLAST && (await getChainId()) != CHAIN_ID.HARDHAT) {
log(`Not Blast or Hardhat`);
} else {
// Constructor arguments
const TOKEN_ADDRESSES = [(await get("nETH")).address, (await get("WETH")).address];
const TOKEN_DECIMALS = [18, 18];
const LP_TOKEN_NAME = "nETH-LP";
const LP_TOKEN_SYMBOL = "nETH-LP";
const INITIAL_A = 500;
const SWAP_FEE = 1e6; // 4bps
const ADMIN_FEE = 9900000000;

const receipt = await execute(
"SwapDeployer",
{ from: deployer, log: true },
"deploy",
(
await get("SwapFlashLoan")
).address,
TOKEN_ADDRESSES,
TOKEN_DECIMALS,
LP_TOKEN_NAME,
LP_TOKEN_SYMBOL,
INITIAL_A,
SWAP_FEE,
ADMIN_FEE,
(
await get("LPToken")
).address
);

const newPoolEvent = receipt?.events?.find((e: any) => e["event"] == "NewSwapPool");
const usdSwapAddress = newPoolEvent["args"]["swapAddress"];
log(`deployed ETH pool clone (targeting "SwapFlashLoan") at ${usdSwapAddress}`);
await save("ETHPool", {
abi: (await get("SwapFlashLoan")).abi,
address: usdSwapAddress,
});

const lpTokenAddress = (await read("ETHPool", "swapStorage")).lpToken;
log(`ETH pool LP Token at ${lpTokenAddress}`);

await save("ETHPoolLPToken", {
abi: (await get("WETH")).abi, // Generic ERC20 ABI
address: lpTokenAddress,
});
}
};
export default func;
func.tags = ["BLAST_ETHPool"];
func.dependencies = ["SwapUtils", "SwapDeployer", "SwapFlashLoan", "USDPoolTokens"];
24 changes: 24 additions & 0 deletions deploy/blast/014_deploy_SwapEthWrapper.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
import { DeployFunction } from "hardhat-deploy/types";
import { HardhatRuntimeEnvironment } from "hardhat/types";
import { CHAIN_ID } from "../../utils/network";

const func: DeployFunction = async function (hre: HardhatRuntimeEnvironment) {
const { deployments, getNamedAccounts, getChainId } = hre;
const { deploy, get } = deployments;
const { deployer } = await getNamedAccounts();

if ((await getChainId()) === CHAIN_ID.BLAST) {
await deploy("SwapEthWrapper", {
from: deployer,
log: true,
skipIfAlreadyDeployed: true,
args: [
(await get("WETH")).address,
(await get("ETHPool")).address,
(await get("DevMultisig")).address,
],
});
}
};
export default func;
func.tags = ["BLAST_SwapEthWrapper"];
1 change: 1 addition & 0 deletions deployments/blast/.chainId
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
81457
163 changes: 163 additions & 0 deletions deployments/blast/AmplificationUtils.json

Large diffs are not rendered by default.

4 changes: 4 additions & 0 deletions deployments/blast/Create2Factory.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
{
"address": "0xa6190aBC82427800935E0598892f7488a7F73A04",
"constructorArgs": "0x"
}
30 changes: 30 additions & 0 deletions deployments/blast/DefaultPoolCalc.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
{
"address": "0x0000000000Cc5af216a3E1614091a20e11bbfD32",
"constructorArgs": "0x",
"abi": [
{
"type": "function",
"name": "calculateAddLiquidity",
"inputs": [
{
"name": "pool",
"type": "address",
"internalType": "address"
},
{
"name": "amounts",
"type": "uint256[]",
"internalType": "uint256[]"
}
],
"outputs": [
{
"name": "amountOut",
"type": "uint256",
"internalType": "uint256"
}
],
"stateMutability": "view"
}
]
}
259 changes: 259 additions & 0 deletions deployments/blast/DefaultProxyAdmin.json

Large diffs are not rendered by default.

4 changes: 4 additions & 0 deletions deployments/blast/DevMultisig.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
{
"address": "0x11EB5B6C45fB7E70aDf6a639E6C9CF58F0073aa9",
"abi": [{"type":"function","stateMutability":"view","payable":false,"outputs":[{"type":"address","name":""}],"name":"owners","inputs":[{"type":"uint256","name":""}],"constant":true},{"type":"function","stateMutability":"nonpayable","payable":false,"outputs":[],"name":"removeOwner","inputs":[{"type":"address","name":"owner"}],"constant":false},{"type":"function","stateMutability":"nonpayable","payable":false,"outputs":[],"name":"revokeConfirmation","inputs":[{"type":"uint256","name":"transactionId"}],"constant":false},{"type":"function","stateMutability":"view","payable":false,"outputs":[{"type":"bool","name":""}],"name":"isOwner","inputs":[{"type":"address","name":""}],"constant":true},{"type":"function","stateMutability":"view","payable":false,"outputs":[{"type":"bool","name":""}],"name":"confirmations","inputs":[{"type":"uint256","name":""},{"type":"address","name":""}],"constant":true},{"type":"function","stateMutability":"view","payable":false,"outputs":[{"type":"uint256","name":""}],"name":"calcMaxWithdraw","inputs":[],"constant":true},{"type":"function","stateMutability":"view","payable":false,"outputs":[{"type":"uint256","name":"count"}],"name":"getTransactionCount","inputs":[{"type":"bool","name":"pending"},{"type":"bool","name":"executed"}],"constant":true},{"type":"function","stateMutability":"view","payable":false,"outputs":[{"type":"uint256","name":""}],"name":"dailyLimit","inputs":[],"constant":true},{"type":"function","stateMutability":"view","payable":false,"outputs":[{"type":"uint256","name":""}],"name":"lastDay","inputs":[],"constant":true},{"type":"function","stateMutability":"nonpayable","payable":false,"outputs":[],"name":"addOwner","inputs":[{"type":"address","name":"owner"}],"constant":false},{"type":"function","stateMutability":"view","payable":false,"outputs":[{"type":"bool","name":""}],"name":"isConfirmed","inputs":[{"type":"uint256","name":"transactionId"}],"constant":true},{"type":"function","stateMutability":"view","payable":false,"outputs":[{"type":"uint256","name":"count"}],"name":"getConfirmationCount","inputs":[{"type":"uint256","name":"transactionId"}],"constant":true},{"type":"function","stateMutability":"view","payable":false,"outputs":[{"type":"address","name":"destination"},{"type":"uint256","name":"value"},{"type":"bytes","name":"data"},{"type":"bool","name":"executed"}],"name":"transactions","inputs":[{"type":"uint256","name":""}],"constant":true},{"type":"function","stateMutability":"view","payable":false,"outputs":[{"type":"address[]","name":""}],"name":"getOwners","inputs":[],"constant":true},{"type":"function","stateMutability":"view","payable":false,"outputs":[{"type":"uint256[]","name":"_transactionIds"}],"name":"getTransactionIds","inputs":[{"type":"uint256","name":"from"},{"type":"uint256","name":"to"},{"type":"bool","name":"pending"},{"type":"bool","name":"executed"}],"constant":true},{"type":"function","stateMutability":"view","payable":false,"outputs":[{"type":"address[]","name":"_confirmations"}],"name":"getConfirmations","inputs":[{"type":"uint256","name":"transactionId"}],"constant":true},{"type":"function","stateMutability":"view","payable":false,"outputs":[{"type":"uint256","name":""}],"name":"transactionCount","inputs":[],"constant":true},{"type":"function","stateMutability":"nonpayable","payable":false,"outputs":[],"name":"changeRequirement","inputs":[{"type":"uint256","name":"_required"}],"constant":false},{"type":"function","stateMutability":"nonpayable","payable":false,"outputs":[],"name":"confirmTransaction","inputs":[{"type":"uint256","name":"transactionId"}],"constant":false},{"type":"function","stateMutability":"nonpayable","payable":false,"outputs":[{"type":"uint256","name":"transactionId"}],"name":"submitTransaction","inputs":[{"type":"address","name":"destination"},{"type":"uint256","name":"value"},{"type":"bytes","name":"data"}],"constant":false},{"type":"function","stateMutability":"nonpayable","payable":false,"outputs":[],"name":"changeDailyLimit","inputs":[{"type":"uint256","name":"_dailyLimit"}],"constant":false},{"type":"function","stateMutability":"view","payable":false,"outputs":[{"type":"uint256","name":""}],"name":"MAX_OWNER_COUNT","inputs":[],"constant":true},{"type":"function","stateMutability":"view","payable":false,"outputs":[{"type":"uint256","name":""}],"name":"required","inputs":[],"constant":true},{"type":"function","stateMutability":"nonpayable","payable":false,"outputs":[],"name":"replaceOwner","inputs":[{"type":"address","name":"owner"},{"type":"address","name":"newOwner"}],"constant":false},{"type":"function","stateMutability":"nonpayable","payable":false,"outputs":[],"name":"executeTransaction","inputs":[{"type":"uint256","name":"transactionId"}],"constant":false},{"type":"function","stateMutability":"view","payable":false,"outputs":[{"type":"uint256","name":""}],"name":"spentToday","inputs":[],"constant":true},{"type":"constructor","stateMutability":"nonpayable","payable":false,"inputs":[{"type":"address[]","name":"_owners"},{"type":"uint256","name":"_required"},{"type":"uint256","name":"_dailyLimit"}]},{"type":"fallback","stateMutability":"payable","payable":true},{"type":"event","name":"DailyLimitChange","inputs":[{"type":"uint256","name":"dailyLimit","indexed":false}],"anonymous":false},{"type":"event","name":"Confirmation","inputs":[{"type":"address","name":"sender","indexed":true},{"type":"uint256","name":"transactionId","indexed":true}],"anonymous":false},{"type":"event","name":"Revocation","inputs":[{"type":"address","name":"sender","indexed":true},{"type":"uint256","name":"transactionId","indexed":true}],"anonymous":false},{"type":"event","name":"Submission","inputs":[{"type":"uint256","name":"transactionId","indexed":true}],"anonymous":false},{"type":"event","name":"Execution","inputs":[{"type":"uint256","name":"transactionId","indexed":true}],"anonymous":false},{"type":"event","name":"ExecutionFailure","inputs":[{"type":"uint256","name":"transactionId","indexed":true}],"anonymous":false},{"type":"event","name":"Deposit","inputs":[{"type":"address","name":"sender","indexed":true},{"type":"uint256","name":"value","indexed":false}],"anonymous":false},{"type":"event","name":"OwnerAddition","inputs":[{"type":"address","name":"owner","indexed":true}],"anonymous":false},{"type":"event","name":"OwnerRemoval","inputs":[{"type":"address","name":"owner","indexed":true}],"anonymous":false},{"type":"event","name":"RequirementChange","inputs":[{"type":"uint256","name":"required","indexed":false}],"anonymous":false}]
}
Loading

0 comments on commit 47fe6e8

Please sign in to comment.