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

feat(interchain-token-service): apply balance invariants for ITS transfers #573

Draft
wants to merge 45 commits into
base: main
Choose a base branch
from

Conversation

milapsheth
Copy link
Member

@milapsheth milapsheth commented Aug 7, 2024

Description

AXE-4185

Todos

  • Unit tests
  • Manual tests
  • Documentation
  • Connect epics/issues

Steps to Test

Expected Behaviour

Other Notes

Copy link

codecov bot commented Aug 7, 2024

Codecov Report

Attention: Patch coverage is 95.43379% with 30 lines in your changes missing coverage. Please review.

Project coverage is 93.90%. Comparing base (22642d7) to head (33d76c8).

Files Patch % Lines
interchain-token-service/src/state.rs 79.48% 16 Missing ⚠️
interchain-token-service/src/primitives.rs 20.00% 12 Missing ⚠️
interchain-token-service/src/contract.rs 0.00% 1 Missing ⚠️
interchain-token-service/src/contract/execute.rs 99.73% 1 Missing ⚠️
Additional details and impacted files
@@                     Coverage Diff                     @@
##           feat/its-hub-middleware     #573      +/-   ##
===========================================================
+ Coverage                    93.76%   93.90%   +0.14%     
===========================================================
  Files                          210      211       +1     
  Lines                        28607    29262     +655     
===========================================================
+ Hits                         26823    27479     +656     
+ Misses                        1784     1783       -1     

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

Comment on lines +33 to +40
/// Token balance for a given token id and chain
#[cw_serde]
pub enum TokenBalance {
/// Token balance is tracked on the chain
Tracked(Uint256),
/// Token balance is not tracked
Untracked,
}
Copy link
Member Author

Choose a reason for hiding this comment

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

Open to naming suggestions here. We need to distinguish between whether the token was already deployed once or not, and whether the balance invariant should be updated for this token

For custom tokens, we don't want to track balances since ITS doesn't have sole control over the mint/burn rights there. I used an enum instead of Option to make it more explicit.

Copy link
Member Author

Choose a reason for hiding this comment

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

There is also more token related info that we will likely store, such as rate limits. I'm thinking about wrapping this into a TokenInfo struct vs having separate maps for each. For transfers we'd be reading both everytime, but for deployments we only need to read the token balance though (but when stored under the same struct, we end up read both)

Base automatically changed from feat/its-hub-middleware to main September 11, 2024 08:50
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.

1 participant