Working tree is now the canonical repo. Off-chain play-money + trustless on-chain (FPMM AMM + CLOB via UMA settlement), AI market factory, creator/social/distribution, mobile shell + push, one-command demo + deploy-kit. Secrets excluded (see ENV-AND-KEYS.md). Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
41 lines
1.2 KiB
Solidity
41 lines
1.2 KiB
Solidity
// SPDX-License-Identifier: MIT
|
|
pragma solidity ^0.8.4;
|
|
|
|
/// @dev WARNING! This mock is strictly intended for testing purposes only.
|
|
/// Do NOT copy anything here into production code unless you really know what you are doing.
|
|
contract MockETHRecipient {
|
|
bool public immutable gasGriefUponReceiveETH;
|
|
|
|
bool public immutable updateCounterUponReceiveETH;
|
|
|
|
uint256 public counter;
|
|
|
|
uint256 public garbage;
|
|
|
|
constructor(bool updateCounterUponReceiveETH_, bool gasGriefUponReceiveETH_) {
|
|
updateCounterUponReceiveETH = updateCounterUponReceiveETH_;
|
|
gasGriefUponReceiveETH = gasGriefUponReceiveETH_;
|
|
}
|
|
|
|
receive() external payable {
|
|
if (updateCounterUponReceiveETH) {
|
|
counter += 1;
|
|
}
|
|
if (gasGriefUponReceiveETH) {
|
|
/// @solidity memory-safe-assembly
|
|
assembly {
|
|
mstore(0x00, timestamp())
|
|
mstore(0x20, 0)
|
|
|
|
for { let i := 0 } lt(i, 10) { i := add(i, 1) } {
|
|
let h := keccak256(0x00, 0x40)
|
|
mstore(0x00, sload(h))
|
|
mstore(0x20, i)
|
|
sstore(add(h, 1), h)
|
|
}
|
|
sstore(garbage.slot, keccak256(0x00, 0x40))
|
|
}
|
|
}
|
|
}
|
|
}
|