Skip to content

Commit

Permalink
feat(protocol): Deploy a FreeMintERC20 and a MayFailFreeMintERC20 on …
Browse files Browse the repository at this point in the history
…deploy of L1 (#13222)
  • Loading branch information
cyberhorsey authored Feb 28, 2023
1 parent cd52dc0 commit 0d3e769
Show file tree
Hide file tree
Showing 3 changed files with 40 additions and 10 deletions.
19 changes: 19 additions & 0 deletions packages/protocol/contracts/test/erc20/FreeMintERC20.sol
Original file line number Diff line number Diff line change
@@ -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());
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -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(
Expand Down
21 changes: 16 additions & 5 deletions packages/protocol/tasks/deploy_L1.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down Expand Up @@ -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,
Expand All @@ -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 }
),
};

Expand Down

0 comments on commit 0d3e769

Please sign in to comment.