//Write your own contracts here. Currently compiles using solc v0.4.15+commit.bbb8e64f. pragma solidity ^0.4.25; interface IMigration { // pass the index to handle situations where the migration takes a few transactions to process function migrate(uint256 index) external; function numOfScripts() external view returns (uint); } contract DelegatedMigrator is Owned { uint waitingPeriod; struct Migration { bytes32 name; address target; uint acceptedTimestamp; } mapping(bytes32 => Migration) proposals; constructor(address _owner) public Owned(_owner) { waitingPeriod = 3 hours; } function setWaitingPeriod(uint _waitingPeriod) external ownlyOwner { waitingPeriod = _waitingPeriod; } function propose(bytes32 version, address target) external { // Anyone can call require(proposals[version] == Migration(0), "Cannot modify existing proposal"); // each contract needs to confirm to IMigration // ... } function accept(bytes32 version) onlyOwner { // .. } function reject(bytes32 version) onlyOwner { // .. } function execute(bytes32 version, uint index) onlyOwner { Migration migration = proposals[version]; require(migration.acceptedTimestamp > 0, "Must be accepted to execute"); require(now > migration.acceptedTimestamp + waitingPeriod, "Waiting period not yet expired"); // require(index not used) // mark index as used migration.delegatecall(bytes4(sha3("migrate(uint256)")), index); } }
0.4.25