0

I have no idea how to title this but essentially I'm building a token that when owned you get a percentage of a certain amount of money monthly. Here's the thing, I asked how I could airdrop that amount but I was made aware of the fact that'd be less than ideal.

So I've moved onto the idea of basically having a simple website where you can see how much you've made just owning the token, and you can withdraw that amount directly into your wallet. I've decided on using USDT as the token that is withdrawn, basically if you own 10% of the tokens, you can withdraw 10% of what is made that month. Does that make sense?

I'm really lost and could use some help on how I'd add that functionality.

This is the basic idea:

You own x% of the total tokens -> you can withdraw x% of the total kitty (in USDT) that is made that month -> that amount gets withdrawn to your metamask wallet.

I hope to make it so that if someone doesn't withdraw one month they can the next month, and not lose any but I have no how I'd implement that in a smart contract.

Your help is appreciated.

2
  • I am not sure if this can be done in a direct way. You got to enter the information of the user in the contract somehow. Let's say he buys your tokens, ABC. The contract will put an entry in it and start calculating the reward. Whenever a user comes to claim, you compute his rewards based on the time he purchased and the number of tokens he currently has. Something like that maybe? Commented Dec 2, 2022 at 10:19
  • a hint would be: keep track of how much the person has already withdrawn Commented Dec 2, 2022 at 14:29

1 Answer 1

0

In order to add this functionality to your token, you could use a smart contract that implements a withdrawal mechanism for the monthly revenue.

Here are the basic steps you could follow to implement this functionality:

Set up a smart contract to manage your token and the monthly revenue. The contract should keep track of the total number of tokens in circulation and the total amount of revenue generated in a given month.

Implement a function in the smart contract that allows token holders to claim their share of the monthly revenue. This function should take the user's wallet address and the number of tokens they own as input, and use these values to calculate the amount of USDT they are entitled to receive.

Use the ERC20 transfer function to send the calculated amount of USDT to the user's wallet.

To allow users to carry over unclaimed revenue from one month to the next, you could implement a function that allows users to check their current balance of unclaimed revenue. This function could take the user's wallet address as input and return the amount of unclaimed revenue associated with that address.

When a user claims their share of the monthly revenue, the smart contract could first check if they have any unclaimed revenue from previous months. If they do, this amount could be added to the amount of USDT they are entitled to receive, and the total amount could be transferred to their wallet in a single transaction.

This is just one possible approach to implementing the functionality you described. There may be other ways to achieve the same result, depending on your specific requirements and design choices. You may want to consider consulting with a blockchain developer or seeking additional resources and guidance on how to implement this functionality in your smart contract.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.