BNB Chain
0x0b9e2d931985e54d3f457c9edc20c51fc5fe17f5
Decompiled Solidity recovered from this contract's runtime bytecode. Best-effort reconstruction — confirm behaviour against on-chain state.
Decompilation outputBNB Chain · 0x0b9e2d93…c5fe17f53.2 KB3.9 s
This result is permanently available athttps://decompiler.exvul.com/bsc/0x0b9e2d931985e54d3f457c9edc20c51fc5fe17f5
//decompiled by exvvul decompiler tool contact@exvul.com https://x.com/exvulsec
// SPDX-License-Identifier: MIT
pragma solidity >=0.8.0;
contract DesolexContract {
uint256 public constant GOVERNANCE_ROLE = 51344670724517732003549907689393193919197804398902247150944709319656146718385;
uint256 public constant DEFAULT_ADMIN_ROLE = 0;
uint256 public constant unresolved_6310a7e5 = 14676828636721710172463727908446343864275579542820431181449891546081629123067;
mapping(bytes32 => mapping(address => bool)) public hasRole; // STORAGE[0x0]
mapping(bytes32 => uint256) public getRoleMemberCount; // STORAGE[0x1]
bool public tradingOpen; // STORAGE[0x2] bytes 0 to 0
mapping(address => bool) public unresolved_e4aee622; // STORAGE[0x3]
bytes32[] array_4; // STORAGE[0x4] // DESOLEX_RAW_STORAGE: array element 0: address [LegacyInference] vs uint256 [LegacyInference] (ambiguous)
bytes32 stor_4; // STORAGE[0x4] // DESOLEX_RAW_STORAGE: array element 0: address [LegacyInference] vs uint256 [LegacyInference] (ambiguous)
mapping(address => uint256) mapping_5; // STORAGE[0x5]
mapping(address => bool) mapping_316a51056d8b2401ab04c48d9973add294eadde229c785c6d19cde93785467ef; // STORAGE[0x316a51056d8b2401ab04c48d9973add294eadde229c785c6d19cde93785467ef]
mapping(address => bool) mapping_e5dfbfd9d8e1320fb38bab6d8927a22f4e995f75a4ec67178a7772be9559486f; // STORAGE[0xe5dfbfd9d8e1320fb38bab6d8927a22f4e995f75a4ec67178a7772be9559486f]
mapping(address => uint256) mapping_expr_an;
mapping(address => uint256) mapping_expr_ax;
mapping(address => uint256) mapping_expr_o;
uint256 stor_expr_ad;
bytes32 stor_expr_al;
bytes32 stor_expr_aq;
uint256 stor_expr_ar;
bytes32 stor_expr_as;
uint256 stor_expr_au;
uint256 stor_expr_aw;
address stor_expr_ay;
bytes32 stor_expr_f;
bytes32 stor_expr_g;
bytes32 stor_expr_i;
bytes32 stor_expr_l;
uint256 stor_expr_q;
uint256 stor_expr_s;
bytes32 stor_expr_u;
uint256 stor_expr_v;
bytes32 stor_expr_w;
uint256 stor_expr_y;
uint256 stor_expr_z;
error AccessControlBadConfirmation();
event RoleRevoked(bytes32 indexed, address indexed, address indexed);
error TradingAlreadyOpen();
error AccessControlUnauthorizedAccount(address, bytes32);
event RoleGranted(bytes32 indexed, address indexed, address indexed);
event TradingOpened(address indexed, uint256);
event Event_faa80784();
error ZeroAddress();
function _desolexPanic(uint256 code) private pure {
assembly ("memory-safe") {
mstore(0x00, shl(224, 0x4e487b71))
mstore(0x04, code)
revert(0x00, 0x24)
}
}
fallback() external {
// Synthetic compatibility routes preserve original selectors for unresolved names.
if ((msg.data.length >= 4) && (msg.sig == 0x9010d07c)) {
// Route to Unknown_9010d07c(uint256,uint256) after replacing only msg.sig.
__desolexSelectorShim(uint32(0xb656a175));
return;
}
if ((msg.data.length >= 4) && (msg.sig == 0xa3246ad3)) {
// Route to Unknown_a3246ad3(uint256) after replacing only msg.sig.
__desolexSelectorShim(uint32(0x1cf458ec));
return;
}
if ((msg.data.length >= 4) && (msg.sig == 0xd3418eed)) {
// Route to Unknown_d3418eed(address,bool) after replacing only msg.sig.
__desolexSelectorShim(uint32(0x03b27155));
return;
}
if ((msg.data.length >= 4) && (msg.sig == 0xfd5a79ba)) {
// Route to Unknown_fd5a79ba(bytes,bool) after replacing only msg.sig.
__desolexSelectorShim(uint32(0xaaecc9c5));
return;
}
revert();
}
function Unknown_fd5a79ba(bytes memory arg0, bool arg1) public {
require((arg0 + 0x23) < msg.data.length);
require(!(((arg0 + (arg0.length << 0x05)) + 0x24) > msg.data.length));
require(mapping_316a51056d8b2401ab04c48d9973add294eadde229c785c6d19cde93785467ef[msg.sender], AccessControlUnauthorizedAccount());
require(!tradingOpen, TradingAlreadyOpen());
uint256 value0 = 0;
while (true) {
if (!(value0 < arg0.length)) {
break;
}
if (msg.data[0x24 + (arg0 + (value0 << 0x05))] != (address(msg.data[0x24 + (arg0 + (value0 << 0x05))]))) {
revert();
break;
}
if (!(address(msg.data[0x24 + (arg0 + (value0 << 0x05))]))) {
revert ZeroAddress();
break;
}
if (unresolved_e4aee622[address(msg.data[0x24 + (arg0 + (value0 << 0x05))])] != arg1) {
unresolved_e4aee622[address(msg.data[0x24 + (arg0 + (value0 << 0x05))])] = (bytes1(arg1)) | (unresolved_e4aee622[address(msg.data[0x24 + (arg0 + (value0 << 0x05))])] & (0xffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff00));
if (!arg1) {
if ((mapping_5[address(msg.data[0x24 + (arg0 + (value0 << 0x05))])] + 0xffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff) > mapping_5[address(msg.data[0x24 + (arg0 + (value0 << 0x05))])]) {
_desolexPanic(17);
break;
}
if ((stor_4 + 0xffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff) > stor_4) {
_desolexPanic(17);
break;
}
uint256 value1 = 0;
uint256 value2 = 0;
uint256 value3 = 0;
if ((mapping_5[address(msg.data[0x24 + (arg0 + (value0 << 0x05))])] + 0xffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff) != (stor_4 + 0xffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff)) {
if (!((stor_4 + 0xffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff) < stor_4)) _desolexPanic(50);
if (!((mapping_5[address(msg.data[0x24 + (arg0 + (value0 << 0x05))])] + 0xffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff) < stor_4)) _desolexPanic(50);
stor_expr_g = (0xffffffffffffffffffffffff0000000000000000000000000000000000000000 & stor_expr_g) | (0xffffffffffffffffffffffffffffffffffffffff & (0xffffffffffffffffffffffffffffffffffffffff & (stor_expr_f >> 0)) << 0);
mapping_5[address(stor_expr_f >> 0)] = mapping_5[address(msg.data[0x24 + (arg0 + (value0 << 0x05))])];
} else {
value1 = stor_4 + 0xffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff;
value2 = mapping_5[address(msg.data[0x24 + (arg0 + (value0 << 0x05))])] + 0xffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff;
value3 = mapping_5[address(msg.data[0x24 + (arg0 + (value0 << 0x05))])];
}
if (!stor_4) {
_desolexPanic(49);
break;
}
if (!((0xffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff + stor_4) < stor_4)) _desolexPanic(50);
stor_expr_i = (0xffffffffffffffffffffffff0000000000000000000000000000000000000000) & stor_expr_i;
stor_4 = 0xffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff + stor_4;
mapping_5[address(msg.data[0x24 + (arg0 + (value0 << 0x05))])] = 0;
} else {
if (!(stor_4 < 0x010000000000000000)) {
_desolexPanic(65);
break;
}
stor_4 = stor_4 + 0x01;
if (!(stor_4 < stor_4)) _desolexPanic(50);
array_4[stor_4] = (0xffffffffffffffffffffffff0000000000000000000000000000000000000000 & array_4[stor_4]) | (0xffffffffffffffffffffffffffffffffffffffff & (msg.data[0x24 + (arg0 + (value0 << 0x05))]) << 0);
mapping_5[address(msg.data[0x24 + (arg0 + (value0 << 0x05))])] = stor_4;
}
emit Event_faa80784(address(msg.data[0x24 + (arg0 + (value0 << 0x05))]), arg1, block.timestamp);
}
value0 = value0 + 0x01;
}
}
function revokeRole(bytes32 role, address account) public {
require(bytes1(hasRole[stor_expr_l][msg.sender]), AccessControlUnauthorizedAccount());
uint256 value0 = 0;
if (bytes1(hasRole[role][account])) {
hasRole[role][account] = false;
emit RoleRevoked(role, account, msg.sender);
value0 = 0x01;
}
if (value0 != 0x0) {
uint256 value4 = 0;
if (!(0 == (!(!(mapping_expr_o[account]))))) {
uint256 value1 = 0;
uint256 value2 = 0;
uint256 value3 = 0;
if ((mapping_expr_o[account] + 0xffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff) != (getRoleMemberCount[role] + 0xffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff)) {
if (!(((getRoleMemberCount[role] + 0xffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff) < stor_expr_q))) _desolexPanic(50);
if (!(((mapping_expr_o[account] + 0xffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff) < stor_expr_s))) _desolexPanic(50);
stor_expr_v = 0 & stor_expr_w | (stor_expr_u >> (0 << 0x03) << 0);
mapping_expr_o[stor_expr_u >> (0 << 0x03)] = mapping_expr_o[account];
} else {
value1 = mapping_expr_o[account] + 0xffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff;
value2 = getRoleMemberCount[role] + 0xffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff;
value3 = mapping_expr_o[account];
}
if (!(getRoleMemberCount[role])) _desolexPanic(49);
if (!(((0xffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff + getRoleMemberCount[role]) < stor_expr_y))) _desolexPanic(50);
stor_expr_z = (~(0xffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff << (0 << 0x03))) & stor_expr_z;
getRoleMemberCount[role] = 0xffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff + getRoleMemberCount[role];
mapping_expr_o[account] = 0;
flag0 = true;
}
}
}
function Unknown_d3418eed(address arg0, bool arg1) public {
require(mapping_316a51056d8b2401ab04c48d9973add294eadde229c785c6d19cde93785467ef[msg.sender], AccessControlUnauthorizedAccount());
require(!tradingOpen, TradingAlreadyOpen());
internal_8b4(arg0, arg1);
}
function openTrading() public {
require(mapping_e5dfbfd9d8e1320fb38bab6d8927a22f4e995f75a4ec67178a7772be9559486f[msg.sender], AccessControlUnauthorizedAccount());
require(!tradingOpen, TradingAlreadyOpen());
tradingOpen = true;
emit TradingOpened(msg.sender, block.timestamp);
}
function members() public view returns (bytes memory) {
uint256 value0 = 0;
uint256 value1 = 0x8a35acfbc15ff81a39ae7d344fd709f28e8600b4aa8c65c6b64bfe7fe36bd19b;
uint256 var_a;
uint256 value2 = var_a + 0x20;
while (true) {
if (value0 >= stor_4) {
break;
}
value0 = 0x01 + value0;
value1 = 0x01 + value1;
value2 = value2 + 0x20;
}
if (((var_a + (((value2 - var_a) + 0x1f) & (0xffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe0))) > 0xffffffffffffffff) | ((var_a + (((value2 - var_a) + 0x1f) & (0xffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe0))) < var_a)) _desolexPanic(65);
uint256 value3 = 0;
uint256 value4 = var_a + 0x20;
uint256 value5 = var_a + 0x40;
while (true) {
var_a = var_a + (((value2 - var_a) + 0x1f) & (0xffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe0));
if (value3 >= var_a.length) {
break;
}
value3 = 0x01 + value3;
value4 = value4 + 0x20;
value5 = 0x20 + value5;
}
return abi.encodePacked(0x20, var_a.length);
}
function Unknown_a3246ad3(uint256 arg0) public view returns (bytes memory) {
uint256 value0 = 0;
uint256 value1 = keccak256(abi.encode(keccak256(abi.encode(arg0, 0x01))));
uint256 var_a;
uint256 value2 = var_a + 0x20;
while (true) {
if (value0 >= getRoleMemberCount[arg0]) {
break;
}
value0 = 0x01 + value0;
value1 = 0x01 + value1;
value2 = value2 + 0x20;
}
if (((var_a + (((value2 - var_a) + 0x1f) & (0xffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe0))) > 0xffffffffffffffff) | ((var_a + (((value2 - var_a) + 0x1f) & (0xffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe0))) < var_a)) _desolexPanic(65);
uint256 value3 = 0;
uint256 value4 = var_a + 0x20;
uint256 value5 = var_a + 0x40;
while (true) {
var_a = var_a + (((value2 - var_a) + 0x1f) & (0xffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe0));
if (value3 >= var_a.length) {
break;
}
value3 = 0x01 + value3;
value4 = value4 + 0x20;
value5 = 0x20 + value5;
}
return abi.encodePacked(0x20, var_a.length);
}
function Unknown_9010d07c(uint256 arg0, uint256 arg1) public view returns (address) {
if (!(arg1 < getRoleMemberCount[arg0])) _desolexPanic(50);
return address(stor_expr_al >> 0);
}
function renounceRole(bytes32 role, address account) public {
require(account == msg.sender, AccessControlBadConfirmation());
internal_839(role, account);
}
function grantRole(bytes32 role, address account) public {
require(bytes1(hasRole[stor_expr_l][msg.sender]), AccessControlUnauthorizedAccount());
if (!(bytes1(hasRole[role][account]) != 0x0)) {
hasRole[role][account] = true;
emit RoleGranted(role, account, msg.sender);
}
if (!(0 == (!(mapping_expr_ax[account])))) {
if (!(stor_expr_aw < 0x010000000000000000)) _desolexPanic(65);
stor_expr_aw = stor_expr_aw + 0x01;
if (!(stor_expr_aw < stor_expr_aw)) _desolexPanic(50);
stor_expr_ay = (0 & stor_expr_ay) | (account << 0);
mapping_expr_ax[account] = stor_expr_aw;
}
}
function getRoleAdmin(bytes32 role) public view returns (uint256) {
return stor_expr_l;
}
function memberCount() public view returns (uint256) {
return stor_4;
}
function supportsInterface(bytes4 interfaceId) public pure returns (bool) {
require(interfaceId == (interfaceId & 0xffffffff00000000000000000000000000000000000000000000000000000000));
uint256 value1 = msg.data[0] >> 0xe0;
bool flag1;
if ((interfaceId & 0xffffffff00000000000000000000000000000000000000000000000000000000) != 0x5a05180f00000000000000000000000000000000000000000000000000000000) {
uint256 value0 = msg.data[0] >> 0xe0;
bool flag0 = 0x1ffc9a700000000000000000000000000000000000000000000000000000000 == (interfaceId & 0xffffffff00000000000000000000000000000000000000000000000000000000);
if (interfaceId & (0xffffffff00000000000000000000000000000000000000000000000000000000) == 0x7965db0b00000000000000000000000000000000000000000000000000000000) {
value0 = interfaceId & (0xffffffff00000000000000000000000000000000000000000000000000000000);
flag0 = (interfaceId & 0xffffffff00000000000000000000000000000000000000000000000000000000) == 0x7965db0b00000000000000000000000000000000000000000000000000000000;
}
flag1 = flag0;
} else {
value1 = interfaceId & (0xffffffff00000000000000000000000000000000000000000000000000000000);
flag1 = (interfaceId & 0xffffffff00000000000000000000000000000000000000000000000000000000) == 0x5a05180f00000000000000000000000000000000000000000000000000000000;
}
return flag1;
}
function internal_8b4(uint256 arg0, bool arg1) private {
// Decompilation incomplete: helper effect provenance is conservative.
require(arg0 != address(0), ZeroAddress());
if (unresolved_e4aee622[arg0] == arg1) {
return;
} else {
unresolved_e4aee622[arg0] = (bytes1(arg1)) | (unresolved_e4aee622[arg0] & (0xffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff00));
if (arg1) {
if (!(stor_4 < 0x010000000000000000)) _desolexPanic(65);
stor_4 = stor_4 + 0x01;
if (!(stor_4 < stor_4)) _desolexPanic(50);
array_4[stor_4] = (0xffffffffffffffffffffffff0000000000000000000000000000000000000000 & array_4[stor_4]) | (arg0 << 0);
mapping_5[arg0] = stor_4;
emit Event_faa80784(arg0, arg1, block.timestamp);
return;
} else if ((mapping_5[arg0] + 0xffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff) == (stor_4 + 0xffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff)) {
if (!(stor_4 != 0x0)) _desolexPanic(49);
if (!((0xffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff + stor_4) < stor_4)) _desolexPanic(50);
stor_expr_i = (0xffffffffffffffffffffffff0000000000000000000000000000000000000000) & stor_expr_i;
stor_4 = 0xffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff + stor_4;
mapping_5[arg0] = 0;
emit Event_faa80784(arg0, arg1, block.timestamp);
return;
} else {
if (!((stor_4 + 0xffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff) < stor_4)) _desolexPanic(50);
if (!((mapping_5[arg0] + 0xffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff) < stor_4)) _desolexPanic(50);
stor_expr_ad = (~(0xffffffffffffffffffffffffffffffffffffffff << (0 << 0x03)) & stor_expr_ad) | (address((address(stor_expr_f >> 0))) << (0 << 0x03));
mapping_5[(address(stor_expr_f >> 0))] = mapping_5[arg0];
if (!(stor_4 != 0x0)) _desolexPanic(49);
if (!((0xffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff + stor_4) < stor_4)) _desolexPanic(50);
stor_expr_i = (0xffffffffffffffffffffffff0000000000000000000000000000000000000000) & stor_expr_i;
stor_4 = 0xffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff + stor_4;
mapping_5[arg0] = 0;
emit Event_faa80784(arg0, arg1, block.timestamp);
}
}
}
function internal_839(bytes32 role, address account) private {
// Decompilation incomplete: helper effect provenance is conservative.
uint256 value0 = 0;
if (bytes1(hasRole[role][account])) {
hasRole[role][account] = false;
emit RoleRevoked(role, account, msg.sender);
value0 = 0x01;
}
if (value0 != 0x0) {
uint256 value4 = 0;
if (!(0 == (!(!(mapping_expr_an[account]))))) {
uint256 value1 = 0;
uint256 value2 = 0;
uint256 value3 = 0;
if ((mapping_expr_an[account] + 0xffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff) != (getRoleMemberCount[role] + 0xffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff)) {
if (!(((getRoleMemberCount[role] + 0xffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff) < stor_expr_q))) _desolexPanic(50);
if (!(((mapping_expr_an[account] + 0xffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff) < stor_expr_s))) _desolexPanic(50);
stor_expr_ar = (0 & stor_expr_as | (stor_expr_aq >> (0 << 0x03) << 0));
mapping_expr_an[stor_expr_aq >> (0 << 0x03)] = mapping_expr_an[account];
} else {
value1 = mapping_expr_an[account] + 0xffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff;
value2 = getRoleMemberCount[role] + 0xffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff;
value3 = mapping_expr_an[account];
}
if (!(getRoleMemberCount[role])) _desolexPanic(49);
if (!(((0xffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff + getRoleMemberCount[role]) < stor_expr_y))) _desolexPanic(50);
stor_expr_au = (~(0xffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff << (0 << 0x03))) & stor_expr_au;
getRoleMemberCount[role] = 0xffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff + getRoleMemberCount[role];
mapping_expr_an[account] = 0;
flag0 = true;
}
}
}
function __desolexSelectorShim(uint32 rewrittenSelector) private {
assembly {
let input := mload(0x40)
calldatacopy(input, 0, calldatasize())
mstore(input, or(and(mload(input), 0x00000000ffffffffffffffffffffffffffffffffffffffffffffffffffffffff), shl(224, and(rewrittenSelector, 0xffffffff))))
let success := delegatecall(gas(), address(), input, calldatasize(), 0, 0)
let size := returndatasize()
returndatacopy(input, 0, size)
switch success
case 0 { revert(input, size) }
default { return(input, size) }
}
}
// Note: This selector table is synthetic and is not part of the original Solidity source.
// It records the recovered selector-to-signature mapping without executable behavior.
// 0x01ffc9a7 => supportsInterface(bytes4)
// 0x11aee380 => memberCount()
// 0x248a9ca3 => getRoleAdmin(bytes32)
// 0x2f2ff15d => grantRole(bytes32,address)
// 0x36568abe => renounceRole(bytes32,address)
// 0x6310a7e5 => unresolved_6310a7e5()
// 0x9010d07c => Unknown_9010d07c(uint256,uint256)
// 0x91d14854 => hasRole(bytes32,address)
// 0xa217fddf => DEFAULT_ADMIN_ROLE()
// 0xa3246ad3 => Unknown_a3246ad3(uint256)
// 0xbdd4d18d => members()
// 0xc9567bf9 => openTrading()
// 0xca15c873 => getRoleMemberCount(bytes32)
// 0xd3418eed => Unknown_d3418eed(address,bool)
// 0xd547741f => revokeRole(bytes32,address)
// 0xe4aee622 => unresolved_e4aee622(address)
// 0xf36c8f5c => GOVERNANCE_ROLE()
// 0xfd5a79ba => Unknown_fd5a79ba(bytes,bool)
// 0xffb54a99 => tradingOpen()
}