diff --git a/packages/protocol/contracts/test/erc20/FreeMintERC20.sol b/packages/protocol/contracts/test/erc20/FreeMintERC20.sol new file mode 100644 index 00000000000..4830bd584ca --- /dev/null +++ b/packages/protocol/contracts/test/erc20/FreeMintERC20.sol @@ -0,0 +1,19 @@ +// SPDX-License-Identifier: MIT +// _____ _ _ _ _ +// |_ _|_ _(_) |_____ | | __ _| |__ ___ +// | |/ _` | | / / _ \ | |__/ _` | '_ (_-< +// |_|\__,_|_|_\_\___/ |____\__,_|_.__/__/ + +pragma solidity ^0.8.18; + +import {ERC20} from "@openzeppelin/contracts/token/ERC20/ERC20.sol"; + +// An ERC20 Token with a mint function anyone can call, for free, to receive +// 5 tokens. +contract FreeMintERC20 is ERC20 { + constructor(string memory name, string memory symbol) ERC20(name, symbol) {} + + function mint(address to) public { + _mint(to, 5 ** decimals()); + } +} diff --git a/packages/protocol/contracts/test/bridge/BullToken.sol b/packages/protocol/contracts/test/erc20/MayFailFreeMintERC20.sol similarity index 78% rename from packages/protocol/contracts/test/bridge/BullToken.sol rename to packages/protocol/contracts/test/erc20/MayFailFreeMintERC20.sol index 7d80b56b408..6e38de584e3 100644 --- a/packages/protocol/contracts/test/bridge/BullToken.sol +++ b/packages/protocol/contracts/test/erc20/MayFailFreeMintERC20.sol @@ -8,14 +8,14 @@ pragma solidity ^0.8.18; import {ERC20} from "@openzeppelin/contracts/token/ERC20/ERC20.sol"; -// An ERC2 token for testing the Taiko Bridge on testnets. +// An ERC20 token for testing the Taiko Bridge on testnets. // This token has 50% of failure on transfers so we can // test the bridge's error handling. -contract BullToken is ERC20 { - uint256 private constant INITIAL_SUPPLY = 10000000 * 1E18; +contract MayFailFreeMintERC20 is ERC20 { + constructor(string memory name, string memory symbol) ERC20(name, symbol) {} - constructor() ERC20("Bull Token", "BLL") { - _mint(msg.sender, INITIAL_SUPPLY); + function mint(address to) public { + _mint(to, 5 ** decimals()); } function transfer( diff --git a/packages/protocol/tasks/deploy_L1.ts b/packages/protocol/tasks/deploy_L1.ts index 9f6aecbd769..4c4f5a074d1 100644 --- a/packages/protocol/tasks/deploy_L1.ts +++ b/packages/protocol/tasks/deploy_L1.ts @@ -132,6 +132,20 @@ export async function deployContracts(hre: any) { ) ); + // HorseToken + const HorseToken = await utils.deployContract(hre, "FreeMintERC20", {}, [ + "Horse Token", + "HORSE", + ]); + + // BullToken + const BullToken = await utils.deployContract( + hre, + "MayFailFreeMintERC20", + {}, + ["Bull Token", "BLL"] + ); + // TaikoL1 const TaikoL1 = await utils.deployContract( hre, @@ -242,10 +256,6 @@ export async function deployContracts(hre: any) { ); } - // BullToken - // TODO(david): remove this deployment after we finish bridge testing in devnet. - const BullToken = await utils.deployContract(hre, "BullToken"); - // save deployments const deployments = { network, @@ -259,7 +269,8 @@ export async function deployContracts(hre: any) { { Bridge: Bridge.address }, { SignalService: SignalService.address }, { TokenVault: TokenVault.address }, - { BullToken: BullToken.address } + { BullToken: BullToken.address }, + { HorseToken: HorseToken.address } ), };