I have following contract here on ropsten https://ropsten.etherscan.io/address/0x813870feba76f27ec1afcf79432e065a4839f7ab#code
I want to use tokens from a different erc20 contract(0x8eB24319393716668D768dCEC29356ae9CfFe285) inside my own contract.
I know that i have to approve the amount i want to use in my own contract from the Token contract those tokens i want to use in my contract (0x8eB24319393716668D768dCEC29356ae9CfFe285).
What i did In remix i compiled the code and selected TOKEN from inside my contract, i deployed TOKEN "at address" of 0x8eb24319393716668d768dcec29356ae9cffe285
i than approved this address 0x813870feba76f27ec1AfcF79432e065A4839F7(my contract)
and set amount to approve to 2 Which all worked.
But when i try to use the buy Function from inside my code- the transaction fails.
How can i use Token from a different erc20 Contract in my Contract?