BNB Chain
0x1c4f0e9b9d92137430babb23c908bfe83642dc0c
Decompiled Solidity recovered from this contract's runtime bytecode. Best-effort reconstruction — confirm behaviour against on-chain state.
Decompilation outputBNB Chain · 0x1c4f0e9b…3642dc0c4.5 KB26.2 s
This result is permanently available athttps://decompiler.exvul.com/bsc/0x1c4f0e9b9d92137430babb23c908bfe83642dc0c
//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 hasOpenPositions = 0;
address public constant stakingMain = address(0xe3a24afea37dc8547cedb480e291881bba335c31);
address public constant protocolRegistry = address(0xfd89fb9faf9de258c2148b2d0ec14da16ee42593);
uint256 public constant moduleKey = 25909600137362552319085765283125928232487037494189676162316430751684376751924;
address public constant usdc = address(0x55d398326f99059ff775485246999027b3197955);
uint256 public constant interfaceVersion = 1;
address public constant protocolToken = address(0x61e91daf03a49ecec334bffbf5008860cfb33333);
uint256 public constant totalLiability = 0;
uint256 stor_0; // STORAGE[0x0]
error SafeERC20FailedOperation(address);
event Unstaked(address indexed, uint256);
error ZeroAmount();
event Staked(address indexed, uint256, uint256);
error ReentrancyGuardReentrantCall();
error ZeroReceived();
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 == 0x4f1ccb77)) {
// Route to Unknown_4f1ccb77(uint256,uint256) after replacing only msg.sig.
__desolexSelectorShim(uint32(0x8a831416));
return;
}
revert();
}
function stake(uint256 amount) public {
require(stor_0 != 0x02, ReentrancyGuardReentrantCall());
stor_0 = 0x02;
require(amount != 0x0, ZeroAmount());
(bool success0, bytes memory returnData0) = address(0xe3a24afea37dc8547cedb480e291881bba335c31).Unknown_06fbe47a(); // call
require(success0);
uint256 var_b;
uint256 value1 = var_b.length;
if (success0) {
uint256 value0 = returnData0.length;
if (0x20 <= returnData0.length) {
value0 = 0x20;
}
if (((var_b + ((value0 + 0x1f) & (0xffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe0))) > 0xffffffffffffffff) | ((var_b + ((value0 + 0x1f) & (0xffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe0))) < var_b)) _desolexPanic(65);
var_b = var_b + ((value0 + 0x1f) & (0xffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe0));
require(((var_b + value0) - var_b) >= 0x20);
require(var_b.length == var_b.length);
} else {
value1 = var_b;
}
(bool success1, bytes memory returnData1) = address(0x61e91daf03a49ecec334bffbf5008860cfb33333).balanceOf(0xe3a24afea37dc8547cedb480e291881bba335c31); // staticcall
require(success1);
if (!(success1)) {
if (((var_b + 0xa0) > 0xffffffffffffffff) | ((var_b + 0xa0) < var_b)) _desolexPanic(65);
var_b = var_b + 0xa0;
(bool success2, bytes memory returnData2) = address(0x61e91daf03a49ecec334bffbf5008860cfb33333).transferFrom(msg.sender, 0xe3a24afea37dc8547cedb480e291881bba335c31, amount); // call
require(success2);
bool flag0 = !(0x01 == var_i);
if (returnData2.length == 0) {
flag0 = 0x61e91daf03a49ecec334bffbf5008860cfb33333.code.length == 0x0;
}
require(!(flag0), SafeERC20FailedOperation());
(bool success3, bytes memory returnData3) = address(0x61e91daf03a49ecec334bffbf5008860cfb33333).balanceOf(0xe3a24afea37dc8547cedb480e291881bba335c31); // staticcall
require(success3);
if (!(success3)) {
require(0 != 0x0, ZeroReceived());
require(0xe3a24afea37dc8547cedb480e291881bba335c31.code.length != 0x0);
(bool success4, bytes memory returnData4) = address(0xe3a24afea37dc8547cedb480e291881bba335c31).stakeFor(msg.sender, 0); // call
require(success4);
uint256 value2 = 0;
if (success4) {
if (((var_b + 0) > 0xffffffffffffffff) | ((var_b + 0) < var_b)) _desolexPanic(65);
var_b = var_b + 0;
require(0x0 == 0x0);
} else {
value2 = var_b;
}
emit Staked(msg.sender, amount, 0);
stor_0 = 0x01;
return;
}
uint256 value3 = returnData3.length;
if (0x20 <= returnData3.length) {
value3 = 0x20;
}
if (((var_b + ((value3 + 0x1f) & (0xffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe0))) > 0xffffffffffffffff) | ((var_b + ((value3 + 0x1f) & (0xffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe0))) < var_b)) _desolexPanic(65);
var_b = var_b + ((value3 + 0x1f) & (0xffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe0));
require(((var_b + value3) - var_b) >= 0x20);
require(var_b.length - 0, ZeroReceived());
require(0xe3a24afea37dc8547cedb480e291881bba335c31.code.length != 0x0);
(bool success5, bytes memory returnData5) = address(0xe3a24afea37dc8547cedb480e291881bba335c31).stakeFor(msg.sender, var_b.length - 0); // call
require(success5);
uint256 value4 = 0;
if (success5) {
if (((var_b + 0) > 0xffffffffffffffff) | ((var_b + 0) < var_b)) _desolexPanic(65);
var_b = var_b + 0;
require(0x0 == 0x0);
} else {
value4 = var_b;
}
emit Staked(msg.sender, amount, var_b.length - 0);
stor_0 = 0x01;
return;
}
uint256 value5 = returnData1.length;
if (0x20 <= returnData1.length) {
value5 = 0x20;
}
if (((var_b + ((value5 + 0x1f) & (0xffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe0))) > 0xffffffffffffffff) | ((var_b + ((value5 + 0x1f) & (0xffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe0))) < var_b)) _desolexPanic(65);
var_b = var_b + ((value5 + 0x1f) & (0xffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe0));
require(((var_b + value5) - var_b) >= 0x20);
if (((var_b + 0xa0) > 0xffffffffffffffff) | ((var_b + 0xa0) < var_b)) _desolexPanic(65);
var_b = var_b + 0xa0;
(bool success6, bytes memory returnData6) = address(0x61e91daf03a49ecec334bffbf5008860cfb33333).transferFrom(msg.sender, 0xe3a24afea37dc8547cedb480e291881bba335c31, amount); // call
require(success6);
bool flag1 = !(0x01 == var_i);
if (returnData6.length == 0) {
flag1 = 0x61e91daf03a49ecec334bffbf5008860cfb33333.code.length == 0x0;
}
require(!(flag1), SafeERC20FailedOperation());
(bool success7, bytes memory returnData7) = address(0x61e91daf03a49ecec334bffbf5008860cfb33333).balanceOf(0xe3a24afea37dc8547cedb480e291881bba335c31); // staticcall
require(success7);
if (!(success7)) {
require(0 - var_b.length, ZeroReceived());
require(0xe3a24afea37dc8547cedb480e291881bba335c31.code.length != 0x0);
(bool success8, bytes memory returnData8) = address(0xe3a24afea37dc8547cedb480e291881bba335c31).stakeFor(msg.sender, 0 - var_b.length); // call
require(success8);
uint256 value6 = 0;
if (success8) {
if (((var_b + 0) > 0xffffffffffffffff) | ((var_b + 0) < var_b)) _desolexPanic(65);
var_b = var_b + 0;
require(0x0 == 0x0);
} else {
value6 = var_b;
}
emit Staked(msg.sender, amount, 0 - var_b.length);
stor_0 = 0x01;
return;
}
uint256 value7 = returnData7.length;
if (0x20 <= returnData7.length) {
value7 = 0x20;
}
if (((var_b + ((value7 + 0x1f) & (0xffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe0))) > 0xffffffffffffffff) | ((var_b + ((value7 + 0x1f) & (0xffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe0))) < var_b)) _desolexPanic(65);
var_b = var_b + ((value7 + 0x1f) & (0xffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe0));
require(((var_b + value7) - var_b) >= 0x20);
require(var_b.length - var_b.length, ZeroReceived());
require(0xe3a24afea37dc8547cedb480e291881bba335c31.code.length != 0x0);
(bool success9, bytes memory returnData9) = address(0xe3a24afea37dc8547cedb480e291881bba335c31).stakeFor(msg.sender, var_b.length - var_b.length); // call
require(success9);
uint256 value8 = 0;
if (success9) {
if (((var_b + 0) > 0xffffffffffffffff) | ((var_b + 0) < var_b)) _desolexPanic(65);
var_b = var_b + 0;
require(0x0 == 0x0);
} else {
value8 = var_b;
}
emit Staked(msg.sender, amount, var_b.length - var_b.length);
stor_0 = 0x01;
}
function Unknown_4f1ccb77(uint256 arg0, uint256 arg1) public payable {
if (!(msg.value) && !((0xfffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffc + msg.data.length) < 0x60) && !(stor_0 == 0x02)) {
stor_0 = 0x02;
if (arg0 != 0x0) {
var_b = var_b;
address(0xfd89fb9faf9de258c2148b2d0ec14da16ee42593).activeAddress(var_b); // staticcall
}
}
}
function unstake(uint256 arg0) public {
require(stor_0 != 0x02, ReentrancyGuardReentrantCall());
stor_0 = 0x02;
require(arg0 != 0x0, ZeroAmount());
(bool success0, bytes memory returnData0) = address(0xe3a24afea37dc8547cedb480e291881bba335c31).Unknown_06fbe47a(); // call
require(success0);
if (!(success0)) {
require(0xe3a24afea37dc8547cedb480e291881bba335c31.code.length != 0x0);
(bool success1, bytes memory returnData1) = address(0xe3a24afea37dc8547cedb480e291881bba335c31).unstakeFor(msg.sender, arg0); // call
require(success1);
uint256 value0 = 0;
uint256 var_d;
if (success1) {
if (((var_d + 0) > 0xffffffffffffffff) | ((var_d + 0) < var_d)) _desolexPanic(65);
var_d = var_d + 0;
} else {
value0 = var_d;
}
emit Unstaked(msg.sender, arg0);
stor_0 = 0x01;
return;
}
if (0x20 > returnData0.length) {
if (((var_d + ((returnData0.length + 0x1f) & (0xffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe0))) > 0xffffffffffffffff) | ((var_d + ((returnData0.length + 0x1f) & (0xffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe0))) < var_d)) _desolexPanic(65);
var_d = var_d + ((returnData0.length + 0x1f) & (0xffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe0));
require(((var_d + returnData0.length) - var_d) >= 0x20);
require(var_d.length == var_d.length);
require(0xe3a24afea37dc8547cedb480e291881bba335c31.code.length != 0x0);
(bool success2, bytes memory returnData2) = address(0xe3a24afea37dc8547cedb480e291881bba335c31).unstakeFor(msg.sender, arg0); // call
require(success2);
uint256 value1 = 0;
if (success2) {
if (((var_d + 0) > 0xffffffffffffffff) | ((var_d + 0) < var_d)) _desolexPanic(65);
var_d = var_d + 0;
} else {
value1 = var_d;
}
} else {
if (((var_d + 0x20) > 0xffffffffffffffff) | ((var_d + 0x20) < var_d)) _desolexPanic(65);
var_d = var_d + 0x20;
require(((var_d + 0x20) - var_d) >= 0x20);
require(var_d.length == var_d.length);
require(0xe3a24afea37dc8547cedb480e291881bba335c31.code.length != 0x0);
(bool success3, bytes memory returnData3) = address(0xe3a24afea37dc8547cedb480e291881bba335c31).unstakeFor(msg.sender, arg0); // call
require(success3);
uint256 value2 = 0;
if (success3) {
if (((var_d + 0) > 0xffffffffffffffff) | ((var_d + 0) < var_d)) _desolexPanic(65);
var_d = var_d + 0;
} else {
value2 = var_d;
}
}
emit Unstaked(msg.sender, arg0);
stor_0 = 0x01;
}
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.
// 0x0fc29349 => totalLiability()
// 0x1a465fe1 => protocolToken()
// 0x1d8ffa4d => interfaceVersion()
// 0x2e17de78 => unstake(uint256)
// 0x3e413bee => usdc()
// 0x4f1ccb77 => Unknown_4f1ccb77(uint256,uint256)
// 0x55fd7fa0 => moduleKey()
// 0x7656419f => protocolRegistry()
// 0x8ba1dbf7 => stakingMain()
// 0x9ce6dd9f => hasOpenPositions()
// 0xa694fc3a => stake(uint256)
}