Skip to content

Commit

Permalink
mode && holesky
Browse files Browse the repository at this point in the history
  • Loading branch information
jordaniza committed Sep 20, 2024
1 parent 1ad34f7 commit a93ba53
Show file tree
Hide file tree
Showing 14 changed files with 1,256 additions and 6 deletions.
46 changes: 43 additions & 3 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -15,20 +15,60 @@ coverage:; ./coverage.sh
install :; make allow-scripts && make coverage


deploy-holesky :; forge script Deploy \
deploy-holesky :; forge script DeployV2 \
--rpc-url https://1rpc.io/holesky \
--private-key $(PRIVATE_KEY) \
--broadcast \
--verify --etherscan-api-key $(ETHERSCAN_API_KEY) \
-vvvvv


deploy-preview-holesky :; forge script Deploy \
deploy-preview-holesky :; forge script DeployV2 \
--rpc-url https://1rpc.io/holesky \
--private-key $(PRIVATE_KEY) \
-vvvvv

activate-preview-holesky :; forge script ApplyInstall \
--rpc-url https://1rpc.io/holesky \
--private-key $(PRIVATE_KEY) \
-vvvvv

activate-holesky :; forge script ApplyInstall \
--rpc-url https://1rpc.io/holesky \
--private-key $(PRIVATE_KEY) \
--broadcast \
-vvvvv


test-fork-holesky :; forge test --match-test testPostDeploy \
--rpc-url https://1rpc.io/holesky \
-vvvvv
-vvvvv




deploy-preview-mode-sepolia :; forge script DeployV2 \
--rpc-url https://sepolia.mode.network \
--private-key $(PRIVATE_KEY) \
-vvvvv

deploy-mode-sepolia :; forge script DeployV2 \
--rpc-url https://sepolia.mode.network \
--private-key $(PRIVATE_KEY) \
--broadcast \
--verify \
--verifier blockscout \
--verifier-url https://sepolia.explorer.mode.network/api\? \
-vvvvv

activate-preview-mode-sepolia :; forge script ApplyInstall \
--rpc-url https://sepolia.mode.network \
--private-key $(PRIVATE_KEY) \
-vvvvv

activate-mode-sepolia :; forge script ApplyInstall \
--rpc-url https://sepolia.mode.network \
--private-key $(PRIVATE_KEY) \
--broadcast \
-vvvvv

129 changes: 129 additions & 0 deletions script/ApplyInstall.s.sol
Original file line number Diff line number Diff line change
@@ -0,0 +1,129 @@
pragma solidity ^0.8.17;

import {Script} from "forge-std/Script.sol";
import {console2 as console} from "forge-std/console2.sol";

// aragon contracts
import {IDAO} from "@aragon/osx/core/dao/IDAO.sol";
import {DAO} from "@aragon/osx/core/dao/DAO.sol";
import {Multisig, MultisigSetup} from "@aragon/multisig/MultisigSetup.sol";

import {MockPluginSetupProcessor} from "@mocks/osx/MockPSP.sol";
import {MockDAOFactory} from "@mocks/osx/MockDAOFactory.sol";
import {MockERC20} from "@mocks/MockERC20.sol";

import "test/helpers/OSxHelpers.sol";

import {Clock} from "@clock/Clock.sol";
import {IEscrowCurveUserStorage} from "@escrow-interfaces/IEscrowCurveIncreasing.sol";
import {IWithdrawalQueueErrors} from "src/escrow/increasing/interfaces/IVotingEscrowIncreasing.sol";
import {IGaugeVote} from "src/voting/ISimpleGaugeVoter.sol";
import {VotingEscrow, Lock, QuadraticIncreasingEscrow, ExitQueue, SimpleGaugeVoter, SimpleGaugeVoterSetup, ISimpleGaugeVoterSetupParams} from "src/voting/SimpleGaugeVoterSetup.sol";

// import "./params/DeployParams.sol";
import "./params/DeployedContractsHolesky.sol";

