Skip to content
Verified contractPartial

MockB

Address0xcd2bdb8af031d29d2bc38ef08b842d31e344384c
Balance

0 ETH

 

Transactions

13,823

 

Compiler

solc 0.8.34

 

Same code

6 more contracts

 

Details

Compiler
solc 0.8.34+commit.80d5c536
Language
solidity
Optimization
No
License
Not stated
Match
Partialcreation code: yes, runtime code: yes
Verified on Sourcify
Created in block
25,700,977
Creation transaction
0x2f03b3f312…83d7a90db3
Main copy (most transactions)
0xb442b0b7…38c2673a

b.sol

pragma solidity ^0.8.34;

contract MockB {
    address public immutable allowedCaller;
    address public immutable A;

    error NotAllowed();

    constructor(address allowedCaller_, address a_) {
        allowedCaller = allowedCaller_;
        A = a_;
    }

    receive() external payable {}

    function func_2093253501(bytes calldata blob) external payable {
        blob; // 只为保持和 A 的函数签名一致
        if (msg.sender != allowedCaller) revert NotAllowed();

        address target = A;

        assembly ("memory-safe") {
            let size := calldatasize()
            let ptr := mload(0x40)

            // 把“本次调用 B 的整段 calldata”原样复制
            calldatacopy(ptr, 0, size)

            // 原样转发给 A,msg.value 也一起带过去
            pop(call(gas(), target, callvalue(), ptr, size, 0, 0))

            mstore(0x40, and(add(add(ptr, size), 0x1f), not(0x1f)))
        }
    }
}
Compiler settingsShow
{
  "optimizer": {
    "runs": 200,
    "enabled": false
  },
  "remappings": []
}

Source code and metadata: Sourcify.

The source code belongs to the authors of the contract.