Address Contract Verified
Address
0x01DcB88678aedD0C4cC9552B20F4718550250574
Balance
0 ETH
Nonce
1
Code Size
917 bytes
Creator
Create2 Deployer at tx 0xf6b98f2b...832bea
Indexed Transactions
0 (1 on-chain, 1.3% indexed)
Contract Bytecode
917 bytes
0x608060405234801561000f575f80fd5b5060043610610034575f3560e01c80635116063014610038578063760f2a0b14610088575b5f80fd5b61005f7f0000000000000000000000009008d19f58aabd9ed0d60971565aa8510560ab4181565b60405173ffffffffffffffffffffffffffffffffffffffff909116815260200160405180910390f35b61009b6100963660046101d6565b61009d565b005b3373ffffffffffffffffffffffffffffffffffffffff7f0000000000000000000000009008d19f58aabd9ed0d60971565aa8510560ab41161461010c576040517f0cd41ec000000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b365f5b828110156101d05783838281811061012957610129610245565b905060200281019061013b9190610272565b91505f61014b60208401846102ae565b73ffffffffffffffffffffffffffffffffffffffff16604084013561017360208601866102e8565b604051610181929190610350565b5f604051808303815f8787f1925050503d805f81146101bb576040519150601f19603f3d011682016040523d82523d5f602084013e6101c0565b606091505b505090505080600101905061010f565b50505050565b5f80602083850312156101e7575f80fd5b823567ffffffffffffffff808211156101fe575f80fd5b818501915085601f830112610211575f80fd5b81358181111561021f575f80fd5b8660208260051b8501011115610233575f80fd5b60209290920196919550909350505050565b7f4e487b71000000000000000000000000000000000000000000000000000000005f52603260045260245ffd5b5f82357fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffa18336030181126102a4575f80fd5b9190910192915050565b5f602082840312156102be575f80fd5b813573ffffffffffffffffffffffffffffffffffffffff811681146102e1575f80fd5b9392505050565b5f8083357fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe184360301811261031b575f80fd5b83018035915067ffffffffffffffff821115610335575f80fd5b602001915036819003821315610349575f80fd5b9250929050565b818382375f910190815291905056fea264697066735822122048824f9c095935f2330d7ea74847fe7fb85f0c3252be801ec53d992478da430864736f6c63430008140033
Verified Source Code Full Match
Compiler: v0.8.20+commit.a1b79de6
EVM: shanghai
Optimization: Yes (1000000 runs)
HooksTrampoline.sol 67 lines
// SPDX-License-Identifier: LGPL-3.0-only
pragma solidity ^0.8;
/// @title CoW Protocol Hooks Trampoline
/// @dev A trampoline contract for calling user-specified hooks. It ensures that
/// user-specified calls are not executed from a privileged context, and that
/// reverts do not prevent settlements from executing.
/// @author CoW Developers
contract HooksTrampoline {
/// @dev A user-specified hook.
struct Hook {
address target;
bytes callData;
uint256 gasLimit;
}
/// @dev Error indicating that the trampoline was not called from the CoW
/// Protocol settlement contract.
error NotASettlement();
/// @dev The address of the CoW Protocol settlement contract.
address public immutable settlement;
/// @param settlement_ The address of the CoW protocol settlement contract.
constructor(address settlement_) {
settlement = settlement_;
}
/// @dev Modifier that ensures that the `msg.sender` is the CoW Protocol
/// settlement contract. Methods with this modifier are guaranteed to only
/// be called as part of a CoW Protocol settlement.
modifier onlySettlement() {
if (msg.sender != settlement) {
revert NotASettlement();
}
_;
}
/// @dev Executes the specified hooks. This function will revert if not
/// called by the CoW Protocol settlement contract. This allows hooks to be
/// semi-permissioned, ensuring that they are only executed as part of a CoW
/// Protocol settlement. Additionally, hooks are called with a gas limit,
/// and are allowed to revert. This is done in order to prevent badly
/// configured user-specified hooks from consuming more gas than expected
/// (for example, if a hook were to revert with an `INVALID` opcode) or
/// causing an otherwise valid settlement to revert, effectively
/// DoS-ing other orders.
///
/// @param hooks The hooks to execute.
function execute(Hook[] calldata hooks) external onlySettlement {
// Array bounds and overflow checks are not needed here, as `i` will
// never overflow and `hooks[i]` will never be out of bounds as `i` is
// smaller than `hooks.length`.
unchecked {
Hook calldata hook;
for (uint256 i; i < hooks.length; ++i) {
hook = hooks[i];
(bool success,) = hook.target.call{gas: hook.gasLimit}(hook.callData);
// In order to prevent custom hooks from DoS-ing settlements, we
// explicitly allow them to revert.
success;
}
}
}
}
Read Contract
settlement 0x51160630 → address
Write Contract 1 functions
These functions modify contract state and require a wallet transaction to execute.
execute 0xfab5b395
tuple[] hooks
Recent Transactions
This address has 1 on-chain transactions, but only 1.3% of the chain is indexed. Transactions will appear as indexing progresses. View on Etherscan →