BNB Chain

0xc6c3c19ed039e5f9bf58b1daedd2fc095cedd3fd

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

Decompilation outputBNB Chain · 0xc6c3c19e5cedd3fd3.9 KB2.7 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 DEFAULT_ADMIN_ROLE = 0;
    uint8 public constant decimals = 9;
    
    mapping(bytes32 => mapping(address => bool)) public hasRole; // STORAGE[0x0]
    mapping(bytes32 => uint256) public getRoleMemberCount; // STORAGE[0x1]
    string _name; // STORAGE[0x2]
    string _symbol; // STORAGE[0x3]
    mapping(address => uint256) mapping_4; // STORAGE[0x4]
    mapping(address => mapping(address => uint256)) public allowance; // STORAGE[0x5]
    uint256 stor_6; // STORAGE[0x6]
    uint256 stor_7; // STORAGE[0x7]
    address public controller; // STORAGE[0x8]
    mapping(address => bool) mapping_ad3228b676f7d3cd4284a5443f17f1962b36e491b30a40b2405849e597ba5fb5; // STORAGE[0xad3228b676f7d3cd4284a5443f17f1962b36e491b30a40b2405849e597ba5fb5]
    mapping(address => uint256) mapping_expr_af;
    mapping(address => uint256) mapping_expr_ap;
    mapping(address => uint256) mapping_expr_j;
    bytes32 stor_expr_ad;
    bytes32 stor_expr_ai;
    uint256 stor_expr_aj;
    bytes32 stor_expr_ak;
    uint256 stor_expr_am;
    uint256 stor_expr_ao;
    address stor_expr_aq;
    bytes32 stor_expr_g;
    uint256 stor_expr_k;
    uint256 stor_expr_l;
    uint256 stor_expr_m;
    bytes32 stor_expr_o;
    bytes32 stor_expr_p;
    bytes32 stor_expr_q;
    uint256 stor_expr_s;
    bytes32 stor_expr_t;
    
    error AccessControlBadConfirmation();
    event RoleRevoked(bytes32 indexed, address indexed, address indexed);
    event ControllerSet(address indexed, uint256);
    event Event_d292d86f(uint256 indexed, uint256, uint256, uint256, uint256);
    error ControllerMustBeContract();
    event Transfer(address indexed, address indexed, uint256);
    error OnlyController();
    error InsufficientBalance();
    error AccessControlUnauthorizedAccount(address, bytes32);
    event RoleGranted(bytes32 indexed, address indexed, address indexed);
    event Approval(address indexed, address indexed, uint256);
    error TransferDisabled();
    error ControllerAlreadySet();
    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 == 0x23b872dd)) {
            // Route to Unknown_23b872dd(address,address) after replacing only msg.sig.
            __desolexSelectorShim(uint32(0x4323c215));
            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 == 0xa9059cbb)) {
            // Route to Unknown_a9059cbb(address) after replacing only msg.sig.
            __desolexSelectorShim(uint32(0x621546ec));
            return;
        }
        if ((msg.data.length >= 4) && (msg.sig == 0xde8ef1cd)) {
            // Route to Unknown_de8ef1cd(uint256,uint64) after replacing only msg.sig.
            __desolexSelectorShim(uint32(0xd96bb150));
            return;
        }
        revert();
    }
    
    
    function Unknown_de8ef1cd(uint256 arg0, uint64 arg1) public returns (uint256) {
        require(arg1 == (arg1 & 0xffffffffffffffff));
        require(msg.sender == controller, OnlyController());
        if (((stor_6 / stor_7 != 0x0) && (arg0 == 0x0)) || (stor_6 / stor_7 == 0x0)) {
            emit Event_d292d86f(uint64(arg1), stor_6 / stor_7, stor_6 / stor_7, 0, arg0);
            return 0;
        } else {
            stor_7 = stor_6 * ((stor_6 + 0xffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff) / ((stor_6 / stor_7) + arg0) + 0x01);
            emit Event_d292d86f(uint64(arg1), stor_6 / stor_7, stor_6 / (stor_6 * ((stor_6 + 0xffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff) / ((stor_6 / stor_7) + arg0) + 0x01)), (stor_6 / (stor_6 * ((stor_6 + 0xffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff) / ((stor_6 / stor_7) + arg0) + 0x01))) - (stor_6 / stor_7), arg0 - ((stor_6 / (stor_6 * ((stor_6 + 0xffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff) / ((stor_6 / stor_7) + arg0) + 0x01))) - (stor_6 / stor_7)));
            return (stor_6 / (stor_6 * ((stor_6 + 0xffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff) / ((stor_6 / stor_7) + arg0) + 0x01))) - (stor_6 / stor_7);
        }
    }
    
    function revokeRole(bytes32 role, address account) public {
        require(bytes1(hasRole[stor_expr_g][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_j[account]))))) {
                uint256 value1 = 0;
                uint256 value2 = 0;
                uint256 value3 = 0;
                if ((mapping_expr_j[account] + 0xffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff) != (stor_expr_k + 0xffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff)) {
                    if (!(((stor_expr_k + 0xffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff) < stor_expr_l))) _desolexPanic(50);
                    if (!(((mapping_expr_j[account] + 0xffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff) < stor_expr_m))) _desolexPanic(50);
                    stor_expr_p = (0 & stor_expr_q) | ((stor_expr_o >> 0) << 0);
                    mapping_expr_j[stor_expr_o >> 0] = mapping_expr_j[account];
                } else {
                    value1 = mapping_expr_j[account] + 0xffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff;
                    value2 = stor_expr_k + 0xffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff;
                    value3 = mapping_expr_j[account];
                }
                if (!(stor_expr_k != 0x0)) _desolexPanic(49);
                if (!(((0xffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff + stor_expr_k) < stor_expr_s))) _desolexPanic(50);
                stor_expr_t = (0) & stor_expr_t;
                stor_expr_k = 0xffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff + stor_expr_k;
                mapping_expr_j[account] = 0;
                value4 = 0x01;
            }
        }
    }
    
    function Unknown_a9059cbb(address arg0) public pure {
        if (!(msg.value) && !((0xfffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffc + msg.data.length) < 0x40)) {
            require(arg0 != arg0, TransferDisabled());
        }
        revert();
    }
    
    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 burn(address account, uint256 amount) public {
        require(msg.sender == controller, OnlyController());
        require(amount <= (mapping_4[account] / stor_7), InsufficientBalance());
        uint256 value0 = msg.data[0] >> 0xe0;
        if (amount == 0) {
            value0 = mapping_4[account] / stor_7;
        }
        uint256 value1 = amount * stor_7;
        if (!(amount && amount == mapping_4[account] / stor_7)) {
        } else {
            value1 = mapping_4[account];
        }
        require(mapping_4[account] >= value1, InsufficientBalance());
        mapping_4[account] = mapping_4[account] - value1;
        stor_6 = stor_6 - value1;
        emit Transfer(account, address(0), amount);
    }
    
    function symbol() public view returns (string memory) {
        return _symbol;
    }
    
    function totalSupply() public view returns (uint256) {
        return stor_6 / stor_7;
    }
    
    function circulatingSupply() public view returns (uint256) {
        return stor_6 / stor_7;
    }
    
    function setController(address _controller) public {
        require(mapping_ad3228b676f7d3cd4284a5443f17f1962b36e491b30a40b2405849e597ba5fb5[msg.sender], AccessControlUnauthorizedAccount());
        require(!(controller), ControllerAlreadySet());
        require(_controller.code.length != 0x0, ControllerMustBeContract());
        controller = _controller;
        emit ControllerSet(controller, block.timestamp);
    }
    
    function Unknown_9010d07c(uint256 arg0, uint256 arg1) public view returns (address) {
        if (!(arg1 < getRoleMemberCount[arg0])) _desolexPanic(50);
        return address(stor_expr_ad >> 0);
    }
    
    function balanceOf(address account) public view returns (uint256) {
        return mapping_4[account] / stor_7;
    }
    
    function mint(address to, uint256 amount) public returns (uint256) {
        require(msg.sender == controller, OnlyController());
        require(to != address(0), ZeroAddress());
        mapping_4[to] = mapping_4[to] + (amount * stor_7);
        stor_6 = stor_6 + (amount * stor_7);
        emit Transfer(address(0), to, amount);
        return amount;
    }
    
    function renounceRole(bytes32 role, address account) public {
        require(account == msg.sender, AccessControlBadConfirmation());
        internal_cf8(role, account);
    }
    
    function grantRole(bytes32 role, address account) public {
        require(bytes1(hasRole[stor_expr_g][msg.sender]), AccessControlUnauthorizedAccount());
        if (!(bytes1(hasRole[role][account]) != 0x0)) {
            hasRole[role][account] = true;
            emit RoleGranted(role, account, msg.sender);
        }
        if (!(0 == (!(mapping_expr_ap[account])))) {
            if (!(stor_expr_ao < 0x010000000000000000)) _desolexPanic(65);
            stor_expr_ao = stor_expr_ao + 0x01;
            if (!(stor_expr_ao < stor_expr_ao)) _desolexPanic(50);
            stor_expr_aq = (0 & stor_expr_aq) | (account << 0);
            mapping_expr_ap[account] = stor_expr_ao;
        }
    }
    
    function getRoleAdmin(bytes32 role) public view returns (uint256) {
        return stor_expr_g;
    }
    
    function Unknown_23b872dd(address arg0, address arg1) public pure {
        if (!(msg.value) && !((0xfffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffc + msg.data.length) < 0x60) && arg0 == arg0) {
            require(arg1 != arg1, TransferDisabled());
        }
        revert();
    }
    
    function approve(address spender, uint256 amount) public returns (bool) {
        require(spender != address(0), ZeroAddress());
        allowance[msg.sender][spender] = amount;
        emit Approval(msg.sender, spender, allowance[msg.sender][spender]);
        return true;
    }
    
    function name() public view returns (string memory) {
        return _name;
    }
    
    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_cf8(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_af[arg1]))))) {
                uint256 value1 = 0;
                uint256 value2 = 0;
                uint256 value3 = 0;
                if ((mapping_expr_af[arg1] + 0xffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff) != (getRoleMemberCount[arg0] + 0xffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff)) {
                    if (!(((getRoleMemberCount[arg0] + 0xffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff) < stor_expr_l))) _desolexPanic(50);
                    if (!(((mapping_expr_af[arg1] + 0xffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff) < stor_expr_m))) _desolexPanic(50);
                    stor_expr_aj = (0 & stor_expr_ak | (stor_expr_ai >> (0 << 0x03) << 0));
                    mapping_expr_af[stor_expr_ai >> (0 << 0x03)] = mapping_expr_af[arg1];
                } else {
                    value1 = mapping_expr_af[arg1] + 0xffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff;
                    value2 = getRoleMemberCount[arg0] + 0xffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff;
                    value3 = mapping_expr_af[arg1];
                }
                if (!(getRoleMemberCount[arg0])) _desolexPanic(49);
                if (!(((0xffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff + getRoleMemberCount[arg0]) < stor_expr_s))) _desolexPanic(50);
                stor_expr_am = (~(0xffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff << (0 << 0x03))) & stor_expr_am;
                getRoleMemberCount[arg0] = 0xffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff + getRoleMemberCount[arg0];
                mapping_expr_af[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)
    // 0x06fdde03 => name()
    // 0x095ea7b3 => approve(address,uint256)
    // 0x18160ddd => totalSupply()
    // 0x23b872dd => Unknown_23b872dd(address,address)
    // 0x248a9ca3 => getRoleAdmin(bytes32)
    // 0x2f2ff15d => grantRole(bytes32,address)
    // 0x313ce567 => decimals()
    // 0x36568abe => renounceRole(bytes32,address)
    // 0x40c10f19 => mint(address,uint256)
    // 0x70a08231 => balanceOf(address)
    // 0x9010d07c => Unknown_9010d07c(uint256,uint256)
    // 0x91d14854 => hasRole(bytes32,address)
    // 0x92eefe9b => setController(address)
    // 0x9358928b => circulatingSupply()
    // 0x95d89b41 => symbol()
    // 0x9dc29fac => burn(address,uint256)
    // 0xa217fddf => DEFAULT_ADMIN_ROLE()
    // 0xa3246ad3 => Unknown_a3246ad3(uint256)
    // 0xa9059cbb => Unknown_a9059cbb(address)
    // 0xca15c873 => getRoleMemberCount(bytes32)
    // 0xd547741f => revokeRole(bytes32,address)
    // 0xdd62ed3e => allowance(address,address)
    // 0xde8ef1cd => Unknown_de8ef1cd(uint256,uint64)
    // 0xf77c4791 => controller()
}
0xc6c3c1…edd3fd on BNB Chain — Decompiled Solidity