-
Notifications
You must be signed in to change notification settings - Fork 186
Add stablecoin and real world asset tabs #404
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
Merged
Merged
Changes from all commits
Commits
Show all changes
26 commits
Select commit
Hold shift + click to select a range
bf5fc34
Update lockfile
renovate[bot] 52e1bbe
Add stablecoin section and community repo
cairoeth 63c23db
Add real world assets and update stablecoin
cairoeth e5be59f
Add limitations section
cairoeth 15e990f
Add limitations build
cairoeth 8ffb9a5
Add custodian feature
cairoeth a4c79da
Remove upgradeability on stablecoin
cairoeth 4b42090
Add tests
cairoeth ed2f32c
Update tests
cairoeth 2bd2b3f
Use repo dependency
cairoeth 5bef7c5
Improve access managed custodian
cairoeth 2e4bb09
Update limitation options
cairoeth cdd5198
Add experimental note
cairoeth 7d26a46
Update stablecoin.ts
cairoeth 2cd81ec
Fix default
cairoeth 6ae0d65
Simplify
cairoeth 54129d3
Merge remote-tracking branch 'upstream/renovate/lock-file-maintenance…
cairoeth 63457fd
Revert "Merge remote-tracking branch 'upstream/renovate/lock-file-mai…
cairoeth a8ab856
Community dependency
cairoeth edc3bd9
Fix Real-World Assets tab, disable Remix and download packages
ericglau b43be4d
Add experimental notice
cairoeth 71af676
Rename to `Real-World Asset`
cairoeth 630b535
Update default RWA name and symbol
cairoeth b8ba6c0
Add asterisks
cairoeth 9343183
Add asterisks on tabs
cairoeth aae71ba
Add changelog, bump version
ericglau File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,31 @@ | ||
| import type { StablecoinOptions } from '../stablecoin'; | ||
| import { accessOptions } from '../set-access-control'; | ||
| import { clockModeOptions } from '../set-clock-mode'; | ||
| import { infoOptions } from '../set-info'; | ||
| import { upgradeableOptions } from '../set-upgradeable'; | ||
| import { generateAlternatives } from './alternatives'; | ||
|
|
||
| const booleans = [true, false]; | ||
|
|
||
| const blueprint = { | ||
| name: ['MyStablecoin'], | ||
| symbol: ['MST'], | ||
| burnable: booleans, | ||
| pausable: booleans, | ||
| mintable: booleans, | ||
| permit: booleans, | ||
| limitations: [false, 'allowlist', 'blocklist'] as const, | ||
| votes: [ ...booleans, ...clockModeOptions ] as const, | ||
| flashmint: booleans, | ||
| premint: ['1'], | ||
| custodian: booleans, | ||
| access: accessOptions, | ||
| upgradeable: upgradeableOptions, | ||
| info: infoOptions, | ||
| }; | ||
|
|
||
| export function* generateStablecoinOptions(): Generator<Required<StablecoinOptions>> { | ||
| for (const opts of generateAlternatives(blueprint)) { | ||
| yield { ...opts, upgradeable: false }; | ||
| } | ||
| } | ||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,135 @@ | ||
| import test from 'ava'; | ||
| import { stablecoin } from '.'; | ||
|
|
||
| import { buildStablecoin, StablecoinOptions } from './stablecoin'; | ||
| import { printContract } from './print'; | ||
|
|
||
| function testStablecoin(title: string, opts: Partial<StablecoinOptions>) { | ||
| test(title, t => { | ||
| const c = buildStablecoin({ | ||
| name: 'MyStablecoin', | ||
| symbol: 'MST', | ||
| ...opts, | ||
| }); | ||
| t.snapshot(printContract(c)); | ||
| }); | ||
| } | ||
|
|
||
| /** | ||
| * Tests external API for equivalence with internal API | ||
| */ | ||
| function testAPIEquivalence(title: string, opts?: StablecoinOptions) { | ||
| test(title, t => { | ||
| t.is(stablecoin.print(opts), printContract(buildStablecoin({ | ||
| name: 'MyStablecoin', | ||
| symbol: 'MST', | ||
| ...opts, | ||
| }))); | ||
| }); | ||
| } | ||
|
|
||
| testStablecoin('basic stablecoin', {}); | ||
|
|
||
| testStablecoin('stablecoin burnable', { | ||
| burnable: true, | ||
| }); | ||
|
|
||
| testStablecoin('stablecoin pausable', { | ||
| pausable: true, | ||
| access: 'ownable', | ||
| }); | ||
|
|
||
| testStablecoin('stablecoin pausable with roles', { | ||
| pausable: true, | ||
| access: 'roles', | ||
| }); | ||
|
|
||
| testStablecoin('stablecoin pausable with managed', { | ||
| pausable: true, | ||
| access: 'managed', | ||
| }); | ||
|
|
||
| testStablecoin('stablecoin burnable pausable', { | ||
| burnable: true, | ||
| pausable: true, | ||
| }); | ||
|
|
||
| testStablecoin('stablecoin preminted', { | ||
| premint: '1000', | ||
| }); | ||
|
|
||
| testStablecoin('stablecoin premint of 0', { | ||
| premint: '0', | ||
| }); | ||
|
|
||
| testStablecoin('stablecoin mintable', { | ||
| mintable: true, | ||
| access: 'ownable', | ||
| }); | ||
|
|
||
| testStablecoin('stablecoin mintable with roles', { | ||
| mintable: true, | ||
| access: 'roles', | ||
| }); | ||
|
|
||
| testStablecoin('stablecoin permit', { | ||
| permit: true, | ||
| }); | ||
|
|
||
| testStablecoin('stablecoin custodian', { | ||
| custodian: true, | ||
| }); | ||
|
|
||
| testStablecoin('stablecoin allowlist', { | ||
| limitations: 'allowlist', | ||
| }); | ||
|
|
||
| testStablecoin('stablecoin blocklist', { | ||
| limitations: 'blocklist', | ||
| }); | ||
|
|
||
| testStablecoin('stablecoin votes', { | ||
| votes: true, | ||
| }); | ||
|
|
||
| testStablecoin('stablecoin votes + blocknumber', { | ||
| votes: 'blocknumber', | ||
| }); | ||
|
|
||
| testStablecoin('stablecoin votes + timestamp', { | ||
| votes: 'timestamp', | ||
| }); | ||
|
|
||
| testStablecoin('stablecoin flashmint', { | ||
| flashmint: true, | ||
| }); | ||
|
|
||
| testAPIEquivalence('stablecoin API default'); | ||
|
|
||
| testAPIEquivalence('stablecoin API basic', { name: 'CustomStablecoin', symbol: 'CST' }); | ||
|
|
||
| testAPIEquivalence('stablecoin API full', { | ||
| name: 'CustomStablecoin', | ||
| symbol: 'CST', | ||
| premint: '2000', | ||
| access: 'roles', | ||
| burnable: true, | ||
| mintable: true, | ||
| pausable: true, | ||
| permit: true, | ||
| votes: true, | ||
| flashmint: true, | ||
| limitations: 'allowlist', | ||
| custodian: true | ||
| }); | ||
|
|
||
| test('stablecoin API assert defaults', async t => { | ||
| t.is(stablecoin.print(stablecoin.defaults), stablecoin.print()); | ||
| }); | ||
|
|
||
| test('stablecoin API isAccessControlRequired', async t => { | ||
| t.is(stablecoin.isAccessControlRequired({ mintable: true }), true); | ||
| t.is(stablecoin.isAccessControlRequired({ pausable: true }), true); | ||
| t.is(stablecoin.isAccessControlRequired({ limitations: 'allowlist' }), true); | ||
| t.is(stablecoin.isAccessControlRequired({ limitations: 'blocklist' }), true); | ||
| }); |
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.