Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,7 @@ Ref: https://keepachangelog.com/en/1.0.0/
### API Breaking

* (core) [\#227](https://github.com/cosmos/ibc-go/pull/227) Remove sdk.Result from application callbacks
* (transfer) [\#350](https://github.com/cosmos/ibc-go/pull/350) Change FungibleTokenPacketData to use a string for the Amount field. This enables token transfers with amounts previously restricted by uint64. Up to the maximum uint256 value is supported.

### State Machine Breaking

Expand Down
60 changes: 39 additions & 21 deletions docs/ibc/proto-docs.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,6 @@

- [ibc/applications/transfer/v1/transfer.proto](#ibc/applications/transfer/v1/transfer.proto)
- [DenomTrace](#ibc.applications.transfer.v1.DenomTrace)
- [FungibleTokenPacketData](#ibc.applications.transfer.v1.FungibleTokenPacketData)
- [Params](#ibc.applications.transfer.v1.Params)

- [ibc/applications/transfer/v1/genesis.proto](#ibc/applications/transfer/v1/genesis.proto)
Expand Down Expand Up @@ -37,6 +36,9 @@

- [Msg](#ibc.applications.transfer.v1.Msg)

- [ibc/applications/transfer/v2/packet.proto](#ibc/applications/transfer/v2/packet.proto)
- [FungibleTokenPacketData](#ibc.applications.transfer.v2.FungibleTokenPacketData)

- [ibc/core/channel/v1/channel.proto](#ibc/core/channel/v1/channel.proto)
- [Acknowledgement](#ibc.core.channel.v1.Acknowledgement)
- [Channel](#ibc.core.channel.v1.Channel)
Expand Down Expand Up @@ -270,26 +272,6 @@ source tracing information path.



<a name="ibc.applications.transfer.v1.FungibleTokenPacketData"></a>

### FungibleTokenPacketData
FungibleTokenPacketData defines a struct for the packet payload
See FungibleTokenPacketData spec:
https://github.com/cosmos/ics/tree/master/spec/ics-020-fungible-token-transfer#data-structures


| Field | Type | Label | Description |
| ----- | ---- | ----- | ----------- |
| `denom` | [string](#string) | | the token denomination to be transferred |
| `amount` | [uint64](#uint64) | | the token amount to be transferred |
| `sender` | [string](#string) | | the sender address |
| `receiver` | [string](#string) | | the recipient address on the destination chain |






<a name="ibc.applications.transfer.v1.Params"></a>

### Params
Expand Down Expand Up @@ -675,6 +657,42 @@ Msg defines the ibc/transfer Msg service.



<a name="ibc/applications/transfer/v2/packet.proto"></a>
<p align="right"><a href="#top">Top</a></p>

## ibc/applications/transfer/v2/packet.proto



<a name="ibc.applications.transfer.v2.FungibleTokenPacketData"></a>

### FungibleTokenPacketData
FungibleTokenPacketData defines a struct for the packet payload
See FungibleTokenPacketData spec:
https://github.com/cosmos/ics/tree/master/spec/ics-020-fungible-token-transfer#data-structures


| Field | Type | Label | Description |
| ----- | ---- | ----- | ----------- |
| `denom` | [string](#string) | | the token denomination to be transferred |
| `amount` | [string](#string) | | the token amount to be transferred |
| `sender` | [string](#string) | | the sender address |
| `receiver` | [string](#string) | | the recipient address on the destination chain |





<!-- end messages -->

<!-- end enums -->

<!-- end HasExtensions -->

<!-- end services -->



<a name="ibc/core/channel/v1/channel.proto"></a>
<p align="right"><a href="#top">Top</a></p>

Expand Down
2 changes: 1 addition & 1 deletion modules/apps/transfer/keeper/MBT_README.md
Original file line number Diff line number Diff line change
Expand Up @@ -48,4 +48,4 @@ docker run --rm -v $(pwd):/var/apalache apalache/mc $@
```


In case of any questions please don't hesitate to contact Andrey Kuprianov (andrey@informal.systems).
In case of any questions please don't hesitate to contact Andrey Kuprianov (andrey@informal.systems).
10 changes: 7 additions & 3 deletions modules/apps/transfer/keeper/mbt_relay_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ type TlaBalance struct {
type TlaFungibleTokenPacketData struct {
Sender string `json:"sender"`
Receiver string `json:"receiver"`
Amount int `json:"amount"`
Amount string `json:"amount"`
Denom []string `json:"denom"`
}

Expand Down Expand Up @@ -143,7 +143,7 @@ func FungibleTokenPacketFromTla(packet TlaFungibleTokenPacket) FungibleTokenPack
DestPort: packet.DestPort,
Data: types.NewFungibleTokenPacketData(
DenomFromTla(packet.Data.Denom),
uint64(packet.Data.Amount),
packet.Data.Amount,
AddressFromString(packet.Data.Sender),
AddressFromString(packet.Data.Receiver)),
}
Expand Down Expand Up @@ -333,11 +333,15 @@ func (suite *KeeperTestSuite) TestModelBasedRelay() {
denom := denomTrace.IBCDenom()
err = sdk.ValidateDenom(denom)
if err == nil {
amount, ok := sdk.NewIntFromString(tc.packet.Data.Amount)
if !ok {
panic("MBT failed to parse amount from string")
}
err = suite.chainB.GetSimApp().TransferKeeper.SendTransfer(
suite.chainB.GetContext(),
tc.packet.SourcePort,
tc.packet.SourceChannel,
sdk.NewCoin(denom, sdk.NewIntFromUint64(tc.packet.Data.Amount)),
sdk.NewCoin(denom, amount),
sender,
tc.packet.Data.Receiver,
clienttypes.NewHeight(0, 110),
Expand Down
12 changes: 6 additions & 6 deletions modules/apps/transfer/keeper/model_based_tests/Test5Packets.json
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
"data": {
"sender": "a3",
"receiver": "a3",
"amount": 2,
"amount": "2",
"denom": [
"",
"",
Expand Down Expand Up @@ -79,7 +79,7 @@
"data": {
"sender": "a1",
"receiver": "a3",
"amount": 1,
"amount": "1",
"denom": [
"cosmos-hub",
"",
Expand Down Expand Up @@ -165,7 +165,7 @@
"data": {
"sender": "a2",
"receiver": "a2",
"amount": 4,
"amount": "4",
"denom": [
"",
"",
Expand Down Expand Up @@ -266,7 +266,7 @@
"data": {
"sender": "",
"receiver": "a2",
"amount": 4,
"amount": "4",
"denom": [
"",
"",
Expand Down Expand Up @@ -382,7 +382,7 @@
"data": {
"sender": "a1",
"receiver": "",
"amount": 1,
"amount": "1",
"denom": [
"transfer",
"channel-0",
Expand Down Expand Up @@ -489,4 +489,4 @@
],
"error": true
}
]
]
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
"data": {
"sender": "a3",
"receiver": "a2",
"amount": 3,
"amount": "3",
"denom": [
"",
"",
Expand Down Expand Up @@ -79,7 +79,7 @@
"data": {
"sender": "a2",
"receiver": "a1",
"amount": 3,
"amount": "3",
"denom": [
"transfer",
"channel-1",
Expand Down Expand Up @@ -180,7 +180,7 @@
"data": {
"sender": "a1",
"receiver": "a2",
"amount": 3,
"amount": "3",
"denom": [
"",
"",
Expand Down Expand Up @@ -311,7 +311,7 @@
"data": {
"sender": "a1",
"receiver": "",
"amount": 2,
"amount": "2",
"denom": [
"",
"channel-0",
Expand Down Expand Up @@ -457,7 +457,7 @@
"data": {
"sender": "a3",
"receiver": "a3",
"amount": 1,
"amount": "1",
"denom": [
"",
"",
Expand Down Expand Up @@ -609,4 +609,4 @@
],
"error": false
}
]
]
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
"data": {
"sender": "a1",
"receiver": "a2",
"amount": 1,
"amount": "1",
"denom": [
"cosmos-hub",
"transfer",
Expand Down Expand Up @@ -55,4 +55,4 @@
],
"error": true
}
]
]
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
"data": {
"sender": "",
"receiver": "a1",
"amount": 1,
"amount": "1",
"denom": [
"",
"",
Expand Down Expand Up @@ -79,7 +79,7 @@
"data": {
"sender": "a1",
"receiver": "a2",
"amount": 1,
"amount": "1",
"denom": [
"transfer",
"channel-1",
Expand Down Expand Up @@ -156,4 +156,4 @@
],
"error": false
}
]
]
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
"data": {
"sender": "a1",
"receiver": "a2",
"amount": 1,
"amount": "1",
"denom": [
"cosmos-hub",
"transfer",
Expand Down Expand Up @@ -55,4 +55,4 @@
],
"error": true
}
]
]
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
"data": {
"sender": "a1",
"receiver": "a2",
"amount": 1,
"amount": "1",
"denom": [
"cosmos-hub",
"transfer",
Expand Down Expand Up @@ -55,4 +55,4 @@
],
"error": false
}
]
]
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
"data": {
"sender": "",
"receiver": "",
"amount": 1,
"amount": "1",
"denom": [
"",
"",
Expand Down Expand Up @@ -55,4 +55,4 @@
],
"error": true
}
]
]
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
"data": {
"sender": "",
"receiver": "a2",
"amount": 1,
"amount": "1",
"denom": [
"",
"",
Expand Down Expand Up @@ -70,4 +70,4 @@
],
"error": false
}
]
]
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
"data": {
"sender": "a1",
"receiver": "a2",
"amount": 1,
"amount": "1",
"denom": [
"cosmos-hub",
"transfer",
Expand Down Expand Up @@ -55,4 +55,4 @@
],
"error": true
}
]
]
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
"data": {
"sender": "a3",
"receiver": "a1",
"amount": 1,
"amount": "1",
"denom": [
"",
"",
Expand Down Expand Up @@ -79,7 +79,7 @@
"data": {
"sender": "a1",
"receiver": "",
"amount": 1,
"amount": "1",
"denom": [
"transfer",
"channel-1",
Expand Down Expand Up @@ -156,4 +156,4 @@
],
"error": false
}
]
]
Loading