Skip to content

core staking contracts

WrappedTokenBridge Contract: Cross-Chain wstLINK via CCIP

The WrappedTokenBridge enables users to wrap a token and transfer it to another chain in a single transaction using CCIP. Additionally 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.

Returns the current CCIP router

function getRouter() public view returns (address)
Name Type Description
router address router address

Returns the address of the LINK token

function linkToken() external view returns (address)
Name Type Description
linkToken address address of LINK token

Returns the address of the underlying token bridged by this contract

function token() external view returns (address)
Name Type Description
underlyingToken address address of underlying token

Returns the address of the wrapped token bridged by this contract

function wrappedToken() external view returns (address)
Name Type Description
wrappedToken address address of wrapped token

Returns the current fee for a token transfer

function getFee(uint64 _destinationChainSelector, uint256 _amount, bool _payNative) external view returns (uint256)
Name Type Description
_destinationChainSelector uint64 id of destination chain
_amount uint256 amount of tokens to transfer
_payNative bool whether fee should be paid natively or with LINK
Name Type Description
fee uint256 current fee

Sets the CCIP router

function setRouter(address _router) external
Name Type Description
_router address router address

ERC677 implementation to receive a token transfer to be wrapped and sent to a destination chain

function onTokenTransfer(address _sender, uint256 _value, bytes _calldata) external
Name Type Description
_sender address address of sender
_value uint256 amount of tokens transferred
_calldata bytes encoded calldata consisting of destinationChainSelector (uint64), receiver (address), maxLINKFee (uint256)

Wraps and transfers tokens to a destination chain

function transferTokens(uint64 _destinationChainSelector, address _receiver, uint256 _amount, bool _payNative, uint256 _maxLINKFee) external payable returns (bytes32 messageId)
Name Type Description
_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

Withdraws tokens held by this contract

function recoverTokens(address[] _tokens, uint256[] _amounts, address _receiver) external
Name Type Description
_tokens address[] list of tokens to withdraw
_amounts uint256[] list of corresponding amounts to withdraw
_receiver address address to receive tokens