-
Notifications
You must be signed in to change notification settings - Fork 215
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
refs: #10328 ## Description Sets up a package for Fast USDC and stubs out its CLI. Finishing #10328 will require a contract that has the offer makers. ### Security Considerations none ### Scaling Considerations none ### Documentation Considerations This will need end user documentation later ### Testing Considerations basic test ### Upgrade Considerations not deployed
- Loading branch information
Showing
11 changed files
with
181 additions
and
1 deletion.
There are no files selected for viewing
This file contains 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 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 |
---|---|---|
|
@@ -49,5 +49,6 @@ export default [ | |
"@agoric/xsnap-lockdown", | ||
"@agoric/zoe", | ||
"@agoric/zone", | ||
"agoric" | ||
"agoric", | ||
"fast-usdc" | ||
]; |
This file contains 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,25 @@ | ||
# Fast USDC | ||
|
||
Development package for the Fast USDC product. | ||
Here in agoric-sdk as a convenience for integration testing and iterating on the SDK affordances required for the product. | ||
|
||
# Naming | ||
|
||
The package is `fast-usdc`, not `@agoric/fast-usdc`, because it's not part of the SDK. | ||
|
||
It should not appear in the NPM directory. To this end the package is marked as private. | ||
|
||
# Factoring | ||
|
||
This package is meant to contain all the code for the Fast USDC product. However there are some constraints: | ||
|
||
- a3p integration tests are in the `a3p-integration` top-level package, separate from this workspace | ||
- the proposal builders are in `@agoric/builders` to work with the a3p-integration `build:submissions` script | ||
- the RunUtils tests are in `@agoric/boot` to test running them atop a fresh bootstrapped environment | ||
|
||
Over time we can update our tooling to decouple this more from the `packages` directory. | ||
|
||
1. Make a3p-integration `build:submissions` script work with arbitrary builder paths, allowing this to be above `@agoric/builders` in the package graph | ||
2. Export bootstrap testing utilities from `@agoric/boot`, allowing this to be above `@agoric/boot` in the package graph | ||
3. Update CI to support packages that aren't under `packages/`, eg. a top-level `dapps` directory | ||
4. Move this package out of agoric-sdk |
This file contains 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,50 @@ | ||
{ | ||
"name": "fast-usdc", | ||
"private": true, | ||
"version": "0.1.0", | ||
"description": "Create an Agoric Javascript smart contract application", | ||
"type": "module", | ||
"files": [ | ||
"contract", | ||
"src" | ||
], | ||
"bin": { | ||
"fast-usdc": "./src/cli.js" | ||
}, | ||
"scripts": { | ||
"build": "exit 0", | ||
"test": "ava", | ||
"test:c8": "c8 $C8_OPTIONS ava --config=ava-nesm.config.js", | ||
"test:xs": "exit 0", | ||
"lint-fix": "yarn lint:eslint --fix", | ||
"lint": "run-s --continue-on-error lint:*", | ||
"lint:types": "tsc", | ||
"lint:eslint": "eslint ." | ||
}, | ||
"devDependencies": { | ||
"ava": "^5.3.0", | ||
"c8": "^9.1.0", | ||
"ts-blank-space": "^0.4.1" | ||
}, | ||
"dependencies": { | ||
"agoric": "^0.21.1", | ||
"commander": "^12.1.0" | ||
}, | ||
"ava": { | ||
"extensions": { | ||
"js": true, | ||
"ts": "module" | ||
}, | ||
"files": [ | ||
"test/**/*.test.*" | ||
], | ||
"nodeArguments": [ | ||
"--import=ts-blank-space/register", | ||
"--no-warnings" | ||
], | ||
"require": [ | ||
"@endo/init/debug.js" | ||
], | ||
"timeout": "20m" | ||
} | ||
} |
This file contains 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,38 @@ | ||
#!/usr/bin/env node | ||
|
||
import { Command } from 'commander'; | ||
import { readFileSync } from 'fs'; | ||
import { fileURLToPath } from 'url'; | ||
import { dirname, resolve } from 'path'; | ||
|
||
const packageJson = JSON.parse( | ||
readFileSync( | ||
resolve(dirname(fileURLToPath(import.meta.url)), '../package.json'), | ||
'utf8', | ||
), | ||
); | ||
|
||
const program = new Command(); | ||
|
||
program | ||
.name('fast-usdc') | ||
.description('CLI to interact with Fast USDC liquidity pool') | ||
.version(packageJson.version); | ||
|
||
program | ||
.command('deposit') | ||
.description('Offer assets to the liquidity pool') | ||
.action(() => { | ||
console.error('TODO actually send deposit'); | ||
// TODO: Implement deposit logic | ||
}); | ||
|
||
program | ||
.command('withdraw') | ||
.description('Withdraw assets from the liquidity pool') | ||
.action(() => { | ||
console.error('TODO actually send withdrawal'); | ||
// TODO: Implement withdraw logic | ||
}); | ||
|
||
program.parse(); |
This file contains 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,24 @@ | ||
import test from 'ava'; | ||
import { spawn } from 'child_process'; | ||
import { fileURLToPath } from 'url'; | ||
import { dirname, join } from 'path'; | ||
|
||
const dir = dirname(fileURLToPath(import.meta.url)); | ||
const CLI_PATH = join(dir, '../src/cli.js'); | ||
|
||
test('CLI shows help when run without arguments', async t => { | ||
const output = await new Promise(resolve => { | ||
const child = spawn('node', [CLI_PATH]); | ||
let stderr = ''; | ||
|
||
child.stderr.on('data', data => { | ||
stderr += data.toString(); | ||
}); | ||
|
||
child.on('close', () => { | ||
resolve(stderr); | ||
}); | ||
}); | ||
|
||
t.snapshot(output); | ||
}); |
This file contains 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,23 @@ | ||
# Snapshot report for `test/cli.test.ts` | ||
|
||
The actual snapshot is saved in `cli.test.ts.snap`. | ||
|
||
Generated by [AVA](https://avajs.dev). | ||
|
||
## CLI shows help when run without arguments | ||
|
||
> Snapshot 1 | ||
`Usage: fast-usdc [options] [command]␊ | ||
␊ | ||
CLI to interact with Fast USDC liquidity pool␊ | ||
␊ | ||
Options:␊ | ||
-V, --version output the version number␊ | ||
-h, --help display help for command␊ | ||
␊ | ||
Commands:␊ | ||
deposit Offer assets to the liquidity pool␊ | ||
withdraw Withdraw assets from the liquidity pool␊ | ||
help [command] display help for command␊ | ||
` |
Binary file not shown.
This file contains 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,10 @@ | ||
{ | ||
"extends": "../../tsconfig.json", | ||
"compilerOptions": { | ||
"strict": true, | ||
}, | ||
"include": [ | ||
"src", | ||
"test", | ||
], | ||
} |
This file contains 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 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 |
---|---|---|
|
@@ -4941,6 +4941,11 @@ commander@^11.1.0: | |
resolved "https://registry.yarnpkg.com/commander/-/commander-11.1.0.tgz#62fdce76006a68e5c1ab3314dc92e800eb83d906" | ||
integrity sha512-yPVavfyCcRhmorC7rWlkHn15b4wDVgVmBA7kV4QVBsF7kv/9TKJAbAXVTxvTnwP8HHKjRCJDClKbciiYS7p0DQ== | ||
|
||
commander@^12.1.0: | ||
version "12.1.0" | ||
resolved "https://registry.yarnpkg.com/commander/-/commander-12.1.0.tgz#01423b36f501259fdaac4d0e4d60c96c991585d3" | ||
integrity sha512-Vw8qHK3bZM9y/P10u3Vib8o/DdkvA2OtPtZvD871QKjy74Wj1WSKFILMPRPSdUSx5RFK1arlJzEtA4PkFgnbuA== | ||
|
||
[email protected], comment-parser@^1.4.0: | ||
version "1.4.1" | ||
resolved "https://registry.yarnpkg.com/comment-parser/-/comment-parser-1.4.1.tgz#bdafead37961ac079be11eb7ec65c4d021eaf9cc" | ||
|