When I perform a token transfer from the cleos command line, it works with no problems:
$ cleos push action eosio.token transfer '["rider2","vehicle1","1000.0000 TOK","initial"]' -p rider2
executed transaction: 44412ed34b9008c0802d22c2e52174428c377467e2cf633ffcf8510cd35eb6f9 136 bytes 719 us
# eosio.token <= eosio.token::transfer {"from":"rider2","to":"vehicle1","quantity":"1000.0000 TOK","memo":"initial"}
# rider2 <= eosio.token::transfer {"from":"rider2","to":"vehicle1","quantity":"1000.0000 TOK","memo":"initial"}
# vehicle1 <= eosio.token::transfer {"from":"rider2","to":"vehicle1","quantity":"1000.0000 TOK","memo":"initial"}
However, when I try to perform the same action inside of a smart contract, I get a problem with permissions (even through I'm signing the transaction with the appropriate transactions).
Here's the code within my action:
eosio::action(
std::vector<eosio::permission_level>(2,{rider, N(active)}),
N(eosio.token), // contract
N(transfer), // action
xfer{rider, gate, fee, std::to_string(breachId) } )
.send();
Here's how I'm invoking the action (essentially, tokens should be transferred from rider1 to gate1.
$ cleos push action eosride breachgate '[47539,"gate1","vehicle1"]' -p gate1 -p vehicle1 -p rider3
But I'm getting an error claiming that it does not have permissions from rider3 even though I am signing it.
Error 3090003: provided keys, permissions, and delays do not satisfy declared authorizations
Ensure that you have the related private keys inside your wallet and your wallet is unlocked.
Error Details:
transaction declares authority '{"actor":"rider3","permission":"active"}', but does not have signatures for it under a provided delay of 0 ms