CosmWasm / cw-plus

Production Quality contracts under open source licenses
Apache License 2.0
504 stars 353 forks source link

Added optional memo to ics20 packets #868

Closed nicolaslara closed 1 year ago

nicolaslara commented 1 year ago

IBC has introduced an optional memo field on the ICS20 transfer packet. The memo enables features such as Osmosis cross chain swaps, and forwarding tokens using the packet forward middleware.

The change in this PR allows users to specify the memo to use when transferring CW20s. Note that since the memo is optional (both in the messages passed to the contract and the serialization of the Ics20Packet) this change will only affect the case when the memo is included in TransferMsg by the user. In short, this change should be backwards compatible.

CLAassistant commented 1 year ago

CLA assistant check
All committers have signed the CLA.

nicolaslara commented 1 year ago

Tested this on mainnet as follows:

nicolaslara commented 1 year ago

Signed!

webmaster128 commented 1 year ago

Okay, so this breaks existing Rust code when constructing or destructing Ics20Packet or TransferMsg. Those are public symbols. However, I am not sure if this contract is embedded as a library somewhere.

nicolaslara commented 1 year ago

Okay, so this breaks existing Rust code when constructing or destructing Ics20Packet or TransferMsg. Those are public symbols. However, I am not sure if this contract is embedded as a library somewhere.

Right. I don't think this merits having two different v1 and v2 structs, but happy to have this be tagged in a 2.x major version (like you said, I don't think this is used as a library)

Having serialization be backwards compatible should be enough to be able to update the live contracts

webmaster128 commented 1 year ago

To be on the safe side, let's create a 1.x release branch befor this merge. Then we can have breaking changes on main that people can use. There will be a 2.0 release series of the contracts in summer anyways.