WrappedTokenBridge
The WrappedTokenBridge
enables users to wrap a token and transfer it to another chain in a single transaction using CCIP. Additonally it can receive a CCIP token transfer from another chain and automatically unwrap tokens before sending them to their final destination.
This contract is used to handle stLINK <-> wstLINK transfers between the primary chain and secondary chains.
View Functions
getRouter
Returns the current CCIP router
Return Values
router
address
router address
linkToken
Returns the address of the LINK token
Return Values
linkToken
address
address of LINK token
token
Returns the address of the underlying token bridged by this contract
Return Values
underlyingToken
address
address of underlying token
wrappedToken
Returns the address of the wrapped token bridged by this contract
Return Values
wrappedToken
address
address of wrapped token
getFee
Returns the current fee for a token transfer
Parameters
_destinationChainSelector
uint64
id of destination chain
_amount
uint256
amount of tokens to transfer
_payNative
bool
whether fee should be paid natively or with LINK
Return Values
fee
uint256
current fee
Write Functions
setRouter
Sets the CCIP router
Parameters
_router
address
router address
onTokenTransfer
ERC677 implementation to receive a token transfer to be wrapped and sent to a destination chain
Parameters
_sender
address
address of sender
_value
uint256
amount of tokens transferred
_calldata
bytes
encoded calldata consisting of destinationChainSelector (uint64), receiver (address), maxLINKFee (uint256)
transferTokens
Wraps and transfers tokens to a destination chain
Parameters
_destinationChainSelector
uint64
id of destination chain
_receiver
address
address to receive tokens on destination chain
_amount
uint256
amount of tokens to transfer
_payNative
bool
whether fee should be paid natively or with LINK
_maxLINKFee
uint256
call will revert if LINK fee exceeds this value
recoverTokens
Withdraws tokens held by this contract
Parameters
_tokens
address[]
list of tokens to withdraw
_amounts
uint256[]
list of corresponding amounts to withdraw
_receiver
address
address to receive tokens
Last updated