Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: rewardDistributor ready to be added to prod SUP-6630 #542

Merged
merged 10 commits into from
Jun 3, 2024
Prev Previous commit
Next Next commit
chore: add smoke tests
  • Loading branch information
sujithsomraaj committed Jun 3, 2024
commit 12e0c2210e362d18894e1ed30c93b2adde3b33e3
21 changes: 21 additions & 0 deletions test/mainnet/SmokeTest.Staging.t.sol
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@ contract SmokeTestStaging is MainnetBaseSetup {

TARGET_DEPLOYMENT_CHAINS = chains;
EMERGENCY_ADMIN = 0x6A5DD913fE3CB5193E09D1810a3b9ff1C0f9c0D6;
REWARDS_ADMIN = 0x1F05a8Ff6d895Ba04C84c5031c5d63FA1afCDA6F;

super.setUp();
}
Expand Down Expand Up @@ -453,4 +454,24 @@ contract SmokeTestStaging is MainnetBaseSetup {
}
}
}

function test_rewardsDistributorStaging() public {
RewardsDistributor rewardsDistributor;
SuperRegistry superRegistry;
SuperRBAC superRBAC;

for (uint256 i; i < TARGET_DEPLOYMENT_CHAINS.length; ++i) {
uint64 chainId = TARGET_DEPLOYMENT_CHAINS[i];
vm.selectFork(FORKS[chainId]);
rewardsDistributor = RewardsDistributor(getContract(chainId, "RewardsDistributor"));
superRegistry = SuperRegistry(getContract(chainId, "SuperRegistry"));
superRBAC = SuperRBAC(getContract(chainId, "SuperRBAC"));

assertEq(superRBAC.getRoleAdmin(keccak256("REWARDS_ADMIN_ROLE")), superRBAC.PROTOCOL_ADMIN_ROLE());
assertTrue(superRBAC.hasRole(keccak256("REWARDS_ADMIN_ROLE"), REWARDS_ADMIN));

assertEq(superRegistry.getAddress(keccak256("REWARDS_DISTRIBUTOR")), address(rewardsDistributor));
assertEq(address(rewardsDistributor.superRegistry()), address(superRegistry));
}
}
}
20 changes: 20 additions & 0 deletions test/mainnet/SmokeTest.t.sol
Original file line number Diff line number Diff line change
Expand Up @@ -479,4 +479,24 @@ contract SmokeTest is MainnetBaseSetup {
}
}
}

function test_rewardsDistributor() public {
RewardsDistributor rewardsDistributor;
SuperRegistry superRegistry;
SuperRBAC superRBAC;

for (uint256 i; i < TARGET_DEPLOYMENT_CHAINS.length; ++i) {
uint64 chainId = TARGET_DEPLOYMENT_CHAINS[i];
vm.selectFork(FORKS[chainId]);
rewardsDistributor = RewardsDistributor(getContract(chainId, "RewardsDistributor"));
superRegistry = SuperRegistry(getContract(chainId, "SuperRegistry"));
superRBAC = SuperRBAC(getContract(chainId, "SuperRBAC"));

assertEq(superRBAC.getRoleAdmin(keccak256("REWARDS_ADMIN_ROLE")), superRBAC.PROTOCOL_ADMIN_ROLE());
0xTimepunk marked this conversation as resolved.
Show resolved Hide resolved
assertTrue(superRBAC.hasRole(keccak256("REWARDS_ADMIN_ROLE"), REWARDS_ADMIN));

assertEq(superRegistry.getAddress(keccak256("REWARDS_DISTRIBUTOR")), address(rewardsDistributor));
assertEq(address(rewardsDistributor.superRegistry()), address(superRegistry));
}
}
}
5 changes: 5 additions & 0 deletions test/utils/MainnetBaseSetup.sol
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@ abstract contract MainnetBaseSetup is BaseSetup {
address public ownerAddress;

address public EMERGENCY_ADMIN = 0x73009CE7cFFc6C4c5363734d1b429f0b848e0490;
address public REWARDS_ADMIN = 0xf82F3D7Df94FC2994315c32322DA6238cA2A2f7f;

address[] public PROTOCOL_ADMINS = [
0xd26b38a64C812403fD3F87717624C80852cD6D61,
Expand Down Expand Up @@ -176,6 +177,10 @@ abstract contract MainnetBaseSetup is BaseSetup {
/// @dev 14 vault claimer
contracts[chainId][bytes32(bytes("VaultClaimer"))] =
_readContract(chainNames[trueIndex], chainId, "VaultClaimer");

/// @dev 15 rewards distributor
contracts[chainId][bytes32(bytes("RewardsDistributor"))] =
_readContract(chainNames[trueIndex], chainId, "RewardsDistributor");
}

function _readContract(
Expand Down