0

A while back I saw an example contract which allowed users to send any ERC-20 tokens through one of its functions, but I can't seem to find anything about this anywhere anymore. So, what is the simplest way to implement:

a) A function in a smart contract that allows the contract to handle transactions between another (specific) token contract?

b) A function allowing for any ERC-20 token to be used (probably through the user specifying the token contract)?

Thanks.

1

You can find an example of a contract which supports and interacts with other ERC20 tokens in the Bounties Network Standard Bounty.

The simple gist of it is you need to import the ERC20 standard interface into your contract, and then you can interact with any ERC20 contract by specifying their contract address is using that interface. From there you can call functions like normal. You can see that it is generalized enough that the initial bounty creator could specify the use of any ERC20 token through its contract address.

The Standard Bounty contract does a good job showing how a user could escrow a certain amount of an ERC20 token in the bounty contract, and then have another user get paid using that token directly.

  • Sorry for the delay, I will take a look at their contract, thanks! – Yakko Majuri Oct 29 '18 at 19:48

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.