CRYPTO NEWS

Altcoin Roundup: Holding Bitcoin? Here’s how to put it to work in DeFi

BTC is back at all-time highs, meaning it’s even easier for holders to capitalize on the lucrative yield opportunities DeFi offers to investors who are willing to stake their tokens.

Interact with token contract

I am trying to create a simple contract to interact with it, but it seems I always get 0 when I try to retrieve my balance and I do not understand what I am doing wrong. I have coins and it should return the correct balance. Solidity: // SPDX-License-Identifier: GPL-3.0-only pragma solidity ^0.8.11; import "IERC20.sol";::Listen

I am trying to create a simple contract to interact with it, but it seems I always get 0 when I try to retrieve my balance and I do not understand what I am doing wrong. I have coins and it should return the correct balance.

Solidity:

// SPDX-License-Identifier: GPL-3.0-only pragma solidity ^0.8.11;  import "IERC20.sol";  contract TestContract {  IERC20 testToken = IERC20(my_token_address_here);  function GetUserTokenBalance(address name) public view returns(uint256){     name = msg.sender;    return testToken.balanceOf(name); }  } 

Thank you!

Altcoin Roundup: Holding Bitcoin? Here’s how to put it to work in DeFi

Shopping cart
There are no products in the cart!
Continue shopping
0