BNB Chain

0xe7399d682898f830efff380e2b033a4b3fb420bb

Decompiled Solidity recovered from this contract's runtime bytecode. Best-effort reconstruction — confirm behaviour against on-chain state.

Decompilation outputBNB Chain · 0xe7399d683fb420bb5.5 KB17.5 s
Share
//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 predecessor = 0;
    uint256 public constant unresolved_b163d46c = 8;
    uint256 public constant totalLiability = 0;
    uint256 public constant hasOpenPositions = 0;
    uint256 public constant DEFAULT_ADMIN_ROLE = 0;
    address public constant protocolRegistry = address(0xfd89fb9faf9de258c2148b2d0ec14da16ee42593);
    uint256 public constant moduleKey = 18294672045979070683417863658226497114251631266019119083093864235398900506401;
    address public constant binding = address(0xc7bc8217313badfad9e9108674cb5b45a719c672);
    uint256 public constant unresolved_2b3d2c38 = 0;
    uint256 public constant interfaceVersion = 1;
    
    mapping(bytes32 => mapping(address => bool)) public hasRole; // STORAGE[0x0]
    mapping(bytes32 => uint256) public getRoleMemberCount; // STORAGE[0x1]
    bytes32 stor_2; // STORAGE[0x2] // DESOLEX_RAW_STORAGE: whole slot: uint256 [ArithmeticUse] vs uint64 [ArithmeticUse] (ambiguous)
    mapping(address => uint256) public checkpointCount; // STORAGE[0x3]
    mapping(address => bool) mapping_316a51056d8b2401ab04c48d9973add294eadde229c785c6d19cde93785467ef; // STORAGE[0x316a51056d8b2401ab04c48d9973add294eadde229c785c6d19cde93785467ef]
    mapping(address => uint256) mapping_expr_ae;
    mapping(address => uint256) mapping_expr_ao;
    mapping(address => uint256) mapping_expr_h;
    uint256 stor_expr_ab;
    bytes32 stor_expr_ah;
    uint256 stor_expr_ai;
    bytes32 stor_expr_aj;
    uint256 stor_expr_al;
    uint256 stor_expr_an;
    address stor_expr_ap;
    bytes32 stor_expr_b; // DESOLEX_RAW_STORAGE: whole slot: uint256 [ArithmeticUse] vs uint64 [ArithmeticUse] (ambiguous)
    uint256 stor_expr_d;
    bytes32 stor_expr_e;
    uint256 stor_expr_i;
    uint256 stor_expr_j;
    uint256 stor_expr_k;
    bytes32 stor_expr_m;
    bytes32 stor_expr_n;
    bytes32 stor_expr_o;
    uint256 stor_expr_q;
    bytes32 stor_expr_r;
    bytes32 stor_expr_w;
    bytes32 stor_expr_x; // DESOLEX_RAW_STORAGE: whole slot: uint256 [ArithmeticUse] vs uint64 [ArithmeticUse] (ambiguous)
    uint64 stor_expr_z;
    
    event Event_457841ae(uint256 indexed, uint256 indexed, uint256, uint256, uint256);
    event RoleRevoked(bytes32 indexed, address indexed, address indexed);
    event RoleGranted(bytes32 indexed, address indexed, address indexed);
    error AccessControlBadConfirmation();
    error CustomError_c2b74bfc();
    error AccessControlUnauthorizedAccount(address, bytes32);
    error CustomError_d27cc074();
    function _desolexPanic(uint256 code) private pure {
        assembly ("memory-safe") {
            mstore(0x00, shl(224, 0x4e487b71))
            mstore(0x04, code)
            revert(0x00, 0x24)
        }
    }
    fallback() external payable {
        // Synthetic compatibility routes preserve original selectors for unresolved names.
        if ((msg.data.length >= 4) && (msg.sig == 0x36cd007d)) {
            // Route to Unknown_36cd007d(address,uint256) after replacing only msg.sig.
            __desolexSelectorShim(uint32(0x7d2b206c));
            return;
        }
        if ((msg.data.length >= 4) && (msg.sig == 0x8ce826bb)) {
            // Route to Unknown_8ce826bb(address,uint64) after replacing only msg.sig.
            __desolexSelectorShim(uint32(0x4c898122));
            return;
        }
        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 == 0xbbaebfc3)) {
            // Route to Unknown_bbaebfc3() after replacing only msg.sig.
            __desolexSelectorShim(uint32(0xf8f30500));
            return;
        }
        if ((msg.data.length >= 4) && (msg.sig == 0xbd7ad804)) {
            // Route to Unknown_bd7ad804() after replacing only msg.sig.
            __desolexSelectorShim(uint32(0x2b95f0be));
            return;
        }
        if ((msg.data.length >= 4) && (msg.sig == 0xdfb59510)) {
            // Route to Unknown_dfb59510(address,uint64) after replacing only msg.sig.
            __desolexSelectorShim(uint32(0x0f8b1c74));
            return;
        }
        revert();
    }
    
    
    function Unknown_dfb59510(address arg0, uint64 arg1) public view returns (uint256) {
        require(arg1 == (arg1 & 0xffffffffffffffff));
        uint256 value0 = checkpointCount[arg0];
        while (true) {
            if (0 >= value0) {
                break;
            }
            if (0x0 > 0x0 + value0) {
                _desolexPanic(17);
                break;
            }
            if (!(((0 + value0) >> 0x01) < checkpointCount[arg0])) _desolexPanic(50);
            if (uint64(arg1) < (uint64(stor_expr_b))) {
                value0 = (0 + value0) >> 0x01;
            } else {
                if (((0 + value0) >> 0x01) > (((0 + value0) >> 0x01) + 0x01)) {
                    _desolexPanic(17);
                    break;
                }
                value0 = value0;
            }
        }
        if (!(0 < 0x03)) _desolexPanic(33);
        return 0;
    }
    
    function revokeRole(bytes32 role, address account) public {
        require(bytes1(hasRole[stor_expr_e][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_h[account]))))) {
                uint256 value1 = 0;
                uint256 value2 = 0;
                uint256 value3 = 0;
                if ((mapping_expr_h[account] + 0xffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff) != (stor_expr_i + 0xffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff)) {
                    if (!(((stor_expr_i + 0xffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff) < stor_expr_j))) _desolexPanic(50);
                    if (!(((mapping_expr_h[account] + 0xffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff) < stor_expr_k))) _desolexPanic(50);
                    stor_expr_n = (0 & stor_expr_o) | ((stor_expr_m >> 0) << 0);
                    mapping_expr_h[stor_expr_m >> 0] = mapping_expr_h[account];
                } else {
                    value1 = mapping_expr_h[account] + 0xffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff;
                    value2 = stor_expr_i + 0xffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff;
                    value3 = mapping_expr_h[account];
                }
                if (!(stor_expr_i != 0x0)) _desolexPanic(49);
                if (!(((0xffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff + stor_expr_i) < stor_expr_q))) _desolexPanic(50);
                stor_expr_r = (0) & stor_expr_r;
                stor_expr_i = 0xffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff + stor_expr_i;
                mapping_expr_h[account] = 0;
                value4 = 0x01;
            }
        }
    }
    
    function Unknown_bd7ad804() public view returns (uint64) {
        return uint64(stor_2 >> 0x40);
    }
    
    function Unknown_bbaebfc3() public view returns (uint64) {
        return uint64(stor_2);
    }
    
    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) {
                return abi.encodePacked(0x20, var_a.length);
            }
            value3 = 0x01 + value3;
            value4 = value4 + 0x20;
            value5 = 0x20 + value5;
        }
    }
    
    function Unknown_9010d07c(uint256 arg0, uint256 arg1) public view returns (address) {
        if (!(arg1 < getRoleMemberCount[arg0])) _desolexPanic(50);
        return address(stor_expr_w >> 0);
    }
    
    function Unknown_8ce826bb(address arg0, uint64 arg1) public payable {
        if (!(msg.value)) {
            if ((0xfffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffc + msg.data.length) >= 0x40) {
                if (arg0 == arg0) {
                    if (arg1 == (arg1 & 0xffffffffffffffff)) {
                        (bool success0, bytes memory returnData0) = address(0xc7bc8217313badfad9e9108674cb5b45a719c672).commRoot(); // staticcall
                        if (success0) {
                            uint256 value0 = 0;
                            uint256 var_b;
                            uint256 value1 = var_b.length;
                            if (success0) {
                                if (0x20 > returnData0.length) {
                                    if (((var_b + ((returnData0.length + 0x1f) & (0xffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe0))) > 0xffffffffffffffff) | ((var_b + ((returnData0.length + 0x1f) & (0xffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe0))) < var_b)) _desolexPanic(65);
                                    var_b = var_b + ((returnData0.length + 0x1f) & (0xffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe0));
                                    require(((var_b + returnData0.length) - var_b) >= 0x20);
                                } else {
                                    if (((var_b + 0x20) > 0xffffffffffffffff) | ((var_b + 0x20) < var_b)) _desolexPanic(65);
                                    var_b = var_b + 0x20;
                                    require(((var_b + 0x20) - var_b) >= 0x20);
                                }
                                require(var_b.length == (address(var_b.length)));
                            } else {
                                value0 = var_b;
                                value1 = 0;
                            }
                            bool flag0;
                            if ((value1 & 0xffffffffffffffffffffffffffffffffffffffff) != arg0) {
                                (bool success1, bytes memory returnData1) = address(0xc7bc8217313badfad9e9108674cb5b45a719c672).isJoined(arg0); // staticcall
                                require(success1);
                                uint256 value2 = 0;
                                uint256 value3 = var_b.length;
                                if (success1) {
                                    if (0x20 > returnData1.length) {
                                        if (((var_b + ((returnData1.length + 0x1f) & (0xffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe0))) > 0xffffffffffffffff) | ((var_b + ((returnData1.length + 0x1f) & (0xffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe0))) < var_b)) _desolexPanic(65);
                                        var_b = var_b + ((returnData1.length + 0x1f) & (0xffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe0));
                                        require(((var_b + returnData1.length) - var_b) >= 0x20);
                                    } else {
                                        if (((var_b + 0x20) > 0xffffffffffffffff) | ((var_b + 0x20) < var_b)) _desolexPanic(65);
                                        var_b = var_b + 0x20;
                                        require(((var_b + 0x20) - var_b) >= 0x20);
                                    }
                                    require(var_b.length == var_b.length);
                                } else {
                                    value2 = var_b;
                                    value3 = 0;
                                }
                                flag0 = value3 == 0x0;
                            } else {
                                flag0 = (address(value1)) == arg0;
                            }
                        }
                    }
                }
            }
        }
    }
    
    function checkpointAt(address arg0, uint256 arg1) public view returns (bytes memory) {
        if (!(arg1 < checkpointCount[arg0])) _desolexPanic(50);
        if (!(bytes1(stor_expr_x >> 0x40) < 0x03)) _desolexPanic(33);
        return abi.encodePacked(uint64(stor_expr_x), bytes1(stor_expr_x >> 0x40));
    }
    
    function Unknown_36cd007d(address arg0, uint256 arg1) public payable {
        if (!(msg.value)) {
            if ((0xfffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffc + msg.data.length) >= 0x40) {
                if (arg0 == arg0) {
                    if (arg1 < 0x03) {
                        if (mapping_316a51056d8b2401ab04c48d9973add294eadde229c785c6d19cde93785467ef[msg.sender]) {
                            (bool success0, bytes memory returnData0) = address(0xfd89fb9faf9de258c2148b2d0ec14da16ee42593).isActive(0x28726adcc70d62d71a8a9aded75a5c405c5d4f4b431d2e7c15f9d7a6bdfc5f21, address(this)); // staticcall
                            if (success0) {
                                uint256 value1 = msg.data[0] >> 0xe0;
                                uint256 var_f;
                                uint256 value2 = var_f.length;
                                if (success0) {
                                    uint256 value0 = returnData0.length;
                                    if (0x20 <= returnData0.length) {
                                        value0 = 0x20;
                                    }
                                    if (((var_f + ((value0 + 0x1f) & (0xffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe0))) > 0xffffffffffffffff) | ((var_f + ((value0 + 0x1f) & (0xffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe0))) < var_f)) _desolexPanic(65);
                                    var_f = var_f + ((value0 + 0x1f) & (0xffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe0));
                                    require(((var_f + value0) - var_f) >= 0x20);
                                    require(var_f.length == var_f.length);
                                } else {
                                    value1 = var_f;
                                    value2 = 0;
                                }
                                if (value2 != 0x0) {
                                    (bool success1, bytes memory returnData1) = address(0xc7bc8217313badfad9e9108674cb5b45a719c672).commRoot(); // staticcall
                                    if (success1) {
                                        if (!(success1)) {
                                            if (arg0 != address(0)) {
                                                (bool success2, bytes memory returnData2) = address(0xfd89fb9faf9de258c2148b2d0ec14da16ee42593).activeAddress(0xca3d97006cf7d8eb1c25ea3619005d254dd30f30d857ea714bdd35c870ba2a22); // staticcall
                                                if (success2) {
                                                    uint256 value4 = msg.data[0] >> 0xe0;
                                                    uint256 value5 = var_f.length;
                                                    if (success2) {
                                                        uint256 value3 = returnData2.length;
                                                        if (0x20 <= returnData2.length) {
                                                            value3 = 0x20;
                                                        }
                                                        if (((var_f + ((value3 + 0x1f) & (0xffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe0))) > 0xffffffffffffffff) | ((var_f + ((value3 + 0x1f) & (0xffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe0))) < var_f)) _desolexPanic(65);
                                                        var_f = var_f + ((value3 + 0x1f) & (0xffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe0));
                                                        require(((var_f + value3) - var_f) >= 0x20);
                                                        require(var_f.length == (address(var_f.length)));
                                                    } else {
                                                        value4 = var_f;
                                                        value5 = 0;
                                                    }
                                                    if (value5.code.length != 0x0) {
                                                        (bool success3, bytes memory returnData3) = address(value5).currentCycleId(); // staticcall
                                                        if (success3) {
                                                            if (success3) {
                                                                if (0x20 > returnData3.length) {
                                                                    if (!(((var_f + ((returnData3.length + 0x1f) & (0xffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe0))) > 0xffffffffffffffff) | ((var_f + ((returnData3.length + 0x1f) & (0xffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe0))) < var_f))) {
                                                                        var_f = var_f + ((returnData3.length + 0x1f) & (0xffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe0));
                                                                        if (((var_f + returnData3.length) - var_f) >= 0x20) {
                                                                            if (var_f.length == (uint64(var_f.length))) {
                                                                                (bool success4, bytes memory returnData4) = address(value5).nextCycleId(); // staticcall
                                                                                if (success4) {
                                                                                    uint256 value7 = msg.data[0] >> 0xe0;
                                                                                    uint256 value8 = var_f.length;
                                                                                    if (success4) {
                                                                                        uint256 value6 = returnData4.length;
                                                                                        if (0x20 <= returnData4.length) {
                                                                                            value6 = 0x20;
                                                                                        }
                                                                                        if (((var_f + ((value6 + 0x1f) & (0xffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe0))) > 0xffffffffffffffff) | ((var_f + ((value6 + 0x1f) & (0xffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe0))) < var_f)) _desolexPanic(65);
                                                                                        var_f = var_f + ((value6 + 0x1f) & (0xffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe0));
                                                                                        require(((var_f + value6) - var_f) >= 0x20);
                                                                                        require(var_f.length == (uint64(var_f.length)));
                                                                                    } else {
                                                                                        value7 = var_f;
                                                                                        value8 = 0;
                                                                                    }
                                                                                    bool flag0 = !(uint64(value8) > (uint64(var_f.length)));
                                                                                    if (!(uint64(value8))) {
                                                                                        flag0 = (value8 & 0xffffffffffffffff) == 0x0;
                                                                                    }
                                                                                    require(!(flag0), CustomError_c2b74bfc());
                                                                                    bool flag1 = (uint64(value8)) < (uint64(stor_2 >> 0x40));
                                                                                    if (uint64(var_f.length) < (uint64(stor_2))) {
                                                                                        flag1 = (uint64(var_f.length)) < (uint64(stor_2));
                                                                                    }
                                                                                    require(!(flag1), CustomError_d27cc074());
                                                                                    uint256 value9 = msg.data[0] >> 0xe0;
                                                                                    uint256 value10 = msg.data[0] >> 0xe0;
                                                                                    if (uint64(var_f.length) > (uint64(stor_2))) {
                                                                                        stor_2 = (0xffffffffffffffffffffffffffffffffffffffffffffffff0000000000000000 & stor_2) | (var_f.length & (0xffffffffffffffff));
                                                                                    } else {
                                                                                        value9 = stor_2;
                                                                                        value10 = uint64(var_f.length);
                                                                                    }
                                                                                    uint256 value11 = msg.data[0] >> 0xe0;
                                                                                    if (uint64(value8) > (uint64(stor_2 >> 0x40))) {
                                                                                        stor_2 = (0xffffffffffffffff0000000000000000 & (value8 << 0x40)) | (0xffffffffffffffffffffffffffffffff0000000000000000ffffffffffffffff & stor_2);
                                                                                    } else {
                                                                                        value11 = stor_2;
                                                                                    }
                                                                                    uint256 value12 = checkpointCount[arg0];
                                                                                    while (true) {
                                                                                        if (0 >= value12) {
                                                                                            break;
                                                                                        }
                                                                                        if (0x0 > 0x0 + value12) {
                                                                                            _desolexPanic(17);
                                                                                            break;
                                                                                        }
                                                                                        if (!(((0 + value12) >> 0x01) < checkpointCount[arg0])) _desolexPanic(50);
                                                                                        if (uint64(value8) < (uint64(stor_expr_b))) {
                                                                                            value12 = (0 + value12) >> 0x01;
                                                                                        } else {
                                                                                            if (((0 + value12) >> 0x01) > (((0 + value12) >> 0x01) + 0x01)) {
                                                                                                _desolexPanic(17);
                                                                                                break;
                                                                                            }
                                                                                            value12 = value12;
                                                                                        }
                                                                                    }
                                                                                }
                                                                            }
                                                                        }
                                                                    }
                                                                } else {
                                                                    if (((var_f + 0x20) > 0xffffffffffffffff) | ((var_f + 0x20) < var_f)) _desolexPanic(65);
                                                                    var_f = var_f + 0x20;
                                                                    require(((var_f + 0x20) - var_f) >= 0x20);
                                                                    require(var_f.length == (uint64(var_f.length)));
                                                                    (bool success5, bytes memory returnData5) = address(value5).nextCycleId(); // staticcall
                                                                    require(success5);
                                                                    uint256 value14 = msg.data[0] >> 0xe0;
                                                                    uint256 value15 = var_f.length;
                                                                    if (success5) {
                                                                        uint256 value13 = returnData5.length;
                                                                        if (0x20 <= returnData5.length) {
                                                                            value13 = 0x20;
                                                                        }
                                                                        if (((var_f + ((value13 + 0x1f) & (0xffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe0))) > 0xffffffffffffffff) | ((var_f + ((value13 + 0x1f) & (0xffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe0))) < var_f)) _desolexPanic(65);
                                                                        var_f = var_f + ((value13 + 0x1f) & (0xffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe0));
                                                                        require(((var_f + value13) - var_f) >= 0x20);
                                                                        require(var_f.length == (uint64(var_f.length)));
                                                                    } else {
                                                                        value14 = var_f;
                                                                        value15 = 0;
                                                                    }
                                                                    bool flag3 = !(uint64(value15) > (uint64(var_f.length)));
                                                                    if (!(uint64(value15))) {
                                                                        flag3 = (value15 & 0xffffffffffffffff) == 0x0;
                                                                    }
                                                                    require(!(flag3), CustomError_c2b74bfc());
                                                                    bool flag4 = (uint64(value15)) < (uint64(stor_2 >> 0x40));
                                                                    if (uint64(var_f.length) < (uint64(stor_2))) {
                                                                        flag4 = (uint64(var_f.length)) < (uint64(stor_2));
                                                                    }
                                                                    require(!(flag4), CustomError_d27cc074());
                                                                    uint256 value16 = msg.data[0] >> 0xe0;
                                                                    uint256 value17 = msg.data[0] >> 0xe0;
                                                                    if (uint64(var_f.length) > (uint64(stor_2))) {
                                                                        stor_2 = (0xffffffffffffffffffffffffffffffffffffffffffffffff0000000000000000 & stor_2) | (var_f.length & (0xffffffffffffffff));
                                                                    } else {
                                                                        value16 = stor_2;
                                                                        value17 = uint64(var_f.length);
                                                                    }
                                                                    uint256 value18 = msg.data[0] >> 0xe0;
                                                                    if (uint64(value15) > (uint64(stor_2 >> 0x40))) {
                                                                        stor_2 = (0xffffffffffffffff0000000000000000 & (value15 << 0x40)) | (0xffffffffffffffffffffffffffffffff0000000000000000ffffffffffffffff & stor_2);
                                                                    } else {
                                                                        value18 = stor_2;
                                                                    }
                                                                    uint256 value12 = checkpointCount[arg0];
                                                                    while (true) {
                                                                        if (0 >= value12) {
                                                                            break;
                                                                        }
                                                                        if (0x0 > 0x0 + value12) {
                                                                            _desolexPanic(17);
                                                                            break;
                                                                        }
                                                                        if (!(((0 + value12) >> 0x01) < checkpointCount[arg0])) _desolexPanic(50);
                                                                        if (uint64(value15) < (uint64(stor_expr_b))) {
                                                                            value12 = (0 + value12) >> 0x01;
                                                                        } else {
                                                                            if (((0 + value12) >> 0x01) > (((0 + value12) >> 0x01) + 0x01)) {
                                                                                _desolexPanic(17);
                                                                                break;
                                                                            }
                                                                            value12 = value12;
                                                                        }
                                                                    }
                                                                    bool flag7 = (uint64(stor_expr_z)) == (uint64(value15));
                                                                    if (!(!(checkpointCount[arg0]))) {
                                                                        if (!((checkpointCount[arg0] + 0xffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff) < checkpointCount[arg0])) _desolexPanic(50);
                                                                    } else {
                                                                        flag7 = !(!(checkpointCount[arg0]));
                                                                    }
                                                                    if (flag7) {
                                                                        if (!((checkpointCount[arg0] + 0xffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff) < checkpointCount[arg0])) _desolexPanic(50);
                                                                        if (!((arg1 < 0x03))) _desolexPanic(33);
                                                                        stor_expr_z = (0xffffffffffffffffffffffffffffffffffffffffffffff00ffffffffffffffff & stor_expr_z) | ((arg1 << 0x40) & (0xff0000000000000000));
                                                                        if (!(0 < 0x03)) _desolexPanic(33);
                                                                        if (!((arg1 < 0x03))) _desolexPanic(33);
                                                                        emit Event_457841ae(arg0, uint64(value15), 0, arg1, flag7);
                                                                    }
                                                                    if (((var_f + 0x40) > 0xffffffffffffffff) | ((var_f + 0x40) < var_f)) _desolexPanic(65);
                                                                    var_f = var_f + 0x40;
                                                                    if (!((checkpointCount[arg0] < 0x010000000000000000))) _desolexPanic(65);
                                                                    checkpointCount[arg0] = checkpointCount[arg0] + 0x01;
                                                                    if (!(checkpointCount[arg0] < checkpointCount[arg0])) _desolexPanic(50);
                                                                    if (!(0x0 == 0x0)) _desolexPanic(0);
                                                                    stor_expr_ab = (stor_expr_ab & (0xffffffffffffffffffffffffffffffffffffffffffffffff0000000000000000)) | (var_f.length & (0xffffffffffffffff));
                                                                    if (!((var_n < 0x03))) _desolexPanic(33);
                                                                    if (!((var_n < 0x03))) _desolexPanic(33);
                                                                    stor_expr_ab = (0xffffffffffffffffffffffffffffffffffffffffffffff00ffffffffffffffff & stor_expr_ab) | ((var_n << 0x40) & (0xff0000000000000000));
                                                                    if (!(0 < 0x03)) _desolexPanic(33);
                                                                    if (!((arg1 < 0x03))) _desolexPanic(33);
                                                                    emit Event_457841ae(arg0, uint64(value15), 0, arg1, flag7);
                                                                }
                                                            } else {
                                                                (bool success6, bytes memory returnData6) = address(value5).nextCycleId(); // staticcall
                                                                require(success6);
                                                                uint256 value21 = msg.data[0] >> 0xe0;
                                                                uint256 value22 = var_f.length;
                                                                if (success6) {
                                                                    uint256 value20 = returnData6.length;
                                                                    if (0x20 <= returnData6.length) {
                                                                        value20 = 0x20;
                                                                    }
                                                                    if (((var_f + ((value20 + 0x1f) & (0xffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe0))) > 0xffffffffffffffff) | ((var_f + ((value20 + 0x1f) & (0xffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe0))) < var_f)) _desolexPanic(65);
                                                                    var_f = var_f + ((value20 + 0x1f) & (0xffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe0));
                                                                    require(((var_f + value20) - var_f) >= 0x20);
                                                                    require(var_f.length == (uint64(var_f.length)));
                                                                } else {
                                                                    value21 = var_f;
                                                                    value22 = 0;
                                                                }
                                                                require(!((value22 & 0xffffffffffffffff) != 0x0 && (value22 & 0xffffffffffffffff) <= 0x0 || (value22 & 0xffffffffffffffff) == 0x0), CustomError_c2b74bfc());
                                                                require(!(0x0 >= (stor_2 & 0xffffffffffffffff) && (value22 & 0xffffffffffffffff) < (SHR(0x40, stor_2) & 0xffffffffffffffff) || 0x0 < (stor_2 & 0xffffffffffffffff)), CustomError_d27cc074());
                                                                uint256 value23 = msg.data[0] >> 0xe0;
                                                                uint256 value24 = msg.data[0] >> 0xe0;
                                                                if (0 > (uint64(stor_2))) {
                                                                    stor_2 = (0xffffffffffffffffffffffffffffffffffffffffffffffff0000000000000000 & stor_2) | 0;
                                                                } else {
                                                                    value23 = stor_2;
                                                                    value24 = 0;
                                                                }
                                                                uint256 value25 = msg.data[0] >> 0xe0;
                                                                if (uint64(value22) > (uint64(stor_2 >> 0x40))) {
                                                                    stor_2 = (0xffffffffffffffff0000000000000000 & (value22 << 0x40)) | (0xffffffffffffffffffffffffffffffff0000000000000000ffffffffffffffff & stor_2);
                                                                } else {
                                                                    value25 = stor_2;
                                                                }
                                                                uint256 value12 = checkpointCount[arg0];
                                                                while (true) {
                                                                    if (0 >= value12) {
                                                                        break;
                                                                    }
                                                                    if (0x0 > 0x0 + value12) {
                                                                        _desolexPanic(17);
                                                                        break;
                                                                    }
                                                                    if (!(((0 + value12) >> 0x01) < checkpointCount[arg0])) _desolexPanic(50);
                                                                    if (uint64(value22) < (uint64(stor_expr_b))) {
                                                                        value12 = (0 + value12) >> 0x01;
                                                                    } else {
                                                                        if (((0 + value12) >> 0x01) > (((0 + value12) >> 0x01) + 0x01)) {
                                                                            _desolexPanic(17);
                                                                            break;
                                                                        }
                                                                        value12 = value12;
                                                                    }
                                                                }
                                                                bool flag13 = (uint64(stor_expr_z)) == (uint64(value22));
                                                                if (!(!(checkpointCount[arg0]))) {
                                                                    if (!((checkpointCount[arg0] + 0xffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff) < checkpointCount[arg0])) _desolexPanic(50);
                                                                } else {
                                                                    flag13 = !(!(checkpointCount[arg0]));
                                                                }
                                                                if (flag13) {
                                                                    if (!((checkpointCount[arg0] + 0xffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff) < checkpointCount[arg0])) _desolexPanic(50);
                                                                    if (!((arg1 < 0x03))) _desolexPanic(33);
                                                                    stor_expr_z = (0xffffffffffffffffffffffffffffffffffffffffffffff00ffffffffffffffff & stor_expr_z) | ((arg1 << 0x40) & (0xff0000000000000000));
                                                                    if (!(0 < 0x03)) _desolexPanic(33);
                                                                    if (!((arg1 < 0x03))) _desolexPanic(33);
                                                                    emit Event_457841ae(arg0, uint64(value22), 0, arg1, flag13);
                                                                }
                                                                if (((var_f + 0x40) > 0xffffffffffffffff) | ((var_f + 0x40) < var_f)) _desolexPanic(65);
                                                                var_f = var_f + 0x40;
                                                                if (!((checkpointCount[arg0] < 0x010000000000000000))) _desolexPanic(65);
                                                                checkpointCount[arg0] = checkpointCount[arg0] + 0x01;
                                                                if (!(checkpointCount[arg0] < checkpointCount[arg0])) _desolexPanic(50);
                                                                if (!(0x0 == 0x0)) _desolexPanic(0);
                                                                stor_expr_ab = (stor_expr_ab & (0xffffffffffffffffffffffffffffffffffffffffffffffff0000000000000000)) | (var_f.length & (0xffffffffffffffff));
                                                                if (!((var_n < 0x03))) _desolexPanic(33);
                                                                if (!((var_n < 0x03))) _desolexPanic(33);
                                                                stor_expr_ab = (0xffffffffffffffffffffffffffffffffffffffffffffff00ffffffffffffffff & stor_expr_ab) | ((var_n << 0x40) & (0xff0000000000000000));
                                                                if (!(0 < 0x03)) _desolexPanic(33);
                                                                if (!((arg1 < 0x03))) _desolexPanic(33);
                                                                emit Event_457841ae(arg0, uint64(value22), 0, arg1, flag13);
                                                            }
                                                        }
                                                    }
                                                }
                                            }
                                        }
                                    }
                                }
                            }
                        }
                    }
                }
            }
        }
    }
    
    function renounceRole(bytes32 role, address account) public {
        require(account == msg.sender, AccessControlBadConfirmation());
        internal_139a(role, account);
    }
    
    function grantRole(bytes32 role, address account) public {
        require(bytes1(hasRole[stor_expr_e][msg.sender]), AccessControlUnauthorizedAccount());
        if (!(bytes1(hasRole[role][account]) != 0x0)) {
            hasRole[role][account] = true;
            emit RoleGranted(role, account, msg.sender);
        }
        if (!(0 == (!(mapping_expr_ao[account])))) {
            if (!(stor_expr_an < 0x010000000000000000)) _desolexPanic(65);
            stor_expr_an = stor_expr_an + 0x01;
            if (!(stor_expr_an < stor_expr_an)) _desolexPanic(50);
            stor_expr_ap = (0 & stor_expr_ap) | (account << 0);
            mapping_expr_ao[account] = stor_expr_an;
        }
    }
    
    function getRoleAdmin(bytes32 role) public view returns (uint256) {
        return stor_expr_e;
    }
    
    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_139a(bytes32 arg0, address arg1) private {
        // Decompilation incomplete: helper effect provenance is conservative.
        uint256 value0 = 0;
        if (bytes1(hasRole[arg0][arg1])) {
            hasRole[arg0][arg1] = false;
            emit RoleRevoked(arg0, arg1, msg.sender);
            value0 = 0x01;
        }
        if (value0 != 0x0) {
            uint256 value4 = 0;
            if (!(0 == (!(!(mapping_expr_ae[arg1]))))) {
                uint256 value1 = 0;
                uint256 value2 = 0;
                uint256 value3 = 0;
                if ((mapping_expr_ae[arg1] + 0xffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff) != (getRoleMemberCount[arg0] + 0xffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff)) {
                    if (!(((getRoleMemberCount[arg0] + 0xffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff) < stor_expr_j))) _desolexPanic(50);
                    if (!(((mapping_expr_ae[arg1] + 0xffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff) < stor_expr_k))) _desolexPanic(50);
                    stor_expr_ai = (0 & stor_expr_aj | (stor_expr_ah >> (0 << 0x03) << 0));
                    mapping_expr_ae[stor_expr_ah >> (0 << 0x03)] = mapping_expr_ae[arg1];
                } else {
                    value1 = mapping_expr_ae[arg1] + 0xffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff;
                    value2 = getRoleMemberCount[arg0] + 0xffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff;
                    value3 = mapping_expr_ae[arg1];
                }
                if (!(getRoleMemberCount[arg0])) _desolexPanic(49);
                if (!(((0xffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff + getRoleMemberCount[arg0]) < stor_expr_q))) _desolexPanic(50);
                stor_expr_al = (~(0xffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff << (0 << 0x03))) & stor_expr_al;
                getRoleMemberCount[arg0] = 0xffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff + getRoleMemberCount[arg0];
                mapping_expr_ae[arg1] = 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)
    // 0x0fc29349 => totalLiability()
    // 0x1d8ffa4d => interfaceVersion()
    // 0x248a9ca3 => getRoleAdmin(bytes32)
    // 0x2b3d2c38 => unresolved_2b3d2c38()
    // 0x2f2ff15d => grantRole(bytes32,address)
    // 0x36568abe => renounceRole(bytes32,address)
    // 0x36cd007d => Unknown_36cd007d(address,uint256)
    // 0x480a51a6 => binding()
    // 0x55fd7fa0 => moduleKey()
    // 0x7656419f => protocolRegistry()
    // 0x76a82342 => checkpointCount(address)
    // 0x84a0e082 => checkpointAt(address,uint256)
    // 0x8ce826bb => Unknown_8ce826bb(address,uint64)
    // 0x9010d07c => Unknown_9010d07c(uint256,uint256)
    // 0x91d14854 => hasRole(bytes32,address)
    // 0x9ce6dd9f => hasOpenPositions()
    // 0xa217fddf => DEFAULT_ADMIN_ROLE()
    // 0xa3246ad3 => Unknown_a3246ad3(uint256)
    // 0xb163d46c => unresolved_b163d46c()
    // 0xb719d032 => predecessor()
    // 0xbbaebfc3 => Unknown_bbaebfc3()
    // 0xbd7ad804 => Unknown_bd7ad804()
    // 0xca15c873 => getRoleMemberCount(bytes32)
    // 0xd547741f => revokeRole(bytes32,address)
    // 0xdfb59510 => Unknown_dfb59510(address,uint64)
    // 0xf36c8f5c => GOVERNANCE_ROLE()
}
0xe7399d…b420bb on BNB Chain — Decompiled Solidity