Feature Tip: Add private address tag to any address under My Name Tag !
Source Code
| Transaction Hash |
Method
|
Block
|
From
|
|
To
|
||||
|---|---|---|---|---|---|---|---|---|---|
Latest 1 internal transaction
Advanced mode:
| Parent Transaction Hash | Method | Block |
From
|
|
To
|
||
|---|---|---|---|---|---|---|---|
| 0x60a06040 | 17663878 | 976 days ago | Contract Creation | 0 ETH |
Loading...
Loading
Loading...
Loading
Cross-Chain Transactions
Loading...
Loading
Contract Name:
HooksTrampoline
Compiler Version
v0.8.20+commit.a1b79de6
Optimization Enabled:
Yes with 1000000 runs
Other Settings:
default evmVersion
Contract Source Code (Solidity Standard Json-Input format)
// 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;
}
}
}
}{
"remappings": [
"ds-test/=lib/forge-std/lib/ds-test/src/",
"forge-std/=lib/forge-std/src/"
],
"optimizer": {
"enabled": true,
"runs": 1000000
},
"metadata": {
"useLiteralContent": false,
"bytecodeHash": "ipfs",
"appendCBOR": true
},
"outputSelection": {
"*": {
"*": [
"evm.bytecode",
"evm.deployedBytecode",
"devdoc",
"userdoc",
"metadata",
"abi"
]
}
},
"evmVersion": "shanghai",
"libraries": {}
}Contract Security Audit
- No Contract Security Audit Submitted- Submit Audit Here
Contract ABI
API[{"inputs":[{"internalType":"address","name":"settlement_","type":"address"}],"stateMutability":"nonpayable","type":"constructor"},{"inputs":[],"name":"NotASettlement","type":"error"},{"inputs":[{"components":[{"internalType":"address","name":"target","type":"address"},{"internalType":"bytes","name":"callData","type":"bytes"},{"internalType":"uint256","name":"gasLimit","type":"uint256"}],"internalType":"struct HooksTrampoline.Hook[]","name":"hooks","type":"tuple[]"}],"name":"execute","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"settlement","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"}]Contract Creation Code
60a060405234801561000f575f80fd5b5060405161041e38038061041e83398101604081905261002e9161003f565b6001600160a01b031660805261006c565b5f6020828403121561004f575f80fd5b81516001600160a01b0381168114610065575f80fd5b9392505050565b6080516103956100895f395f8181603d015260b501526103955ff3fe608060405234801561000f575f80fd5b5060043610610034575f3560e01c80635116063014610038578063760f2a0b14610088575b5f80fd5b61005f7f000000000000000000000000000000000000000000000000000000000000000081565b60405173ffffffffffffffffffffffffffffffffffffffff909116815260200160405180910390f35b61009b6100963660046101d6565b61009d565b005b3373ffffffffffffffffffffffffffffffffffffffff7f0000000000000000000000000000000000000000000000000000000000000000161461010c576040517f0cd41ec000000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b365f5b828110156101d05783838281811061012957610129610245565b905060200281019061013b9190610272565b91505f61014b60208401846102ae565b73ffffffffffffffffffffffffffffffffffffffff16604084013561017360208601866102e8565b604051610181929190610350565b5f604051808303815f8787f1925050503d805f81146101bb576040519150601f19603f3d011682016040523d82523d5f602084013e6101c0565b606091505b505090505080600101905061010f565b50505050565b5f80602083850312156101e7575f80fd5b823567ffffffffffffffff808211156101fe575f80fd5b818501915085601f830112610211575f80fd5b81358181111561021f575f80fd5b8660208260051b8501011115610233575f80fd5b60209290920196919550909350505050565b7f4e487b71000000000000000000000000000000000000000000000000000000005f52603260045260245ffd5b5f82357fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffa18336030181126102a4575f80fd5b9190910192915050565b5f602082840312156102be575f80fd5b813573ffffffffffffffffffffffffffffffffffffffff811681146102e1575f80fd5b9392505050565b5f8083357fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe184360301811261031b575f80fd5b83018035915067ffffffffffffffff821115610335575f80fd5b602001915036819003821315610349575f80fd5b9250929050565b818382375f910190815291905056fea264697066735822122048824f9c095935f2330d7ea74847fe7fb85f0c3252be801ec53d992478da430864736f6c634300081400330000000000000000000000009008d19f58aabd9ed0d60971565aa8510560ab41
Deployed Bytecode
0x608060405234801561000f575f80fd5b5060043610610034575f3560e01c80635116063014610038578063760f2a0b14610088575b5f80fd5b61005f7f0000000000000000000000009008d19f58aabd9ed0d60971565aa8510560ab4181565b60405173ffffffffffffffffffffffffffffffffffffffff909116815260200160405180910390f35b61009b6100963660046101d6565b61009d565b005b3373ffffffffffffffffffffffffffffffffffffffff7f0000000000000000000000009008d19f58aabd9ed0d60971565aa8510560ab41161461010c576040517f0cd41ec000000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b365f5b828110156101d05783838281811061012957610129610245565b905060200281019061013b9190610272565b91505f61014b60208401846102ae565b73ffffffffffffffffffffffffffffffffffffffff16604084013561017360208601866102e8565b604051610181929190610350565b5f604051808303815f8787f1925050503d805f81146101bb576040519150601f19603f3d011682016040523d82523d5f602084013e6101c0565b606091505b505090505080600101905061010f565b50505050565b5f80602083850312156101e7575f80fd5b823567ffffffffffffffff808211156101fe575f80fd5b818501915085601f830112610211575f80fd5b81358181111561021f575f80fd5b8660208260051b8501011115610233575f80fd5b60209290920196919550909350505050565b7f4e487b71000000000000000000000000000000000000000000000000000000005f52603260045260245ffd5b5f82357fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffa18336030181126102a4575f80fd5b9190910192915050565b5f602082840312156102be575f80fd5b813573ffffffffffffffffffffffffffffffffffffffff811681146102e1575f80fd5b9392505050565b5f8083357fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe184360301811261031b575f80fd5b83018035915067ffffffffffffffff821115610335575f80fd5b602001915036819003821315610349575f80fd5b9250929050565b818382375f910190815291905056fea264697066735822122048824f9c095935f2330d7ea74847fe7fb85f0c3252be801ec53d992478da430864736f6c63430008140033
Constructor Arguments (ABI-Encoded and is the last bytes of the Contract Creation Code above)
0000000000000000000000009008d19f58aabd9ed0d60971565aa8510560ab41
-----Decoded View---------------
Arg [0] : settlement_ (address): 0x9008D19f58AAbD9eD0D60971565AA8510560ab41
-----Encoded View---------------
1 Constructor Arguments found :
Arg [0] : 0000000000000000000000009008d19f58aabd9ed0d60971565aa8510560ab41
Loading...
Loading
Loading...
Loading
Loading...
Loading
[ Download: CSV Export ]
A contract address hosts a smart contract, which is a set of code stored on the blockchain that runs when predetermined conditions are met. Learn more about addresses in our Knowledge Base.