Skip to content

Commit

Permalink
feat: add deployment script
Browse files Browse the repository at this point in the history
  • Loading branch information
amusingaxl committed Apr 25, 2024
1 parent e4a0cde commit b8601a6
Show file tree
Hide file tree
Showing 6 changed files with 98 additions and 0 deletions.
2 changes: 2 additions & 0 deletions .env.example
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
FOUNDRY_ROOT_CHAINID='number: the ID of the chain'
FOUNDRY_EXPORTS_OVERWRITE_LATEST='bool: whether to override the latest deployment or not'
43 changes: 43 additions & 0 deletions script/ProtegoDeploy.s.sol
Original file line number Diff line number Diff line change
@@ -0,0 +1,43 @@
// SPDX-FileCopyrightText: © 2023 Dai Foundation <www.daifoundation.org>
// SPDX-License-Identifier: AGPL-3.0-or-later
//
// 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.8.16;

import {Script} from "forge-std/Script.sol";
import {MCD, DssInstance} from "dss-test/MCD.sol";
import {ScriptTools} from "dss-test/ScriptTools.sol";
import {ProtegoDeploy, ProtegoDeployParams} from "./dependencies/ProtegoDeploy.sol";
import {ProtegoInstance} from "./dependencies/ProtegoInstance.sol";

contract ProtegoDeployScript is Script {
using ScriptTools for string;

string constant NAME = "protego";

address constant CHAINLOG = 0xdA0Ab1e0017DEbCd72Be8599041a2aa3bA7e740F;
DssInstance dss = MCD.loadFromChainlog(CHAINLOG);
address pause = dss.chainlog.getAddress("MCD_PAUSE");
ProtegoInstance inst;

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

inst = ProtegoDeploy.deploy(ProtegoDeployParams({pause: pause}));

vm.stopBroadcast();

ScriptTools.exportContract(NAME, "protego", inst.protego);
}
}
30 changes: 30 additions & 0 deletions script/dependencies/ProtegoDeploy.sol
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
// SPDX-FileCopyrightText: © 2023 Dai Foundation <www.daifoundation.org>
// SPDX-License-Identifier: AGPL-3.0-or-later
//
// 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.8.16;

import {ScriptTools} from "dss-test/ScriptTools.sol";
import {Protego} from "src/Protego.sol";
import {ProtegoInstance} from "./ProtegoInstance.sol";

struct ProtegoDeployParams {
address pause;
}

library ProtegoDeploy {
function deploy(ProtegoDeployParams memory p) internal returns (ProtegoInstance memory r) {
r.protego = address(new Protego(p.pause));
}
}
21 changes: 21 additions & 0 deletions script/dependencies/ProtegoInstance.sol
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
// SPDX-FileCopyrightText: © 2023 Dai Foundation <www.daifoundation.org>
// SPDX-License-Identifier: AGPL-3.0-or-later
//
// 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.8.16;

struct ProtegoInstance {
address protego;
}

1 change: 1 addition & 0 deletions script/input/1/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
Inputs for Mainnet scripts.
1 change: 1 addition & 0 deletions script/output/1/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
Outputs for Mainnet scripts.

0 comments on commit b8601a6

Please sign in to comment.