forked from ConstellationCrypto/bridging-tutorial
-
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.
- Loading branch information
1 parent
de260b0
commit 1d827e2
Showing
5 changed files
with
95 additions
and
1 deletion.
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 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,10 @@ | ||
// SPDX-License-Identifier: MIT | ||
pragma solidity 0.8.15; | ||
|
||
import "@openzeppelin/contracts/token/ERC20/ERC20.sol"; | ||
|
||
contract TestToken is ERC20 { | ||
constructor(uint256 initialSupply) ERC20("TestToken", "TT") { | ||
_mint(msg.sender, initialSupply); | ||
} | ||
} |
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 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,42 @@ | ||
require("dotenv").config(); | ||
|
||
const { ethers, run } = require("hardhat"); | ||
const { TOKENS } = require("../config"); | ||
|
||
async function main(token) { | ||
const l2CustomERC20Factory = await ethers.getContractFactory( | ||
"MantaMintableERC20" | ||
); | ||
const args = [ | ||
"0x4638aC6b5727a8b9586D3eba5B44Be4b74ED41Fc", | ||
token.l2TokenAddress, | ||
token.name, | ||
token.symbol, | ||
token.decimals, | ||
]; | ||
const l2CustomERC20 = await l2CustomERC20Factory.deploy(...args); | ||
console.log(`${token.symbol} L1 Address: ${l2CustomERC20.address}`); | ||
|
||
await l2CustomERC20.deployTransaction.wait(); | ||
|
||
await run("verify:verify", { | ||
address: l2CustomERC20.address, | ||
constructorArguments: args, | ||
contract: "contracts/MantaMintableERC20.sol:MantaMintableERC20" | ||
}); | ||
} | ||
|
||
const tokenInfo = TOKENS[process.env.DEPLOY_TOKEN_NAME]; | ||
if (!tokenInfo) { | ||
console.error('Invalid Token: "process.env.DEPLOY_TOKEN_NAME"'); | ||
return; | ||
} | ||
if (tokenInfo.l1TokenAddress) { | ||
console.error(`Already Deployed: ${tokenInfo.l1TokenAddress}`); | ||
return; | ||
} | ||
|
||
main(tokenInfo).catch((error) => { | ||
console.error(error); | ||
process.exitCode = 1; | ||
}); |
24 changes: 24 additions & 0 deletions
24
standard-bridge-custom-token/scripts/deploy_l2_native_token.js
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,24 @@ | ||
require("dotenv").config(); | ||
|
||
const { ethers, run } = require("hardhat"); | ||
|
||
|
||
async function main() { | ||
const factory = await ethers.getContractFactory("TestToken"); | ||
const args = [ethers.BigNumber.from("10000000000000000000000")]; | ||
const l1CustomERC20 = await factory.deploy(...args); | ||
console.log(`L2 Address: ${l1CustomERC20.address}`); | ||
|
||
await l1CustomERC20.deployTransaction.wait(); | ||
|
||
await run("verify:verify", { | ||
address: l1CustomERC20.address, | ||
constructorArguments: args, | ||
contract: "contracts/TestToken.sol:TestToken", | ||
}); | ||
} | ||
|
||
main().catch((error) => { | ||
console.error(error); | ||
process.exitCode = 1; | ||
}); |