LibWormhole
Last updated
Last updated
It provides functions for interacting with the Wormhole bridge in a decentralized exchange system.
Field | Type | Description |
---|---|---|
updates the stargateSettings
struct in the contract's AppStorage
struct.
Input
Field | Type | Description |
---|---|---|
normalizes an amount from one decimal precision to another.
Input
Field | Type | Description |
---|---|---|
Output
Field | Type | Description |
---|---|---|
denormalizes an amount from one decimal precision to another.
Input
Output
this function is responsible for extracting the recipient bridge chain ID from the provided bridge in payload.
Input
Output
this function is responsible for executing the bridge-in operation using the Wormhole bridge. It performs dust management operations for token amounts, approves the spending of tokens, and calls the transferTokens
function of the Wormhole bridge contract to initiate the token transfer. The recipient bridge chain ID, Magpie aggregator address, and timestamp-based nonce are provided as arguments to the transferTokens
function.
Input
Output
this function is responsible for executing the bridge-out operation using the Wormhole bridge. It verifies the token sequence, extracts the amount of tokens from the payload, performs denormalization if necessary, and completes the transfer by calling the completeTransfer
function of the Wormhole bridge contract.
Input
Output
Field | Type | Description |
---|---|---|
Field | Type | Description |
---|---|---|
Field | Type | Description |
---|---|---|
Field | Type | Description |
---|---|---|
Field | Type | Description |
---|---|---|
Field | Type | Description |
---|---|---|
Field | Type | Description |
---|---|---|
Field | Type | Description |
---|---|---|
the receipient chain id as per wormhole standard.
decimals of the source asset
decimals of the target asset
amount that needs to be normalized
the normalized amount
decimal of the source asset
decimal of the target asset
amount that needs to be denormalized
the denormalized amount
Payload necessary for bridging in.
The receipient chain id fetched from the payload
The network identifier of the destination chain
The amount that needs to be swapped
The final token that needs to be received
The sequence received after a successful bridging in
Payload contains data that is necessary for bridging out
The amount received after bridging out