Verified contractExact
EchoReader
Address0xdccd092e40ae9f3ed3e4b5cd9202597822284853
- Balance
0 ETH
- Transactions
1
- Compiler
solc 0.8.26
- Same code
Only this contract
Details
- Compiler
- solc 0.8.26+commit.8a97fa7a
- Language
- solidity
- Optimization
- Yes, 5,120 runs
- EVM version
- cancun
- Via IR
- yes
- License
- Not stated
- Match
- Exactcreation code: yes, runtime code: yes
- Verified on Sourcify
- Created in block
- 25,812,053
- Creation transaction
- 0x72bc459096…65c47614ce
2 files
- src/EchoReader.solmain1.24 KB
- src/IOrderEchoHook.sol823 B
src/EchoReader.sol
pragma solidity 0.8.26;
import {IOrderEchoHook} from "./IOrderEchoHook.sol";
contract EchoReader {
IOrderEchoHook public immutable hook;
error InvalidHook();
error InvalidCount();
constructor(IOrderEchoHook hookAddress) {
if (address(hookAddress).code.length == 0 || hookAddress.EPOCH_LENGTH() == 0) revert InvalidHook();
hook = hookAddress;
}
function read(uint64 firstEpochId, uint16 count)
external
view
returns (IOrderEchoHook.EchoEpoch[] memory rows)
{
if (count == 0 || count > 96) revert InvalidCount();
rows = new IOrderEchoHook.EchoEpoch[](count);
for (uint256 index; index < count; ++index) rows[index] = hook.epoch(firstEpochId + uint64(index));
}
function latest()
external
view
returns (
uint64 epochId,
IOrderEchoHook.EchoEpoch memory data,
uint256 swaps,
uint256 nativeVolume,
uint256 tokenVolume
)
{
epochId = hook.lastEpochId();
data = hook.epoch(epochId);
swaps = hook.totalSwaps();
nativeVolume = hook.cumulativeNativeVolume();
tokenVolume = hook.cumulativeTokenVolume();
}
}
src/IOrderEchoHook.sol
pragma solidity 0.8.26;
interface IOrderEchoHook {
struct EchoEpoch {
uint64 swaps;
uint64 tokenBuys;
uint64 tokenSells;
uint40 openedAt;
uint40 updatedAt;
int24 openTick;
int24 highTick;
int24 lowTick;
int24 closeTick;
uint256 nativeVolume;
uint256 tokenVolume;
}
function EPOCH_LENGTH() external view returns (uint32);
function currentEpochId() external view returns (uint64);
function lastEpochId() external view returns (uint64);
function epoch(uint64 epochId) external view returns (EchoEpoch memory);
function totalSwaps() external view returns (uint256);
function cumulativeNativeVolume() external view returns (uint256);
function cumulativeTokenVolume() external view returns (uint256);
}
Compiler settingsShow
{
"viaIR": true,
"metadata": {
"bytecodeHash": "ipfs"
},
"optimizer": {
"runs": 5120,
"enabled": true
},
"evmVersion": "cancun"
}Source code and metadata: Sourcify.
The source code belongs to the authors of the contract.