// 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"; import { IENSRegistry } from "@interfaces/IENSRegistry.sol"; import { ENSNamehash } from "./ENSNamehash.sol"; contract TestExampleProposal is ProposalUtils { 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); modifier executeCurrentProposalBefore() { createAndExecuteProposal(); _; } function calculateDomainNode(string memory domain) internal pure returns (bytes32) { return ENSNamehash.namehash(bytes(domain)); } 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); } 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"); } }