Address Contract Verified
Address
0x3a6b8012d4790988c0fF6c7F045bFc7B35315Ee7
Balance
0 ETH
Nonce
1
Code Size
7199 bytes
Creator
0x3291B1aE...8115 at tx 0xa2df13e4...57b966
Indexed Transactions
0
Contract Bytecode
7199 bytes
0x6080604052600436101561001b575b361561001957600080fd5b005b60003560e01c806301d5062a146101db57806301ffc9a7146101d657806307bd0265146101d1578063134008d3146101cc57806313bc9f20146101c7578063150b7a02146101c2578063248a9ca3146101bd5780632ab0f529146101b85780632f2ff15d146101b357806331d50750146101ae57806336568abe146101a9578063584b153e146101a457806364d623531461019f5780637958004c1461019a5780638065657f146101955780638f2a0bb0146101905780638f61f4f51461018b57806391d1485414610186578063a217fddf14610181578063b08e51c01461017c578063b1c5f42714610177578063bc197c8114610172578063c4d252f51461016d578063d45c443514610168578063d547741f14610163578063e38335e51461015e578063f23a6e61146101595763f27a0c920361000e57610b07565b610ae8565b610a8a565b610a71565b610a56565b610a3e565b610a1f565b6108f8565b61084e565b610833565b6107f8565b6107bf565b61079d565b6106e1565b6106ba565b610651565b610636565b61061d565b610602565b6105e9565b6105ab565b610590565b610556565b610426565b6103f8565b610359565b610321565b6102c4565b6001600160a01b031690565b90565b6001600160a01b0381165b0361020157565b600080fd5b90503590610213826101ef565b565b806101fa565b9050359061021382610215565b909182601f83011215610201578135916001600160401b03831161020157602001926001830284011161020157565b9160c0838303126102015761026c8284610206565b9261027a836020830161021b565b9260408201356001600160401b038111610201578161029a918401610228565b9290936101ec6102ad846060850161021b565b9360a06102bd826080870161021b565b940161021b565b34610201576102e36102d7366004610257565b95949094939193610c86565b604051005b0390f35b6001600160e01b031981166101fa565b90503590610213826102ec565b90602082820312610201576101ec916102fc565b9052565b34610201576102e861033c610337366004610309565b610c95565b60405191829182901515815260200190565b600091031261020157565b346102015761036936600461034e565b6102e87fd8aa0f3194971a2a116679f7c2090f6939c8d4e01a2a8d7e41d55e5351469e635b6040515b9182918290815260200190565b9060a082820312610201576103b48183610206565b926103c2826020850161021b565b926040810135916001600160401b038311610201576103e6846101ec948401610228565b93909460806102bd826060870161021b565b6102e361040636600461039f565b94939093929192610dc5565b90602082820312610201576101ec9161021b565b34610201576102e861033c61043c366004610412565b610dd3565b634e487b7160e01b600052604160045260246000fd5b90601f01601f191681019081106001600160401b0382111761047857604052565b610441565b9061021361048a60405190565b9283610457565b6001600160401b03811161047857602090601f01601f19160190565b0190565b90826000939282370152565b909291926104d26104cd82610491565b61047d565b9381855281830111610201576102139160208501906104b1565b9080601f83011215610201578160206101ec933591016104bd565b906080828203126102015761051c8183610206565b9261052a8260208501610206565b92610538836040830161021b565b9260608201356001600160401b038111610201576101ec92016104ec565b34610201576102e861057561056c366004610507565b92919091610e3a565b604051918291826001600160e01b0319909116815260200190565b34610201576102e861038e6105a6366004610412565b610e75565b34610201576102e861033c6105c1366004610412565b610e94565b9190604083820312610201576101ec9060206105e2828661021b565b9401610206565b34610201576102e36105fc3660046105c6565b90610eca565b34610201576102e861033c610618366004610412565b610ed4565b34610201576102e36106303660046105c6565b90610ef1565b34610201576102e861033c61064c366004610412565b610f29565b34610201576102e3610664366004610412565b610fa9565b634e487b7160e01b600052602160045260246000fd5b6004111561068957565b610669565b906102138261067f565b6101ec9061068e565b61031d90610698565b60208101929161021391906106a1565b34610201576102e86106d56106d0366004610412565b611050565b604051918291826106aa565b34610201576102e861038e6106f736600461039f565b949390939291926110a1565b909182601f83011215610201578135916001600160401b03831161020157602001926020830284011161020157565b9060c0828203126102015781356001600160401b0381116102015781610759918401610703565b92909360208201356001600160401b038111610201578361077b918401610703565b92909360408201356001600160401b038111610201578161029a918401610703565b34610201576102e36107b0366004610732565b97969096959195949294611327565b34610201576107cf36600461034e565b6102e87fb09aa5aeb3702cfd50b6b62bc4532604938f21248a27a1d5ca736082b6819cc161038e565b34610201576102e861033c61080e3660046105c6565b90611342565b6101ec6101ec6101ec9290565b6101ec6000610814565b6101ec610821565b346102015761084336600461034e565b6102e861038e61082b565b346102015761085e36600461034e565b6102e87ffd643c72710c63c0180259aba6b2d05451e3591a24e58b62239378085726f78361038e565b91909160a0818403126102015780356001600160401b03811161020157836108b0918301610703565b92909360208301356001600160401b03811161020157816108d2918501610703565b9290936040810135916001600160401b038311610201576103e6846101ec948401610703565b34610201576102e861038e61090e366004610887565b969590959491949392936114e8565b6001600160401b0381116104785760208091020190565b909291926109446104cd8261091d565b938185526020808601920283019281841161020157915b8383106109685750505050565b60208091610976848661021b565b81520192019161095b565b9080601f83011215610201578160206101ec93359101610934565b91909160a081840312610201576109b38382610206565b926109c18160208401610206565b9260408301356001600160401b03811161020157826109e1918501610981565b9260608101356001600160401b0381116102015783610a01918301610981565b9260808201356001600160401b038111610201576101ec92016104ec565b34610201576102e8610575610a3536600461099c565b93929092611511565b34610201576102e3610a51366004610412565b61162a565b34610201576102e861038e610a6c366004610412565b611633565b34610201576102e3610a843660046105c6565b9061166a565b6102e3610a98366004610887565b969590959491949392936117b8565b91909160a08184031261020157610abe8382610206565b92610acc8160208401610206565b92610ada826040850161021b565b92610a01836060830161021b565b34610201576102e8610575610afe366004610aa7565b939290926117c8565b3461020157610b1736600461034e565b6102e861038e6117e3565b61021396959493929190610b5a7fb09aa5aeb3702cfd50b6b62bc4532604938f21248a27a1d5ca736082b6819cc16117ed565b6117ed565b610bd7565b9190610b7d81610b76816104ad9560209181520190565b80956104b1565b601f01601f191690565b91610bd39161021396989795608095610bbe610bcb94610bb760a089019560008a01906001600160a01b03169052565b6020880152565b8583036040870152610b5f565b966060830152565b0152565b610c397f4cf4410cc57040e44862ef0f45f3dd5a5e02db8eb8add648d4b0e236f1d07dca939597610c19610c0f898b898b89896110a1565b6101ec838261181f565b988996610c266000610814565b98610c3060405190565b96879687610b87565b0390a3610c496101ec6000610814565b8103610c53575050565b610c817f20fda5fd27a1ea7bf5b9567f143ac5470bb059374a27e8f67cb44f946f6d03879161039260405190565b0390a2565b90610213969594939291610b22565b6101ec906118ac565b6101e06101ec6101ec9290565b6101ec90610c9e565b6102139594939291907fd8aa0f3194971a2a116679f7c2090f6939c8d4e01a2a8d7e41d55e5351469e63610cf8610cf4610cee6000610cab565b83611342565b1590565b610d03575b50610d4e565b610d0f90335b906118f2565b38610cfd565b610d416101ec9593949294610d3a606084019660008501906001600160a01b03169052565b6020830152565b6040818503910152610b5f565b907fc2617efa69bab66782fa219543714338489c4e9e178271560a91b82c3f612b5891610d8f610d886102139896959688878987876110a1565b968761192a565b610d9b848684846119e6565b610dbd8694610daa6000610814565b96610db460405190565b94859485610d15565b0390a3611a17565b906102139594939291610cb4565b610de09060005b50611050565b610df3610ded600261068e565b9161068e565b1490565b6101ec906101e0906001600160a01b031682565b6101ec90610df7565b610e2d610e276101ec9263ffffffff1690565b60e01b90565b6001600160e01b03191690565b50505050610e46600090565b506101ec63150b7a02610e14565b905b600052602052604060002090565b6101ec9081565b6101ec9054610e64565b6001610e8e6101ec92610e86600090565b506000610e54565b01610e6b565b610e9f906000610dda565b610df3610ded600361068e565b9061021391610ebd610b5582610e75565b90610ec791611a56565b50565b9061021391610eac565b610edf906000610dda565b610eec610ded600061068e565b141590565b90610efb336101e0565b6001600160a01b03821603610f1357610ec791611ad7565b60405163334bd91960e11b8152600490fd5b0390fd5b610f34906000610dda565b610f3e600161068e565b610f478261068e565b14908115610f53575090565b9050610df3610ded600261068e565b6101ec90610e0b565b9081526040810192916102139160200152565b90600019905b9181191691161790565b90610f9e6101ec610fa592610814565b8254610f7e565b9055565b33610fb66101e030610f62565b6001600160a01b038216036110155750807f11c24f4ead16507c69ac467fbd5e4eed5fb5c699626d2cc6d66421df253886d561021392610ff66002610e6b565b61100b61100260405190565b92839283610f6b565b0390a16002610f8e565b610f259061102260405190565b63e2850c5960e01b8152918291600483016001600160a01b03909116815260200190565b6101ec6001610814565b61105990611633565b6110636000610814565b810361106f5750600090565b61107a6101ec611046565b81036110865750600390565b4290611091565b9190565b111561109c57600190565b600290565b91946110d2946110c692946110b4600090565b50604051978896602088019687610b87565b90810382520382610457565b6110e46110dd825190565b9160200190565b2090565b61021398979695949392919061111d7fb09aa5aeb3702cfd50b6b62bc4532604938f21248a27a1d5ca736082b6819cc16117ed565b6111cb565b908152606081019392610213929091604091610bd390610d3a565b634e487b7160e01b600052603260045260246000fd5b9190811015611163576020020190565b61113d565b356101ec816101ef565b356101ec81610215565b903590601e19368290030182121561020157018035906001600160401b038211610201576020019136829003831361020157565b908210156111635760206111c7920281019061117c565b9091565b9793959194919290809882808b1415801561131d575b6112f457506111f68986868b878c88886114e8565b98611201878b61181f565b61120b6000610814565b8b5b81101561129d57611296818c6112837f4cf4410cc57040e44862ef0f45f3dd5a5e02db8eb8add648d4b0e236f1d07dca8e8e61128d8f8f8f8f9b8f918f61127261120d9f849061126c6112678361127d9961127797611153565b611168565b9a611153565b611172565b976111b0565b97909890565b96610c268a610814565b0390a360010190565b905061120b565b50995050505050505050506112b56101ec6000610814565b82036112bf575050565b610c816112ea7f20fda5fd27a1ea7bf5b9567f143ac5470bb059374a27e8f67cb44f946f6d03879290565b9261039260405190565b8a610f25865b9261130460405190565b6001624fcdef60e01b0319815293849360048501611122565b50848b14156111e1565b9061021398979695949392916110e8565b90610e5690610f62565b6101ec91600061135e61136493611357600090565b5082610e54565b01611338565b5460ff1690565b506101ec906020810190610206565b818352602090920191906000825b828210611396575050505090565b909192936113c56113be6001926113ad888661136b565b6001600160a01b0316815260200190565b9560200190565b93920190611388565b9037565b8183529091602001916001600160fb1b03811161020157829160206104ad92029384916113ce565b906101ec9291610b5f565b9035601e1936839003018112156102015701602081359101916001600160401b0382116102015736829003831361020157565b81835291602001908161144e6020830284019490565b92836000925b8484106114645750505050505090565b909192939495602061149161148a83856001950388526114848b88611405565b906113fa565b9860200190565b940194019294939190611454565b93956114da610bd394610213999b9a986114cc60809995610bcb9760a08b01918b830360008d015261137a565b9188830360208a01526113d2565b918583036040870152611438565b93946110d29691956110c6949893986114ff600090565b50604051998a9860208a01988961149f565b505050505061151e600090565b506101ec63bc197c81610e14565b610213906115597ffd643c72710c63c0180259aba6b2d05451e3591a24e58b62239378085726f7836117ed565b611597565b9160001960089290920291821b911b610f84565b91906115836101ec610fa593610814565b90835461155e565b61021391600091611572565b6115a3610cf482610f29565b6115f157806101ec60006115bb6115c0946001610e54565b61158b565b7fbaa1eb22f2a492ba1a5fea61b8df4d27c6c8b5f3971e63bb58fa14ff72eedb706115ea60405190565b8080610c81565b6115fb6001611b4c565b610f256116086002611b4c565b9261161260405190565b635ead8eb560e01b8152938493179060048401610f6b565b6102139061152c565b61164a6101ec91611642600090565b506001610e54565b610e6b565b9061021391611660610b5582610e75565b90610ec791611ad7565b906102139161164f565b61021397969594939291907fd8aa0f3194971a2a116679f7c2090f6939c8d4e01a2a8d7e41d55e5351469e636116b0610cf4610cee6000610cab565b6116bb575b506116cb565b6116c59033610d09565b386116b5565b90919493976116d78390565b9784808a141580156117ae575b6117a457506116fc6117039189888d898c8a8a6114e8565b978861192a565b61170d6000610814565b885b8110156117925761178b81896117817fc2617efa69bab66782fa219543714338489c4e9e178271560a91b82c3f612b588e8c61128d611772878f8f8f8f9d61176c9261170f9f611267836112729561176693611153565b98611153565b956111b0565b9590966101ec878987876119e6565b94610daa88610814565b905061170d565b50975050505050506102139150611a17565b89610f25886112fa565b50868a14156116e4565b9061021397969594939291611674565b50505050506117d5600090565b506101ec63f23a6e61610e14565b6101ec6002610e6b565b6102139033610d09565b634e487b7160e01b600052601160045260246000fd5b9190820180921161181a57565b6117f7565b9061182982610ed4565b61187e576118356117e3565b80821061185b57509061185661184e610213934261180d565b916001610e54565b610f8e565b90610f2561186860405190565b635433660960e01b815292839260048401610f6b565b506118896000611b4c565b90610f2561189660405190565b635ead8eb560e01b815292839260048401610f6b565b630271189760e51b6001600160e01b03198216149081156118cb575090565b6101ec9150611b78565b6001600160a01b0390911681526040810192916102139160200152565b90611900610cf48284611342565b611908575050565b610f2561191460405190565b63e2517d3f60e01b8152928392600484016118d5565b611936610cf482610dd3565b61199157506119486101ec6000610814565b8114158061197f575b6119585750565b610f259061196560405190565b63121534c360e31b81529182916004830190815260200190565b5061198c610cf482610e94565b611951565b6118896002611b4c565b90916104ad90839080936104b1565b90916101ec9261199b565b906119c26104cd83610491565b918252565b3d156119e1576119d63d6119b5565b903d6000602084013e565b606090565b610ec793600093928493611a056119fc60405190565b938492836119aa565b03925af1611a116119c7565b90611bb2565b611a23610cf482610dd3565b611991576102139061185661184e611046565b9060ff90610f84565b90611a4f6101ec610fa592151590565b8254611a36565b611a63610cf48383611342565b15611ad057611a826001611a7d84600061135e8682610e54565b611a3f565b611a9c611a96611a90339390565b93610f62565b91610f62565b917f2f8788117e7eff1d82e926ec794901d17c78024a50270940304540a733656f0d611ac760405190565b600090a4600190565b5050600090565b611ae18282611342565b15611ad057611afa6000611a7d848261135e8682610e54565b611b08611a96611a90339390565b917ff6391f5c32d9c69d2a47ea670b442974b53935d1edc7fd64eb21e047a839171b611ac760405190565b6101ec90611b4761108d6101ec9460ff1690565b901b90565b611b73611b646101ec92611b5e600090565b50610698565b611b6e6001610814565b611b33565b610814565b637965db0b60e01b6001600160e01b0319821614908115611b97575090565b6101ec91506001600160e01b0319166301ffc9a760e01b1490565b90919061021357508051611bc961108d6000610814565b1115611bd757805190602001fd5b604051630a12f52160e11b8152600490fdfea2646970667358221220d2343e71ab51fc607f2a1b47748a6ec7873a961148c764d3cd6c9150e4f2ee1564736f6c63430008180033
Verified Source Code Full Match
Compiler: v0.8.24+commit.e11b9ed9
EVM: paris
Address.sol 159 lines
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v5.0.0) (utils/Address.sol)
pragma solidity ^0.8.20;
/**
* @dev Collection of functions related to the address type
*/
library Address {
/**
* @dev The ETH balance of the account is not enough to perform the operation.
*/
error AddressInsufficientBalance(address account);
/**
* @dev There's no code at `target` (it is not a contract).
*/
error AddressEmptyCode(address target);
/**
* @dev A call to an address target failed. The target may have reverted.
*/
error FailedInnerCall();
/**
* @dev Replacement for Solidity's `transfer`: sends `amount` wei to
* `recipient`, forwarding all available gas and reverting on errors.
*
* https://eips.ethereum.org/EIPS/eip-1884[EIP1884] increases the gas cost
* of certain opcodes, possibly making contracts go over the 2300 gas limit
* imposed by `transfer`, making them unable to receive funds via
* `transfer`. {sendValue} removes this limitation.
*
* https://consensys.net/diligence/blog/2019/09/stop-using-soliditys-transfer-now/[Learn more].
*
* IMPORTANT: because control is transferred to `recipient`, care must be
* taken to not create reentrancy vulnerabilities. Consider using
* {ReentrancyGuard} or the
* https://solidity.readthedocs.io/en/v0.8.20/security-considerations.html#use-the-checks-effects-interactions-pattern[checks-effects-interactions pattern].
*/
function sendValue(address payable recipient, uint256 amount) internal {
if (address(this).balance < amount) {
revert AddressInsufficientBalance(address(this));
}
(bool success, ) = recipient.call{value: amount}("");
if (!success) {
revert FailedInnerCall();
}
}
/**
* @dev Performs a Solidity function call using a low level `call`. A
* plain `call` is an unsafe replacement for a function call: use this
* function instead.
*
* If `target` reverts with a revert reason or custom error, it is bubbled
* up by this function (like regular Solidity function calls). However, if
* the call reverted with no returned reason, this function reverts with a
* {FailedInnerCall} error.
*
* Returns the raw returned data. To convert to the expected return value,
* use https://solidity.readthedocs.io/en/latest/units-and-global-variables.html?highlight=abi.decode#abi-encoding-and-decoding-functions[`abi.decode`].
*
* Requirements:
*
* - `target` must be a contract.
* - calling `target` with `data` must not revert.
*/
function functionCall(address target, bytes memory data) internal returns (bytes memory) {
return functionCallWithValue(target, data, 0);
}
/**
* @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`],
* but also transferring `value` wei to `target`.
*
* Requirements:
*
* - the calling contract must have an ETH balance of at least `value`.
* - the called Solidity function must be `payable`.
*/
function functionCallWithValue(address target, bytes memory data, uint256 value) internal returns (bytes memory) {
if (address(this).balance < value) {
revert AddressInsufficientBalance(address(this));
}
(bool success, bytes memory returndata) = target.call{value: value}(data);
return verifyCallResultFromTarget(target, success, returndata);
}
/**
* @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`],
* but performing a static call.
*/
function functionStaticCall(address target, bytes memory data) internal view returns (bytes memory) {
(bool success, bytes memory returndata) = target.staticcall(data);
return verifyCallResultFromTarget(target, success, returndata);
}
/**
* @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`],
* but performing a delegate call.
*/
function functionDelegateCall(address target, bytes memory data) internal returns (bytes memory) {
(bool success, bytes memory returndata) = target.delegatecall(data);
return verifyCallResultFromTarget(target, success, returndata);
}
/**
* @dev Tool to verify that a low level call to smart-contract was successful, and reverts if the target
* was not a contract or bubbling up the revert reason (falling back to {FailedInnerCall}) in case of an
* unsuccessful call.
*/
function verifyCallResultFromTarget(
address target,
bool success,
bytes memory returndata
) internal view returns (bytes memory) {
if (!success) {
_revert(returndata);
} else {
// only check if target is a contract if the call was successful and the return data is empty
// otherwise we already know that it was a contract
if (returndata.length == 0 && target.code.length == 0) {
revert AddressEmptyCode(target);
}
return returndata;
}
}
/**
* @dev Tool to verify that a low level call was successful, and reverts if it wasn't, either by bubbling the
* revert reason or with a default {FailedInnerCall} error.
*/
function verifyCallResult(bool success, bytes memory returndata) internal pure returns (bytes memory) {
if (!success) {
_revert(returndata);
} else {
return returndata;
}
}
/**
* @dev Reverts with returndata if present. Otherwise reverts with {FailedInnerCall}.
*/
function _revert(bytes memory returndata) private pure {
// Look for revert reason and bubble it up if present
if (returndata.length > 0) {
// The easiest way to bubble the revert reason is using memory via assembly
/// @solidity memory-safe-assembly
assembly {
let returndata_size := mload(returndata)
revert(add(32, returndata), returndata_size)
}
} else {
revert FailedInnerCall();
}
}
}
Context.sol 28 lines
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v5.0.1) (utils/Context.sol)
pragma solidity ^0.8.20;
/**
* @dev Provides information about the current execution context, including the
* sender of the transaction and its data. While these are generally available
* via msg.sender and msg.data, they should not be accessed in such a direct
* manner, since when dealing with meta-transactions the account sending and
* paying for execution may not be the actual sender (as far as an application
* is concerned).
*
* This contract is only required for intermediate, library-like contracts.
*/
abstract contract Context {
function _msgSender() internal view virtual returns (address) {
return msg.sender;
}
function _msgData() internal view virtual returns (bytes calldata) {
return msg.data;
}
function _contextSuffixLength() internal view virtual returns (uint256) {
return 0;
}
}
AccessControl.sol 209 lines
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v5.0.0) (access/AccessControl.sol)
pragma solidity ^0.8.20;
import {IAccessControl} from "./IAccessControl.sol";
import {Context} from "../utils/Context.sol";
import {ERC165} from "../utils/introspection/ERC165.sol";
/**
* @dev Contract module that allows children to implement role-based access
* control mechanisms. This is a lightweight version that doesn't allow enumerating role
* members except through off-chain means by accessing the contract event logs. Some
* applications may benefit from on-chain enumerability, for those cases see
* {AccessControlEnumerable}.
*
* Roles are referred to by their `bytes32` identifier. These should be exposed
* in the external API and be unique. The best way to achieve this is by
* using `public constant` hash digests:
*
* ```solidity
* bytes32 public constant MY_ROLE = keccak256("MY_ROLE");
* ```
*
* Roles can be used to represent a set of permissions. To restrict access to a
* function call, use {hasRole}:
*
* ```solidity
* function foo() public {
* require(hasRole(MY_ROLE, msg.sender));
* ...
* }
* ```
*
* Roles can be granted and revoked dynamically via the {grantRole} and
* {revokeRole} functions. Each role has an associated admin role, and only
* accounts that have a role's admin role can call {grantRole} and {revokeRole}.
*
* By default, the admin role for all roles is `DEFAULT_ADMIN_ROLE`, which means
* that only accounts with this role will be able to grant or revoke other
* roles. More complex role relationships can be created by using
* {_setRoleAdmin}.
*
* WARNING: The `DEFAULT_ADMIN_ROLE` is also its own admin: it has permission to
* grant and revoke this role. Extra precautions should be taken to secure
* accounts that have been granted it. We recommend using {AccessControlDefaultAdminRules}
* to enforce additional security measures for this role.
*/
abstract contract AccessControl is Context, IAccessControl, ERC165 {
struct RoleData {
mapping(address account => bool) hasRole;
bytes32 adminRole;
}
mapping(bytes32 role => RoleData) private _roles;
bytes32 public constant DEFAULT_ADMIN_ROLE = 0x00;
/**
* @dev Modifier that checks that an account has a specific role. Reverts
* with an {AccessControlUnauthorizedAccount} error including the required role.
*/
modifier onlyRole(bytes32 role) {
_checkRole(role);
_;
}
/**
* @dev See {IERC165-supportsInterface}.
*/
function supportsInterface(bytes4 interfaceId) public view virtual override returns (bool) {
return interfaceId == type(IAccessControl).interfaceId || super.supportsInterface(interfaceId);
}
/**
* @dev Returns `true` if `account` has been granted `role`.
*/
function hasRole(bytes32 role, address account) public view virtual returns (bool) {
return _roles[role].hasRole[account];
}
/**
* @dev Reverts with an {AccessControlUnauthorizedAccount} error if `_msgSender()`
* is missing `role`. Overriding this function changes the behavior of the {onlyRole} modifier.
*/
function _checkRole(bytes32 role) internal view virtual {
_checkRole(role, _msgSender());
}
/**
* @dev Reverts with an {AccessControlUnauthorizedAccount} error if `account`
* is missing `role`.
*/
function _checkRole(bytes32 role, address account) internal view virtual {
if (!hasRole(role, account)) {
revert AccessControlUnauthorizedAccount(account, role);
}
}
/**
* @dev Returns the admin role that controls `role`. See {grantRole} and
* {revokeRole}.
*
* To change a role's admin, use {_setRoleAdmin}.
*/
function getRoleAdmin(bytes32 role) public view virtual returns (bytes32) {
return _roles[role].adminRole;
}
/**
* @dev Grants `role` to `account`.
*
* If `account` had not been already granted `role`, emits a {RoleGranted}
* event.
*
* Requirements:
*
* - the caller must have ``role``'s admin role.
*
* May emit a {RoleGranted} event.
*/
function grantRole(bytes32 role, address account) public virtual onlyRole(getRoleAdmin(role)) {
_grantRole(role, account);
}
/**
* @dev Revokes `role` from `account`.
*
* If `account` had been granted `role`, emits a {RoleRevoked} event.
*
* Requirements:
*
* - the caller must have ``role``'s admin role.
*
* May emit a {RoleRevoked} event.
*/
function revokeRole(bytes32 role, address account) public virtual onlyRole(getRoleAdmin(role)) {
_revokeRole(role, account);
}
/**
* @dev Revokes `role` from the calling account.
*
* Roles are often managed via {grantRole} and {revokeRole}: this function's
* purpose is to provide a mechanism for accounts to lose their privileges
* if they are compromised (such as when a trusted device is misplaced).
*
* If the calling account had been revoked `role`, emits a {RoleRevoked}
* event.
*
* Requirements:
*
* - the caller must be `callerConfirmation`.
*
* May emit a {RoleRevoked} event.
*/
function renounceRole(bytes32 role, address callerConfirmation) public virtual {
if (callerConfirmation != _msgSender()) {
revert AccessControlBadConfirmation();
}
_revokeRole(role, callerConfirmation);
}
/**
* @dev Sets `adminRole` as ``role``'s admin role.
*
* Emits a {RoleAdminChanged} event.
*/
function _setRoleAdmin(bytes32 role, bytes32 adminRole) internal virtual {
bytes32 previousAdminRole = getRoleAdmin(role);
_roles[role].adminRole = adminRole;
emit RoleAdminChanged(role, previousAdminRole, adminRole);
}
/**
* @dev Attempts to grant `role` to `account` and returns a boolean indicating if `role` was granted.
*
* Internal function without access restriction.
*
* May emit a {RoleGranted} event.
*/
function _grantRole(bytes32 role, address account) internal virtual returns (bool) {
if (!hasRole(role, account)) {
_roles[role].hasRole[account] = true;
emit RoleGranted(role, account, _msgSender());
return true;
} else {
return false;
}
}
/**
* @dev Attempts to revoke `role` to `account` and returns a boolean indicating if `role` was revoked.
*
* Internal function without access restriction.
*
* May emit a {RoleRevoked} event.
*/
function _revokeRole(bytes32 role, address account) internal virtual returns (bool) {
if (hasRole(role, account)) {
_roles[role].hasRole[account] = false;
emit RoleRevoked(role, account, _msgSender());
return true;
} else {
return false;
}
}
}
IAccessControl.sol 98 lines
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v5.0.0) (access/IAccessControl.sol)
pragma solidity ^0.8.20;
/**
* @dev External interface of AccessControl declared to support ERC165 detection.
*/
interface IAccessControl {
/**
* @dev The `account` is missing a role.
*/
error AccessControlUnauthorizedAccount(address account, bytes32 neededRole);
/**
* @dev The caller of a function is not the expected one.
*
* NOTE: Don't confuse with {AccessControlUnauthorizedAccount}.
*/
error AccessControlBadConfirmation();
/**
* @dev Emitted when `newAdminRole` is set as ``role``'s admin role, replacing `previousAdminRole`
*
* `DEFAULT_ADMIN_ROLE` is the starting admin for all roles, despite
* {RoleAdminChanged} not being emitted signaling this.
*/
event RoleAdminChanged(bytes32 indexed role, bytes32 indexed previousAdminRole, bytes32 indexed newAdminRole);
/**
* @dev Emitted when `account` is granted `role`.
*
* `sender` is the account that originated the contract call, an admin role
* bearer except when using {AccessControl-_setupRole}.
*/
event RoleGranted(bytes32 indexed role, address indexed account, address indexed sender);
/**
* @dev Emitted when `account` is revoked `role`.
*
* `sender` is the account that originated the contract call:
* - if using `revokeRole`, it is the admin role bearer
* - if using `renounceRole`, it is the role bearer (i.e. `account`)
*/
event RoleRevoked(bytes32 indexed role, address indexed account, address indexed sender);
/**
* @dev Returns `true` if `account` has been granted `role`.
*/
function hasRole(bytes32 role, address account) external view returns (bool);
/**
* @dev Returns the admin role that controls `role`. See {grantRole} and
* {revokeRole}.
*
* To change a role's admin, use {AccessControl-_setRoleAdmin}.
*/
function getRoleAdmin(bytes32 role) external view returns (bytes32);
/**
* @dev Grants `role` to `account`.
*
* If `account` had not been already granted `role`, emits a {RoleGranted}
* event.
*
* Requirements:
*
* - the caller must have ``role``'s admin role.
*/
function grantRole(bytes32 role, address account) external;
/**
* @dev Revokes `role` from `account`.
*
* If `account` had been granted `role`, emits a {RoleRevoked} event.
*
* Requirements:
*
* - the caller must have ``role``'s admin role.
*/
function revokeRole(bytes32 role, address account) external;
/**
* @dev Revokes `role` from the calling account.
*
* Roles are often managed via {grantRole} and {revokeRole}: this function's
* purpose is to provide a mechanism for accounts to lose their privileges
* if they are compromised (such as when a trusted device is misplaced).
*
* If the calling account had been granted `role`, emits a {RoleRevoked}
* event.
*
* Requirements:
*
* - the caller must be `callerConfirmation`.
*/
function renounceRole(bytes32 role, address callerConfirmation) external;
}
ERC165.sol 27 lines
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v5.0.0) (utils/introspection/ERC165.sol)
pragma solidity ^0.8.20;
import {IERC165} from "./IERC165.sol";
/**
* @dev Implementation of the {IERC165} interface.
*
* Contracts that want to implement ERC165 should inherit from this contract and override {supportsInterface} to check
* for the additional interface id that will be supported. For example:
*
* ```solidity
* function supportsInterface(bytes4 interfaceId) public view virtual override returns (bool) {
* return interfaceId == type(MyInterface).interfaceId || super.supportsInterface(interfaceId);
* }
* ```
*/
abstract contract ERC165 is IERC165 {
/**
* @dev See {IERC165-supportsInterface}.
*/
function supportsInterface(bytes4 interfaceId) public view virtual returns (bool) {
return interfaceId == type(IERC165).interfaceId;
}
}
IERC165.sol 25 lines
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v5.0.0) (utils/introspection/IERC165.sol)
pragma solidity ^0.8.20;
/**
* @dev Interface of the ERC165 standard, as defined in the
* https://eips.ethereum.org/EIPS/eip-165[EIP].
*
* Implementers can declare support of contract interfaces, which can then be
* queried by others ({ERC165Checker}).
*
* For an implementation, see {ERC165}.
*/
interface IERC165 {
/**
* @dev Returns true if this contract implements the interface defined by
* `interfaceId`. See the corresponding
* https://eips.ethereum.org/EIPS/eip-165#how-interfaces-are-identified[EIP section]
* to learn more about how these ids are created.
*
* This function call must use less than 30 000 gas.
*/
function supportsInterface(bytes4 interfaceId) external view returns (bool);
}
IERC721Receiver.sol 28 lines
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v5.0.0) (token/ERC721/IERC721Receiver.sol)
pragma solidity ^0.8.20;
/**
* @title ERC721 token receiver interface
* @dev Interface for any contract that wants to support safeTransfers
* from ERC721 asset contracts.
*/
interface IERC721Receiver {
/**
* @dev Whenever an {IERC721} `tokenId` token is transferred to this contract via {IERC721-safeTransferFrom}
* by `operator` from `from`, this function is called.
*
* It must return its Solidity selector to confirm the token transfer.
* If any other value is returned or the interface is not implemented by the recipient, the transfer will be
* reverted.
*
* The selector can be obtained in Solidity with `IERC721Receiver.onERC721Received.selector`.
*/
function onERC721Received(
address operator,
address from,
uint256 tokenId,
bytes calldata data
) external returns (bytes4);
}
TimelockController.sol 472 lines
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v5.0.0) (governance/TimelockController.sol)
pragma solidity ^0.8.20;
import {AccessControl} from "../access/AccessControl.sol";
import {ERC721Holder} from "../token/ERC721/utils/ERC721Holder.sol";
import {ERC1155Holder} from "../token/ERC1155/utils/ERC1155Holder.sol";
import {Address} from "../utils/Address.sol";
/**
* @dev Contract module which acts as a timelocked controller. When set as the
* owner of an `Ownable` smart contract, it enforces a timelock on all
* `onlyOwner` maintenance operations. This gives time for users of the
* controlled contract to exit before a potentially dangerous maintenance
* operation is applied.
*
* By default, this contract is self administered, meaning administration tasks
* have to go through the timelock process. The proposer (resp executor) role
* is in charge of proposing (resp executing) operations. A common use case is
* to position this {TimelockController} as the owner of a smart contract, with
* a multisig or a DAO as the sole proposer.
*/
contract TimelockController is AccessControl, ERC721Holder, ERC1155Holder {
bytes32 public constant PROPOSER_ROLE = keccak256("PROPOSER_ROLE");
bytes32 public constant EXECUTOR_ROLE = keccak256("EXECUTOR_ROLE");
bytes32 public constant CANCELLER_ROLE = keccak256("CANCELLER_ROLE");
uint256 internal constant _DONE_TIMESTAMP = uint256(1);
mapping(bytes32 id => uint256) private _timestamps;
uint256 private _minDelay;
enum OperationState {
Unset,
Waiting,
Ready,
Done
}
/**
* @dev Mismatch between the parameters length for an operation call.
*/
error TimelockInvalidOperationLength(uint256 targets, uint256 payloads, uint256 values);
/**
* @dev The schedule operation doesn't meet the minimum delay.
*/
error TimelockInsufficientDelay(uint256 delay, uint256 minDelay);
/**
* @dev The current state of an operation is not as required.
* The `expectedStates` is a bitmap with the bits enabled for each OperationState enum position
* counting from right to left.
*
* See {_encodeStateBitmap}.
*/
error TimelockUnexpectedOperationState(bytes32 operationId, bytes32 expectedStates);
/**
* @dev The predecessor to an operation not yet done.
*/
error TimelockUnexecutedPredecessor(bytes32 predecessorId);
/**
* @dev The caller account is not authorized.
*/
error TimelockUnauthorizedCaller(address caller);
/**
* @dev Emitted when a call is scheduled as part of operation `id`.
*/
event CallScheduled(
bytes32 indexed id,
uint256 indexed index,
address target,
uint256 value,
bytes data,
bytes32 predecessor,
uint256 delay
);
/**
* @dev Emitted when a call is performed as part of operation `id`.
*/
event CallExecuted(bytes32 indexed id, uint256 indexed index, address target, uint256 value, bytes data);
/**
* @dev Emitted when new proposal is scheduled with non-zero salt.
*/
event CallSalt(bytes32 indexed id, bytes32 salt);
/**
* @dev Emitted when operation `id` is cancelled.
*/
event Cancelled(bytes32 indexed id);
/**
* @dev Emitted when the minimum delay for future operations is modified.
*/
event MinDelayChange(uint256 oldDuration, uint256 newDuration);
/**
* @dev Initializes the contract with the following parameters:
*
* - `minDelay`: initial minimum delay in seconds for operations
* - `proposers`: accounts to be granted proposer and canceller roles
* - `executors`: accounts to be granted executor role
* - `admin`: optional account to be granted admin role; disable with zero address
*
* IMPORTANT: The optional admin can aid with initial configuration of roles after deployment
* without being subject to delay, but this role should be subsequently renounced in favor of
* administration through timelocked proposals. Previous versions of this contract would assign
* this admin to the deployer automatically and should be renounced as well.
*/
constructor(uint256 minDelay, address[] memory proposers, address[] memory executors, address admin) {
// self administration
_grantRole(DEFAULT_ADMIN_ROLE, address(this));
// optional admin
if (admin != address(0)) {
_grantRole(DEFAULT_ADMIN_ROLE, admin);
}
// register proposers and cancellers
for (uint256 i = 0; i < proposers.length; ++i) {
_grantRole(PROPOSER_ROLE, proposers[i]);
_grantRole(CANCELLER_ROLE, proposers[i]);
}
// register executors
for (uint256 i = 0; i < executors.length; ++i) {
_grantRole(EXECUTOR_ROLE, executors[i]);
}
_minDelay = minDelay;
emit MinDelayChange(0, minDelay);
}
/**
* @dev Modifier to make a function callable only by a certain role. In
* addition to checking the sender's role, `address(0)` 's role is also
* considered. Granting a role to `address(0)` is equivalent to enabling
* this role for everyone.
*/
modifier onlyRoleOrOpenRole(bytes32 role) {
if (!hasRole(role, address(0))) {
_checkRole(role, _msgSender());
}
_;
}
/**
* @dev Contract might receive/hold ETH as part of the maintenance process.
*/
receive() external payable {}
/**
* @dev See {IERC165-supportsInterface}.
*/
function supportsInterface(
bytes4 interfaceId
) public view virtual override(AccessControl, ERC1155Holder) returns (bool) {
return super.supportsInterface(interfaceId);
}
/**
* @dev Returns whether an id corresponds to a registered operation. This
* includes both Waiting, Ready, and Done operations.
*/
function isOperation(bytes32 id) public view returns (bool) {
return getOperationState(id) != OperationState.Unset;
}
/**
* @dev Returns whether an operation is pending or not. Note that a "pending" operation may also be "ready".
*/
function isOperationPending(bytes32 id) public view returns (bool) {
OperationState state = getOperationState(id);
return state == OperationState.Waiting || state == OperationState.Ready;
}
/**
* @dev Returns whether an operation is ready for execution. Note that a "ready" operation is also "pending".
*/
function isOperationReady(bytes32 id) public view returns (bool) {
return getOperationState(id) == OperationState.Ready;
}
/**
* @dev Returns whether an operation is done or not.
*/
function isOperationDone(bytes32 id) public view returns (bool) {
return getOperationState(id) == OperationState.Done;
}
/**
* @dev Returns the timestamp at which an operation becomes ready (0 for
* unset operations, 1 for done operations).
*/
function getTimestamp(bytes32 id) public view virtual returns (uint256) {
return _timestamps[id];
}
/**
* @dev Returns operation state.
*/
function getOperationState(bytes32 id) public view virtual returns (OperationState) {
uint256 timestamp = getTimestamp(id);
if (timestamp == 0) {
return OperationState.Unset;
} else if (timestamp == _DONE_TIMESTAMP) {
return OperationState.Done;
} else if (timestamp > block.timestamp) {
return OperationState.Waiting;
} else {
return OperationState.Ready;
}
}
/**
* @dev Returns the minimum delay in seconds for an operation to become valid.
*
* This value can be changed by executing an operation that calls `updateDelay`.
*/
function getMinDelay() public view virtual returns (uint256) {
return _minDelay;
}
/**
* @dev Returns the identifier of an operation containing a single
* transaction.
*/
function hashOperation(
address target,
uint256 value,
bytes calldata data,
bytes32 predecessor,
bytes32 salt
) public pure virtual returns (bytes32) {
return keccak256(abi.encode(target, value, data, predecessor, salt));
}
/**
* @dev Returns the identifier of an operation containing a batch of
* transactions.
*/
function hashOperationBatch(
address[] calldata targets,
uint256[] calldata values,
bytes[] calldata payloads,
bytes32 predecessor,
bytes32 salt
) public pure virtual returns (bytes32) {
return keccak256(abi.encode(targets, values, payloads, predecessor, salt));
}
/**
* @dev Schedule an operation containing a single transaction.
*
* Emits {CallSalt} if salt is nonzero, and {CallScheduled}.
*
* Requirements:
*
* - the caller must have the 'proposer' role.
*/
function schedule(
address target,
uint256 value,
bytes calldata data,
bytes32 predecessor,
bytes32 salt,
uint256 delay
) public virtual onlyRole(PROPOSER_ROLE) {
bytes32 id = hashOperation(target, value, data, predecessor, salt);
_schedule(id, delay);
emit CallScheduled(id, 0, target, value, data, predecessor, delay);
if (salt != bytes32(0)) {
emit CallSalt(id, salt);
}
}
/**
* @dev Schedule an operation containing a batch of transactions.
*
* Emits {CallSalt} if salt is nonzero, and one {CallScheduled} event per transaction in the batch.
*
* Requirements:
*
* - the caller must have the 'proposer' role.
*/
function scheduleBatch(
address[] calldata targets,
uint256[] calldata values,
bytes[] calldata payloads,
bytes32 predecessor,
bytes32 salt,
uint256 delay
) public virtual onlyRole(PROPOSER_ROLE) {
if (targets.length != values.length || targets.length != payloads.length) {
revert TimelockInvalidOperationLength(targets.length, payloads.length, values.length);
}
bytes32 id = hashOperationBatch(targets, values, payloads, predecessor, salt);
_schedule(id, delay);
for (uint256 i = 0; i < targets.length; ++i) {
emit CallScheduled(id, i, targets[i], values[i], payloads[i], predecessor, delay);
}
if (salt != bytes32(0)) {
emit CallSalt(id, salt);
}
}
/**
* @dev Schedule an operation that is to become valid after a given delay.
*/
function _schedule(bytes32 id, uint256 delay) private {
if (isOperation(id)) {
revert TimelockUnexpectedOperationState(id, _encodeStateBitmap(OperationState.Unset));
}
uint256 minDelay = getMinDelay();
if (delay < minDelay) {
revert TimelockInsufficientDelay(delay, minDelay);
}
_timestamps[id] = block.timestamp + delay;
}
/**
* @dev Cancel an operation.
*
* Requirements:
*
* - the caller must have the 'canceller' role.
*/
function cancel(bytes32 id) public virtual onlyRole(CANCELLER_ROLE) {
if (!isOperationPending(id)) {
revert TimelockUnexpectedOperationState(
id,
_encodeStateBitmap(OperationState.Waiting) | _encodeStateBitmap(OperationState.Ready)
);
}
delete _timestamps[id];
emit Cancelled(id);
}
/**
* @dev Execute an (ready) operation containing a single transaction.
*
* Emits a {CallExecuted} event.
*
* Requirements:
*
* - the caller must have the 'executor' role.
*/
// This function can reenter, but it doesn't pose a risk because _afterCall checks that the proposal is pending,
// thus any modifications to the operation during reentrancy should be caught.
// slither-disable-next-line reentrancy-eth
function execute(
address target,
uint256 value,
bytes calldata payload,
bytes32 predecessor,
bytes32 salt
) public payable virtual onlyRoleOrOpenRole(EXECUTOR_ROLE) {
bytes32 id = hashOperation(target, value, payload, predecessor, salt);
_beforeCall(id, predecessor);
_execute(target, value, payload);
emit CallExecuted(id, 0, target, value, payload);
_afterCall(id);
}
/**
* @dev Execute an (ready) operation containing a batch of transactions.
*
* Emits one {CallExecuted} event per transaction in the batch.
*
* Requirements:
*
* - the caller must have the 'executor' role.
*/
// This function can reenter, but it doesn't pose a risk because _afterCall checks that the proposal is pending,
// thus any modifications to the operation during reentrancy should be caught.
// slither-disable-next-line reentrancy-eth
function executeBatch(
address[] calldata targets,
uint256[] calldata values,
bytes[] calldata payloads,
bytes32 predecessor,
bytes32 salt
) public payable virtual onlyRoleOrOpenRole(EXECUTOR_ROLE) {
if (targets.length != values.length || targets.length != payloads.length) {
revert TimelockInvalidOperationLength(targets.length, payloads.length, values.length);
}
bytes32 id = hashOperationBatch(targets, values, payloads, predecessor, salt);
_beforeCall(id, predecessor);
for (uint256 i = 0; i < targets.length; ++i) {
address target = targets[i];
uint256 value = values[i];
bytes calldata payload = payloads[i];
_execute(target, value, payload);
emit CallExecuted(id, i, target, value, payload);
}
_afterCall(id);
}
/**
* @dev Execute an operation's call.
*/
function _execute(address target, uint256 value, bytes calldata data) internal virtual {
(bool success, bytes memory returndata) = target.call{value: value}(data);
Address.verifyCallResult(success, returndata);
}
/**
* @dev Checks before execution of an operation's calls.
*/
function _beforeCall(bytes32 id, bytes32 predecessor) private view {
if (!isOperationReady(id)) {
revert TimelockUnexpectedOperationState(id, _encodeStateBitmap(OperationState.Ready));
}
if (predecessor != bytes32(0) && !isOperationDone(predecessor)) {
revert TimelockUnexecutedPredecessor(predecessor);
}
}
/**
* @dev Checks after execution of an operation's calls.
*/
function _afterCall(bytes32 id) private {
if (!isOperationReady(id)) {
revert TimelockUnexpectedOperationState(id, _encodeStateBitmap(OperationState.Ready));
}
_timestamps[id] = _DONE_TIMESTAMP;
}
/**
* @dev Changes the minimum timelock duration for future operations.
*
* Emits a {MinDelayChange} event.
*
* Requirements:
*
* - the caller must be the timelock itself. This can only be achieved by scheduling and later executing
* an operation where the timelock is the target and the data is the ABI-encoded call to this function.
*/
function updateDelay(uint256 newDelay) external virtual {
address sender = _msgSender();
if (sender != address(this)) {
revert TimelockUnauthorizedCaller(sender);
}
emit MinDelayChange(_minDelay, newDelay);
_minDelay = newDelay;
}
/**
* @dev Encodes a `OperationState` into a `bytes32` representation where each bit enabled corresponds to
* the underlying position in the `OperationState` enum. For example:
*
* 0x000...1000
* ^^^^^^----- ...
* ^---- Done
* ^--- Ready
* ^-- Waiting
* ^- Unset
*/
function _encodeStateBitmap(OperationState operationState) internal pure returns (bytes32) {
return bytes32(1 << uint8(operationState));
}
}
IERC1155Receiver.sol 59 lines
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v5.0.0) (token/ERC1155/IERC1155Receiver.sol)
pragma solidity ^0.8.20;
import {IERC165} from "../../utils/introspection/IERC165.sol";
/**
* @dev Interface that must be implemented by smart contracts in order to receive
* ERC-1155 token transfers.
*/
interface IERC1155Receiver is IERC165 {
/**
* @dev Handles the receipt of a single ERC1155 token type. This function is
* called at the end of a `safeTransferFrom` after the balance has been updated.
*
* NOTE: To accept the transfer, this must return
* `bytes4(keccak256("onERC1155Received(address,address,uint256,uint256,bytes)"))`
* (i.e. 0xf23a6e61, or its own function selector).
*
* @param operator The address which initiated the transfer (i.e. msg.sender)
* @param from The address which previously owned the token
* @param id The ID of the token being transferred
* @param value The amount of tokens being transferred
* @param data Additional data with no specified format
* @return `bytes4(keccak256("onERC1155Received(address,address,uint256,uint256,bytes)"))` if transfer is allowed
*/
function onERC1155Received(
address operator,
address from,
uint256 id,
uint256 value,
bytes calldata data
) external returns (bytes4);
/**
* @dev Handles the receipt of a multiple ERC1155 token types. This function
* is called at the end of a `safeBatchTransferFrom` after the balances have
* been updated.
*
* NOTE: To accept the transfer(s), this must return
* `bytes4(keccak256("onERC1155BatchReceived(address,address,uint256[],uint256[],bytes)"))`
* (i.e. 0xbc197c81, or its own function selector).
*
* @param operator The address which initiated the batch transfer (i.e. msg.sender)
* @param from The address which previously owned the token
* @param ids An array containing ids of each token being transferred (order and length must match values array)
* @param values An array containing amounts of each token being transferred (order and length must match ids array)
* @param data Additional data with no specified format
* @return `bytes4(keccak256("onERC1155BatchReceived(address,address,uint256[],uint256[],bytes)"))` if transfer is allowed
*/
function onERC1155BatchReceived(
address operator,
address from,
uint256[] calldata ids,
uint256[] calldata values,
bytes calldata data
) external returns (bytes4);
}
ERC721Holder.sol 24 lines
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v5.0.0) (token/ERC721/utils/ERC721Holder.sol)
pragma solidity ^0.8.20;
import {IERC721Receiver} from "../IERC721Receiver.sol";
/**
* @dev Implementation of the {IERC721Receiver} interface.
*
* Accepts all token transfers.
* Make sure the contract is able to use its token with {IERC721-safeTransferFrom}, {IERC721-approve} or
* {IERC721-setApprovalForAll}.
*/
abstract contract ERC721Holder is IERC721Receiver {
/**
* @dev See {IERC721Receiver-onERC721Received}.
*
* Always returns `IERC721Receiver.onERC721Received.selector`.
*/
function onERC721Received(address, address, uint256, bytes memory) public virtual returns (bytes4) {
return this.onERC721Received.selector;
}
}
ERC1155Holder.sol 42 lines
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v5.0.0) (token/ERC1155/utils/ERC1155Holder.sol)
pragma solidity ^0.8.20;
import {IERC165, ERC165} from "../../../utils/introspection/ERC165.sol";
import {IERC1155Receiver} from "../IERC1155Receiver.sol";
/**
* @dev Simple implementation of `IERC1155Receiver` that will allow a contract to hold ERC1155 tokens.
*
* IMPORTANT: When inheriting this contract, you must include a way to use the received tokens, otherwise they will be
* stuck.
*/
abstract contract ERC1155Holder is ERC165, IERC1155Receiver {
/**
* @dev See {IERC165-supportsInterface}.
*/
function supportsInterface(bytes4 interfaceId) public view virtual override(ERC165, IERC165) returns (bool) {
return interfaceId == type(IERC1155Receiver).interfaceId || super.supportsInterface(interfaceId);
}
function onERC1155Received(
address,
address,
uint256,
uint256,
bytes memory
) public virtual override returns (bytes4) {
return this.onERC1155Received.selector;
}
function onERC1155BatchReceived(
address,
address,
uint256[] memory,
uint256[] memory,
bytes memory
) public virtual override returns (bytes4) {
return this.onERC1155BatchReceived.selector;
}
}
Read Contract
CANCELLER_ROLE 0xb08e51c0 → bytes32
DEFAULT_ADMIN_ROLE 0xa217fddf → bytes32
EXECUTOR_ROLE 0x07bd0265 → bytes32
PROPOSER_ROLE 0x8f61f4f5 → bytes32
getMinDelay 0xf27a0c92 → uint256
getOperationState 0x7958004c → uint8
getRoleAdmin 0x248a9ca3 → bytes32
getTimestamp 0xd45c4435 → uint256
hasRole 0x91d14854 → bool
hashOperation 0x8065657f → bytes32
hashOperationBatch 0xb1c5f427 → bytes32
isOperation 0x31d50750 → bool
isOperationDone 0x2ab0f529 → bool
isOperationPending 0x584b153e → bool
isOperationReady 0x13bc9f20 → bool
supportsInterface 0x01ffc9a7 → bool
Write Contract 12 functions
These functions modify contract state and require a wallet transaction to execute.
cancel 0xc4d252f5
bytes32 id
execute 0x134008d3
address target
uint256 value
bytes payload
bytes32 predecessor
bytes32 salt
executeBatch 0xe38335e5
address[] targets
uint256[] values
bytes[] payloads
bytes32 predecessor
bytes32 salt
grantRole 0x2f2ff15d
bytes32 role
address account
onERC1155BatchReceived 0xbc197c81
address
address
uint256[]
uint256[]
bytes
returns: bytes4
onERC1155Received 0xf23a6e61
address
address
uint256
uint256
bytes
returns: bytes4
onERC721Received 0x150b7a02
address
address
uint256
bytes
returns: bytes4
renounceRole 0x36568abe
bytes32 role
address callerConfirmation
revokeRole 0xd547741f
bytes32 role
address account
schedule 0x01d5062a
address target
uint256 value
bytes data
bytes32 predecessor
bytes32 salt
uint256 delay
scheduleBatch 0x8f2a0bb0
address[] targets
uint256[] values
bytes[] payloads
bytes32 predecessor
bytes32 salt
uint256 delay
updateDelay 0x64d62353
uint256 newDelay
Recent Transactions
No transactions found for this address