-
Notifications
You must be signed in to change notification settings - Fork 30
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
1 parent
c2369bb
commit 396eed4
Showing
1 changed file
with
64 additions
and
0 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,64 @@ | ||
// SPDX-License-Identifier: Apache-2.0 | ||
pragma solidity 0.8.16; | ||
|
||
import "forge-std/Test.sol"; | ||
|
||
import "../../src/gov-action-contracts/AIPs/AIPXAction.sol"; | ||
import "../../src/security-council-mgmt/governors/SecurityCouncilNomineeElectionGovernor.sol"; | ||
|
||
contract AIPXActionTest is Test { | ||
address oldImplementation = 0x8436A1bc9f9f9EB0cF1B51942C5657b60A40CCDD; | ||
SecurityCouncilNomineeElectionGovernor gov = SecurityCouncilNomineeElectionGovernor(payable(0x8a1cDA8dee421cD06023470608605934c16A05a0)); | ||
ProxyAdmin proxyAdmin = ProxyAdmin(0xdb216562328215E010F819B5aBe947bad4ca961e); | ||
UpgradeExecutor arbOneUe = UpgradeExecutor(0xCF57572261c7c2BCF21ffD220ea7d1a27D40A827); | ||
address council = 0x423552c0F05baCCac5Bfa91C6dCF1dc53a0A1641; | ||
|
||
address newImplementation = address(new SecurityCouncilNomineeElectionGovernor()); | ||
uint256 votingDelay = 7 days; | ||
AIPXAction action = new AIPXAction( | ||
address(proxyAdmin), | ||
address(gov), | ||
newImplementation, | ||
votingDelay | ||
); | ||
|
||
function testAction() external { | ||
if (!_isForkTest()) { | ||
console.log("not fork test, skipping AIPXActionTest"); | ||
return; | ||
} | ||
|
||
if (_getImplementation() != oldImplementation) { | ||
console.log("implementation not set to old implementation, skipping AIPXActionTest"); | ||
return; | ||
} | ||
|
||
vm.prank(council); | ||
arbOneUe.execute(address(action), abi.encodeWithSelector(action.perform.selector)); | ||
|
||
assertEq( | ||
gov.votingDelay(), | ||
votingDelay, | ||
"voting delay not set" | ||
); | ||
|
||
assertEq( | ||
_getImplementation(), | ||
newImplementation, | ||
"implementation not set" | ||
); | ||
} | ||
|
||
function _getImplementation() internal view returns (address) { | ||
return proxyAdmin.getProxyImplementation(TransparentUpgradeableProxy(payable(gov))); | ||
} | ||
|
||
function _isForkTest() internal view returns (bool) { | ||
bool isForkTest; | ||
address _gov = address(gov); | ||
assembly { | ||
isForkTest := gt(extcodesize(_gov), 0) | ||
} | ||
return isForkTest; | ||
} | ||
} |