Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Exchange contract updates; AuthenticatedProxy
- Loading branch information
Showing
3 changed files
with
92 additions
and
18 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,32 @@ | ||
/* | ||
Proxy contract to hold access to assets on behalf a user (e.g. ERC20 approve). | ||
* DOES NOT prevent repeat usage of same txdata | ||
*/ | ||
|
||
pragma solidity ^0.4.18; | ||
|
||
/** | ||
* @title AuthenticatedProxy | ||
* @author Project Wyvern Developers | ||
*/ | ||
contract AuthenticatedProxy { | ||
|
||
address userAddr; | ||
|
||
address contractAddr; | ||
|
||
function AuthenticatedProxy(address addrUser, address addrContract) public { | ||
userAddr = addrUser; | ||
contractAddr = addrContract; | ||
} | ||
|
||
function proxy(address dest, bytes calldata, uint8 v, bytes32 r, bytes32 s) public returns (bool) { | ||
require(msg.sender == contractAddr); | ||
require(ecrecover(keccak256(dest, calldata), v, r, s) == userAddr); | ||
return dest.call(calldata); | ||
} | ||
|
||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters