-
Notifications
You must be signed in to change notification settings - Fork 11.4k
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
[experiments, wip] Adds an abstract implementation of the regulated currency #1589
Conversation
Make small edits directly Markdown in PR.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Markdown looks good with some small changes I made directly.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think this is an interesting piece of code and perhaps worth checking in as an example. However, I would be reluctant to implement a regulated stablecoin this way because I think it will make it impossible to use the stablecoin in DeFi etc. (or indeed, for anything except payments becase of the lack of store
).
If you imagine the type of a key component in a Uniswap 1.0-style DEX, it would probably be something like struct Pool<T1, T2> { t1: Balance<T2>, t2: Balance<T2> }
. This would preclude using the regulated coin as one of the pairings in a EX, which would be unfortunate.
@@ -0,0 +1,9 @@ | |||
[package] | |||
name = "USDC" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Nit: let's use RegulatedCoin
or PermissionedCoin
everywhere?
@@ -0,0 +1,9 @@ | |||
[package] |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Could we put this example into examples/fungible_tokens
?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I wasn't going to add it anywhere actually. The whole idea was to poc.
/// authorizing borrows with a witness (which can only be created in | ||
/// the custom coin module). | ||
/// | ||
/// TODO: make a tutorial on Witness auth somewhere. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
+1 :)
// Copyright (c) 2022, Mysten Labs, Inc. | ||
// SPDX-License-Identifier: Apache-2.0 | ||
|
||
module USDC::Abstract { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Trying to understand the Abstract
part of this name...
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Oh. Yeah, it's still in development, and the initial idea was to showcase basic types but then I got carried away.
However, I think there is a very similar approach that would work:
|
If we shaped regulated coin into something worth including to the framework, people could consider using special type for stable coins. Also, inside an |
Closing it for now until I sort out how to use shared balances. |
This PR is built on top of the #1573.
What's inside:
Open to comments!