#StackBounty: #tokens #erc-20 #web3.py Fetch vesting schedule for a token in an account by using web3.py

Bounty: 50

Private investors usually have tokens locked in their wallet and released by a specific schedule. I want to find this schedule for any given token contract address and a given wallet address (function of locked tokens number in the wallet dependent of the date) using python. How do I do this? I am already using web3.py, does it have such a functionality?

The function should be working for any ERC20 token contract I know the contract address of.

———EDIT———–

From checking the answers and comments here, it looks like there is no uniform function in every ERC20 contract that returns the questioned data, but a transfer lock can be implemented in many different ways. Therefore, the only method I can think of to find the data is simulation.

I came up with this idea:

  1. Fork the ethereum mainnet using ganache-cli in a QEMU-KVM virtual machine:

https://www.quicknode.com/guides/web3-sdks/how-to-fork-ethereum-blockchain-with-ganache

  1. unlock all accounts in the forked testnet
  2. find all token holders of the token in question
  3. try to transfer the full token amount for each token holder to a burn address. When the transfer fails, we know there must be a transfer lock for some amount of the tokens
  4. try to find that amount by transferring partially until I know the locked amount up to a good precision
  5. alter the system time in the virtual machine to one day in the future (this assumes the testnet uses the system time to calculate how many tokens are vested, is this indeed the case?)
  6. repeat steps 5 and 6 until all the tokens are unlocked.

Would be great to get some feedback if this will work of if I missed something.

—– EDIT 2——–

After checking multiple token contracts, I came to the conclusion that this problem is probably impossible to solve, because many contracts require a claim function or similar to be called before being able to transfer tokens. In the above steps, I assumed that this check is done by the transfer function itself. A lot of tokens even have a separate vault contract for the private sale investors. I see no way how to make this work automatedly for any deployed contract – because I do not know the details of each implementation. I do no know the address of the correct vault contract if there is one, and I also do not know the steps presale investors need to follow to claim the tokens (name of the function can vary arbitrarily).

If anybody has an idea how to solve this, I’d be interested to know.

To clarify:

  • This question is NOT about writing my own contract.
  • I do NOT want to know how to interact with a particular contract. I know how this is done. I want to find a general solution which works for all ERC20 tokens.
  • I do not know any details about a particular token’s code. I only know the contract address of each token from my database.


Get this bounty!!!

Leave a Reply

This site uses Akismet to reduce spam. Learn how your comment data is processed.