Skip to content

Commit

Permalink
Fix deploy script
Browse files Browse the repository at this point in the history
  • Loading branch information
snnbotchway committed Oct 22, 2023
1 parent 523d53f commit 6e7b509
Show file tree
Hide file tree
Showing 4 changed files with 16 additions and 12 deletions.
11 changes: 7 additions & 4 deletions script/DeployGBPSystem.s.sol → script/DeployGBPCSystem.s.sol
Original file line number Diff line number Diff line change
Expand Up @@ -10,9 +10,8 @@ import {GreatTimeLock} from "src/dao/GreatTimeLock.sol";
import {HelperConfig} from "./HelperConfig.s.sol";
import {VaultMaster} from "src/VaultMaster.sol";

contract DeployGBPSystem is Script {
uint256 public constant MIN_DELAY = 1 days;
address public constant TIMELOCK_ADMIN = address(0);
contract DeployGBPCSystem is Script {
uint256 public constant MIN_DELAY = 5 hours;
address[] proposers;
address[] executors;

Expand All @@ -34,10 +33,14 @@ contract DeployGBPSystem is Script {
vm.startBroadcast(deployerKey);
gbpCoin = new GBPCoin(deployer);
greatCoin = new GreatCoin(deployer);
timelock = new GreatTimeLock(MIN_DELAY, proposers, executors, TIMELOCK_ADMIN);
timelock = new GreatTimeLock(MIN_DELAY, proposers, executors, deployer);
greatDAO = new GreatDAO(greatCoin, timelock);
vaultMaster = new VaultMaster(address(timelock), address(gbpCoin), gbpUsdPriceFeed, gbpUsdPriceFeedDecimals);

timelock.grantRole(timelock.PROPOSER_ROLE(), address(greatDAO));
timelock.grantRole(timelock.EXECUTOR_ROLE(), address(0));
timelock.renounceRole(timelock.DEFAULT_ADMIN_ROLE(), deployer);

bytes32 adminRole = gbpCoin.DEFAULT_ADMIN_ROLE();
gbpCoin.grantRole(adminRole, address(vaultMaster));
gbpCoin.renounceRole(adminRole, deployer);
Expand Down
6 changes: 3 additions & 3 deletions test/TestGBPCoin.t.sol
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ import {AggregatorV3Interface} from "chainlink/contracts/src/v0.8/interfaces/Agg
import {Test, console2} from "forge-std/Test.sol";
import {IAccessControl} from "openzeppelin-contracts/contracts/access/IAccessControl.sol";

import {DeployGBPSystem} from "script/DeployGBPSystem.s.sol";
import {DeployGBPCSystem} from "script/DeployGBPCSystem.s.sol";
import {GBPCoin} from "src/GBPCoin.sol";
import {GreatDAO} from "src/dao/GreatDAO.sol";
import {GreatCoin} from "src/dao/GreatCoin.sol";
Expand All @@ -22,14 +22,14 @@ contract TestGBPCoin is Test {
GreatVault public greatVault;
VaultMaster public vaultMaster;
HelperConfig public config;
DeployGBPSystem public deployer;
DeployGBPCSystem public deployer;

uint8 public constant LIQUIDATION_THRESHOLD = 80;
uint8 public constant LIQUIDATION_SPREAD = 10;
uint8 public constant CLOSE_FACTOR = 50;

function setUp() public {
deployer = new DeployGBPSystem();
deployer = new DeployGBPCSystem();
(greatDAO, timelock, vaultMaster, gbpCoin, greatCoin, config) = deployer.run();

(,,, address wEth, address wEthUsdPriceFeed, uint8 wEthUsdPriceFeedDecimals) = config.activeNetworkConfig();
Expand Down
5 changes: 3 additions & 2 deletions test/TestGreatVault.t.sol
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ import {ERC20Mock} from "openzeppelin-contracts/contracts/mocks/token/ERC20Mock.
import {Math} from "@openzeppelin/contracts/utils/math/Math.sol";
import {MockV3Aggregator} from "chainlink/contracts/src/v0.8/tests/MockV3Aggregator.sol";

import {DeployGBPSystem} from "script/DeployGBPSystem.s.sol";
import {DeployGBPCSystem} from "script/DeployGBPCSystem.s.sol";
import {GBPCoin} from "src/GBPCoin.sol";
import {GreatDAO} from "src/dao/GreatDAO.sol";
import {GreatCoin} from "src/dao/GreatCoin.sol";
Expand Down Expand Up @@ -51,7 +51,7 @@ contract TestGreatVault is Test {
address public LIQUIDATOR = makeAddr("liquidator");

function setUp() public {
DeployGBPSystem deployer = new DeployGBPSystem();
DeployGBPCSystem deployer = new DeployGBPCSystem();
(greatDAO, timelock, vaultMaster, gbpCoin, greatCoin, config) = deployer.run();

address wEthAddress;
Expand Down Expand Up @@ -396,6 +396,7 @@ contract TestGreatVault is Test {
/* ========================= PREVIEW MINT GBPC ========================= */

function testReturnsMinCollateralToDepositForSpecifiedGbpcToMint(uint128 collateralAmount) public {
vm.assume(collateralAmount != 0);
uint256 maxMintableGbpc = greatVault.previewDepositCollateral(collateralAmount);
uint256 minCollateralDeposit = greatVault.previewMintGBPC(maxMintableGbpc);

Expand Down
6 changes: 3 additions & 3 deletions test/TestVaultMaster.t.sol
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ import {Test, console2} from "forge-std/Test.sol";
import {IAccessControl} from "openzeppelin-contracts/contracts/access/IAccessControl.sol";
import {Ownable} from "@openzeppelin/contracts/access/Ownable.sol";

import {DeployGBPSystem} from "script/DeployGBPSystem.s.sol";
import {DeployGBPCSystem} from "script/DeployGBPCSystem.s.sol";
import {GBPCoin} from "src/GBPCoin.sol";
import {GreatDAO} from "src/dao/GreatDAO.sol";
import {GreatCoin} from "src/dao/GreatCoin.sol";
Expand All @@ -23,7 +23,7 @@ contract TestVaultMaster is Test {
GreatTimeLock public timelock;
VaultMaster public vaultMaster;
HelperConfig public config;
DeployGBPSystem public deployer;
DeployGBPCSystem public deployer;

address public wEth;
address public wEthUsdPriceFeed;
Expand All @@ -36,7 +36,7 @@ contract TestVaultMaster is Test {
uint8 public constant CLOSE_FACTOR = 50;

function setUp() public {
deployer = new DeployGBPSystem();
deployer = new DeployGBPCSystem();
(greatDAO, timelock, vaultMaster, gbpCoin, greatCoin, config) = deployer.run();

(, gbpUsdPriceFeed, gbpUsdPriceFeedDecimals, wEth, wEthUsdPriceFeed, wEthUsdPriceFeedDecimals) =
Expand Down

0 comments on commit 6e7b509

Please sign in to comment.