@@ -27,6 +27,8 @@ contract Escrow is Owned, IEscrow {
2727 mapping (address => bool ) public canClaim;
2828 mapping (address => uint ) public recipientNonces;
2929
30+ address public signer;
31+
3032 struct Deposit {
3133 uint amount;
3234 ERC20 token;
@@ -47,6 +49,7 @@ contract Escrow is Owned, IEscrow {
4749
4850 constructor (
4951 address _owner ,
52+ address _signer ,
5053 address [] memory _initialWhitelistedTokens ,
5154 uint _initialFeeBps
5255 ) Owned (_owner) {
@@ -55,6 +58,7 @@ contract Escrow is Owned, IEscrow {
5558 protocolFeeBps = _initialFeeBps;
5659 CLAIM_INITIAL_CHAIN_ID = block .chainid ;
5760 CLAIM_INITIAL_DOMAIN_SEPARATOR = _computeClaimDomainSeparator ();
61+ signer = _signer;
5862
5963 for (uint256 i = 0 ; i < _initialWhitelistedTokens.length ; i++ ) {
6064 _whitelistedTokens.add (_initialWhitelistedTokens[i]);
@@ -240,8 +244,8 @@ contract Escrow is Owned, IEscrow {
240244 abi.encodePacked ("\x19\x01 " , CLAIM_DOMAIN_SEPARATOR (), structHash)
241245 );
242246
243- address signer = ECDSA.recover (digest, v, r, s);
244- require (signer == owner , Errors.INVALID_SIGNATURE);
247+ address recoveredSigner = ECDSA.recover (digest, v, r, s);
248+ require (recoveredSigner == signer , Errors.INVALID_SIGNATURE);
245249
246250 recipientNonces[recipient]++ ;
247251
@@ -324,4 +328,12 @@ contract Escrow is Owned, IEscrow {
324328 emit FeeRecipientSet (_newFeeRecipient);
325329 }
326330
331+ /*//////////////////////////////////////////////////////////////
332+ SIGNER MANAGEMENT (Owner Only)
333+ //////////////////////////////////////////////////////////////*/
334+ function setSigner (address _newSigner ) external onlyOwner {
335+ require (_newSigner != address (0 ), Errors.INVALID_ADDRESS);
336+ signer = _newSigner;
337+ emit SignerSet (_newSigner);
338+ }
327339}
0 commit comments