Is it possible to change params of one contract from another? I mean:

contract One {
  address public addr;

contract Two {
  function test(address oneAdd) public {
     One one = One(oneAdd);
     one.addr = address(0);
  • 2
    Not directly as you wrote. But you can add a public or external function which changes this variable in contract One, and then call it from a function in contract Two. Just keep in mind that anyone else will also be able to call this function, so you might need to add some sort of protection in it (for example, verify that msg.sender is equal to the address of your deployed contract Two (assuming that you have only one such instance)). – goodvibration May 21 '19 at 8:50
  • @goodvibration great! Thanks for the answer! – Aleksandr May 21 '19 at 9:08
  • Any time....... – goodvibration May 21 '19 at 9:09

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.