Skip to content

Commit

Permalink
solhint said no
Browse files Browse the repository at this point in the history
  • Loading branch information
BCLeFevre committed May 11, 2022
1 parent 929be46 commit 2b8ca6e
Showing 1 changed file with 36 additions and 36 deletions.
72 changes: 36 additions & 36 deletions contracts/lib/GettersAndDerivers.sol
Original file line number Diff line number Diff line change
Expand Up @@ -222,42 +222,6 @@ contract GettersAndDerivers is ConsiderationBase {
}
}

/**
* @dev Internal pure function to efficiently derive an digest to sign for
* an order in accordance with EIP-712.
*
* @param domainSeparator The domain separator.
* @param orderHash The order hash.
*
* @return value The hash.
*/
function _deriveEIP712Digest(bytes32 domainSeparator, bytes32 orderHash)
internal
pure
returns (bytes32 value)
{
// Leverage scratch space to perform an efficient hash.
assembly {
// Place the EIP-712 prefix at the start of scratch space.
mstore(0, EIP_712_PREFIX)

// Place the domain separator in the next region of scratch space.
mstore(EIP712_DomainSeparator_offset, domainSeparator)

// Place the order hash in scratch space, spilling into the first
// two bytes of the free memory pointer — this should never be set
// as memory cannot be expanded to that size, and will be zeroed out
// after the hash is performed.
mstore(EIP712_OrderHash_offset, orderHash)

// Hash the relevant region (65 bytes).
value := keccak256(0, EIP712_DigestPayload_size)

// Clear out the dirtied bits in the memory pointer.
mstore(EIP712_OrderHash_offset, 0)
}
}

/**
* @dev Internal view function to derive the address of a given conduit
* using a corresponding conduit key.
Expand Down Expand Up @@ -373,4 +337,40 @@ contract GettersAndDerivers is ConsiderationBase {
return(0, ThreeWords) // Return all three words.
}
}

/**
* @dev Internal pure function to efficiently derive an digest to sign for
* an order in accordance with EIP-712.
*
* @param domainSeparator The domain separator.
* @param orderHash The order hash.
*
* @return value The hash.
*/
function _deriveEIP712Digest(bytes32 domainSeparator, bytes32 orderHash)
internal
pure
returns (bytes32 value)
{
// Leverage scratch space to perform an efficient hash.
assembly {
// Place the EIP-712 prefix at the start of scratch space.
mstore(0, EIP_712_PREFIX)

// Place the domain separator in the next region of scratch space.
mstore(EIP712_DomainSeparator_offset, domainSeparator)

// Place the order hash in scratch space, spilling into the first
// two bytes of the free memory pointer — this should never be set
// as memory cannot be expanded to that size, and will be zeroed out
// after the hash is performed.
mstore(EIP712_OrderHash_offset, orderHash)

// Hash the relevant region (65 bytes).
value := keccak256(0, EIP712_DigestPayload_size)

// Clear out the dirtied bits in the memory pointer.
mstore(EIP712_OrderHash_offset, 0)
}
}
}

0 comments on commit 2b8ca6e

Please sign in to comment.