Skip to main content
1 of 3
confused00
  • 5.6k
  • 2
  • 11
  • 37

You need to call the transfer action of eosio.token contract with the appropriate arguments after your preferred delay:

void send(account_name from, account_name to, asset amount, string memo, uint64_t delay) { 
    eosio::transaction t{};
    t.actions.emplace_back(
        eosio::permission_level(from, N(active)), // with `from@active` permission
        N(eosio.token), // You're sending this to `eosio.token`
        N(transfer),   // to their `transfer` action
        std::make_tuple(from, to, amount, memo));  // with the appropriate args
    t.delay_sec = delay; // Set the delay
    t.send(eosio::string_to_name(memo.c_str()), amount); // Send the transaction with some ID derived from the memo
   }
};

You'll need to set permissions accordingly

$ cleos set account permission <sender-account> active '{"threshold": 1,"keys": [{"key": "EOS6MRyAjQq8ud7hVNYcfnVPJqcVpscN5So8BhtHuGYqET5GDW5CV","weight": 1}],"accounts": [{"permission":{"actor":"<contract-account>","permission":"eosio.code"},"weight":1}]}' owner -p <sender-account>
confused00
  • 5.6k
  • 2
  • 11
  • 37