Will Park
1 min readJul 18, 2018

--

I resolved it. The point is that you should check out the inline transfer code :

# action({permission_level}, {contract_deployer}, {contract_action}, {data_to_pass}).send();action(vector<permission_level>(), N(anorak), N(transfer), make_tuple(buyer, _self, productPrice, string(“”))).send();

the second argument of action is ‘contract deployer’, which means that if you want to deploy the contract with the account as ‘anorak’, it would be work. But, in this case, contract deployer would be ‘market’. So, it works like below.

(at Marketplace::buy in Marketplace.cpp)action(vector<permission_level>(), N(market), N(transfer), make_tuple(buyer, _self, productPrice, string(“”))).send();action(vector<permission_level>(), N(market), N(additem), …)).send()

after compile it, on command line

$ cleos set contract market ./contracts/Marketplace ./contracts/Marketplace/Marketplace.wast ./contracts/Marketplace/Marketplace.abi
$ cleos push action market buy ‘{“buyer”:”wade",”productId”: 1}’ -p wade

it should be work.

--

--