1

I need to know which parameters has been used to init the following smart contract: https://testnet.bscscan.com/address/0x9Ac64Cc6e4415144C455BD8E4837Fea55603e5c3#code

From the page, I can only see it has been init with 2 arguments, yet they are encoded. From the source code I can guess they are 2 addresses, but is there a way to decode them?

Thank you in advance

2 Answers 2

1

You gave the answer =) they are 2 address, the first one is 0xb7926c0430afb07aa7defde6da862ae0bde767bc, for example. The issue is that addresses have 20 bytes, and the parameters have 32bytes. That is why they are encoded as 000000000000000000000000b7926c0430afb07aa7defde6da862ae0bde767bc. Just pickup the last 20 bytes (40 digits).

0
1

Have you seen the "Constructor Arguments" section in the page you linked? There you can see the values too (they are padded to 32 bytes (256 bits)) and simply ignore the first zeros since an address is 20 bytes).

However, even for not verified contracts, if you know che constructor signature (in this case address,address, without spaces) you can always recover the parameter values. If you need this programmatically you can use ether.js's AbiCoder object. Otherwise there are many tools online like this.

1
  • Yes I saw the Constructo Argumetns section but I thought values were encoded... Thank you for the second part of the answer too!
    – xyz
    Feb 21, 2022 at 17:53

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.