Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

F/rewards distribution send #96

Open
wants to merge 22 commits into
base: f/btc-lc-feature
Choose a base branch
from

Conversation

maurolacy
Copy link
Collaborator

@maurolacy maurolacy commented Dec 10, 2024

#97 follow-up. Sends the rewards along with the distribution table to Babylon using ICS-20 with a json payload in the Memo field.

Comment on lines 287 to 288
// Route to babylon over IBC
let channel = IBC_CHANNEL.load(deps.storage)?;
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hmm I guess IBC_CHANNEL is the channel that this contract involves, but not necessarily a channel for IBC transfer. Probably we need to confirm this in some e2e test.

Maybe as a part of the integration, one needs to establish an IBC channel for interchain transfer, and the contract side needs to remember this channel ID in the config, for facilitating the reward mechanism.

Copy link
Collaborator Author

@maurolacy maurolacy Dec 11, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes, this was my suspicion as well. Implemented it this way for simplicity. Perhaps we can configure a single channel to do / support both, custom messages and ICS20 transfers?

Will write an e2e test and confirm this in any case.

Copy link
Collaborator Author

@maurolacy maurolacy Dec 18, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Was finally able to e2e test this.

Using a single channel doesn't work, as CosmWasm's IbcMsg::Transfer requires an established channel against the ibctransfer module, not the contract address under wasm.

I think this is a design decision that makes sense, as in general you don't want to establish a channel for every contract that needs / wants to use ICS20 transfers.

Update: Ref.: https://github.com/CosmWasm/cosmwasm/blob/4da538debc73065f9aa8f489895cb54393db0f7c/packages/std/src/ibc.rs#L26-L54

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Using a single channel doesn't work, as CosmWasm's IbcMsg::Transfer requires an established channel against the ibctransfer module, not the contract address under wasm.

Yes that's right, even though we can wire up a IBC transfer packet in the contract side, babylon side's zone concerige won't recognise it.

If we really, really want to let zone concerige handle IBC tansfer, then zone concierge has to invoke IBC transfer module (in particular this code snippet) to handle the IBC transfer packets. But I'm not sure if it's worth it

So I'd recommend we consider consolidating IBC channels as future work, and for now start with having 2 IBC channels. This also creates a clean separation between channels' functionalities following IBC channels' best practices

@maurolacy maurolacy force-pushed the f/rewards-distribution-send branch from 961ca90 to da5dbc2 Compare December 11, 2024 10:47
@maurolacy maurolacy changed the base branch from f/rewards-distribution to f/rewards-distribution-2 December 11, 2024 11:06
@maurolacy maurolacy force-pushed the f/rewards-distribution-2 branch from 934aabc to 5a3698e Compare December 15, 2024 16:07
@maurolacy maurolacy force-pushed the f/rewards-distribution-send branch from da5dbc2 to 54e733f Compare December 16, 2024 07:26
Base automatically changed from f/rewards-distribution-2 to main December 16, 2024 07:44
@maurolacy maurolacy force-pushed the f/rewards-distribution-send branch 2 times, most recently from da78c91 to e528d44 Compare December 16, 2024 16:33
@maurolacy maurolacy changed the base branch from main to f/btc-lc-feature December 16, 2024 16:33
@maurolacy maurolacy force-pushed the f/rewards-distribution-send branch from 9455a91 to cb8e897 Compare December 22, 2024 21:03
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants