Skip to content

Commit

Permalink
Hardcode hashes
Browse files Browse the repository at this point in the history
  • Loading branch information
rmeissner committed Oct 1, 2020
1 parent 23351ec commit 53808ee
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 10 deletions.
20 changes: 10 additions & 10 deletions allowances/contracts/AlowanceModule.sol
Original file line number Diff line number Diff line change
Expand Up @@ -19,15 +19,15 @@ contract AllowanceModule is SignatureDecoder {
string public constant NAME = "Allowance Module";
string public constant VERSION = "0.1.0";

// TODO: Fix hardcode hash
bytes32 public constant DOMAIN_SEPARATOR_TYPEHASH = keccak256(
"EIP712Domain(uint256 chainId,address verifyingContract)"
);
bytes32 public constant DOMAIN_SEPARATOR_TYPEHASH = 0x47e79534a245952e8b16893a336b85a3d9ea9fa8c573f3d803afb92a79469218;
// keccak256(
// "EIP712Domain(uint256 chainId,address verifyingContract)"
// );

// TODO: Fix hardcode hash
bytes32 public constant ALLOWANCE_TRANSFER_TYPEHASH = keccak256(
"AllowanceTransfer(address safe,address token,uint96 amount,address paymentToken,uint96 payment,uint16 nonce)"
);
bytes32 public constant ALLOWANCE_TRANSFER_TYPEHASH = 0x80b006280932094e7cc965863eb5118dc07e5d272c6670c4a7c87299e04fceeb;
// keccak256(
// "AllowanceTransfer(address safe,address token,uint96 amount,address paymentToken,uint96 payment,uint16 nonce)"
// );

// Safe -> Delegate -> Allowance
mapping(address => mapping (address => mapping(address => Allowance))) public allowances;
Expand Down Expand Up @@ -170,7 +170,7 @@ contract AllowanceModule is SignatureDecoder {
}

/// @dev Returns the chain id used by this contract.
function getChainId() public view returns (uint256) {
function getChainId() public pure returns (uint256) {
uint256 id;
assembly {
id := chainid()
Expand Down Expand Up @@ -211,7 +211,7 @@ contract AllowanceModule is SignatureDecoder {
));
}

function checkSignature(address expectedDelegate, bytes memory signature, bytes memory transferHashData, GnosisSafe safe) private {
function checkSignature(address expectedDelegate, bytes memory signature, bytes memory transferHashData, GnosisSafe safe) private view {
address signer = recoverSignature(signature, transferHashData);
require(
expectedDelegate == signer && delegates[address(safe)][uint48(signer)].delegate == signer,
Expand Down
1 change: 1 addition & 0 deletions allowances/test/allowanceSingle.js
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@ contract('AllowanceModule delegate', function(accounts) {

// Create Master Copies
safeModule = await AllowanceModule.new()

const gnosisSafeMasterCopy = await GnosisSafe.new({ from: accounts[0] })
const proxy = await GnosisSafeProxy.new(gnosisSafeMasterCopy.address, { from: accounts[0] })
gnosisSafe = await GnosisSafe.at(proxy.address)
Expand Down

0 comments on commit 53808ee

Please sign in to comment.