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

Send protocol fees from pool manager via FillRewards rather than BankMsg #334

Merged
merged 1 commit into from
Apr 22, 2024

Conversation

kaimen-sano
Copy link
Contributor

Description and Motivation

We currently use BankMsg::Send when a swap has occurred to send the protocol fees to the whale-lair. This is not desired, as it does not allow the whale-lair contract to hook into receiving the assets.

Related Issues

Closes #312.

Adding a integration test for this behaviour this is hard due to CosmWasm/cw-plus#763. Unfortunately the cosmwasm team is not interested in addressing this issue.


Checklist:

  • I have read Migaloo's contribution guidelines.
  • My pull request has a sound title and description (not something vague like Update index.md)
  • All existing and new tests are passing.
  • I updated/added relevant documentation.
  • The code is formatted properly cargo fmt --all --.
  • Clippy doesn't report any issues cargo clippy -- -D warnings.
  • I have regenerated the schemas if needed cargo schema.

@kaimen-sano kaimen-sano added bug Something isn't working V2 Everything related to the V2 implementation of White Whale labels Apr 20, 2024
@kaimen-sano kaimen-sano self-assigned this Apr 20, 2024
Copy link

codecov bot commented Apr 20, 2024

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 89.50%. Comparing base (a8ebb95) to head (e180cc6).
Report is 1 commits behind head on release/v2_contracts.

Additional details and impacted files
@@                  Coverage Diff                  @@
##           release/v2_contracts     #334   +/-   ##
=====================================================
  Coverage                 89.49%   89.50%           
=====================================================
  Files                       261      261           
  Lines                     26646    26650    +4     
=====================================================
+ Hits                      23848    23852    +4     
  Misses                     2798     2798           

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

fee_messages.push(CosmosMsg::Bank(BankMsg::Send {
to_address: config.whale_lair_addr.to_string(),
amount: vec![swap_result.protocol_fee_asset],
fee_messages.push(CosmosMsg::Wasm(WasmMsg::Execute {
Copy link
Contributor

Choose a reason for hiding this comment

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

There's a function in the ww-std package (whale_lair.rs) that contains a function that builds this message for you. We can refactor this in the future.

Copy link
Contributor

@kerber0x kerber0x left a comment

Choose a reason for hiding this comment

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

well done!

@kerber0x kerber0x merged commit f14fb74 into release/v2_contracts Apr 22, 2024
7 checks passed
@kerber0x kerber0x deleted the fix/pool-swap-to-whale-lair branch April 22, 2024 10:59
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working V2 Everything related to the V2 implementation of White Whale
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants