L2TBTC
L2TBTC
Canonical L2/sidechain token implementation. tBTC token is minted on L1 and locked there to be moved to L2/sidechain. By deploying a canonical token on each L2/sidechain, we can ensure the supply of tBTC remains sacrosanct, while enabling quick, interoperable cross-chain bridges and localizing ecosystem risk.
This contract is flexible enough to:
Delegate minting authority to a native bridge on the chain, if present.
Delegate minting authority to a short list of ecosystem bridges.
Have mints and burns paused by any one of n guardians, allowing avoidance of contagion in case of a chain- or bridge-specific incident.
Be governed and upgradeable.
The token is burnable by the token holder and supports EIP2612 permits. Token holder can authorize a transfer of their token with a signature conforming EIP712 standard instead of an on-chain transaction from their address. Anyone can submit this signature on the user's behalf by calling the permit function, paying gas fees, and possibly performing other actions in the same transaction. The governance can recover ERC20 and ERC721 tokens sent mistakenly to L2TBTC token contract.
isMinter
Indicates if the given address is a minter. Only minters can mint the token.
minters
List of all minters.
isGuardian
Indicates if the given address is a guardian. Only guardians can pause token mints and burns.
guardians
List of all guardians.
MinterAdded
MinterRemoved
GuardianAdded
GuardianRemoved
onlyMinter
onlyGuardian
initialize
Initializes the token contract.
Parameters
Name | Type | Description |
---|---|---|
_name | string | The name of the token. |
_symbol | string | The symbol of the token, usually a shorter version of the name. |
addMinter
Adds the address to the minters list.
Requirements:
The caller must be the contract owner.
minter
must not be a minter address already.
Parameters
Name | Type | Description |
---|---|---|
minter | address | The address to be added as a minter. |
removeMinter
Removes the address from the minters list.
Requirements:
The caller must be the contract owner.
minter
must be a minter address.
Parameters
Name | Type | Description |
---|---|---|
minter | address | The address to be removed from the minters list. |
addGuardian
Adds the address to the guardians list.
Requirements:
The caller must be the contract owner.
guardian
must not be a guardian address already.
Parameters
Name | Type | Description |
---|---|---|
guardian | address | The address to be added as a guardian. |
removeGuardian
Removes the address from the guardians list.
Requirements:
The caller must be the contract owner.
guardian
must be a guardian address.
Parameters
Name | Type | Description |
---|---|---|
guardian | address | The address to be removed from the guardians list. |
recoverERC20
Allows the governance of the token contract to recover any ERC20 sent mistakenly to the token contract address.
Parameters
Name | Type | Description |
---|---|---|
token | contract IERC20Upgradeable | The address of the token to be recovered. |
recipient | address | The token recipient address that will receive recovered tokens. |
amount | uint256 | The amount to be recovered. |
recoverERC721
Allows the governance of the token contract to recover any ERC721 sent mistakenly to the token contract address.
Parameters
Name | Type | Description |
---|---|---|
token | contract IERC721Upgradeable | The address of the token to be recovered. |
recipient | address | The token recipient address that will receive the recovered token. |
tokenId | uint256 | The ID of the ERC721 token to be recovered. |
data | bytes |
pause
Allows one of the guardians to pause mints and burns allowing avoidance of contagion in case of a chain- or bridge-specific incident.
Requirements:
The caller must be a guardian.
The contract must not be already paused.
unpause
Allows the governance to unpause mints and burns previously paused by one of the guardians.
Requirements:
The caller must be the contract owner.
The contract must be paused.
mint
Allows one of the minters to mint amount
tokens and assign them to account
, increasing the total supply. Emits a Transfer
event with from
set to the zero address.
Requirements:
The caller must be a minter.
account
must not be the zero address.
Parameters
Name | Type | Description |
---|---|---|
account | address | The address to receive tokens. |
amount | uint256 | The amount of token to be minted. |
burn
Destroys amount
tokens from the caller. Emits a Transfer
event with to
set to the zero address.
Requirements:
The caller must have at least
amount
tokens.
Parameters
Name | Type | Description |
---|---|---|
amount | uint256 | The amount of token to be burned. |
burnFrom
Destroys amount
tokens from account
, deducting from the caller's allowance. Emits a Transfer
event with to
set to the zero address.
Requirements:
The che caller must have allowance for
accounts
's tokens of at leastamount
.account
must not be the zero address.account
must have at leastamount
tokens.
Parameters
Name | Type | Description |
---|---|---|
account | address | The address owning tokens to be burned. |
amount | uint256 | The amount of token to be burned. |
getMinters
Allows to fetch a list of all minters.
getGuardians
Allows to fetch a list of all guardians.
Last updated