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

[move] new fungible token example: synthetic currency backed by baske… #1221

Merged
merged 2 commits into from
Apr 6, 2022

Conversation

sblackshear
Copy link
Collaborator

…t of other currencies

Useful to show how to represent a "reserve" via a singleton shared object. A variant of this approach can also be used to issue a token that is backed by a basket of NFT's.

@sblackshear sblackshear force-pushed the basket_currency branch 2 times, most recently from 75d10b2 to dcce483 Compare April 4, 2022 01:18
@codecov
Copy link

codecov bot commented Apr 4, 2022

Codecov Report

Merging #1221 (59857f3) into main (7c30c0a) will increase coverage by 0.81%.
The diff coverage is n/a.

@@            Coverage Diff             @@
##             main    #1221      +/-   ##
==========================================
+ Coverage   80.64%   81.46%   +0.81%     
==========================================
  Files          98       99       +1     
  Lines       20288    20367      +79     
==========================================
+ Hits        16361    16591     +230     
+ Misses       3927     3776     -151     
Impacted Files Coverage Δ
sui_core/src/transaction_input_checker.rs 87.68% <0.00%> (-3.48%) ⬇️
network_utils/src/unit_tests/transport_tests.rs 88.23% <0.00%> (-1.48%) ⬇️
sui_core/src/unit_tests/authority_tests.rs 87.45% <0.00%> (-0.92%) ⬇️
sui_core/src/generate_format.rs 83.60% <0.00%> (-0.27%) ⬇️
sui_core/src/unit_tests/gas_tests.rs 97.38% <0.00%> (ø)
sui/src/microbench.rs 0.21% <0.00%> (+0.01%) ⬆️
sui/src/microbench_latency.rs 0.23% <0.00%> (+0.01%) ⬆️
sui_core/src/unit_tests/move_integration_tests.rs 93.33% <0.00%> (+0.01%) ⬆️
sui/src/wallet.rs 1.00% <0.00%> (+0.01%) ⬆️
sui_core/src/gateway_state.rs 91.18% <0.00%> (+0.07%) ⬆️
... and 12 more

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update 7c30c0a...59857f3. Read the comment docs.

}

/// Needed to deposit a 1:1 ratio of SUI and MANAGED for minting, but deposited a different ratio
const EBAD_DEPOSIT_RATIO: u64 = 0;
Copy link
Contributor

Choose a reason for hiding this comment

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

Nit: we need to figure out a canonical way of ordering module members.


/// === Writes ===

/// Mint BASKET coins by accepting an equal number of SUI and MANAGED coins
Copy link
Contributor

Choose a reason for hiding this comment

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

I don't fully understand how a Basket works. Why providing an equal number of SUI and MANAGED will generate an equal number of BASKET? Does the pricing of these coins not play a role?

Copy link
Contributor

@damirka damirka Apr 5, 2022

Choose a reason for hiding this comment

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

I believe this system is similar to Uniswap where you get a liquidity token for providing liquidity to one or both of the sides of the pool. It can be improved to support flexible rates for each of the currency. But that's my guess. 😆

Copy link
Collaborator Author

@sblackshear sblackshear Apr 5, 2022

Choose a reason for hiding this comment

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

The idea is that the value of BASKET fluctuates with the value of the assets in the reserve.

For a real-life example, SDR is a synthetic currency composed of a basket of USD, EUR, RMB, JPY, and GBP. I will add a comment about this + a link

Similarly, you might want a synthetic currency backed by a basket of NFT's that changes over time (e.g., some DAO's do this https://www.coindesk.com/markets/2022/02/10/flamingodaos-nft-portfolio-is-now-worth-1b/). Probably need a separate example to show how this would work, though.

Copy link
Contributor

@damirka damirka left a comment

Choose a reason for hiding this comment

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

LGTM

…t of other currencies

Useful to show how to represent a "reserve" via a singleton shared object. A variant of this approach can also be used to issue a token that is backed by a basket of NFT's.
Spelling out Special Drawing Rights (SDR)
Copy link
Contributor

@Clay-Mysten Clay-Mysten left a comment

Choose a reason for hiding this comment

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

Thanks, Sam!

@sblackshear sblackshear merged commit e678c63 into MystenLabs:main Apr 6, 2022
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.

4 participants