0

Assuming I have a wallet, I want to authorize another wallet to send a transfer on my behalf, how do I implement the above using the following practice.

pragma solidity ^0.8.0;
import 'Token.sol';
contract TransferToken{
function transferFrom(address recipient, uint amount) external {
Token token = Token(0xd9145CCE52D386f254917e481eB44e9943F3555);
token.transferFrom(msg.sender, recipient, amount);
}
}
contract Owner {
function transfer(address recipient, uint amount) external {
Token token = Token(0xd9145CCE52D386f254917e481eB44e9943F39138);
token.approve(0x617F2E2fD72FD9D5503197092aC168c91465E7f2, amount);

TransferToken transferToken = TransferToken(0x617F2E2fD72FD9D5503197092aC168c91465E7f2);
transferToken.transferFrom(recipient, amount);}}

in the above example, i am using the openZappelin implementation for ERC20 on the import (Token.sol) now my question is this ... since I want to use a real wallet with ERC20 token how do I implement the above example, I am thinking for this I don't need the import anymore, but I don't know how to implement it without too many mistakes already, I very new to solidity and I am using remix for the above implementation

will be glad if i could get a help on this

Yilmaz
  • 35,338
  • 10
  • 157
  • 202
sonia
  • 9
  • 1
  • See this thread: https://stackoverflow.com/questions/71941928/how-to-transfer-erc20-tokens-to-another-address-using-solidity/71943184#71943184 – Antonio Carito Jan 21 '23 at 12:11

0 Answers0