-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #1 from rhlsthrm/base
Base
- Loading branch information
Showing
72 changed files
with
22,901 additions
and
2,538 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,81 @@ | ||
import { HardhatRuntimeEnvironment } from "hardhat/types"; | ||
import { DeployFunction } from "hardhat-deploy/types"; | ||
|
||
const func: DeployFunction = async function (hre: HardhatRuntimeEnvironment) { | ||
const { deployments, ethers, getChainId } = hre; | ||
const { deploy } = deployments; | ||
const { deployer } = await ethers.getNamedSigners(); | ||
console.log("deployer: ", deployer.address); | ||
const chainId = await getChainId(); | ||
console.log("chainId: ", chainId); | ||
|
||
const network = await deployer.provider.getNetwork(); | ||
console.log("network: ", network.chainId); | ||
|
||
const xerc20Res = await deploy("XERC20", { | ||
contract: "src/XERC20.sol:XERC20", | ||
from: deployer.address, | ||
proxy: { | ||
proxyContract: "OpenZeppelinTransparentProxy", | ||
execute: { | ||
init: { | ||
methodName: "initialize", | ||
args: [ | ||
[8453n, 84531n].includes(network.chainId) | ||
? "BasedZoomerCoin" | ||
: "ZoomerCoin", | ||
"ZOOMER", | ||
deployer.address, | ||
], | ||
}, | ||
}, | ||
}, | ||
log: true, | ||
}); | ||
console.log("xerc20Res.address: ", xerc20Res.address); | ||
console.log("xerc20Res.transactionHash: ", xerc20Res.transactionHash); | ||
const xerc20 = await ethers.getContractAt( | ||
"src/XERC20.sol:XERC20", | ||
xerc20Res.address | ||
); | ||
console.log("xerc20.name: ", await xerc20.name()); | ||
console.log("xerc20.symbol: ", await xerc20.symbol()); | ||
console.log("xerc20.decimals: ", await xerc20.decimals()); | ||
console.log("xerc20.totalSupply: ", await xerc20.totalSupply()); | ||
|
||
if (["1", "5"].includes(chainId)) { | ||
const xerc20LockboxRes = await deploy("XERC20Lockbox", { | ||
contract: "src/XERC20Lockbox.sol:XERC20Lockbox", | ||
from: deployer.address, | ||
proxy: { | ||
proxyContract: "OpenZeppelinTransparentProxy", | ||
execute: { | ||
init: { | ||
methodName: "initialize", | ||
args: [ | ||
xerc20Res.address, | ||
chainId === "1" | ||
? "0x0D505C03d30e65f6e9b4Ef88855a47a89e4b7676" | ||
: "0x7ea6eA49B0b0Ae9c5db7907d139D9Cd3439862a1", | ||
false, | ||
], | ||
}, | ||
}, | ||
}, | ||
log: true, | ||
}); | ||
console.log("xerc20LockboxRes: ", xerc20LockboxRes.address); | ||
console.log( | ||
"xerc20LockboxRes.transactionHash: ", | ||
xerc20LockboxRes.transactionHash | ||
); | ||
|
||
const lockbox = await xerc20.lockbox(); | ||
console.log("lockbox: ", lockbox); | ||
if (lockbox !== xerc20LockboxRes.address) { | ||
await xerc20.setLockbox(xerc20LockboxRes.address); | ||
} | ||
} | ||
}; | ||
export default func; | ||
func.tags = ["XERC20"]; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,102 @@ | ||
import { HardhatRuntimeEnvironment } from "hardhat/types"; | ||
import { DeployFunction } from "hardhat-deploy/types"; | ||
import { MaxUint256, ZeroAddress } from "ethers"; | ||
|
||
const l1CrossDomainMessengerAddresses: Record<string, string> = { | ||
"1": "0x866E82a600A1414e583f7F13623F1aC5d58b0Afa", | ||
"5": "0x8e5693140eA606bcEB98761d9beB1BC87383706D", | ||
}; | ||
|
||
const func: DeployFunction = async function (hre: HardhatRuntimeEnvironment) { | ||
const { deployments, ethers } = hre; | ||
const { deploy } = deployments; | ||
const { deployer } = await ethers.getNamedSigners(); | ||
console.log("deployer: ", deployer.address); | ||
|
||
const network = await deployer.provider.getNetwork(); | ||
console.log("network: ", network.chainId); | ||
|
||
console.log("Deploying OP Bridge Contracts..."); | ||
const xerc20 = await deployments.get("XERC20"); | ||
if (!xerc20) { | ||
throw new Error("XERC20 not deployed"); | ||
} | ||
|
||
let bridgeAddress: string | undefined; | ||
if ([1n, 5n].includes(network.chainId)) { | ||
console.log("Deploying L1 side..."); | ||
const opBridgeRes = await deploy("OpL1XERC20Bridge", { | ||
from: deployer.address, | ||
proxy: { | ||
proxyContract: "OpenZeppelinTransparentProxy", | ||
execute: { | ||
init: { | ||
methodName: "initialize", | ||
args: [ | ||
deployer.address, | ||
xerc20.address, | ||
l1CrossDomainMessengerAddresses[network.chainId.toString()], | ||
], | ||
}, | ||
}, | ||
}, | ||
log: true, | ||
}); | ||
console.log("opBridge L1 deployed to:", opBridgeRes.address); | ||
const opBridge = await ethers.getContractAt( | ||
"OpL1XERC20Bridge", | ||
opBridgeRes.address | ||
); | ||
console.log("opBridge L1 zoomer: ", await opBridge.zoomer()); | ||
bridgeAddress = opBridgeRes.address; | ||
} | ||
|
||
if ([8453n, 84531n].includes(network.chainId)) { | ||
console.log("Deploying L2 side..."); | ||
const opBridgeRes = await deploy("OpL2XERC20Bridge", { | ||
from: deployer.address, | ||
proxy: { | ||
proxyContract: "OpenZeppelinTransparentProxy", | ||
|
||
execute: { | ||
init: { | ||
methodName: "initialize", | ||
args: [deployer.address, xerc20.address], | ||
}, | ||
}, | ||
}, | ||
log: true, | ||
}); | ||
console.log("opBridge L2 deployed to:", opBridgeRes.address); | ||
const opBridge = await ethers.getContractAt( | ||
"OpL2XERC20Bridge", | ||
opBridgeRes.address | ||
); | ||
console.log("opBridge L2 zoomer: ", await opBridge.zoomer()); | ||
bridgeAddress = opBridgeRes.address; | ||
} | ||
|
||
if (bridgeAddress) { | ||
console.log("Setting limits..."); | ||
const _xerc20 = await ethers.getContractAt( | ||
"src/XERC20.sol:XERC20", | ||
xerc20.address | ||
); | ||
const mintLimit = await _xerc20.mintingMaxLimitOf(bridgeAddress); | ||
console.log("mintLimit: ", mintLimit); | ||
const burnLimit = await _xerc20.burningMaxLimitOf(bridgeAddress); | ||
console.log("burnLimit: ", burnLimit); | ||
if (mintLimit != MaxUint256 || burnLimit != MaxUint256) { | ||
const res = await _xerc20.setLimits( | ||
bridgeAddress, | ||
MaxUint256, | ||
MaxUint256 | ||
); | ||
console.log("setLimits tx: ", res.hash); | ||
await res.wait(); | ||
console.log("setLimits done"); | ||
} | ||
} | ||
}; | ||
export default func; | ||
func.tags = ["BridgeContracts"]; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
8453 |
Large diffs are not rendered by default.
Oops, something went wrong.
Oops, something went wrong.