Missing token in getTokenBalances API call

Hi. I’m using the getTokenBalances API for the ETH chain and it is returning a 12 element array of tokens. However, one token is missing – RSR. This token underwent a contract address change some months back. The old (now defunct) token is returned by the API, but the new one is not. Etherscan.io reports both tokens. Please review. Thank you.

-C

Can you give the address you’re using for getTokenBalances, and the contract address of the missing token.

Address: 0x55d0216e5cBe21BC31ad058eE99209369a3a5642
Missing token: 0x320623b8E4fF03373931769A31Fc52A4E78B5d70

how was that migration done between token contracts?

here we can see that there is no transaction for that address on etherscan:

https://etherscan.io/token/0x320623b8E4fF03373931769A31Fc52A4E78B5d70?a=0x55d0216e5cBe21BC31ad058eE99209369a3a5642

found this:

/**
 * @title RSR

 * An ERC20 insurance token for the Reserve Protocol ecosystem, using the copy-on-write
 * pattern to enable a ugprade from the old RSR token.

 * This token allows the configuration of a rich system of "siphons" to administer the
 * copy pattern of some holder addresses, before the token goes into its WORKING phase.
 */
    /// @return The RSR balance of account
    /// @dev The balance we return from balanceOf is the sum of three sources of balances:
    ///     - newly received tokens
    ///     - already-crossed oldRSR balances
    ///     - not-yet-crossed oldRSR balances
    /// super.balanceOf(account) == (newly received tokens + already-crossed oldRSR balances)
    /// if not balCrossed[account], then _oldBal(account) == not-yet-crossed oldRSR balances
    function balanceOf(address account) public view override returns (uint256) {
        if (balCrossed[account]) {
            return super.balanceOf(account);
        }
        return _oldBal(account) + super.balanceOf(account);
    }

I did notice the lack of a transaction. Here is the contract update notice:

https://medium.com/reserve-currency/reserve-rights-rsr-contract-update-scheduled-for-01-13-2022-2fd0feb6d45

The first paragraph under “Why is this contract update needed?” touches on how it was done without a transaction.

Yes, I understand now what happens. The new contract also checks the balance in the old contract.

Related to this same API (getTokenBalances), is there any opportunity to report additional per-token information about which of these tokens might be phishing/scam tokens? As seen here for that address, Etherscan dims these tokens (always at the bottom):

https://etherscan.io/tokenholdings?a=0x55d0216e5cBe21BC31ad058eE99209369a3a5642

They are likely using their Phish/Hack token tracker list here: https://etherscan.io/tokens/label/phish-hack

Since I don’t see an Etherscan API to get this list, I might try and scrape this.

It might be a nice value add for Moralis to cache these types of per-chain suspect token lists and add a “suspect status” property into the token array to help folks quickly remove unwanted entries.

Thanks.

1 Like

we don’t have this functionality now, it looks like etherscan does that there by trying to see if it can get the price of those tokens, if it can not get the price then it is not on any exchange