Skip to content
Branch: master
Find file Copy path
Find file Copy path
Fetching contributors…
Cannot retrieve contributors at this time
34 lines (27 sloc) 1.19 KB
import { flags } from '@oclif/command'
import BigNumber from 'bignumber.js'
import { BaseCommand } from '../../base'
import { displaySendTx } from '../../utils/cli'
import { Flags } from '../../utils/command'
export default class TransferDollars extends BaseCommand {
static description = 'Transfer Celo Dollars to a specified address.'
static flags = {
from: Flags.address({ required: true, description: 'Address of the sender' }),
to: Flags.address({ required: true, description: 'Address of the receiver' }),
value: flags.string({ required: true, description: 'Amount to transfer (in wei)' }),
static examples = [
'dollars --from 0xa0Af2E71cECc248f4a7fD606F203467B500Dd53B --to 0x5409ed021d9299bf6814279a6a1411a7e866a631 --value 1000000000000000000',
async run() {
const res = this.parse(TransferDollars)
const from: string = res.flags.from
const to: string =
const value = new BigNumber(res.flags.value)
this.kit.defaultAccount = from
const stableToken = await this.kit.contracts.getStableToken()
// Perform the transfer
await displaySendTx('dollar.Transfer', stableToken.transfer(to, value.toFixed()))
You can’t perform that action at this time.