Skip to content

Commit

Permalink
feat(fast-usdc): stub transfer cli command
Browse files Browse the repository at this point in the history
  • Loading branch information
samsiegart committed Oct 29, 2024
1 parent acbd3ae commit c574e8d
Show file tree
Hide file tree
Showing 3 changed files with 29 additions and 6 deletions.
23 changes: 22 additions & 1 deletion packages/fast-usdc/src/cli.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
#!/usr/bin/env node

import { Command } from 'commander';
import { Argument, Command, createArgument } from 'commander';
import { readFileSync } from 'fs';
import { fileURLToPath } from 'url';
import { dirname, resolve } from 'path';
Expand Down Expand Up @@ -35,4 +35,25 @@ program
// TODO: Implement withdraw logic
});

program
.command('transfer')
.description('Transfer USDC from Ethereum/L2 to Cosmos via Fast USDC')
.addArgument(
createArgument('amount', 'Amount to transfer denominated in uusdc'),
)
.addArgument(createArgument('dest', 'Destination address'))
.action((amount, destination) => {
const start = Date.now();
console.error(
`TODO actually kick off USDC transfer. Amount: ${amount}uusdc Destination: ${destination}`,
);
console.info(`Finished in ${Date.now() - start}ms`);
// TODO: Implement transfer logic
// 1. Look up agoric Fast USDC contract address
// 2. Append destination address to agoric address
// 3. Compute noble forwarding address from result
// 4. Tell watcher to watch for transfers to computer address
// 5. Sign and broadcast CCTP transfer to noble forwarding address
});

program.parse();
12 changes: 7 additions & 5 deletions packages/fast-usdc/test/snapshots/cli.test.ts.md
Original file line number Diff line number Diff line change
Expand Up @@ -13,11 +13,13 @@ Generated by [AVA](https://avajs.dev).
CLI to interact with Fast USDC liquidity pool␊
Options:␊
-V, --version output the version number␊
-h, --help display help for command␊
-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␊
deposit Offer assets to the liquidity pool␊
withdraw Withdraw assets from the liquidity pool␊
transfer <amount> <dest> Transfer USDC from Ethereum/L2 to Cosmos via Fast␊
USDC␊
help [command] display help for command␊
`
Binary file modified packages/fast-usdc/test/snapshots/cli.test.ts.snap
Binary file not shown.

0 comments on commit c574e8d

Please sign in to comment.