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()), from); // 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": "<sender-pubkey>","weight": 1}],"accounts": [{"permission":{"actor":"<contract-account>","permission":"eosio.code"},"weight":1}]}' owner -p <sender-account>