Specifically, if I wanted to send multiple different tokens to a smart contract, but it was important to the contracts function that all tokens arrive at the same time, could I put;
20 Token A
45 Token B
7.5 Token C
in a single transaction, or easily be able to create packages of different tokens to send out together and remain together when sent back and forth?
Ethereum Wallet DApp – Grouping Multiple ERC20 Tokens into One Transaction
erc-20ethereum-wallet-dapp
Best Answer
You can do this by creating a contract and having the contract interact with the various token contracts.
One method would be to create your contract, then transfer ownership of your balance on each token to the contract. Untested example (for illustrative purposes only, don't use this as is):
Another method would be to leave the ownership of the tokens under your own account, and call
approve()
against each token to give your proxy contract permission to move them. Then where the above code callstransfer(_to, _value)
in the proxy contract, you'd instead calltransferFrom(msg.sender, _to, _value)
.