EOSIO / eos

An open source smart contract platform
https://developers.eos.io/manuals/eos
MIT License
11.28k stars 3.6k forks source link

How to develop multiple contracts communicate with each other? #4283

Closed lingyiliu016 closed 6 years ago

lingyiliu016 commented 6 years ago
 When I intend to develop a contract that trade goods on market ,I found that I have to develop a contract communicated with eosio.token contract, because customers trade goods with token. it means that the contract must call transfer that is a member function of eosio.token contract.
 I have developed three seperated contracts, each contract is very simple.because they are all test case.  currency contract represents the eosio.token contract.
 I have develop currency contracts and goods contracts,and deployed on blockchain, everything is ok!
 but I don't know how to use market contract to call currency contracts and goods contracts.
 specific as follow:
 Here is the three contract structure
1
 Here is currency contract(currency.hpp and currency.cpp)
currency hpp currency cpp
 Here is goods contract(goods.hpp and goods.cpp)
goods hpp 20180622181315
Here is market contract(market.hpp and market.cpp)
market hpp market cpp
lingyiliu016 commented 6 years ago

currency.hpp and currency.cpp are ok! I have deployed it on blockchain. goods.hpp and goods.cpp are ok ! I have deployed it on blockchain. I don't know how to write market.hpp and market.cpp .Here is a example ,but it doesn't work! Anyone help me? give me some suggetions ,please! if you have some suggestion,answer the question Thank you very much!

lingyiliu016 commented 6 years ago

I have seen on the eos official website that multiple contracts can interact with each other. Here is the screenshot.

20180622170942

But the website doesn't give a example,so I don't know how to write it!

lingyiliu016 commented 6 years ago

I think the content of market.cpp is probably like this:

20180622180641

Maybe I'm one step closer to he correct answer, but there are still many error!

abhi3700 commented 6 years ago

Please make a tutorial on this, if possible.

And post it on utopian community over STEEM Blockchain. This is for getting reward for contribution.

It will be really helpful for the EOS developer community.