Created
March 30, 2018 11:31
-
-
Save ukstv/885c287f9c8b8bf161d0231fee1016f1 to your computer and use it in GitHub Desktop.
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
pragma solidity ^0.4.19; | |
import "./Lineup.sol"; | |
import "./PublicRegistry.sol"; | |
contract Conditional { | |
function doCall( | |
address _registry, | |
bytes32 _lineupCF, | |
bytes _proof, | |
address _destination, | |
uint256 _value, | |
bytes _data | |
) public | |
{ | |
PublicRegistry registry = PublicRegistry(_registry); | |
address lineupAddress = registry.resolve(_lineupCF); | |
Lineup lineup = Lineup(lineupAddress); | |
bytes32 hash = callHash(_destination, _value, _data); | |
require(lineup.isContained(_proof, hash)); | |
require(_destination.call.value(_value)(_data)); // solium-disable-line security/no-call-value | |
} | |
function doDelegate( | |
address _registry, | |
bytes32 _lineupCF, | |
bytes _proof, | |
address _destination, | |
uint256 _value, | |
bytes _data | |
) public | |
{ | |
PublicRegistry registry = PublicRegistry(_registry); | |
address lineupAddress = registry.resolve(_lineupCF); | |
Lineup lineup = Lineup(lineupAddress); | |
bytes32 hash = callHash(_destination, _value, _data); | |
require(lineup.isContained(_proof, hash)); | |
require(_destination.delegatecall(_data)); // solium-disable-line security/no-low-level-calls | |
} | |
function callHash(address _destination, uint256 _value, bytes _data) public pure returns (bytes32) { | |
return keccak256(_destination, _value, _data); | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment