3 ms·
You are correct, here is their smart contact code which has been verified: https://bscscan.com/address/0x7e0c621ea9f7afd5b86a50b0942eaee68b04a61c#code https://b
by qqii 6y ago
You are correct, here is their smart contact code which has been verified: https://bscscan.com/address/0x7e0c621ea9f7afd5b86a50b0942eaee68b04a61c#code https://bscscan.com/address/0x7e0c621ea9f7afd5b86a50b0942eae...
Note line 304 the O is a 0:
bytes32 slot = ADMIN_SL0T;
- minitoar 6y agoWhat does this obfuscation accomplish? Is ADMIN_SLOT some sort of standard constant?
- Semaphor 6y agoNo, but it’s one they set in the code: comment: @dev Storage slot with the admin of the contract. This is the keccak-256 hash of "eip1967.proxy.admin" subtracted by 1, and is validated in the constructor. bytes32 internal constant ADMIN_SLOT = 0xb53127684a568b3173ae13b9f8a6016e243e63b6e8ee1178d6a717850b5d6103;
- minitoar 6y agoSo by using ADMIN_SL0T instead was it just set to null or something?
- Semaphor 6y agoI have no idea how the language or VM works, I guess the important part was that it wasn’t the right constant ;)
- qqii 6y agoThat's right, they've tried to obfuscate that their setter doesn't actually set. https://news.ycombinator.com/item?id=26358876 https://news.ycombinator.com/item?id=26358876
- qqii 6y agoPerhaps it will be clear if I move all of the code together and add comments: bytes32 internal constant ADMIN_SLOT = 0xb53127684a568b3173ae13b9f8a6016e243e63b6e8ee1178d6a717850b5d6103; // this is the getter function _admin() internal view returns (address adm) { bytes32 slot = ADMIN_SLOT; assembly { // return the memory at slot adm := sload(slot) } } // this is the setter, notice the 0 and the different hash bytes32 internal constant ADMIN_SL0T = 0xb53127684a568b3173ae13b9f8a6016e243e63b6e8ee1178d6a717850b5d6102; // this doesn't set the same value as the getter, in effect the admin cannot be changed function _setAdmin(address newAdmin) internal { bytes32 slot = ADMIN_SL0T; assembly { // set the memory at slot to the value of newAdmin sstore(slot, newAdmin) } } https://bscscan.com/address/0x7e0c621ea9f7afd5b86a50b0942eaee68b04a61c#code https://bscscan.com/address/0x7e0c621ea9f7afd5b86a50b0942eae...
- minitoar 6y agoStrange to me that the constant was defined in two places. I guess it would take a careful code review to notice that.