Verified contractPartialGPL-3.0-or-later
Agent
Address0x0d63cd5aeafe5b57a8845f807ec1854c0a1b31d1
- Balance
0 ETH
- Transactions
0
- Compiler
solc 0.8.18
- Same code
217 more contracts
Details
- Compiler
- solc 0.8.18+commit.87f61d96
- Language
- solidity
- Optimization
- Yes, 1,000,000 runs
- EVM version
- paris
- License
- GPL-3.0-or-later
- Match
- Partialcreation code: yes, runtime code: yes
- Verified on Sourcify
- Created in block
- 18,862,189
- Creation transaction
- 0xc0f0301795…1e4610767d
src/Agent.sol
// SPDX-License-Identifier: GPL-3.0-or-later
pragma solidity ^0.8.0;
/// @title A user's agent contract created by the router
/// @notice A proxy for delegating calls to the immutable agent implementation contract
contract Agent {
address internal immutable _implementation;
/// @dev Create an initialized agent
constructor(address implementation) {
_implementation = implementation;
(bool ok, ) = implementation.delegatecall(abi.encodeWithSignature('initialize()'));
require(ok);
}
receive() external payable {}
/// @notice Delegate all function calls to `_implementation`
fallback() external payable {
_delegate(_implementation);
}
/// @notice Delegate the call to `_implementation`
/// @dev Referenced from https://github.com/OpenZeppelin/openzeppelin-contracts/blob/v4.8.1/contracts/proxy/Proxy.sol#L22
/// @param implementation The address of the implementation contract that this agent delegates calls to
function _delegate(address implementation) internal {
assembly {
// Copy msg.data. We take full control of memory in this inline assembly
// block because it will not return to Solidity code. We overwrite the
// Solidity scratch pad at memory position 0.
calldatacopy(0, 0, calldatasize())
// Call the implementation.
// out and outsize are 0 because we don't know the size yet.
let result := delegatecall(gas(), implementation, 0, calldatasize(), 0, 0)
// Copy the returned data.
returndatacopy(0, 0, returndatasize())
switch result
// delegatecall returns 0 on error.
case 0 {
revert(0, returndatasize())
}
default {
return(0, returndatasize())
}
}
}
}
Compiler settingsShow
{
"metadata": {
"bytecodeHash": "ipfs"
},
"libraries": {},
"optimizer": {
"runs": 1000000,
"enabled": true
},
"evmVersion": "paris",
"remappings": [
":create3-factory/=lib/create3-factory/src/",
":ds-test/=lib/forge-std/lib/ds-test/src/",
":erc4626-tests/=lib/create3-factory/lib/openzeppelin-contracts/lib/erc4626-tests/",
":forge-gas-snapshot/=lib/permit2/lib/forge-gas-snapshot/src/",
":forge-std/=lib/forge-std/src/",
":openzeppelin-contracts/=lib/openzeppelin-contracts/",
":openzeppelin/=lib/create3-factory/lib/openzeppelin-contracts/contracts/",
":permit2/=lib/permit2/",
":solmate/=lib/permit2/lib/solmate/src/"
]
}Source code and metadata: Sourcify.
The source code belongs to the authors of the contract.