Transactions
Token Transfers
Tokens
Internal Transactions
Coin Balance History
Logs
Code
Read Proxy
Write Contract
Write Proxy
Warning! Contract bytecode has been changed and doesn't match the verified one. Therefore, interaction with this smart contract may be risky.
- Contract name:
- Diamond
- Optimization enabled
- true
- Compiler version
- v0.8.28+commit.7893614a
- Optimization runs
- 50
- EVM Version
- paris
- Verified at
- 2024-11-03T17:50:36.882117Z
contracts/Diamond.sol
// This is the code Vault address will actually hold. // a Diamond proxy with two ingrained functions // implementation addresses will be stored on the last 2^32 slots. in other words, bitwise_not(msg.sig). // the value will be either: // 1. implementation address --> normal function // 2. bitwise_not(implementation address) --> view function, implemented with the ingrained function 2 // on creation, it delegatecalls back to the caller. // the caller is expected to initialize the storage. // ingrained function 1: 'read' (0x72656164) // a cheap way to read storage slots // other contracts are expected to directly read predefined storage slots using this mechanism. // expected calldata: // 0x72656164 | bytes32 | bytes32 | bytes32 ... (no length header) // the query is interpreted as a series of storage slots. // returns: // bytes32 | bytes32 | bytes32 | .... // returns storage values without header // ingraned function 2: 'view' (0x76696577) // delegatecall any contract; revert if the call didn't, and vice versa. // used to calculate the result of a state-modifying function, without actually modifying the state. // expected calldata: 0x76696577 | destination address padded to 32 bytes | calldata to be forwarded contract Diamond { constructor() { assembly { let success := delegatecall(gas(), caller(), 0, 0, 0, 0) if iszero(success) { revert(0, 0) } } } fallback() external payable { assembly { if calldatasize() { let selector := shr(0xe0, calldataload(0x00)) if eq(selector, 0x72656164) { // 'read' for { let i := 4 } lt(i, calldatasize()) { i := add(i, 0x20) } { mstore(i, sload(calldataload(i))) } return(4, sub(calldatasize(), 4)) } if eq(selector, 0x76696577) { // view calldatacopy(0, 36, sub(calldatasize(), 36)) let success := delegatecall(gas(), calldataload(4), 0, sub(calldatasize(), 36), 0, 0) returndatacopy(0, 0, returndatasize()) if success { revert(0, returndatasize()) } return(0, returndatasize()) } let implementation := sload(not(selector)) if implementation { if lt(implementation, 0x10000000000000000000000000000000000000000) { // registered as a function calldatacopy(0, 0, calldatasize()) let result := delegatecall(gas(), implementation, 0, calldatasize(), 0, 0) returndatacopy(0, 0, returndatasize()) switch result case 0 { revert(0, returndatasize()) } default { return(0, returndatasize()) } } // registered as a view function mstore(0, 0x7669657700000000000000000000000000000000000000000000000000000000) mstore(4, not(implementation)) calldatacopy(36, 0, calldatasize()) let success := delegatecall(gas(), address(), 0, add(calldatasize(), 36), 0, 0) returndatacopy(0, 0, returndatasize()) if success { revert(0, returndatasize()) } return(0, returndatasize()) } revert(0, 0) } } } }
Compiler Settings
{"viaIR":true,"remappings":["@prb/test/=lib/prb-math/lib/prb-test/src/","ds-test/=lib/solmate/lib/ds-test/src/","forge-std/=lib/forge-std/src/","openzeppelin/=lib/openzeppelin-contracts/contracts/","@openzeppelin/=lib/openzeppelin-contracts/","openzeppelin-upgradeable/=lib/openzeppelin-contracts-upgradeable/contracts/","@prb/math/=lib/prb-math/","prb-test/=lib/prb-math/lib/prb-test/src/","solmate/=lib/solmate/src/","lzapp/=lib/solidity-examples/contracts/","algebra-core/=lib/Algebra/src/core/contracts/","algebra-plugin/=lib/Algebra/src/plugin/contracts/","algebra-periphery/=lib/Algebra/src/periphery/contracts/","algebra-farming/=lib/Algebra/src/farming/contracts/","@cryptoalgebra/integral-base-plugin/=lib/Algebra/src/plugin/","@cryptoalgebra/integral-core/=lib/Algebra/src/core/","@cryptoalgebra/integral-periphery/=lib/Algebra/src/periphery/","Algebra/=lib/Algebra/src/","erc4626-tests/=lib/openzeppelin-contracts-upgradeable/lib/erc4626-tests/","openzeppelin-contracts-upgradeable/=lib/openzeppelin-contracts-upgradeable/","openzeppelin-contracts/=lib/openzeppelin-contracts/","prb-math/=lib/prb-math/src/"],"outputSelection":{"*":{"*":["abi","evm.bytecode","evm.deployedBytecode","evm.methodIdentifiers","metadata"]}},"optimizer":{"runs":50,"enabled":true},"metadata":{"useLiteralContent":false,"bytecodeHash":"ipfs","appendCBOR":true},"libraries":{},"evmVersion":"paris"}
Contract ABI
[{"type":"constructor","stateMutability":"nonpayable","inputs":[]},{"type":"fallback","stateMutability":"payable"}]
Contract Creation Code
0x6080604052346022576000808080335af41560225760405160fa90816100288239f35b600080fdfe608060405236600a57005b60003560e01c6372656164811460a65763766965778114608657195480602f57600080fd5b600160a01b8110606b57637669657760e01b600052196004523660006024376000806024360181305af43d6000803e6066573d6000f35b3d6000fd5b60008091368280378136915af43d6000803e156066573d6000f35b60008036602319018060248337816004355af43d6000803e6066573d6000f35b60045b36811060b85736600319016004f35b803554815260200160a956fea2646970667358221220512627942425c8edbcef98b81cbc276e61d390569ebbbe4d02fada0666bd202664736f6c634300081c0033
Deployed ByteCode
0x608060405236600a57005b60003560e01c6372656164811460a65763766965778114608657195480602f57600080fd5b600160a01b8110606b57637669657760e01b600052196004523660006024376000806024360181305af43d6000803e6066573d6000f35b3d6000fd5b60008091368280378136915af43d6000803e156066573d6000f35b60008036602319018060248337816004355af43d6000803e6066573d6000f35b60045b36811060b85736600319016004f35b803554815260200160a956fea2646970667358221220512627942425c8edbcef98b81cbc276e61d390569ebbbe4d02fada0666bd202664736f6c634300081c0033