fix ecrecover

This commit is contained in:
Ricardo Guilherme Schmidt 2018-04-26 01:08:36 -03:00
parent be4a54fe30
commit 6d133c35a2
1 changed files with 6 additions and 11 deletions

View File

@ -2,6 +2,7 @@ pragma solidity ^0.4.17;
import "../token/ERC20Token.sol"; import "../token/ERC20Token.sol";
import "../common/Controlled.sol"; import "../common/Controlled.sol";
import "../common/MessageSigned.sol";
/** /**
@ -13,7 +14,7 @@ import "../common/Controlled.sol";
token is deposited, and transferred from stakeholders to recipients upon receiving token is deposited, and transferred from stakeholders to recipients upon receiving
a reply from the recipient. a reply from the recipient.
*/ */
contract MessageTribute is Controlled { contract MessageTribute is Controlled, MessageSigned {
event AudienceRequested(address indexed from, address indexed to); event AudienceRequested(address indexed from, address indexed to);
event AudienceCancelled(address indexed from, address indexed to); event AudienceCancelled(address indexed from, address indexed to);
@ -125,13 +126,9 @@ contract MessageTribute is Controlled {
* @param _waive Refund deposit or not * @param _waive Refund deposit or not
* @param _secret Captcha solution * @param _secret Captcha solution
*/ */
function grantAudience(address _to, bool _approve, bool _waive, bytes32 _secret) public { function grantAudience(address _to, bool _approve, bool _waive, bytes32 _secret, bytes _grantorSignature) public {
uint8 v; address grantor = recoverAddress(
bytes32 r; getSignHash(
bytes32 s;
address grantor = ecrecover(
keccak256(
"\x19Ethereum Signed Message:32",
keccak256( keccak256(
address(this), address(this),
bytes4(keccak256("grantAudience(address,bool,bool,bytes32)")), bytes4(keccak256("grantAudience(address,bool,bool,bytes32)")),
@ -141,9 +138,7 @@ contract MessageTribute is Controlled {
_secret _secret
) )
), ),
v, _grantorSignature
r,
s
); );
Audience storage aud = audienceRequested[grantor][_to]; Audience storage aud = audienceRequested[grantor][_to];