Skip to content
Verified contractExactMIT

ConsentBatchForwarder

Address0xcd1b1a55e4a55290639939fe709438e9cf6dfd57
Balance

0 ETH

 

Transactions

2

 

Compiler

solc 0.8.34

 

Same code

Only this contract

 

Details

Compiler
solc 0.8.34+commit.80d5c536
Language
solidity
Optimization
No
License
MIT
Match
Exactcreation code: yes, runtime code: yes
Verified on Sourcify
Created in block
26,477,552
Creation transaction
0xeffcc69014…86e74f11b1

ConsentBatch.sol

// SPDX-License-Identifier: MIT
pragma solidity ^0.8.24;

/// @notice Ethereum mainnet fixed-size transfers: D -> B -> B-signed C (operator-confirmed off chain).
/// @dev A pays gas. D/B independently sign each exact transfer. No arbitrary calls.
interface IOwned7702Account {
    function executeSignedTransfer(address to, uint256 nonce, uint256 deadline, bytes calldata signature) external;
}

contract ConsentBatchForwarder {
    uint256 public constant MAINNET = 1;
    uint256 public constant AMOUNT = 998;
    uint256 public constant MAX_ORDERS = 20;

    struct Order {
        address b;
        address c;
        uint256 dNonce;
        uint256 bNonce;
        uint256 deadline;
        bytes dSignature;
        bytes bSignature;
    }

    address public immutable operatorA;
    address public immutable funderD;
    address public implementation;
    address public immutable token;
    uint256 private entered;

    event OrderExecuted(uint256 indexed batchId, uint256 indexed rowNumber, address indexed b, address c, uint256 amount);

    constructor(address a_, address d_, address token_) {
        require(block.chainid == MAINNET, "Mainnet only");
        require(a_ != address(0) && d_ != address(0) && token_ != address(0), "zero addr");
        operatorA = a_;
        funderD = d_;
        token = token_;
    }

    modifier onlyA() { require(msg.sender == operatorA, "A only"); _; }

    function bindImplementation(address implementation_) external onlyA {
        require(implementation == address(0), "already bound");
        require(implementation_.code.length > 0, "no implementation");
        implementation = implementation_;
    }

    function delegatedToUs(address wallet) public view returns (bool) {
        bytes memory code = wallet.code;
        return implementation != address(0) && code.length == 23 && keccak256(code) == keccak256(abi.encodePacked(hex"ef0100", implementation));
    }

    /// @dev C is authorized by B exact signed intent, not by an A-maintained recipient allowlist.
    function executeBatch(uint256 batchId, uint256[] calldata rowNumbers, Order[] calldata orders) external onlyA {
        require(block.chainid == MAINNET, "Mainnet only");
        require(entered == 0, "reentrant");
        require(orders.length > 0 && orders.length <= MAX_ORDERS && orders.length == rowNumbers.length, "bad length");
        require(delegatedToUs(funderD), "D is not delegated");
        entered = 1;
        for (uint256 i = 0; i < orders.length; ++i) {
            Order calldata order = orders[i];
            require(order.b != funderD && order.b != order.c && order.c != funderD, "invalid pair");
            require(delegatedToUs(order.b), "B is not delegated");
            IOwned7702Account(funderD).executeSignedTransfer(order.b, order.dNonce, order.deadline, order.dSignature);
            IOwned7702Account(order.b).executeSignedTransfer(order.c, order.bNonce, order.deadline, order.bSignature);
            emit OrderExecuted(batchId, rowNumbers[i], order.b, order.c, AMOUNT);
        }
        entered = 0;
    }
}
Compiler settingsShow
{
  "optimizer": {
    "runs": 200,
    "enabled": false
  },
  "remappings": []
}

Source code and metadata: Sourcify.

The source code belongs to the authors of the contract.