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

Support layer zero protocol to mint tokens on L2s #53

Draft
wants to merge 6 commits into
base: fantom
Choose a base branch
from

Conversation

boyuan-chen
Copy link
Contributor

@boyuan-chen boyuan-chen commented Jul 11, 2022

This introduces a whitelist system in L2StandardERC20LayerZero.sol for the L2_BOBA.sol. Any contracts or addresses in the whitelist are allowed to mint tokens.

uint8 private immutable _decimals;

// Allow us to register a bridge to mint and burn tokens
mapping(address => bool) public whitelistBridges;
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The whitelistBridges is added

import { Ownable } from "@openzeppelin/contracts/access/Ownable.sol";
import "./IL2StandardERC20.sol";

contract L2StandardERC20LayerZero is IL2StandardERC20, ERC20, Pausable, Ownable {
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The owner can pause this contract for the security consideration.

/*********************/
modifier onlyWhitelistBridge() {
require(
msg.sender == l2Bridge || whitelistBridges[msg.sender],
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

l2Bridge and msg.sender in whitelistBridges can mint and burn tokens.

* @param _symbol ERC20 symbol.
* @param _decimals ERC20 decimals.
*/
function createStandardLayerZeroL2Token(
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The createStandardLayerZeroL2Token is added for contracts that can be minted by third party.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant