Skip to main content

BridgedToken

ERC20 token created when a native token is bridged to a target chain.

bridge

address bridge

_decimals

uint8 _decimals

OnlyBridge

error OnlyBridge(address bridgeAddress)

constructor

constructor() public

Disable constructor for safety

initialize

function initialize(string _tokenName, string _tokenSymbol, uint8 _tokenDecimals) external

onlyBridge

modifier onlyBridge()

Ensures call come from the bridge.

mint

function mint(address _recipient, uint256 _amount) external

Called by the bridge to mint tokens during a bridge transaction.

Parameters

NameTypeDescription
_recipientaddressThe address to receive the minted tokens.
_amountuint256The amount of tokens to mint.

burn

function burn(address _account, uint256 _amount) external

Called by the bridge to burn tokens during a bridge transaction. User should first have allowed the bridge to spend tokens on their behalf.

Parameters

NameTypeDescription
_accountaddressThe account from which tokens will be burned.
_amountuint256The amount of tokens to burn.

decimals

function decimals() public view returns (uint8)

Overrides ERC20 default function to support tokens with different decimals.

Return Values

NameTypeDescription
[0]uint8The number of decimal.