ERC721 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 |
WrappedERC721
Used for the wrapped versions of bridged ERC721 collections
constructor
constructor(string collectionName_, string collectionSymbol_) public
@notice Construct a new WrappedERC721 contract @param collectionName_ The collection name @param collectionSymbol_ The collection symbol
tokenURI
function tokenURI(uint256 tokenId_) public view returns (string)
Parameters
Name | Type | Description |
---|---|---|
tokenId_ | uint256 | ID of the token |
Return Values
Name | Type | Description |
---|---|---|
[0] | string | The token URI |
batchMint
function batchMint(address to_, uint256[] tokenIds_, string[] tokenURIs_) external
Mints a number of tokens at once
Parameters
Name | Type | Description |
---|---|---|
to_ | address | Receiver address |
tokenIds_ | uint256[] | Array of token IDs |
tokenURIs_ | string[] | Array of corresponding token URIs |
batchBurnFrom
function batchBurnFrom(address owner_, uint256[] tokenIds_) external
Burns a number of tokens at once
Parameters
Name | Type | Description |
---|---|---|
owner_ | address | Owner of the tokens |
tokenIds_ | uint256[] | Array of token IDs |
batchUpdateTokenURI
function batchUpdateTokenURI(uint256[] tokenIds_, string[] tokenURIs_) external
Updates the token URIs for existing tokens
Parameters
Name | Type | Description |
---|---|---|
tokenIds_ | uint256[] | Array of token IDs |
tokenURIs_ | string[] | Array of corresponding token URIs |
pause
function pause() public
Pauses the contract
unpause
function unpause() public
Unpauses the contract
_beforeTokenTransfer
function _beforeTokenTransfer(address from_, address to_, uint256 tokenId_, uint256 batchSize) internal virtual
Prevent actions on a paused contract
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 ERC721 tokens
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 data - chain ID, teleport address and dAppId. |
_egress
function _egress(uint8 targetChainId_, struct IRouter.CollectionWithTokens[] assets_, bytes receiver_, bytes extraOptionalArgs_) internal returns (bytes, bytes)
@notice Send tokens to another chain via Teleport. @param targetChainId_ Our ID of the destination chain @param assets_ An array of structs, containing a collection address and an array of token IDs @param receiver_ Address who will receive the tokens on the destination chain @dev We determine the action for each ERC721 contract (collection) and build the appropriate payload
egress
function egress(uint8 targetChainId_, struct IRouter.CollectionWithTokens[] assets_, bytes receiver_, bytes extraOptionalArgs_) external payable
egressWithProvider
function egressWithProvider(uint8 targetChainId_, struct IRouter.CollectionWithTokens[] assets_, bytes receiver_, address providerAddress_, bytes extraOptionalArgs_) external payable
_lockMint
function _lockMint(address collectionAddress_, uint256[] tokenIds_) internal returns (bytes)
@param collectionAddress_ The ERC721 contract address @param tokenIds_ An array of token IDs to be locked and bridged @return Payload for sending native tokens to a non-native chain @dev If the ERC721 contract supports the metadata extension, we have to pass it too
_burnUnlock
function _burnUnlock(address collectionAddress_, uint256[] tokenIds_) internal returns (bytes)
@param collectionAddress_ The ERC721 contract address @param tokenIds_ An array of token IDs to be burned and bridged @return Payload for sending non-native tokens to their native chain
_burnMint
function _burnMint(uint8 nativeChainId_, address collectionAddress_, uint256[] tokenIds_) internal returns (bytes)
@param collectionAddress_ The ERC721 contract address @param tokenIds_ An array of token IDs to be burned and bridged @return Payload for sending non-native tokens to a non-native chain
onTeleportMessage
function onTeleportMessage(uint8 sourceChainId_, bytes transmissionSender_, bytes32 dAppId_, bytes payload_) external
@notice Receive tokens from another chain via Teleport. @param sourceChainId_ 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 collectionAddress_, uint256[] tokenIds_, address receiver_) internal
@notice Release previously locked native tokens. @param collectionAddress_ The ERC721 contract address @param tokenIds_ The token IDs to be unlocked @param receiver_ The address to receive the tokens
_mint
function _mint(bytes nativeAddress_, uint256[] tokenIds_, address receiver_, uint8 nativeChainId_, string[] tokenURIs_, string collectionName_, string collectionSymbol_) internal
@notice Mint wrapped versions of non-native tokens. Deploys a new collection contract if necessary. @param nativeAddress_ The ERC721 contract address on the native chain @param tokenIds_ The token IDs to be minted @param receiver_ The address to receive the tokens @param nativeChainId_ Our chain ID for the native network @param tokenURIs_ Token URIs for the new tokens @param collectionName_ Name for the wrapped collection @param collectionSymbol_ Symbol for the wrapped collection
deployWrappedCollection
function deployWrappedCollection(uint8 sourceChain_, bytes nativeCollection_, string collectionName_, string collectionSymbol_) internal returns (address)
@notice Deploys a wrapped version of a native collection to the current chain @param sourceChain_ Our chain ID for the native chain @param nativeCollection_ ERC721 contract address on the native chain @param collectionName_ Name for the wrapped collection @param collectionSymbol_ Symbol for the wrapped collection
nativeToWrappedCollection
function nativeToWrappedCollection(uint8 chainId_, bytes nativeCollection_) public view returns (address)
@param chainId_ Our chain ID for the native chain
@param nativeCollection_ ERC721 contract address on the native chain
@return The address of the wrapped counterpart of nativeToken
in the current chain
wrappedToNativeCollection
function wrappedToNativeCollection(address wrappedCollection_) public view returns (struct LibRouter.NativeCollectionWithChainId)
@param wrappedCollection_ ERC721 contract address of the wrapped collection @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
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.
pauseCollection
function pauseCollection(address collectionAddress_, bytes[] signatures_) external
@notice Pauses a given collection contract @param collectionAddress_ The collection contract @param signatures_ The array of signatures from the members, authorising the operation
unpauseCollection
function unpauseCollection(address collectionAddress_, bytes[] signatures_) external
@notice Unpauses a given collection contract @param collectionAddress_ The collection contract @param signatures_ The array of signatures from the members, authorising the operation
computeCollectionActionMessage
function computeCollectionActionMessage(enum IUtility.CollectionAction _action, address _collectionAddress) internal view returns (bytes32)
@param _action denotes pause or unpause @param _collectionAddress The collection address @return Hash message represeting the pause/unpause collection operation
setWrappedCollection
function setWrappedCollection(uint8 nativeChainId_, bytes nativeCollection_, address wrappedCollection_, bytes[] signatures_) external
@notice Adds an existing collection contract to use as a WrappedERC721 @param nativeChainId_ The native network for the collection @param nativeCollection_ The address in the native network @param wrappedCollection_ The wrapped collection address in this network @param signatures_ The array of signatures from the members, authorising the operation
computeSetWrappedCollectionMessage
function computeSetWrappedCollectionMessage(uint8 nativeChainId_, bytes nativeCollection_, address wrappedCollection_) internal view returns (bytes32)
@notice Computes the Eth signed message to use for extracting signature signers for toggling a collection state @param nativeChainId_ The native network for the collection @param nativeCollection_ The address in the native network @param wrappedCollection_ The wrapped collection address in this network
unsetWrappedCollection
function unsetWrappedCollection(address wrappedCollection_, bytes[] signatures_) external
@notice Removes a wrapped-native collection pair from the bridge @param wrappedCollection_ The wrapped collection address in this network @param signatures_ The array of signatures from the members, authorising the operation
computeUnsetWrappedCollectionMessage
function computeUnsetWrappedCollectionMessage(address wrappedCollection_) internal view returns (bytes32)
@notice Computes the Eth signed message to use for extracting signature signers for toggling a collection state @param wrappedCollection_ The wrapped collection 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 Set the bridge dappId
setDappId
function setDappId(bytes32 dappId_, bytes[] signatures_) external
@notice Set the bridge dappId @param dappId_ Array of chainId and sender @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 setTeleportSenders 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)
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
TokenTransferWhilePaused
error TokenTransferWhilePaused()
URIQueryForNonexistentToken
error URIQueryForNonexistentToken()
WrongBatchMintParameters
error WrongBatchMintParameters()
BurnNotApproved
error BurnNotApproved()
WrongOwner
error WrongOwner()
WrongBatchUpdateParameters
error WrongBatchUpdateParameters()
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
}
CollectionWithTokens
struct CollectionWithTokens {
address collection;
uint256[] tokenIds;
}
LockMint
event LockMint(uint8 targetChain, address collection, uint256[] tokenIds, bytes receiver)
An event emitted once a Lock transaction is executed
BurnMint
event BurnMint(uint8 targetChain, address collection, uint256[] tokenIds, bytes receiver)
An event emitted once a Burn transaction is executed
BurnUnlock
event BurnUnlock(uint8 targetChain, address collection, uint256[] tokenIds, bytes receiver)
An event emitted once a BurnAndTransfer transaction is executed
Unlock
event Unlock(address collection, uint256[] tokenIds, address receiver)
An event emitted once an Unlock transaction is executed
Mint
event Mint(address collection, uint256[] tokenIds, address receiver)
An even emitted once a Mint transaction is executed
WrappedCollectionDeployed
event WrappedCollectionDeployed(uint8 sourceChain, bytes nativeColllection, address wrappedColllection)
An event emitted once a new wrapped token is deployed by the contract
TeleportAddressSet
event TeleportAddressSet(address teleportAddress)
An event emitted when setting the teleport address
nativeToWrappedCollection
function nativeToWrappedCollection(uint8 _chainId, bytes _nativeCollection) external view returns (address)
wrappedToNativeCollection
function wrappedToNativeCollection(address _wrappedCollection) external view returns (struct LibRouter.NativeCollectionWithChainId)
serviceFee
function serviceFee(uint8 targetChainId_, bytes transmissionReceiver_, bytes32 dAppId_, bytes payload_, bytes extraOptionalArgs_) external view returns (uint256)
egress
function egress(uint8 targetChain_, struct IRouter.CollectionWithTokens[] assets, bytes receiver_, bytes extraOptionalArgs_) external payable
egressWithProvider
function egressWithProvider(uint8 targetChain_, struct IRouter.CollectionWithTokens[] assets, bytes receiver_, address providerAddress_, bytes extraOptionalArgs_) external payable
IRouterDiamond
ISingletonFactory
deploy
function deploy(bytes initCode_, bytes32 salt_, bytes initializer_) external payable returns (address payable deployedContractAddress)
ITeleport
Interface for the Teleport contract, which allows for cross-chain communication and messages transfer using different providers.
TransmissionFees
event TransmissionFees(uint256 serviceFee)
Emitted when collecting fees
Parameters
Name | Type | Description |
---|---|---|
serviceFee | uint256 | The amount of service fee collected |
transmit
function transmit(uint8 targetChainId, bytes transmissionReceiver, bytes32 dAppId, bytes payload) external payable
Transmits a message to the specified target chain ID. The message will be delivered using the most suitable provider.
Parameters
Name | Type | Description |
---|---|---|
targetChainId | uint8 | The ID of the target chain |
transmissionReceiver | bytes | The address of the receiver on the target chain |
dAppId | bytes32 | The ID of the dApp on the target chain |
payload | bytes | The message payload |
transmitWithArgs
function transmitWithArgs(uint8 targetChainId_, bytes transmissionReceiver_, bytes32 dAppId_, bytes payload_, bytes extraOptionalArgs_) external payable
Selects a provider to bridge the message to the target chain
Parameters
Name | Type | Description |
---|---|---|
targetChainId_ | uint8 | The chainID where the message should be delivered to |
transmissionReceiver_ | bytes | The address of the contract in the target chain to receive the transmission |
dAppId_ | bytes32 | ID for the dApp that the message belongs to |
payload_ | bytes | The dApp-specific message data |
extraOptionalArgs_ | bytes | Extra optional arguments to be passed to the provider. This allow for specific provider configurations. Send bytes('') if not needed |
transmitWithProvider
function transmitWithProvider(uint8 targetChainId, bytes transmissionReceiver, bytes32 dAppId, bytes payload, address providerAddress, bytes extraOptionalArgs_) external payable
Transmits a message to the specified target chain ID. The message will be delivered using the specified provider.
Parameters
Name | Type | Description |
---|---|---|
targetChainId | uint8 | The ID of the target chain |
transmissionReceiver | bytes | The address of the receiver on the target chain |
dAppId | bytes32 | The ID of the dApp on the target chain |
payload | bytes | The message payload |
providerAddress | address | The address of the provider to use |
extraOptionalArgs_ | bytes |
deliver
function deliver(address providerAddress, bytes args) external
Delivers a message to this chain.
Parameters
Name | Type | Description |
---|---|---|
providerAddress | address | |
args | bytes | The message arguments, which depend on the provider. See the provider's documentation for more information. |
teleportFee
function teleportFee() external view returns (uint256)
Returns the currently set teleport fee.
Return Values
Name | Type | Description |
---|---|---|
[0] | uint256 | The teleport fee amount |
providerFee
function providerFee(uint8 targetChainId_, bytes transmissionReceiver_, bytes32 dAppId_, bytes payload_, bytes extraOptionalArgs_) external view returns (uint256)
Returns the fee for the automatic selected provider.
Return Values
Name | Type | Description |
---|---|---|
[0] | uint256 | The provider fee amount |
providerFee
function providerFee(address providerAddress_, uint8 targetChainId_, bytes transmissionReceiver_, bytes32 dAppId_, bytes payload_, bytes extraOptionalArgs_) external view returns (uint256)
Returns the fee for the stated provider.
Return Values
Name | Type | Description |
---|---|---|
[0] | uint256 | The provider fee amount |
serviceFee
function serviceFee(uint8 targetChainId_, bytes transmissionReceiver_, bytes32 dAppId_, bytes payload_, bytes extraOptionalArgs_) external view returns (uint256)
Returns the currently set service fee.
Return Values
Name | Type | Description |
---|---|---|
[0] | uint256 | The service fee amount |
serviceFee
function serviceFee(address providerAddress_, uint8 targetChainId_, bytes transmissionReceiver_, bytes32 dAppId_, bytes payload_, bytes extraOptionalArgs_) external view returns (uint256)
Returns the currently set service fee.
Return Values
Name | Type | Description |
---|---|---|
[0] | uint256 | The service fee amount |
DappTransmissionReceive
struct DappTransmissionReceive {
bytes teleportSender;
uint8 sourceChainId;
bytes dappTransmissionSender;
address dappTransmissionReceiver;
bytes32 dAppId;
bytes payload;
}
onProviderReceive
function onProviderReceive(struct ITeleport.DappTransmissionReceive args) external
Notifies the teleport that the provider has received a new message. Teleport should invoke the related dapps.
Parameters
Name | Type | Description |
---|---|---|
args | struct ITeleport.DappTransmissionReceive | The arguments of the message. |
configProviderSelector
function configProviderSelector(bytes configData, bytes[] signatures_) external
configProvider
function configProvider(bytes configData, address providerAddress, bytes[] signatures_) external
ITeleportDApp
onTeleportMessage
function onTeleportMessage(uint8 _sourceChainId, bytes _transmissionSender, bytes32 _dAppId, bytes _payload) external
Called by a Teleport contract to deliver a verified payload to a dApp
Parameters
Name | Type | Description |
---|---|---|
_sourceChainId | uint8 | The Abridge chainID where the transmission originated |
_transmissionSender | bytes | The address that invoked transmit() on the source chain |
_dAppId | bytes32 | an identifier for the dApp |
_payload | bytes | a dApp-specific byte array with the message data |
IUtility
Subroutine
struct Subroutine {
address contractAddress;
bytes callParams;
}
TeleportSender
struct TeleportSender {
uint8 chainId;
bytes senderAddress;
}
CollectionAction
enum CollectionAction {
Pause,
Unpause
}
pauseCollection
function pauseCollection(address collectionAddress_, bytes[] signatures_) external
unpauseCollection
function unpauseCollection(address collectionAddress_, bytes[] signatures_) external
setWrappedCollection
function setWrappedCollection(uint8 nativeChainId_, bytes _nativeCollection, address wrappedCollection_, bytes[] signatures_) external
unsetWrappedCollection
function unsetWrappedCollection(address wrappedCollection_, bytes[] signatures_) external
setTeleportSenders
function setTeleportSenders(struct IUtility.TeleportSender[] senders_, bytes[] signatures_) external
dappId
function dappId() external view returns (bytes32)
setDappId
function setDappId(bytes32 dappId_, bytes[] signatures_) external
CollectionPaused
event CollectionPaused(address account_, address collection_)
CollectionUnpaused
event CollectionUnpaused(address account_, address collection_)
WrappedCollectionSet
event WrappedCollectionSet(uint8 nativeChainId_, bytes _nativeCollection, address wrappedCollection_)
WrappedCollectionUnset
event WrappedCollectionUnset(address wrappedCollection_)
TeleportSenderSet
event TeleportSenderSet(struct IUtility.TeleportSender[] senders_)
DappIdSet
event DappIdSet(bytes32 dappId_)
LibDiamond
DIAMOND_STORAGE_POSITION
bytes32 DIAMOND_STORAGE_POSITION
DiamondStorage
struct DiamondStorage {
mapping(bytes4 => bytes32) facets;
mapping(uint256 => bytes32) selectorSlots;
uint16 selectorCount;
mapping(address => bool) validFacets;
}
diamondStorage
function diamondStorage() internal pure returns (struct LibDiamond.DiamondStorage ds)
DiamondCut
event DiamondCut(struct IDiamondCut.FacetCut[] _diamondCut, address _init, bytes _calldata)
diamondCut
function diamondCut(struct IDiamondCut.FacetCut[] _diamondCut, address _init, bytes _calldata) internal
addFacetSelector
function addFacetSelector(uint256 _selectorCount, bytes32 _selectorSlot, address _newFacetAddress, bytes4[] _selectors, struct LibDiamond.DiamondStorage ds) internal returns (uint256, bytes32)
replaceFacetSelector
function replaceFacetSelector(address _newFacetAddress, bytes4[] _selectors, struct LibDiamond.DiamondStorage ds) internal
removeFacetSelector
function removeFacetSelector(uint256 _selectorCount, bytes32 _selectorSlot, address _newFacetAddress, bytes4[] _selectors, struct LibDiamond.DiamondStorage ds) internal returns (uint256, bytes32)
addReplaceRemoveFacetSelectors
function addReplaceRemoveFacetSelectors(uint256 _selectorCount, bytes32 _selectorSlot, address _newFacetAddress, enum IDiamondCut.FacetCutAction _action, bytes4[] _selectors) internal returns (uint256, bytes32)
initializeDiamondCut
function initializeDiamondCut(struct LibDiamond.DiamondStorage ds, address _init, bytes _calldata) internal
enforceHasContractCode
function enforceHasContractCode(address _contract, string checkCase) internal view
LibGovernance
Storage
struct Storage {
struct Counters.Counter administrativeNonce;
struct EnumerableSet.AddressSet membersSet;
mapping(bytes32 => bool) hashesUsed;
}
governanceStorage
function governanceStorage() internal pure returns (struct LibGovernance.Storage gs)
updateMember
function updateMember(struct LibGovernance.Storage gs, address account_, bool status_) internal
Adds/removes a validator from the member set
isMember
function isMember(struct LibGovernance.Storage gs, address member_) internal view returns (bool)
Returns true/false depending on whether a given address is member or not
membersCount
function membersCount(struct LibGovernance.Storage gs) internal view returns (uint256)
Returns the count of the members
memberAt
function memberAt(struct LibGovernance.Storage gs, uint256 index_) internal view returns (address)
Returns the address of a member at a given index
LibRouter
NativeCollectionWithChainId
struct NativeCollectionWithChainId {
uint8 chainId;
bytes contractAddress;
}
Storage
struct Storage {
mapping(uint8 => mapping(bytes => address)) nativeToWrappedCollection;
mapping(address => struct LibRouter.NativeCollectionWithChainId) wrappedToNativeCollection;
mapping(uint8 => bytes) bridgeAddressByChainId;
uint8 chainId;
address teleportAddress;
bytes32 dAppId;
}
setCollectionMappings
function setCollectionMappings(uint8 sourceChain_, bytes nativeCollection_, address deployedCollection) internal
sets the wrapped to native token mapping
routerStorage
function routerStorage() internal pure returns (struct LibRouter.Storage ds)