macro_rules! eip712_domain { (@opt) => { ... }; (@opt $e:expr) => { ... }; (@cow) => { ... }; (@cow $l:literal) => { ... }; (@cow $e:expr) => { ... }; ( $(name: $name:expr,)? $(version: $version:expr,)? $(chain_id: $chain_id:expr,)? $(verifying_contract: $verifying_contract:expr,)? $(salt: $salt:expr)? $(,)? ) => { ... }; }
Expand description
Convenience macro to instantiate an EIP-712 domain.
This macro allows you to instantiate an EIP-712 domain
struct without manually writing None
for unused fields.
It may be used to declare a domain with any combination of fields. Each field must be labeled with the name of the field, and the fields must be in order. The fields for the domain are:
name
version
chain_id
verifying_contract
salt
ยงExamples
const MY_DOMAIN: Eip712Domain = eip712_domain! {
name: "MyCoolProtocol",
};
let dynamic_name = String::from("MyCoolProtocol");
let my_other_domain: Eip712Domain = eip712_domain! {
name: dynamic_name,
version: "1.0.0",
salt: keccak256("my domain salt"),
};