hyperledger-labs / yui-ibc-solidity

IBC in Solidity
Apache License 2.0
134 stars 62 forks source link

sendTransfer interface modifications proposal #231

Open dzmitry-lahoda opened 1 year ago

dzmitry-lahoda commented 1 year ago

IBC power lays not only in ability to transfer tokens by wallets, but also in ability of on chain protocols(contracts) to work with that. Memo can be formed in memory and send to provide additional instructions. And IBC stack is complex and big to setup, so having interface to work with could be awesome for productivity. Also for packet forwarding middleware, it may be the case that sendTransfer is used via inheritance, so that may be it function to be public and receive memory for memo.

So now having:

    // ... contract 
    function sendTransfer(
        string calldata denom,
        uint256 amount,
        string calldata receiver,
        string calldata sourcePort,
        string calldata sourceChannel,
        uint64 timeoutHeight
    ) external {
  // ...

desired

interface ICS20Transfer { 
    function sendTransfer(
        // not sure about other strings - if they should be memory?
        string calldata denom,
        uint256 amount,
        string calldata receiver,
        string calldata sourcePort,
        string calldata sourceChannel,
        (uint64,uint64) timeoutHeight, // https://github.com/CosmWasm/cosmwasm/blob/e7c4ed8e0a0b0d0816c24a516d413811fdebb686/packages/std/src/ibc.rs#L165
// CosmWasm Rust, Cosmos Go and pallet-ibc in ibc-rs afaik use this defintion of height. so that IBC can talk to forked chains to which height from zero. can we retain that interface?
        string memory memo  // memo is often created via string concatenation
    ) public ;
Bunsen1990 commented 9 months ago

XRP CLOUD HACKER