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

Change to multitokens #1663

Conversation

yito88
Copy link
Member

@yito88 yito88 commented Jul 5, 2023

  • Renew balance keys with Multitoken

    • Account balance key: #Multitoken/{token_addr}/balance/{owner}
    • Supply balance key: #Multitoken/{token_addr}/balance/minted
  • Add Multitoken VP shared/src/ledger/native_vp/multitoken.rs

  • Remove sub_prefix

    • Change printing balances
  • IBC: Clean up with Multitokens

    • IBC-related balance key: #Multitoken/#IbcToken(hash)/balance/{owner}
    • Delete IbcToken VP since Multitoken VP checks the balance changes
  • EthBridge: Change the balance keys

    • ERC20 balance key: #Multitoken/#Erc20(eth_addr)/balance/{owner}
    • ERC20 supply key: #Multitoken/#Erc20(eth_addr)/balance/minted
    • Remove redundancy from EthBridge/EthBridgePool VP after adding Multitoken VP

Copy link
Member

@batconjurer batconjurer left a comment

Choose a reason for hiding this comment

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

So far, this looks like an enormous improvement

Copy link
Contributor

@sug0 sug0 left a comment

Choose a reason for hiding this comment

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

first few comments, may add more later

Comment on lines +466 to +474
.filter_map(|(t, o, s)| match (token, target) {
(Some(token), Some(target)) if t == *token && o == *target => {
Some((t, s))
}
(Some(token), None) if t == *token => Some((t, s)),
(None, Some(target)) if o == *target => Some((t, s)),
(None, None) => Some((t, s)),
_ => None,
})
Copy link
Contributor

Choose a reason for hiding this comment

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

can we document the purpose of each of these match arms? reading this code is hard, especially with these short identifiers (i.e. t, o and s), which have no immediate meaning

@@ -151,7 +152,7 @@ where
{
let denom_key = storage::ibc_denom_key(token_hash);
let denom = match self.ctx.borrow().read(&denom_key) {
Ok(Some(v)) => String::from_utf8(v).map_err(|e| {
Ok(Some(v)) => String::try_from_slice(&v[..]).map_err(|e| {
Copy link
Contributor

Choose a reason for hiding this comment

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

is v borsh encoded?

@sug0 sug0 deleted the branch tiago/ethbridge/v0.17.5 July 10, 2023 08:14
@sug0 sug0 closed this Jul 10, 2023
@yito88 yito88 mentioned this pull request Jul 10, 2023
@yito88 yito88 deleted the yuji/tiago/ethbridge/v0.17.5/ibc-multitoken branch July 24, 2023 14:34
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.

3 participants