Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat(protocol): Deploy a FreeMintERC20 and a MayFailFreeMintERC20 on deploy of L1 #13222

Merged
merged 2 commits into from
Feb 28, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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