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.18 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 TransferGold extends BaseCommand {
static description = 'Transfer Celo Gold 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 = [
'transfergold --from 0xa0Af2E71cECc248f4a7fD606F203467B500Dd53B --to 0x5409ed021d9299bf6814279a6a1411a7e866a631 --value 10000000000000000000',
async run() {
const res = this.parse(TransferGold)
const from: string = res.flags.from
const to: string =
const value = new BigNumber(res.flags.value)
this.kit.defaultAccount = from
const goldToken = await this.kit.contracts.getGoldToken()
// Perform the transfer
await displaySendTx('gold.Transfer', goldToken.transfer(to, value.toFixed()))
You can’t perform that action at this time.