0

I'm trying to write a token that sends a percentage fee to a fee collecting smart contract that does stuff with the token. I start off with writing a token and I point it toward the fee collecting address (meaning it already has to have been made) then how am I supposed to add the token address to the fee collecting smart contracts source code so after it recives it it can be aware of it and do stuff with it. I can't edit anything

1
  • You could deploy the contracts in two steps. The first step will deploy two contracts, in the second step it will configure the contracts, for example calling an initialize method.
    – Ismael
    Commented Nov 2, 2022 at 4:54

1 Answer 1

0

You can use a variable to store the address and update it when needed. Be sure to use modifier to ensure only the owner is able to call the update token address function.

address public tokenAddress;

function updateTokenAddress(address tokenAddy) public 
{
   tokenAddress = tokenAddy;
}
4
  • wouldn't this create trust issuers? Commented Nov 1, 2022 at 3:08
  • If both the contracts are available to the public and the contract address is visible to the public, I don't see any trust issue. Maybe there are better ways, keen to know as well.
    – turbodegen
    Commented Nov 1, 2022 at 3:45
  • people can say that I will change the contract address in the future to something else Commented Nov 1, 2022 at 4:00
  • I've noticed that token smart contracts can also hold tokens themselves. is it possible to make that the fee address? Commented Nov 1, 2022 at 4:03

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.