ERC20 router dapp Solidity API
Diamond
constructor
constructor(struct IDiamondCut.FacetCut[] _diamondCut, address _init, bytes _calldata) public payable
fallback
fallback() external payable
Governable
Provides modifiers for securing methods behind a governance vote
onlyConsensus
function onlyConsensus(struct LibGovernance.Storage gs, bytes32 _ethHash, bytes[] _signatures) internal view
Verifies the message hash against the signatures. Requires a majority.
Parameters
Name | Type | Description |
---|---|---|
gs | struct LibGovernance.Storage | |
_ethHash | bytes32 | hash to verify |
_signatures | bytes[] | governance hash signatures |
onlyConsensusNonce
modifier onlyConsensusNonce(bytes32 _ethHash, bytes[] _signatures)
Verifies the message hash against the signatures. Requires a majority. Burns a nonce.
Parameters
Name | Type | Description |
---|---|---|
_ethHash | bytes32 | hash to verify |
_signatures | bytes[] | governance hash signatures |
onlyConsensusHash
modifier onlyConsensusHash(bytes32 _ethHash, bytes[] _signatures)
Verifies the message hash against the signatures. Requires a majority. Burns the hash.
Parameters
Name | Type | Description |
---|---|---|
_ethHash | bytes32 | hash to verify |
_signatures | bytes[] | governance hash signatures |
SingletonFactory
This contract is to be deployed by a single-purpose wallet on all supported networks. It serves as a CREATE2 factory and lets us have the same Diamond addresses across networks. Which in turn allows the diamond to produce the same WrappedCollection addresses across networks.
OwnerZeroAddress
error OwnerZeroAddress()
TargetAddressOccupied
error TargetAddressOccupied()
InitializationFailed
error InitializationFailed()
constructor
constructor(address owner_) public
Sets owner address who can use deploy()
Parameters
Name | Type | Description |
---|---|---|
owner_ | address | owner address |
deploy
function deploy(bytes initCode_, bytes32 salt_, bytes initializer_) external payable returns (address payable deployedContractAddress)
Deploys a contract and optionally calls an initialization method
Parameters
Name | Type | Description |
---|---|---|
initCode_ | bytes | initCode for the contract to be deployed |
salt_ | bytes32 | hash salt for CREATE2 |
initializer_ | bytes | Encoded function call on the newly deployed contract |
WrappedToken
constructor
constructor(string _tokenName, string _tokenSymbol, uint8 decimals_) public
@notice Construct a new WrappedToken contract @param _tokenName The EIP-20 token name @param tokenSymbol The EIP-20 token symbol @param decimals The number of decimals used to get the token's user representation
decimals
function decimals() public view returns (uint8)
_Returns the number of decimals used to get its user representation.
For example, if decimals
equals 2
, a balance of 505
tokens should
be displayed to a user as 5.05
(505 / 10 ** 2
).
Tokens usually opt for a value of 18, imitating the relationship between Ether and Wei. This is the default value returned by this function, unless it's overridden.
NOTE: This information is only used for display purposes: it in no way affects any of the arithmetic of the contract, including {IERC20-balanceOf} and {IERC20-transfer}._
mint
function mint(address _account, uint256 _amount) public
Mints _amount
of tokens to the _account
address
Parameters
Name | Type | Description |
---|---|---|
_account | address | The address to which the tokens will be minted |
_amount | uint256 | The _amount to be minted |
burnFrom
function burnFrom(address _account, uint256 _amount) public
Burns _amount
of tokens from the _account
address
Parameters
Name | Type | Description |
---|---|---|
_account | address | The address from which the tokens will be burned |
_amount | uint256 | The _amount to be burned |
pause
function pause() public
Pauses the contract
unpause
function unpause() public
Unpauses the contract
_beforeTokenTransfer
function _beforeTokenTransfer(address from, address to, uint256 _amount) internal virtual
ChainIdUpdaterFacet
chainId
function chainId() external view returns (uint8)
setChainId
function setChainId(uint8 chainId_, bytes[] signatures_) external
@notice Sets the chain id @param chainId_ The chain id to set
computeSetChainId
function computeSetChainId(uint8 chainId_) internal view returns (bytes32)
@param chainId_ the new chain id @return Hash message represeting the setchainid operation
DiamondCutGovernableFacet
diamondCut
function diamondCut(struct IDiamondCut.FacetCut[] _diamondCut, address _init, bytes _calldata, bytes[] _signatures) external
Add/replace/remove any number of functions and optionally execute a function with delegatecall
Parameters
Name | Type | Description |
---|---|---|
_diamondCut | struct IDiamondCut.FacetCut[] | Contains the facet addresses and function selectors |
_init | address | The address of the contract or facet to execute _calldata |
_calldata | bytes | A function call, including function selector and arguments _calldata is executed with delegatecall on _init |
_signatures | bytes[] |
computeDiamondCutMessage
function computeDiamondCutMessage(struct IDiamondCut.FacetCut[] _diamondCut, address _init, bytes _calldata) internal view returns (bytes32)
@notice Computes the bytes32 ethereum signed message hash of the signature
DiamondCutSimpleFacet
This facet is being attached on the diamond during construction, then, within the same transaction, it is used to remove itself and add all the other facets (including DiamondCutGovernableFacet). This way we always have the same init code accross networks and CREATE2 yields the same address.
diamondCut
function diamondCut(struct IDiamondCut.FacetCut[] _diamondCut, address _init, bytes _calldata) external
Add/replace/remove any number of functions and optionally execute a function with delegatecall
Parameters
Name | Type | Description |
---|---|---|
_diamondCut | struct IDiamondCut.FacetCut[] | Contains the facet addresses and function selectors |
_init | address | The address of the contract or facet to execute _calldata |
_calldata | bytes | A function call, including function selector and arguments _calldata is executed with delegatecall on _init |
DiamondLoupeFacet
facets
function facets() external view returns (struct IDiamondLoupe.Facet[] facets_)
Gets all facets and their selectors.
Return Values
Name | Type | Description |
---|---|---|
facets_ | struct IDiamondLoupe.Facet[] | Facet |
facetFunctionSelectors
function facetFunctionSelectors(address _facet) external view returns (bytes4[] _facetFunctionSelectors)
Gets all the function selectors supported by a specific facet.
Parameters
Name | Type | Description |
---|---|---|
_facet | address | The facet address. |
Return Values
Name | Type | Description |
---|---|---|
_facetFunctionSelectors | bytes4[] | The selectors associated with a facet address. |
facetAddresses
function facetAddresses() external view returns (address[] facetAddresses_)
Get all the facet addresses used by a diamond.
Return Values
Name | Type | Description |
---|---|---|
facetAddresses_ | address[] |
facetAddress
function facetAddress(bytes4 _functionSelector) external view returns (address facetAddress_)
Gets the facet that supports the given selector.
If facet is not found return address(0).
Parameters
Name | Type | Description |
---|---|---|
_functionSelector | bytes4 | The function selector. |
Return Values
Name | Type | Description |
---|---|---|
facetAddress_ | address | The facet address. |
GovernanceFacet
Handles the management of governance members
state
function state(bytes data_) external
sets the state for the Governance facet
This state method is never attached on the diamond
Parameters
Name | Type | Description |
---|---|---|
data_ | bytes | abi encoded data - the list of governance members. |
updateMember
function updateMember(address account_, bool status_, bytes[] signatures_) external
@notice Adds/removes a member account @param account_ The account to be modified @param status_ Whether the account will be set as member or not @param signatures_ The signatures of the validators authorizing this member update
computeMemberUpdateMessage
function computeMemberUpdateMessage(address account_, bool status_) internal view returns (bytes32)
Computes the bytes32 ethereum signed message hash of the member update message
isMember
function isMember(address member_) external view returns (bool)
Return Values
Name | Type | Description |
---|---|---|
[0] | bool | True/false depending on whether a given address is member or not |
membersCount
function membersCount() external view returns (uint256)
Return Values
Name | Type | Description |
---|---|---|
[0] | uint256 | The count of members in the members set |
memberAt
function memberAt(uint256 index_) external view returns (address)
Return Values
Name | Type | Description |
---|---|---|
[0] | address | The address of a member at a given index |
administrativeNonce
function administrativeNonce() external view returns (uint256)
Return Values
Name | Type | Description |
---|---|---|
[0] | uint256 | The current administrative nonce |
ReceiverFacet
receive
receive() external payable
RouterFacet
@notice Handles the bridging of ERC20 tokens
StateData
struct StateData {
uint8 chainId;
address teleport;
address feeTokenCollector;
address deliveryAgent;
bytes32 dAppId;
}
state
function state(bytes data_) external
sets the state for the Router facet
This state method is never attached on the diamond
Parameters
Name | Type | Description |
---|---|---|
data_ | bytes | Abi encoded LibRouter.NativeCurrency and StateData |
_egress
function _egress(struct IRouter.TransferData transferData_, struct IRouter.DeliveryFeeData deliveryFeeData_, bytes extraOptionalArgs_) internal returns (bytes, uint256, bytes)
@notice Send tokens to another chain via Teleport. @param transferData_ Object holding data necessary for the transfer
- targetChainId_ Our Abridge ID of the destination chain
- feeToken_ Address of the token the user is paying fee in
- token_ Address of the token to bridge, or address(0) if bridging native currency
- amount_ Amount of the bridged tokens
- receiver_ Address who will receive the tokens on the destination chain @param deliveryFeeData_ Object holding data necessary for deducting from msg.value to delivery agent @dev We determine the action for the ERC20 contract and build the appropriate payload bytes payload: { uint256 header, bytes envelope: { bytes msg.sender, bytes receiver, bytes action: { enum TargetAction, bytes token, bytes _lockMint() | _burnUnlock() | _burnMint() }, uint256 deliveryFee } }
egress
function egress(struct IRouter.TransferData transferData_, struct IRouter.DeliveryFeeData deliveryFeeData_, bytes extraOptionalArgs_) public payable
egressWithProvider
function egressWithProvider(struct IRouter.TransferData transferData_, struct IRouter.DeliveryFeeData deliveryFeeData_, address providerAddress_, bytes extraOptionalArgs_) public payable
egressWithPermit
function egressWithPermit(struct IRouter.TransferData transferData_, struct IRouter.DeliveryFeeData deliveryFeeData_, struct IRouter.PermitData permitData, bytes extraOptionalArgs_) external payable
@notice Send tokens to another chain via Teleport using an using an EIP-2612 permit. @param transferData_ Object holding data necessary for the transfer
- targetChainId_ Our Abridge ID of the destination chain
- feeToken_ Address of the token the user is paying fee in
- token_ Address of the token to bridge, or address(0) if bridging native currency
- amount_ Amount of the bridged tokens
- receiver_ Address who will receive the tokens on the destination chain @param deliveryFeeData_ Object holding data necessary for deducting from msg.value to delivery agent @param permitData struct containing the permit data deadline_ The deadline for the provided permit v_ The recovery id of the permit's ECDSA signature r_ The first output of the permit's ECDSA signature s_ The second output of the permit's ECDSA signature
_isNativeCurrency
function _isNativeCurrency(address tokenAddress_) internal pure returns (bool)
@param tokenAddress_ The address of the token contract @return Checks if the supplied token address is representing the native network currency
_lockMint
function _lockMint(address tokenAddress_, uint256 amount_) internal returns (bytes)
@param tokenAddress_ The ERC20 contract address, or address(0) if native currency @param amount_ Amount of the bridged tokens @return Payload for sending native tokens to a non-native chain @dev bytes payload: {uint256 amount, uint8 chainId, string tokenName, string tokenSymbol, uint8 tokenDecimals}
_burnUnlock
function _burnUnlock(address tokenAddress_, uint256 amount_) internal returns (bytes)
@param tokenAddress_ The ERC20 contract address @param amount_ Amount of the bridged tokens @return Payload for sending non-native tokens to their native chain @dev bytes payload: {uint256 amount}
_burnMint
function _burnMint(uint8 nativeChainId_, address tokenAddress_, uint256 amount_) internal returns (bytes)
@param tokenAddress_ The ERC20 contract address @param nativeChainId_ Native Abridge chain id of the token @param amount_ Amount of the bridged tokens @return Payload for sending non-native tokens to a non-native chain @dev bytes payload: {uint256 amount, uint8 chainId, string tokenName, string tokenSymbol, uint8 tokenDecimals}
_collectDeliveryFee
function _collectDeliveryFee(uint8 targetChainId_, address token_, uint256 amount_, bytes receiver_, uint256 deliveryFee_, uint256 deliveryFeeExpiry_, bytes deliveryFeeSignature_) internal
@notice Sends the signed amount of delivery fee to the delivery agent @param targetChainId_ Our Abridge ID of the destination chain @param token_ Address of the token to bridge @param amount_ Amount of the bridged tokens @param receiver_ Address who will receive the tokens on the destination chain @param deliveryFee_ Amount to deduct from msg.value and transfer to the delivery agent @param deliveryFeeExpiry_ Block after which the delivery fee signature should be considered invalid @param deliveryFeeSignature_ Deliver agent's signature for the delivery fee
_computeDeliveryFeeHash
function _computeDeliveryFeeHash(uint8 targetChainId_, address token_, uint256 amount_, bytes receiver_, uint256 deliveryFee_, uint256 deliveryFeeDeadline_) internal view returns (bytes32)
Computes the bytes32 ethereum signed message hash of the delivery fee of an egress operation
_collectFee
function _collectFee(address feeToken_) internal
@notice Send the fee amount in custom token to the fee token collector address @param feeToken_ Address of the token to bridge
onTeleportMessage
function onTeleportMessage(uint8 sourceChainId_, bytes transmissionSender_, bytes32 dAppId_, bytes payload_) external
@notice Receive tokens from another chain via Teleport. @param sourceChainId_ Abridge Chain ID the teleport message comes from @param transmissionSender_ Sender address of the teleport message @param dAppId_ dAppId for the teleport message @param payload_ Data payload of teleport message @dev header is a placeholder for future proofing
_unlock
function _unlock(address tokenAddress_, uint256 amount_, address receiver_) internal
@notice Release previously locked native tokens. @param tokenAddress_ The ERC20 contract address, or address(0) if native currency @param amount_ Amount of the bridged tokens to be unlocked @param receiver_ The address to receive the tokens
_mint
function _mint(bytes nativeAddress_, uint256 amount_, address receiver_, uint8 nativeChainId_, string tokenName_, string tokenSymbol_, uint8 decimals_) internal
@notice Mint wrapped versions of non-native tokens. Deploys a new token contract if necessary. @param nativeAddress_ The ERC20 contract address on the native chain @param amount_ Amount of the bridged tokens to be minted @param receiver_ The address to receive the tokens @param nativeChainId_ Our Abridge chain ID for the native network @param tokenName_ Name for the wrapped token @param tokenSymbol_ Symbol for the wrapped token @param decimals_ The number of decimals used to get the token's user representation
_deployWrappedToken
function _deployWrappedToken(uint8 sourceChain_, bytes nativeToken_, string tokenName_, string tokenSymbol_, uint8 decimals_) internal returns (address)
@notice Deploys a wrapped version of a native token to the current chain @param sourceChain_ Our Abridge chain ID for the native chain @param nativeToken_ ERC20 contract address on the native chain @param tokenName_ Name for the wrapped token @param tokenSymbol_ Symbol for the wrapped token @param decimals_ The number of decimals used to get the token's user representation
nativeToWrappedToken
function nativeToWrappedToken(uint8 chainId_, bytes nativeToken_) public view returns (address)
@param chainId_ Our Abridge chain ID for the native chain
@param nativeToken_ ERC20 contract address on the native chain
@return The address of the wrapped counterpart of nativeToken
in the current chain
wrappedToNativeToken
function wrappedToNativeToken(address wrappedToken_) public view returns (struct LibRouter.NativeTokenWithChainId)
@param wrappedToken_ ERC20 contract address of the wrapped token @return The chainId and address of the original token
serviceFee
function serviceFee(uint8 targetChainId_, bytes transmissionReceiver_, bytes32 dAppId_, bytes payload_, bytes extraOptionalArgs_) public view returns (uint256)
@return Required fee amount for bridging
_bytesToAddress
function _bytesToAddress(bytes addressAsBytes) internal pure returns (address addr)
@param addressAsBytes value of type bytes @return addr addressAsBytes value converted to type address
_addressToBytes
function _addressToBytes(address addr) internal pure returns (bytes)
@param addr value of type address @return addr value converted to type bytes
deliveryFeeNonce
function deliveryFeeNonce(address sender_) external view returns (uint256)
@param sender_ Address that initiates a bridging operation for which we collect delivery fee @return the current nonce for the sender_ address
getTeleport
function getTeleport() external view returns (address)
@return The address of the teleport contract
TeleportUpdaterFacet
setTeleport
function setTeleport(address teleportAddress, bytes[] signatures_) external
@notice Sets the teleport address @param teleportAddress The teleport address to set
computeSetTeleport
function computeSetTeleport(address teleportAddress_) internal view returns (bytes32)
@param teleportAddress_ the new teleport address @return Hash message representing the setTeleport operation
UtilityFacet
state
function state(bytes data_) external
Calls the state functions of other diamond facets
This state method is never attached on the diamond. This method is to be delegatecall-ed from diamondCutGovernableFacet.diamondCut and takes as parameter the encoded call data for the state methods of any other diamond facets.
pauseToken
function pauseToken(address tokenAddress_, bytes[] signatures_) external
@notice Pauses a given token contract @param tokenAddress_ The token contract @param signatures_ The array of signatures from the members, authorising the operation
unpauseToken
function unpauseToken(address tokenAddress_, bytes[] signatures_) external
@notice Unpauses a given token contract @param tokenAddress_ The token contract @param signatures_ The array of signatures from the members, authorising the operation
computeTokenActionMessage
function computeTokenActionMessage(enum IUtility.TokenAction _action, address _tokenAddress) internal view returns (bytes32)
@param _action denotes pause or unpause @param _tokenAddress The token address @return Hash message represeting the pause/unpause token operation
setWrappedToken
function setWrappedToken(uint8 nativeChainId_, bytes nativeToken_, address wrappedToken_, bytes[] signatures_) external
@notice Adds an existing token contract to use as a WrappedToken @param nativeChainId_ The native Abridge chain id for the token @param nativeToken_ The address in the native network @param wrappedToken_ The wrapped token address in this network @param signatures_ The array of signatures from the members, authorising the operation
computeSetWrappedTokenMessage
function computeSetWrappedTokenMessage(uint8 nativeChainId_, bytes nativeToken_, address wrappedToken_) internal view returns (bytes32)
@notice Computes the Eth signed message to use for extracting signature signers for toggling a token state @param nativeChainId_ The native Abridge chain id for the token @param nativeToken_ The address in the native network @param wrappedToken_ The wrapped token address in this network
unsetWrappedToken
function unsetWrappedToken(address wrappedToken_, bytes[] signatures_) external
@notice Removes a wrapped-native token pair from the bridge @param wrappedToken_ The wrapped token address in this network @param signatures_ The array of signatures from the members, authorising the operation
computeUnsetWrappedTokenMessage
function computeUnsetWrappedTokenMessage(address wrappedToken_) internal view returns (bytes32)
@notice Computes the Eth signed message to use for extracting signature signers for toggling a token state @param wrappedToken_ The wrapped token address in this network
setTeleportSenders
function setTeleportSenders(struct IUtility.TeleportSender[] senders_, bytes[] signatures_) external
@notice Set the allowed state for the specified teleport senders @param senders_ Array of chainId and sender @param signatures_ The array of signatures from the members, authorising the operation
computeSetTeleportSenders
function computeSetTeleportSenders(struct IUtility.TeleportSender[] senders_) internal view returns (bytes32)
@param senders_ Array of chainId and sender @return Hash message represeting the setTeleportSenders operation
dappId
function dappId() external view returns (bytes32)
@return Get the bridge dAppId
setDappId
function setDappId(bytes32 dappId_, bytes[] signatures_) external
@notice Set the bridge dAppId @param dappId_ the bridge dAppId to set @param signatures_ The array of signatures from the members, authorising the operation
computeSetDappId
function computeSetDappId(bytes32 dappId_) internal view returns (bytes32)
@param dappId_ dAppId hash @return Hash message represeting the setDappId operation
setFeeToken
function setFeeToken(address feeToken_, uint256 amount_, bytes[] signatures_) external
@notice Adds, updates or removes an accepted fee token @param feeToken_ Address of the fee token to change @param amount_ New amount to set; if 0 the token will no longer be accepted for paying fees
computeSetFeeToken
function computeSetFeeToken(address feeToken_, uint256 amount_) internal view returns (bytes32)
@param feeToken_ Address of the fee token to change @param amount_ New amount to set @return Hash message represeting the setFeeToken operation
feeAmountByToken
function feeAmountByToken(address feeToken_) external view returns (uint256)
@param feeToken_ Address of the fee token to look-up @return The fee amount in the given token
feeTokens
function feeTokens() external view returns (address[])
@return The addresses of all accepted fee tokens
feeTokenCollector
function feeTokenCollector() external view returns (address)
@return Get the address that will collect fees in custom tokens
setFeeTokenCollector
function setFeeTokenCollector(address feeTokenCollector_, bytes[] signatures_) external
@notice Set the address that will collect fees in custom tokens @param feeTokenCollector_ the address to send fee tokens to @param signatures_ The array of signatures from the members, authorising the operation
computeSetFeeTokenCollector
function computeSetFeeTokenCollector(address feeTokenCollector_) internal view returns (bytes32)
@param feeTokenCollector_ the address to send fee tokens to @return Hash message represeting the setFeeTokenCollector operation
deliveryAgent
function deliveryAgent() external view returns (address)
@return Get the address of the agent that will receive funds for completing a bridging operation
setDeliveryAgent
function setDeliveryAgent(address deliveryAgent_, bytes[] signatures_) external
@notice Set the address of the agent that will receive funds for completing a bridging operation @param deliveryAgent_ the address of the agent that will receive funds for completing a bridging operation @param signatures_ The array of signatures from the members, authorising the operation
computeSetDeliveryAgent
function computeSetDeliveryAgent(address deliveryAgent_) internal view returns (bytes32)
@param deliveryAgent_ the address of the agent that will receive funds for completing a bridging operation @return Hash message represeting the setDeliveryAgent operation
Test1Facet
state
function state(bytes _input) external pure
f1
function f1() external pure returns (string)
f2
function f2() external pure returns (string)
f3
function f3() external pure returns (string)
Test2Facet
TestEvent
event TestEvent(uint256)
serviceFee
function serviceFee(uint8 targetChainId_, bytes transmissionReceiver_, bytes32 dAppId_, bytes payload_, bytes extraOptionalArgs_) public returns (uint256 fee)
f2
function f2() external pure returns (string)
Test3Facet
f3
function f3() external pure returns (string)
f1337
function f1337() external pure returns (string)
Test4Facet
TestEvent
event TestEvent(uint256)
callOnce
function callOnce(uint256 _var, bytes[] _signatures) external
IDiamondCut
FacetCutAction
enum FacetCutAction {
Add,
Replace,
Remove
}
FacetCut
struct FacetCut {
address facetAddress;
enum IDiamondCut.FacetCutAction action;
bytes4[] functionSelectors;
}
DiamondCut
event DiamondCut(struct IDiamondCut.FacetCut[] _diamondCut, address _init, bytes _calldata)
IDiamondCutGovernable
diamondCut
function diamondCut(struct IDiamondCut.FacetCut[] _diamondCut, address _init, bytes _calldata, bytes[] _signatures) external
Add/replace/remove any number of functions and optionally execute a function with delegatecall
Parameters
Name | Type | Description |
---|---|---|
_diamondCut | struct IDiamondCut.FacetCut[] | Contains the facet addresses and function selectors |
_init | address | The address of the contract or facet to execute _calldata |
_calldata | bytes | A function call, including function selector and arguments _calldata is executed with delegatecall on _init |
_signatures | bytes[] | Governance members' signatures authorizing the operation |
IDiamondCutSimple
diamondCut
function diamondCut(struct IDiamondCut.FacetCut[] _diamondCut, address _init, bytes _calldata) external
Add/replace/remove any number of functions and optionally execute a function with delegatecall
Parameters
Name | Type | Description |
---|---|---|
_diamondCut | struct IDiamondCut.FacetCut[] | Contains the facet addresses and function selectors |
_init | address | The address of the contract or facet to execute _calldata |
_calldata | bytes | A function call, including function selector and arguments _calldata is executed with delegatecall on _init |
ICommonErrors
NoDirectCall
error NoDirectCall()
TransferFailed
error TransferFailed(string message)
AccountIsAddressZero
error AccountIsAddressZero()
NoValueAllowed
error NoValueAllowed()
IRouterErrors
UnknownDestination
error UnknownDestination()
Used when the destination is not supported by the router
WrongValue
error WrongValue()
Used when the value is not wrong
DeliveryFeeSignatureExpired
error DeliveryFeeSignatureExpired()
Used when the delivery fee signature has expired
InvalidDeliveryFeeSigner
error InvalidDeliveryFeeSigner()
Used when the delivery fee signer is invalid
UnsupportedFeToken
error UnsupportedFeToken()
Used when an unsupported fee token is encountered
FeeTokenCollectorAddressNotSet
error FeeTokenCollectorAddressNotSet()
Used when the fee token collector address is not set
UnknownTeleport
error UnknownTeleport()
Used when an unknown teleport is encountered
UnknownDAppId
error UnknownDAppId()
Used when an unknown DApp ID is encountered
UnknownSender
error UnknownSender()
Used when an unknown sender is encountered
UnknownFormat
error UnknownFormat()
Used when an unknown format is encountered
ShouldContainSender
error ShouldContainSender()
Used to make sure a transaction should contain a sender
WrongAddressLength
error WrongAddressLength()
Used when an address has an incorrect length
IncorrectTargetAction
error IncorrectTargetAction()
Used when an incorrect target action is encountered
DeliveryFeeFailed
error DeliveryFeeFailed(string message)
Used when a delivery fee fails with a specific message
Parameters
Name | Type | Description |
---|---|---|
message | string | The error message |
UnlockFailed
error UnlockFailed(string message)
Used when an unlock fails with a specific message
Parameters
Name | Type | Description |
---|---|---|
message | string | The error message |
AddressOccupied
error AddressOccupied()
Used when an address is already occupied
IDiamondLoupeFacetErrors
ExceededMaxFacets
error ExceededMaxFacets()
ILibDiamondErrors
FunctionDoesNotExist
error FunctionDoesNotExist()
NoSelectorsInFacetToCut
error NoSelectorsInFacetToCut()
FunctionAlreadyExists
error FunctionAlreadyExists()
CantReplaceImmutableFn
error CantReplaceImmutableFn()
CantReplaceWithSameFn
error CantReplaceWithSameFn()
CantReplaceNonexistentFn
error CantReplaceNonexistentFn()
RemoveFacetAddressMustBeZero
error RemoveFacetAddressMustBeZero()
CantRemoveNonexistentFn
error CantRemoveNonexistentFn()
CantRemoveImmutableFn
error CantRemoveImmutableFn()
IncorrectFacetCutAction
error IncorrectFacetCutAction()
InitIsAddress0AndCalldataNotEmpty
error InitIsAddress0AndCalldataNotEmpty()
CalldataIsEmpty
error CalldataIsEmpty()
InitFunctionReverted
error InitFunctionReverted()
ContractHasNoCode
error ContractHasNoCode(string checkCase)
LibDiamond__InitIsNotFacet
error LibDiamond__InitIsNotFacet()
ITeleportFacetErrors
OnlyValidProviderCalls
error OnlyValidProviderCalls()
Used to make sure the function is only called by the teleport contract.
TransmissionNotSupportedByAnyProvider
error TransmissionNotSupportedByAnyProvider()
Used when there's not provider that supports the specified transmission.
ProviderCannotBeZeroAddress
error ProviderCannotBeZeroAddress()
Used when the provided provider address is the zero address.
InvalidProvider
error InvalidProvider()
Used when the provided provider address is not supported by the provider selector.
SourceChainNotSupported
error SourceChainNotSupported()
Thrown when a message is received from an unknown source chain.
InvalidTeleportSender
error InvalidTeleportSender()
Thrown when a message is received from an invalid teleport sender.
TargetChainNotSupported
error TargetChainNotSupported()
Thrown when a message is being send to an unknown target chain.
InvalidChainId
error InvalidChainId()
InvalidSenderAddress
error InvalidSenderAddress()
DuplicateChainId
error DuplicateChainId()
IFeeCalculatorFacetErrors
NothingToClaim
error NothingToClaim()
InsufficientFeeAmount
error InsufficientFeeAmount()
IGovernanceFacetErrors
NotAValidMember
error NotAValidMember()
MemberListEmpty
error MemberListEmpty()
AccountAlreadyAdded
error AccountAlreadyAdded()
WouldBecomeMemberless
error WouldBecomeMemberless()
InvalidNumberOfSignatures
error InvalidNumberOfSignatures()
InvalidSigner
error InvalidSigner()
WrongSignersOrder
error WrongSignersOrder()
HashAlreadyUsed
error HashAlreadyUsed()
IWrappedTokenErrors
BurnAmountExceedsAllowance
error BurnAmountExceedsAllowance()
TokenTransferWhilePaused
error TokenTransferWhilePaused()
ITeleportUpdaterFacetErrors
InvalidNewTeleportAddress
error InvalidNewTeleportAddress()
IUtilityFacetErros
WrappedTokenAddressMustNeNonZero
error WrappedTokenAddressMustNeNonZero()
IDiamondErrors
IDiamondLoupe
Facet
struct Facet {
address facetAddress;
bytes4[] functionSelectors;
}
facets
function facets() external view returns (struct IDiamondLoupe.Facet[] facets_)
Gets all facet addresses and their four byte function selectors.
Return Values
Name | Type | Description |
---|---|---|
facets_ | struct IDiamondLoupe.Facet[] | Facet |
facetFunctionSelectors
function facetFunctionSelectors(address _facet) external view returns (bytes4[] facetFunctionSelectors_)
Gets all the function selectors supported by a specific facet.
Parameters
Name | Type | Description |
---|---|---|
_facet | address | The facet address. |
Return Values
Name | Type | Description |
---|---|---|
facetFunctionSelectors_ | bytes4[] |
facetAddresses
function facetAddresses() external view returns (address[] facetAddresses_)
Get all the facet addresses used by a diamond.
Return Values
Name | Type | Description |
---|---|---|
facetAddresses_ | address[] |
facetAddress
function facetAddress(bytes4 _functionSelector) external view returns (address facetAddress_)
Gets the facet that supports the given selector.
If facet is not found return address(0).
Parameters
Name | Type | Description |
---|---|---|
_functionSelector | bytes4 | The function selector. |
Return Values
Name | Type | Description |
---|---|---|
facetAddress_ | address | The facet address. |
IERC165
supportsInterface
function supportsInterface(bytes4 interfaceId) external view returns (bool)
Query if a contract implements an interface
Interface identification is specified in ERC-165. This function uses less than 30,000 gas.
Parameters
Name | Type | Description |
---|---|---|
interfaceId | bytes4 | The interface identifier, as specified in ERC-165 |
Return Values
Name | Type | Description |
---|---|---|
[0] | bool | true if the contract implements interfaceID and interfaceID is not 0xffffffff, false otherwise |
IGovernance
MemberUpdated
event MemberUpdated(address member, bool status)
An event emitted once member is updated
updateMember
function updateMember(address _account, bool _status, bytes[] _signatures) external
@notice Adds/removes a member account @param _account The account to be modified @param _status Whether the account will be set as member or not @param _signatures The signatures of the validators authorizing this member update
isMember
function isMember(address _member) external view returns (bool)
Return Values
Name | Type | Description |
---|---|---|
[0] | bool | True/false depending on whether a given address is member or not |
membersCount
function membersCount() external view returns (uint256)
Return Values
Name | Type | Description |
---|---|---|
[0] | uint256 | The count of members in the members set |
memberAt
function memberAt(uint256 _index) external view returns (address)
Return Values
Name | Type | Description |
---|---|---|
[0] | address | The address of a member at a given index |
administrativeNonce
function administrativeNonce() external view returns (uint256)
Return Values
Name | Type | Description |
---|---|---|
[0] | uint256 | The current administrative nonce |
IReceiver
Received
event Received(address, uint256)
receive
receive() external payable
IRouter
TargetAction
enum TargetAction {
Unlock,
Mint
}
DeliveryFeeData
struct DeliveryFeeData {
uint256 fee;
uint256 expiry;
bytes signature;
}
PermitData
struct PermitData {
uint256 deadline;
uint8 v;
bytes32 r;
bytes32 s;
}
TransferData
struct TransferData {
uint8 targetChainId_;
address feeToken_;
address token_;
uint256 amount_;
bytes receiver_;
}
LockMint
event LockMint(uint8 targetChain, address token, uint256 amount, bytes receiver)
An event emitted once a Lock transaction is executed
BurnMint
event BurnMint(uint8 targetChain, address token, uint256 amount, bytes receiver)
An event emitted once a Burn transaction is executed