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

Arbitrum bridge functions (DO NOT MERGE) #3

Open
wants to merge 6 commits into
base: master
Choose a base branch
from
Open
Changes from 1 commit
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
20 changes: 14 additions & 6 deletions contracts/MiniMeToken.sol
Original file line number Diff line number Diff line change
Expand Up @@ -84,6 +84,7 @@ contract MiniMeToken is Controlled, IArbToken {
// bytes32 public view VERSION_HASH =
// keccak256("1")
bytes32 public constant VERSION_HASH = 0xc89efdaa54c0f20c7adf612882df0950f5a951637e0307cdcb4c672f298b8bc6;
address public constant BRIDGED_TOKENS_RESERVE = 0x0000000000000000000000000000000000B71d9E;
0xGabi marked this conversation as resolved.
Show resolved Hide resolved


/// @dev `Checkpoint` is the structure that attaches a block number to a
Expand Down Expand Up @@ -144,6 +145,7 @@ contract MiniMeToken is Controlled, IArbToken {
/// @param _tokenSymbol Token Symbol for the new token
/// @param _transfersEnabled If true, tokens will be able to be transferred
/// @param _l1Address The layer1 token address that this layer2 token represents
/// @param _bridge The address of the bridge contract able to grant/lock bridged tokens
function MiniMeToken(
MiniMeTokenFactory _tokenFactory,
MiniMeToken _parentToken,
Expand All @@ -152,7 +154,8 @@ contract MiniMeToken is Controlled, IArbToken {
uint8 _decimalUnits,
string _tokenSymbol,
bool _transfersEnabled,
address _l1Address
address _l1Address,
address _bridge
) public
{
tokenFactory = _tokenFactory;
Expand All @@ -163,6 +166,7 @@ contract MiniMeToken is Controlled, IArbToken {
parentSnapShotBlock = _parentSnapShotBlock;
transfersEnabled = _transfersEnabled;
l1Address = _l1Address;
bridge = _bridge;
creationBlock = block.number;
nameHash = keccak256(_tokenName);
}
Expand Down Expand Up @@ -494,7 +498,8 @@ contract MiniMeToken is Controlled, IArbToken {
_cloneDecimalUnits,
_cloneTokenSymbol,
_transfersEnabled,
l1Address
l1Address,
bridge
);

cloneToken.changeController(msg.sender);
Expand Down Expand Up @@ -568,12 +573,12 @@ contract MiniMeToken is Controlled, IArbToken {

function bridgeMint(address _to, uint256 _amount) external onlyBridge {
require(transfersEnabled);
require(doTransfer(address(this), _to, _amount));
require(doTransfer(BRIDGED_TOKENS_RESERVE, _to, _amount));
}

function bridgeBurn(address _from, uint256 _amount) external onlyBridge {
require(transfersEnabled);
require(doTransfer(_from, address(this), _amount));
require(doTransfer(_from, BRIDGED_TOKENS_RESERVE, _amount));
}

////////////////
Expand Down Expand Up @@ -714,6 +719,7 @@ contract MiniMeTokenFactory {
/// @param _tokenSymbol Token Symbol for the new token
/// @param _transfersEnabled If true, tokens will be able to be transferred
/// @param _l1Address The layer1 token address that this layer2 token represents
/// @param _bridge The address of the bridge contract able to grant/lock bridged tokens
/// @return The address of the new token contract
function createCloneToken(
MiniMeToken _parentToken,
Expand All @@ -722,7 +728,8 @@ contract MiniMeTokenFactory {
uint8 _decimalUnits,
string _tokenSymbol,
bool _transfersEnabled,
address _l1Address
address _l1Address,
address _bridge
) public returns (MiniMeToken)
{
MiniMeToken newToken = new MiniMeToken(
Expand All @@ -733,7 +740,8 @@ contract MiniMeTokenFactory {
_decimalUnits,
_tokenSymbol,
_transfersEnabled,
_l1Address
_l1Address,
_bridge
);

newToken.changeController(msg.sender);
Expand Down