# Trying to use totalSupply() from IERC20, getting error in Remix

**URL:** <https://forum.openzeppelin.com/t/trying-to-use-totalsupply-from-ierc20-getting-error-in-remix/14443>\
**Category:** Contracts\
**Created:** [August 24, 2021, 1:46am UTC](https://forum.openzeppelin.com/t/trying-to-use-totalsupply-from-ierc20-getting-error-in-remix/14443 "2021-08-24T01:46:56Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![ohalloranj94](https://avatars.discourse-cdn.com/v4/letter/o/a87d85/32.png) [@ohalloranj94](https://forum.openzeppelin.com/u/ohalloranj94)\
**Post date:** [August 24, 2021, 1:46am UTC](https://forum.openzeppelin.com/t/trying-to-use-totalsupply-from-ierc20-getting-error-in-remix/14443/1 "2021-08-24T01:46:57Z")

</div>

I'm trying to get the totalSupply function from IERC20 working, but I just keep getting an error in remix saying:

call to Test.getTotalSupply errored: VM error: revert.

revert  
The transaction has been reverted to the initial state.  
Note: The called function should be payable if you send value and the value you send should be less than your current balance.  
Debug the transaction to get more information.

This doesn't make any sense to me, the function isnt payable, it shouldn't need to be? I've made the contract as simple as possible to try get to the issue, but it's still here.

#### 🔢 Code to reproduce

```auto
pragma solidity ^0.8.1;

import "https://github.com/OpenZeppelin/openzeppelin-contracts/blob/master/contracts/token/ERC20/IERC20.sol";

contract Test {
    IERC20 public token;

    function getTotalSupply(address addr) public view returns(uint256) {
        return IERC20(addr).totalSupply();
    }
}

```

#### 💻 Environment

I'm using Remix, with JavaScript VM, solidity version 0.8.1

I used the LINK token at 0x514910771af9ca656af840dff83e8264ecf986ca to try get the total supply of.

---

<div class="post-metadata">

**Author:** ![FreezyEx](https://sea2.discourse-cdn.com/flex022/user_avatar/forum.openzeppelin.com/freezyex/32/5498_2.png) [@FreezyEx](https://forum.openzeppelin.com/u/FreezyEx)\
**Post date:** [August 24, 2021, 9:45am UTC](https://forum.openzeppelin.com/t/trying-to-use-totalsupply-from-ierc20-getting-error-in-remix/14443/2 "2021-08-24T09:45:02Z")

</div>

If you are using LINK token deployed on ETH you should try with Injected Web3
