Skip to content

Commit

Permalink
updated wynd querying logic
Browse files Browse the repository at this point in the history
  • Loading branch information
kakucodes committed Nov 22, 2023
1 parent 51df41c commit 753ec2e
Show file tree
Hide file tree
Showing 4 changed files with 12 additions and 8 deletions.
2 changes: 1 addition & 1 deletion artifacts/checksums.txt
Original file line number Diff line number Diff line change
Expand Up @@ -3,4 +3,4 @@ e8807e9a609751fd138cbf09975b716368caecdc9b98759a602fd17615af31e2 ymos_junostake
dc3ef352ef3ef3fe91ec41eb867faae944c3994fed4aff208deb49369085a337 ymos_junowwmarket_outpost-aarch64.wasm
a192dd17eb2a3f3f77a79c5d1c242dc179ec11851bf3a053d70e4aea89da87c2 ymos_osmostake_outpost-aarch64.wasm
b89b0f087c799b74df32024288ed95589bf34b46e01b9c39755d012925b3a3da ymos_wyndlp_outpost-aarch64.wasm
c3a8bfa2a1175870d2aae3798dfee3f1bfcadf476103874ec77b6f58efee1587 ymos_wyndstake_outpost-aarch64.wasm
01bcbd239387d18b4f4f60b54d99748431d4a7114c6a1bc8a364b297a58fc8ae ymos_wyndstake_outpost-aarch64.wasm
2 changes: 1 addition & 1 deletion artifacts/checksums_intermediate.txt
Original file line number Diff line number Diff line change
Expand Up @@ -3,4 +3,4 @@
f89cacaf00996be7cf2a3b122bc8f8e67650cf8cc02665b6d947abd3eebc1f1b target/wasm32-unknown-unknown/release/ymos_junodca_outpost.wasm
a64f52254d8acfa51fed9c67aa9068f0ec943eb27223eebc0b51ac43d692545b target/wasm32-unknown-unknown/release/ymos_junostake_outpost.wasm
3c9b8e24d44c5389375f78526a770ace341fbf302c129d94e54ef5495ed3372d target/wasm32-unknown-unknown/release/ymos_junowwmarket_outpost.wasm
5f81eef7b5c1c19c9e901b602e7a35b91e7d092b00dccfcd9acbaa4a352473d7 target/wasm32-unknown-unknown/release/ymos_wyndstake_outpost.wasm
2b3ebea586dcc01ad8d7919bdf27c24587d980c56822b96c8024878cd2b434b8 target/wasm32-unknown-unknown/release/ymos_wyndstake_outpost.wasm
1 change: 1 addition & 0 deletions contracts/wyndstake/src/execute.rs
Original file line number Diff line number Diff line change
Expand Up @@ -53,6 +53,7 @@ pub fn compound(
&user_addr,
&project_addrs.take_rate_addr,
&project_addrs.wynd_stake_addr,
&project_addrs.destination_projects.wynd.cw20,
&deps.querier,
)?;

Expand Down
15 changes: 9 additions & 6 deletions contracts/wyndstake/src/helpers.rs
Original file line number Diff line number Diff line change
Expand Up @@ -41,17 +41,19 @@ pub fn query_and_generate_wynd_reward_msgs(
tax_percent: Decimal,
delegator_addr: &Addr,
tax_addr: &Addr,
wynd_addr: &Addr,
wynd_staking_addr: &Addr,
wynd_cw20_addr: &Addr,
querier: &QuerierWrapper,
) -> Result<RewardSplit, ContractError> {
gen_wynd_claim_rewards_msg(
tax_percent,
delegator_addr,
tax_addr,
wynd_addr,
wynd_staking_addr,
wynd_cw20_addr,
querier
.query_wasm_smart(
wynd_addr,
wynd_staking_addr,
&wynd_stake::msg::QueryMsg::WithdrawableRewards {
owner: delegator_addr.to_string(),
},
Expand All @@ -64,21 +66,22 @@ pub fn gen_wynd_claim_rewards_msg(
tax_percent: Decimal,
delegator_addr: &Addr,
tax_addr: &Addr,
wynd_addr: &Addr,
wynd_staking_addr: &Addr,
wynd_cw20_addr: &Addr,
WithdrawableRewardsResponse { rewards }: WithdrawableRewardsResponse,
) -> Result<RewardSplit, ContractError> {
let user_rewards = rewards * (Decimal::one() - tax_percent);
let tax_amount = rewards - user_rewards;

let claim_msgs: Vec<CosmosProtoMsg> = vec![
CosmosProtoMsg::ExecuteContract(create_exec_contract_msg(
wynd_addr.to_string(),
wynd_staking_addr.to_string(),
&delegator_addr,
&wynd_stake::msg::ExecuteMsg::WithdrawRewards { owner: None, receiver: None },
None,
)?),
CosmosProtoMsg::ExecuteContract(create_exec_contract_msg(
wynd_addr,
wynd_cw20_addr,
delegator_addr,
&cw20::Cw20ExecuteMsg::Transfer {
recipient: tax_addr.to_string(),
Expand Down

0 comments on commit 753ec2e

Please sign in to comment.