use alloy_primitives::{Address, U256};
use alloy_sol_types::Eip712Domain;
pub type DomainSeparator = Eip712Domain;
pub fn settlement_domain(chain_id: u64, contract_address: Address) -> DomainSeparator {
Eip712Domain {
name: Some("Gnosis Protocol".into()),
version: Some("v2".into()),
chain_id: Some(U256::from(chain_id)),
verifying_contract: Some(contract_address),
salt: None,
}
}
#[cfg(test)]
mod tests {
use alloy_primitives::b256;
use super::*;
use crate::contracts::GPV2_SETTLEMENT;
#[test]
fn domain_separator_sepolia() {
let chain_id: u64 = 11_155_111;
let domain = settlement_domain(chain_id, GPV2_SETTLEMENT);
let expected = b256!("daee378bd0eb30ddf479272accf91761e697bc00e067a268f95f1d2732ed230b");
assert_eq!(domain.separator(), expected);
}
}