I am trying to find out how to allow multiple transactions on ethereum block chain by simply approving once on meta mask.
My use case is to make a portfolio management system.
for example consider:
token ------------ before ---- after
eth 10$ 20$
usdt 20$ 10$
btc 20$ 50$
old_coin 50$ 0$
new_coin 0$ 20$
result ============> |after-before== |result
------------------------------------
eth |20-10 |+10 (buy)
usdt |10-20 |-10 (sell)
btc |50-20 |+30 (buy)
old_coin |00-50 |-50 (sell)
new_coin |20-00 |+20 (buy)
Now i want to send all this transactions:
buy eth worth 10$,
sell usdt worth 10$,
buy btc worth 30$,
sell old_coin worth 50$,
buy new_coin worth 50$.
If any one can help me please let me know,
Thank You for your time...
First, you need to write your smart contract into one function call you mentioned above and deploy it. Then approve all tokens for max allowance (or upper limit) that you will be using to your smart contract address. Finally, call your smart contract function (you can do it thru REMIX IDE after you successfully deployed)
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.