-
Notifications
You must be signed in to change notification settings - Fork 9
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
Add ibc handling to converter #64
Conversation
Okay, the consumer side is implemented. Please review, but this has some tests and should be ready to merge. #[cfg(test)]
#[msg(exec)]
fn demo_stake( and #[cfg_attr(test, msg(exec))]
fn demo_stake( but neither worked, as I am happy to use a feature flag as well, but the main part is some sort of |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks good! Will take a look at the tests next.
.add_attribute("validator", &validator) | ||
.add_attribute("amount", amount.amount.to_string()); | ||
|
||
let msg = virtual_staking_api::ExecMsg::Bond { validator, amount }; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Nit: Shouldn't this better be called Delegate
?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Good question, can you make a different issue on this?
Out of scope of the IBC connection
use price_feed_api::Querier; | ||
let remote = price_feed_api::Remote::new(config.price_feed); | ||
let price_feed = remote.querier(&deps.querier); | ||
let price = price_feed.price()?.native_per_foreign; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Guess this query will look something like
let price = price_feed.price(config.remote_denom)?.native_per_foreign;
in the (near?) future.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yes, related issue: CosmWasm/sylvia#181
I will add this to code comment
Was trying to do the same to no avail. I think we need to use some form of |
BTW, I settled on this: #[msg(exec)]
fn test_stake(
&self,
ctx: ExecCtx,
validator: String,
stake: Coin,
) -> Result<Response, ContractError> {
#[cfg(test)] {
// This can only ever be called in tests
self.stake(ctx.deps, validator, stake)
}
#[cfg(not(test))] {
let _ = (ctx, validator, stake);
Err(ContractError::Unauthorized)
}
} The entry point is still there, but it is compile-time fixed to errors in non-test builds. |
…s to simulate ibc packets
fdd2363
to
02279a0
Compare
(Currently untested)
sudo entry pointtest ExecMsg variants to allow testing