use alloy::primitives::U256;
use tycho_common::keccak256;
pub mod account_storage;
pub mod decoder;
pub mod engine_db;
pub mod protocol;
pub mod query_pool_swap;
pub mod simulation;
pub mod stream;
pub mod traces;
pub mod tycho_models;
pub type SlotId = U256;
#[derive(Debug, PartialEq, Copy, Clone)]
pub enum ContractCompiler {
Solidity,
Vyper,
}
impl ContractCompiler {
pub fn compute_map_slot(&self, map_base_slot: &[u8], key: &[u8]) -> SlotId {
let concatenated = match &self {
ContractCompiler::Solidity => [key, map_base_slot].concat(),
ContractCompiler::Vyper => [map_base_slot, key].concat(),
};
let slot_bytes = keccak256(&concatenated);
SlotId::from_be_slice(&slot_bytes)
}
}