I have issued some tokens base on eosio.token in jungle testnet, and I am able to transfer the tokens between accounts. Now if I want to enforce some control to the tokens sent ( for example, time lock, I do not want the receiver to transfer the tokens to someone else in 2 years). How should I program this function? Thank you for the help!
You cannot enforce time lock on
eosio.token contract because you do not have ownership over the contract and you can't modify the logic in the contract.
However, you can create your own token contract based on
eosio.token and add the time lock logic in your
You will need to save the timestamp when the recipient receives the token into a
multi-index table depending on your requirements.
You can do that by slightly modifying your token contract.
Things what you need to do is add one more variable for timestamp in your account table or anything else that tracks users.
After that add timestamp by increasing it to two year when user purchase token.
Modify transfer function accordingly that every time checks that timestamp and allow users to transfer tokens after varification.