-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
14 changed files
with
1,256 additions
and
6 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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 | ||
}); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.