makeWithdrawOngTx method

Future<Transaction> makeWithdrawOngTx (Address from, Address to, BigInt amount, int gasPrice, int gasLimit, Address payer)

Implementation

Future<Transaction> makeWithdrawOngTx(Address from, Address to, BigInt amount,
    int gasPrice, int gasLimit, Address payer) async {
  amount = verifyAmount(amount);
  var struct = Struct();
  struct.list.addAll([from, await getTokenContractAddr('ONT'), to, amount]);

  var pb = VmParamsBuilder();
  pb.pushNativeCodeScript([struct]);
  var params = pb.buf.bytes;

  var txb = TxBuilder();
  var tx = await txb.makeNativeContractTx(
      'transferFrom', params, await getTokenContractAddr('ONG'),
      gasPrice: gasPrice, gasLimit: gasLimit, payer: payer);

  tx.tokenType = 'ONG';
  tx.from = from;
  tx.to = to;
  tx.amount = amount;
  tx.method = 'transferFrom';
  return tx;
}