2023-07-28 15:43:53 +03:00
|
|
|
// SPDX-License-Identifier: MIT
|
|
|
|
pragma solidity ^0.8.19;
|
|
|
|
|
|
|
|
import { ProposalUtils } from "./utils/ProposalUtils.sol";
|
|
|
|
import { UpdateENSDataProposal } from "@root/UpdateENSDataProposal.sol";
|
|
|
|
|
|
|
|
import { console2 } from "@forge-std/console2.sol";
|
|
|
|
import { IENSResolver } from "@interfaces/IENSResolver.sol";
|
2023-08-31 00:34:22 +03:00
|
|
|
import { IENSRegistry } from "@interfaces/IENSRegistry.sol";
|
|
|
|
|
|
|
|
import { ENSNamehash } from "./ENSNamehash.sol";
|
2023-07-28 15:43:53 +03:00
|
|
|
|
|
|
|
contract TestExampleProposal is ProposalUtils {
|
2023-08-31 00:34:22 +03:00
|
|
|
using ENSNamehash for bytes;
|
|
|
|
|
|
|
|
IENSResolver internal ensResolver = IENSResolver(0x4976fb03C32e5B8cfe2b6cCB31c09Ba78EBaBa41);
|
|
|
|
IENSRegistry ensRegistry = IENSRegistry(ENSAddress);
|
|
|
|
string internal tornadoContractENSDomain = "contract.tornadocash.eth";
|
|
|
|
string internal governanceImplementationENSDomain = "governance-impl.contract.tornadocash.eth";
|
|
|
|
string internal stakingRewardsENSDomain = "staking-rewards.contract.tornadocash.eth";
|
|
|
|
|
|
|
|
bytes32 internal tornadoContractsENSNode = calculateDomainNode(tornadoContractENSDomain);
|
|
|
|
bytes32 internal stakingRewardsENSNode = calculateDomainNode(stakingRewardsENSDomain);
|
|
|
|
bytes32 internal governanceImplENSNode = calculateDomainNode(governanceImplementationENSDomain);
|
2023-07-28 15:43:53 +03:00
|
|
|
|
|
|
|
modifier executeCurrentProposalBefore() {
|
|
|
|
createAndExecuteProposal();
|
|
|
|
_;
|
|
|
|
}
|
|
|
|
|
2023-08-31 00:34:22 +03:00
|
|
|
function calculateDomainNode(string memory domain) internal pure returns (bytes32) {
|
|
|
|
return ENSNamehash.namehash(bytes(domain));
|
|
|
|
}
|
|
|
|
|
2023-07-28 15:43:53 +03:00
|
|
|
function createAndExecuteProposal() public {
|
|
|
|
address proposalAddress = address(new UpdateENSDataProposal());
|
|
|
|
|
|
|
|
proposeAndExecute(proposalAddress);
|
|
|
|
}
|
|
|
|
|
|
|
|
function testStakingAddressChanged() public executeCurrentProposalBefore {
|
|
|
|
address stakingAddressAfterProposal = ensResolver.addr(stakingRewardsENSNode);
|
|
|
|
|
|
|
|
console2.log("Address on staking ENS Tornado subdomain (staking-rewards.contract.tornadocash.eth): %s", stakingAddressAfterProposal);
|
|
|
|
require(stakingAddressAfterProposal == stakingAddress);
|
|
|
|
}
|
2023-08-31 00:34:22 +03:00
|
|
|
|
|
|
|
function testGovernanceImplAddressChanged() public executeCurrentProposalBefore {
|
|
|
|
address expectedGovernanceImplAddress = 0xBa178126C28F50Ee60322a82f5EbCd6b3711e101;
|
|
|
|
address governanceImplAddressAfterProposal = ensResolver.addr(governanceImplENSNode);
|
|
|
|
|
|
|
|
console2.log(
|
|
|
|
"Address on governance implementation ENS Tornado subdomain (governance-impl.contract.tornadocash.eth): %s",
|
|
|
|
governanceImplAddressAfterProposal
|
|
|
|
);
|
|
|
|
require(expectedGovernanceImplAddress == governanceImplAddressAfterProposal);
|
|
|
|
}
|
|
|
|
|
|
|
|
function testENSSubdomainOwnerChanged() public executeCurrentProposalBefore {
|
|
|
|
address tornadoContractsENSDomainOwner = ensRegistry.owner(tornadoContractsENSNode);
|
|
|
|
address governanceImplENSNodeOwner = ensRegistry.owner(governanceImplENSNode);
|
|
|
|
address stakingRewardsENSNodeOwner = ensRegistry.owner(stakingRewardsENSNode);
|
|
|
|
|
|
|
|
console2.log("Tornado contracts ENS domain owner after proposal execution: %s", tornadoContractsENSDomainOwner);
|
|
|
|
console2.log("Staking rewards ENS domain owner after proposal execution: %s", stakingRewardsENSNodeOwner);
|
|
|
|
console2.log("Governance implementation ENS domain owner after proposal execution: %s", governanceImplENSNodeOwner);
|
|
|
|
require(stakingRewardsENSNodeOwner == governanceAddress, "Staking rewards ENS domain owner is not governance");
|
|
|
|
require(tornadoContractsENSDomainOwner == governanceAddress, "Tornado contracts ENS domain owner is not governance");
|
|
|
|
require(governanceImplENSNodeOwner == governanceAddress, "Governance implementation ENS domain owner is not governance");
|
|
|
|
}
|
2023-07-28 15:43:53 +03:00
|
|
|
}
|