IBC Transfer
The ICS20.sol interface, previously known as IBCTransfer.sol, facilitates Solidity contracts to interact with the Inter-Blockchain Communication (IBC) protocol on the CosVM chain. This interface abstracts the intricacies of the underlying IBC transfer module in IBC-go, enabling developers to utilize a simplified Ethereum interface to execute IBC transfers.
This interface, ICS20.sol, provides a convenient means for developers to conduct IBC transfers using familiar Ethereum-based interfaces. It shields them from the complexities of the IBC transfer module's implementation details within IBC-go, allowing for a more straightforward integration of IBC functionality into Solidity contracts on the CosVM chain.
For practical implementation examples, developers can refer to the cosVM/extensions repository, which includes a demonstration showcasing how the ICS20.sol interface can be utilized within Solidity contracts. This example serves as a guide for developers, illustrating the effective usage of the ICS20.sol interface to enable IBC transfers seamlessly within the CosVm ecosystem, leveraging Ethereum-compatible structures and methods.
Function
approve
Parameters: spender (address), allocations (an array of Allocation structs)
Modifiers: external
Returns: approved (boolean)
Explanation: This function allows the caller to approve a spender (another address) to manage their allocations. The allocations parameter specifies the list of Allocation structs that the spender is allowed to handle. It returns a boolean indicating whether the approval was successful or not
revoke
Parameters: spender (address)
Modifiers: external Returns: revoked (boolean)
Explanation: This function revokes the approval previously given to a spender (specified by the spender address). It returns a boolean indicating whether the revocation was successful or not.
increaseAllowance
Parameters: spender (address), sourcePort (string), sourceChannel (string), denom (string), amount (uint256)
Modifiers: external
Returns: approved (boolean)
Explanation: This function increases the allowance granted to a spender by the specified amount for a specific denom in a particular sourcePort and sourceChannel. It returns a boolean indicating whether the increase in allowance was successful or not.
decreaseAllowance
Parameters: spender (address), sourcePort (string), sourceChannel (string), denom (string), amount (uint256)
Modifiers: external
Returns: approved (boolean)
Explanation: This function decreases the allowance granted to a spender by the specified amount for a specific denom in a particular sourcePort and sourceChannel. It returns a boolean indicating whether the decrease in allowance was successful or not.
transfer
Parameters: Multiple parameters including sourcePort, sourceChannel, denom, amount, sender, receiver, timeoutHeight, timeoutTimestamp, memo
Modifiers: external
Returns: nextSequence (uint64)
Explanation: This function initiates a transfer of tokens from the specified sender to the designated receiver using IBC (Inter-Blockchain Communication) parameters such as sourcePort, sourceChannel, denom, amount, timeoutHeight, timeoutTimestamp, and an optional memo. It returns the next sequence number of the transfer.
denomTrace
Parameters: hash (string)
Modifiers: external
Returns: denomTrace (DenomTrace struct)
Explanation: This function retrieves information about a specific denom by providing its hash. It returns a DenomTrace struct containing details about the denomination trace.
denomTraces
Parameters: pageRequest (PageRequest struct)
Modifiers: external
Returns: An array of denomTraces (DenomTrace structs), pageResponse (PageResponse struct)
Explanation: This function fetches multiple DenomTrace structs based on provided pagination parameters (pageRequest). It returns an array of denomTraces and pageResponse that includes pagination details.
denomHash
Parameters: trace (string)
Modifiers: external
Returns: hash (string)
Explanation: This function generates a hash of the provided trace information related to a denomination.
Event
IBCTransfer
Purpose: This event is emitted when an IBC (Inter-Blockchain Communication) transfer is executed.
Parameters:
sender (address): The address of the sender initiating the transfer.
receiver (string): The identifier or address of the receiver on the other blockchain.
sourcePort (string): The source port of the IBC transaction.
sourceChannel (string): The source channel of the IBC transaction.
denom (string): The denomination of the tokens transferred.
amount (uint256): The amount of tokens transferred.
memo (string): Optional information or description related to the transfer.
IBCTransferAuthorization
Purpose: This event signals the authorization of a grantee to conduct IBC transfers within specified limits.
Parameters:
grantee (address): The address of the entity granted the authorization.
granter (address): The address granting the authorization.
sourcePort (string): The source port for IBC transfers.
sourceChannel (string): The source channel for IBC transfers.
spendLimit (Coin[]): An array of Coin structs specifying spending limits.
RevokeIBCTransferAuthorization
Purpose: This event indicates the revocation of an IBC transfer authorization.
Parameters:
owner (address): The address of the owner or holder of the authorization.
spender (address): The address of the spender whose authorization has been revoked.
AllowanceChange
Purpose: This event signifies a change in allowance related to specified methods for a spender from an owner.
Parameters:
owner (address): The address of the owner or token holder.
spender (address): The address of the spender who has permissions for certain methods.
methods (string[]): An array of strings representing the methods or actions authorized.
values (uint256[]): An array of uint256 values associated with each method, representing the allowance or limits.
Last updated