Skip to content

Commit

Permalink
Update deploy scripts
Browse files Browse the repository at this point in the history
  • Loading branch information
horsefacts committed Jul 26, 2022
1 parent f605b8f commit d5debfe
Show file tree
Hide file tree
Showing 3 changed files with 73 additions and 7 deletions.
6 changes: 3 additions & 3 deletions script/deploy.s.sol → script/dss.s.sol
Original file line number Diff line number Diff line change
Expand Up @@ -26,9 +26,9 @@ import {Dipper} from "../src/dip.sol";
import {Nil} from "../src/nil.sol";
import {Spy} from "../src/spy.sol";

contract Deploy is Script {
contract DeployDSS is Script {

function deployCore() public {
function deployDSS() public {
Sum sum = new Sum();
Use use = new Use(address(sum));
Nil nil = new Nil(address(sum));
Expand All @@ -50,7 +50,7 @@ contract Deploy is Script {
function run() external {
vm.startBroadcast();

deployCore();
deployDSS();

vm.stopBroadcast();
}
Expand Down
66 changes: 66 additions & 0 deletions script/gov.s.sol
Original file line number Diff line number Diff line change
@@ -0,0 +1,66 @@
// SPDX-License-Identifier: AGPL-3.0-or-later

// Copyright (C) 2022 Horsefacts <[email protected]>
//
// This program is free software: you can redistribute it and/or modify
// it under the terms of the GNU Affero General Public License as published by
// the Free Software Foundation, either version 3 of the License, or
// (at your option) any later version.
//
// This program is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU Affero General Public License for more details.
//
// You should have received a copy of the GNU Affero General Public License
// along with this program. If not, see <https://www.gnu.org/licenses/>.
pragma solidity 0.5.16;

import {CTR} from "../src/gov/ctr.sol";
import {DssSpell} from "../src/gov/spell.sol";
import {DSChief, DSChiefFab} from "ds-chief/chief.sol";
import {DSPause, DSPauseProxy} from "ds-pause/pause.sol";

interface VmLike {
function startBroadcast() external;
function stopBroadcast() external;
function envAddress(string calldata key) external returns (address value);
}

interface SumLike {
function rely(address) external;
function deny(address) external;
}

contract DeployGov {

// Can't use forge-std Script here
address private constant VM_ADDRESS = address(bytes20(uint160(uint256(keccak256('hevm cheat code')))));
VmLike public constant vm = VmLike(VM_ADDRESS);

uint256 public constant MAX_YAYS = 5;
uint256 public constant DELAY = 172_800;

function deployGov(address sum) public {
address me = address(this);
CTR ctr = new CTR();
DSChiefFab fab = new DSChiefFab();
DSChief chief = fab.newChief(ctr, MAX_YAYS);
DSPause pause = new DSPause(DELAY, address(0), address(chief));
DSPauseProxy proxy = pause.proxy();

SumLike(sum).rely(address(proxy));
SumLike(sum).deny(me);
}

event Sum(address sum);

function run() external {
vm.startBroadcast();

address sum = vm.envAddress("DSS_SUM_ADDRESS");
deployGov(sum);

vm.stopBroadcast();
}
}
8 changes: 4 additions & 4 deletions src/gov/spell.sol
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@
// You should have received a copy of the GNU Affero General Public License
// along with this program. If not, see <https://www.gnu.org/licenses/>.

pragma solidity 0.5.16;
pragma solidity >=0.5.16;

interface PauseLike {
function plot(address,bytes32,bytes calldata,uint256) external;
Expand Down Expand Up @@ -45,17 +45,17 @@ contract DssSpell {
bytes32 _tag;
assembly { _tag := extcodehash(_action) }
tag = _tag;
expiration = now + 30 days;
expiration = block.timestamp + 30 days;
}

function description() public view returns (string memory) {
return ActionLike(action).description();
}

function schedule() public {
require(now <= expiration, "This contract has expired");
require(block.timestamp <= expiration, "This contract has expired");
require(eta == 0, "This spell has already been scheduled");
eta = now + pause.delay();
eta = block.timestamp + pause.delay();
pause.plot(action, tag, sig, eta);
}

Expand Down

0 comments on commit d5debfe

Please sign in to comment.