How To Send ERC20 Tokens From One Contract To Another

Hello, everyone!

I am trying to discover how to send tokens from one contract to another contract using the Truffle Console.

I have 2 contracts that were successfully deployed on the Ropsten Testnet: TimeToken and Lock.

Below are the contracts for each.

TimeToken.sol:

Lock.sol

The Contract Addresses are as follows and can be verified on Ropsten Etherscan network:

TimeToken: 0x10aA7fEDb58465bB32Afe86fca07603ec41a472f

Lock: 0x9B2f887b2c9aCEccE46369D4fA09e545AfEa0D5C

What I am trying to do is send 6,000,000 of the 10,000,000 tokens to the Lock contract so the tokens can be locked for a predetermined amount of time (in my contract, I set it for a day to test it) through the Truffle Console.

However, I don't know how to do so. I'm thinking I may need to add a send or transfer function somewhere in the Lock smart contract and specify the amount and address of the TimeToken contract.

Any help in advance would be appreciated. Thank you and enjoy your day and week.

Pavon

1 Like