MCPcopy Create free account
hub / github.com/cowprotocol/services / hash_struct

Method hash_struct

crates/e2e/src/api/zeroex.rs:149–165  ·  view source on GitHub ↗

See

(&self)

Source from the content-addressed store, hash-verified

147
148 // See <https://github.com/0xProject/protocol/blob/%400x/contracts-zero-ex%400.49.0/contracts/zero-ex/contracts/src/features/libs/LibNativeOrder.sol#L166-L195>
149 fn hash_struct(&self) -> [u8; 32] {
150 let mut hash_data = [0u8; 416];
151 hash_data[0..32].copy_from_slice(&Self::ZEROEX_LIMIT_ORDER_TYPEHASH);
152 hash_data[44..64].copy_from_slice(self.maker_token.as_slice());
153 hash_data[76..96].copy_from_slice(self.taker_token.as_slice());
154 hash_data[112..128].copy_from_slice(&self.maker_amount.to_be_bytes());
155 hash_data[144..160].copy_from_slice(&self.taker_amount.to_be_bytes());
156 hash_data[176..192].copy_from_slice(&self.taker_token_fee_amount.to_be_bytes());
157 hash_data[204..224].copy_from_slice(self.maker.as_slice());
158 hash_data[236..256].copy_from_slice(self.taker.as_slice());
159 hash_data[268..288].copy_from_slice(self.sender.as_slice());
160 hash_data[300..320].copy_from_slice(self.fee_recipient.as_slice());
161 hash_data[320..352].copy_from_slice(self.pool.as_slice());
162 hash_data[376..384].copy_from_slice(&self.expiry.to_be_bytes());
163 hash_data[384..416].copy_from_slice(&self.salt.to_be_bytes::<32>());
164 alloy::primitives::keccak256(hash_data).into()
165 }
166}
167
168struct ZeroExDomainSeparator([u8; 32]);

Callers 7

signMethod · 0.45
to_order_recordMethod · 0.45
hashMethod · 0.45
order_cancellationFunction · 0.45
testFunction · 0.45
signatureFunction · 0.45

Calls 3

as_sliceMethod · 0.80
to_be_bytesMethod · 0.80
intoMethod · 0.45

Tested by 4

hashMethod · 0.36
order_cancellationFunction · 0.36
testFunction · 0.36
signatureFunction · 0.36