diff --git a/spec/app/ics-020-fungible-token-transfer/README.md b/spec/app/ics-020-fungible-token-transfer/README.md index 0c495c235..8c464ac9a 100644 --- a/spec/app/ics-020-fungible-token-transfer/README.md +++ b/spec/app/ics-020-fungible-token-transfer/README.md @@ -203,35 +203,43 @@ In plain English, between chains `A` and `B`: an acknowledgement of failure is preferable to aborting the transaction since it more easily enables the sending chain to take appropriate action based on the nature of the failure. -`createOutgoingPacket` must be called by a transaction handler in the module which performs appropriate signature checks, specific to the account owner on the host state machine. +`sendFungibleTokens` must be called by a transaction handler in the module which performs appropriate signature checks, specific to the account owner on the host state machine. ```typescript -function createOutgoingPacket( +function sendFungibleTokens( denomination: string, amount: uint256, sender: string, receiver: string, - source: boolean, - destPort: string, - destChannel: string, sourcePort: string, sourceChannel: string, timeoutHeight: Height, timeoutTimestamp: uint64) { - prefix = "{sourcePort}/{sourceChannel}/" - // we are the source if the denomination is not prefixed - source = denomination.slice(0, len(prefix)) !== prefix - if source { - // determine escrow account - escrowAccount = channelEscrowAddresses[sourceChannel] - // escrow source tokens (assumed to fail if balance insufficient) - bank.TransferCoins(sender, escrowAccount, denomination, amount) - } else { - // receiver is source chain, burn vouchers - bank.BurnCoins(sender, denomination, amount) - } - FungibleTokenPacketData data = FungibleTokenPacketData{denomination, amount, sender, receiver} - handler.sendPacket(Packet{timeoutHeight, timeoutTimestamp, destPort, destChannel, sourcePort, sourceChannel, data}, getCapability("port")) + prefix = "{sourcePort}/{sourceChannel}/" + // we are the source if the denomination is not prefixed + source = denomination.slice(0, len(prefix)) !== prefix + if source { + // determine escrow account + escrowAccount = channelEscrowAddresses[sourceChannel] + // escrow source tokens (assumed to fail if balance insufficient) + bank.TransferCoins(sender, escrowAccount, denomination, amount) + } else { + // receiver is source chain, burn vouchers + bank.BurnCoins(sender, denomination, amount) + } + + // create FungibleTokenPacket data + data = FungibleTokenPacketData{denomination, amount, sender, receiver} + + // send packet using the interface defined in ICS4 + handler.sendPacket( + getCapability("port"), + sourcePort, + sourceChannel, + timeoutHeight, + timeoutTimestamp, + data + ) } ```