erc20 token transfer dont work??

Închis Postat la acum 3 ani S-au achitat serviciile după ce au fost prestate
Închis S-au achitat serviciile după ce au fost prestate

Hello everyone,

i have a smart contract , where i need to request other smart contract erc20 token. (Link token in this case)

Example code below:

address linkAdr = 0x84b9B910527Ad5C03A9Ca831909E21e236EA7b06;

IERC20 link = IERC20(linkAdr);

uint256 public linkAllowance;

uint256 public userlinkbalance = 0;

address public msgSender = _msgSender();

uint256 public approvedAmount = 0;

function transferToken(uint256 amount) external returns(string memory){

uint256 linkAmt = amount * 10**18;

[login to view URL](_msgSender(), address(this), linkAmt);

}

function approveTransfer(uint256 amount) external returns(string memory) {

uint256 approveAmt = amount * 10**18;

userlinkbalance = [login to view URL](_msgSender());

[login to view URL](address(this),approveAmt);

// [login to view URL](_msgSender(), 1000);

// linkAllowance = [login to view URL](_msgSender());

// [login to view URL](_msgSender(), amount);

link._approve(_msgSender(), 1000);

approvedAmount = approveAmt;

}

function getLinkBalance() public view returns(uint256){

return [login to view URL](address(this));

}

The increase allowance function dont work for some reason.

Please help me fix this.

Ethereum Blockchain

ID Proiect: #30096345

Detalii despre proiect

2 propuneri Proiect la distanță Activ acum 2 ani

2 freelanceri plasează o ofertă medie de 120$ pentru proiect

eliudc2021

HI, how are you? I read your project carefuly and understand it. My main skill is blockchain and solidity and worked on pancakeswap with solidity. 0xAaD87f47CDEa777FAF87e7602E91e3a6AFbe4D57 I worked with token and this Mai multe

$140 USD în 7 zile
(2 recenzii)
4.1
nemanjap00

Hi! I checked your mentioned codes. I think that your implementation is incorrect. Why did you use _approve instead of increaseAllowance? And _approve's arguments are incorrect if other token is based on ERC20. Or if y Mai multe

$100 USD în 1 zi
(1 părere)
0.0