contract ApplyInstall is Script, IWithdrawalQueueErrors, IGaugeVote, IEscrowCurveUserStorage {
// MultisigSetup multisigSetup;
SimpleGaugeVoterSetup voterSetup = SimpleGaugeVoterSetup(DEPLOYED_VOTER_SETUP);

MockPluginSetupProcessor psp = MockPluginSetupProcessor(DEPLOYED_PSP);
DAO dao = DAO(payable(DEPLOYED_DAO));
MockERC20 token = MockERC20(DEPLOYED_TOKEN);

VotingEscrow ve = VotingEscrow(DEPLOYED_VE);
Lock nftLock = Lock(DEPLOYED_NFT_LOCK);
QuadraticIncreasingEscrow curve = QuadraticIncreasingEscrow(DEPLOYED_CURVE);
SimpleGaugeVoter voter = SimpleGaugeVoter(DEPLOYED_VOTER);
ExitQueue queue = ExitQueue(DEPLOYED_QUEUE);
Clock clock = Clock(DEPLOYED_CLOCK);

Multisig multisig = Multisig(DEPLOYED_MULTISIG);

address deployer;

modifier broadcast() {
deployer = vm.addr(vm.envUint("PRIVATE_KEY"));
vm.startBroadcast(deployer);
_;
vm.stopBroadcast();
}

function run() public broadcast {
_applySetup();
}

function _actions() internal view returns (IDAO.Action[] memory) {
IDAO.Action[] memory actions = new IDAO.Action[](5);

PermissionLib.MultiTargetPermission[] memory voterSetupPermissions = getPermissions();

// action 0: apply the ve installation
actions[0] = IDAO.Action({
to: address(psp),
value: 0,
data: abi.encodeCall(
psp.applyInstallation,
(address(dao), _mockApplyInstallationParams(address(ve), voterSetupPermissions))
)
});

// action 2: activate the curve on the ve
actions[1] = IDAO.Action({
to: address(ve),
value: 0,
data: abi.encodeWithSelector(ve.setCurve.selector, address(curve))
});

// action 3: activate the queue on the ve
actions[2] = IDAO.Action({
to: address(ve),
value: 0,
data: abi.encodeWithSelector(ve.setQueue.selector, address(queue))
});

// action 4: set the voter
actions[3] = IDAO.Action({
to: address(ve),
value: 0,
data: abi.encodeWithSelector(ve.setVoter.selector, address(voter))
});

actions[4] = IDAO.Action({
to: address(ve),
value: 0,
data: abi.encodeWithSelector(ve.setLockNFT.selector, address(nftLock))
});

return wrapGrantRevokeRoot(DAO(payable(address(dao))), address(psp), actions);
}

function _applySetup() internal {
IDAO.Action[] memory actions = _actions();

// execute the actions
multisig.createProposal({
_metadata: "",
_actions: actions,
_allowFailureMap: 0,
_approveProposal: true,
_tryExecution: true,
_startDate: 0,
_endDate: uint64(block.timestamp + 100)
});
}

function getPermissions() internal view returns (PermissionLib.MultiTargetPermission[] memory) {
return
voterSetup.getPermissions({
_dao: address(dao),
_plugin: address(voter),
_curve: address(curve),
_queue: address(queue),
_escrow: address(ve),
_clock: address(clock),
_nft: address(nftLock),
_grantOrRevoke: PermissionLib.Operation.Grant
});
}
}
2 changes: 1 addition & 1 deletion script/Deploy.s.sol
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ import "@helpers/OSxHelpers.sol";
import {ProxyLib} from "@libs/ProxyLib.sol";

import {IVotingEscrowEventsStorageErrorsEvents} from "@escrow-interfaces/IVotingEscrowIncreasing.sol";
import {VotingEscrow} from "@escrow/VotingEscrow.sol";
import {VotingEscrow} from "@escrow/VotingEscrowIncreasing.sol";
import {QuadraticIncreasingEscrow} from "@escrow/QuadraticIncreasingEscrow.sol";
import {ExitQueue} from "@escrow/ExitQueue.sol";
import {SimpleGaugeVoter, SimpleGaugeVoterSetup} from "src/voting/SimpleGaugeVoterSetup.sol";
Expand Down
Loading

0 comments on commit a93ba53

Please sign in to comment.