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

Soloseng/L2-lockedGold-test #11272

Merged
merged 4 commits into from
Nov 19, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -2,11 +2,10 @@
pragma solidity ^0.5.13;
pragma experimental ABIEncoderV2;

import "celo-foundry/Test.sol";
import { TestConstants } from "@test-sol/constants.sol";
import { Utils } from "@test-sol/utils.sol";
import "@test-sol/utils/WhenL2.sol";

import "@celo-contracts/common/FixidityLib.sol";
import "@celo-contracts/common/Registry.sol";
import "@celo-contracts/common/Accounts.sol";
import "@test-sol/unit/common/GoldTokenMock.sol";
import "@celo-contracts/governance/LockedGold.sol";
Expand All @@ -19,10 +18,9 @@ import "@celo-contracts/governance/test/MockValidators.sol";

import { TestBlocker } from "@test-sol/unit/common/Blockable.t.sol";

contract LockedGoldTest is Test, TestConstants {
contract LockedGoldTest is Utils {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

even if Utils inherits Test, I'd still inherit test here or rename utils as something like TestWithUtils, otherwise not instant to know it's a test.

using FixidityLib for FixidityLib.Fraction;

Registry registry;
Accounts accounts;
GoldToken goldToken;
MockStableToken stableToken;
Expand Down Expand Up @@ -68,8 +66,7 @@ contract LockedGoldTest is Test, TestConstants {
event MaxDelegateesCountSet(uint256 value);

function setUp() public {
deployCodeTo("Registry.sol", abi.encode(false), REGISTRY_ADDRESS);
registry = Registry(REGISTRY_ADDRESS);
super.setUp();

goldToken = new GoldTokenMock();
accounts = new Accounts(true);
Expand Down Expand Up @@ -216,6 +213,8 @@ contract LockedGoldTest is Test, TestConstants {
}
}

contract LockedGoldTest_L2 is WhenL2, LockedGoldTest {}

contract LockedGoldTest_initialize is LockedGoldTest {
function setUp() public {
super.setUp();
Expand Down Expand Up @@ -257,6 +256,8 @@ contract LockedGoldTest_setRegistry is LockedGoldTest {
}
}

contract LockedGoldTest_setRegistry_L2 is LockedGoldTest_L2, LockedGoldTest_setRegistry {}

contract LockedGoldTest_setUnlockingPeriod is LockedGoldTest {
function setUp() public {
super.setUp();
Expand Down Expand Up @@ -287,6 +288,11 @@ contract LockedGoldTest_setUnlockingPeriod is LockedGoldTest {
}
}

contract LockedGoldTest_setUnlockingPeriod_L2 is
LockedGoldTest_L2,
LockedGoldTest_setUnlockingPeriod
{}

contract LockedGoldTest_lock is LockedGoldTest {
uint256 value = 1000;
function setUp() public {
Expand Down Expand Up @@ -332,6 +338,8 @@ contract LockedGoldTest_lock is LockedGoldTest {
}
}

contract LockedGoldTest_lock_L2 is LockedGoldTest_L2, LockedGoldTest_lock {}

contract LockedGoldTest_unlock is LockedGoldTest {
uint256 value = 1000;
uint256 availabilityTime = unlockingPeriod + block.timestamp;
Expand Down Expand Up @@ -514,6 +522,8 @@ contract LockedGoldTest_unlock is LockedGoldTest {
}
}

contract LockedGoldTest_unlock_L2 is LockedGoldTest_L2, LockedGoldTest_unlock {}

contract LockedGoldTest_unlockDelegation is LockedGoldTest {
uint256 value = 1000;
uint256 availabilityTime = unlockingPeriod + block.timestamp;
Expand Down Expand Up @@ -589,6 +599,8 @@ contract LockedGoldTest_unlockDelegation is LockedGoldTest {
}
}

contract LockedGoldTest_unlockDelegation_L2 is LockedGoldTest_L2, LockedGoldTest_unlockDelegation {}

contract LockedGoldTest_unlock_WhenDelegation2Delegatees is LockedGoldTest {
uint256 value = 1000;
uint256 availabilityTime = unlockingPeriod + block.timestamp;
Expand Down Expand Up @@ -654,6 +666,11 @@ contract LockedGoldTest_unlock_WhenDelegation2Delegatees is LockedGoldTest {
}
}

contract LockedGoldTest_unlock_WhenDelegation2Delegatees_L2 is
LockedGoldTest_L2,
LockedGoldTest_unlock_WhenDelegation2Delegatees
{}

contract LockedGoldTest_unlock_WhenDelegatingTo3Delegatees is LockedGoldTest {
uint256 value = 5;
uint256 availabilityTime = unlockingPeriod + block.timestamp;
Expand Down Expand Up @@ -787,6 +804,11 @@ contract LockedGoldTest_unlock_WhenDelegatingTo3Delegatees is LockedGoldTest {
}
}

contract LockedGoldTest_unlock_WhenDelegatingTo3Delegatees_L2 is
LockedGoldTest_L2,
LockedGoldTest_unlock_WhenDelegatingTo3Delegatees
{}

contract LockedGoldTest_lock_AfterUnlocking is LockedGoldTest {
uint256 pendingWithdrawalValue = 100;
uint256 index = 0;
Expand Down Expand Up @@ -950,6 +972,11 @@ contract LockedGoldTest_lock_AfterUnlocking is LockedGoldTest {
}
}

contract LockedGoldTest_lock_AfterUnlocking_L2 is
LockedGoldTest_L2,
LockedGoldTest_lock_AfterUnlocking
{}

contract LockedGoldTest_withdraw is LockedGoldTest {
uint256 value = 1000;
uint256 index = 0;
Expand Down Expand Up @@ -990,6 +1017,8 @@ contract LockedGoldTest_withdraw is LockedGoldTest {
function() external payable {}
}

contract LockedGoldTest_withdraw_L2 is LockedGoldTest_L2, LockedGoldTest_withdraw {}

contract LockedGoldTest_addSlasher is LockedGoldTest {
string slasherName = "DowntimeSlasher";
address downtimeSlasher = actor(slasherName);
Expand Down Expand Up @@ -1018,6 +1047,8 @@ contract LockedGoldTest_addSlasher is LockedGoldTest {
}
}

contract LockedGoldTest_addSlasher_L2 is LockedGoldTest_L2, LockedGoldTest_addSlasher {}

contract LockedGoldTest_removeSlasher is LockedGoldTest {
string slasherName = "DowntimeSlasher";
string governanceSlasherName = "GovernanceSlasher";
Expand Down Expand Up @@ -1060,6 +1091,8 @@ contract LockedGoldTest_removeSlasher is LockedGoldTest {
}
}

contract LockedGoldTest_removeSlasher_L2 is LockedGoldTest_L2, LockedGoldTest_removeSlasher {}

contract LockedGoldTest_slash is LockedGoldTest {
string slasherName = "DowntimeSlasher";
uint256 value = 1000;
Expand Down Expand Up @@ -1339,6 +1372,8 @@ contract LockedGoldTest_slash is LockedGoldTest {
}
}

contract LockedGoldTest_slash_L2 is LockedGoldTest_L2, LockedGoldTest_slash {}

contract LockedGoldTest_delegateGovernanceVotes is LockedGoldTest {
address delegatee1 = actor("delegatee1");
address delegatee2 = actor("delegatee2");
Expand Down Expand Up @@ -1753,6 +1788,11 @@ contract LockedGoldTest_delegateGovernanceVotes is LockedGoldTest {
}
}

contract LockedGoldTest_delegateGovernanceVotes_L2 is
LockedGoldTest_L2,
LockedGoldTest_delegateGovernanceVotes
{}

contract LockedGoldTest_revokeDelegatedGovernanceVotes is LockedGoldTest {
address delegatee1 = actor("delegatee1");
address delegatee2 = actor("delegatee2");
Expand Down Expand Up @@ -2122,6 +2162,11 @@ contract LockedGoldTest_revokeDelegatedGovernanceVotes is LockedGoldTest {
}
}

contract LockedGoldTest_revokeDelegatedGovernanceVotes_L2 is
LockedGoldTest_L2,
LockedGoldTest_revokeDelegatedGovernanceVotes
{}

contract LockedGoldTest_getAccountTotalGovernanceVotingPower is LockedGoldTest {
address delegator = actor("delegator");
address delegatee = actor("delegatee");
Expand Down Expand Up @@ -2169,6 +2214,11 @@ contract LockedGoldTest_getAccountTotalGovernanceVotingPower is LockedGoldTest {
}
}

contract LockedGoldTest_getAccountTotalGovernanceVotingPower_L2 is
LockedGoldTest_L2,
LockedGoldTest_getAccountTotalGovernanceVotingPower
{}

contract LockedGoldTest_getDelegatorDelegateeInfo is LockedGoldTest {
address delegator = actor("delegator");
address delegatee = actor("delegatee");
Expand Down Expand Up @@ -2211,6 +2261,11 @@ contract LockedGoldTest_getDelegatorDelegateeInfo is LockedGoldTest {
}
}

contract LockedGoldTest_getDelegatorDelegateeInfo_L2 is
LockedGoldTest_L2,
LockedGoldTest_getDelegatorDelegateeInfo
{}

contract LockedGoldTest_getDelegatorDelegateeExpectedAndRealAmount is LockedGoldTest {
address delegator = actor("delegator");
address delegatee = actor("delegatee");
Expand Down Expand Up @@ -2327,6 +2382,11 @@ contract LockedGoldTest_getDelegatorDelegateeExpectedAndRealAmount is LockedGold
}
}

contract LockedGoldTest_getDelegatorDelegateeExpectedAndRealAmount_L2 is
LockedGoldTest_L2,
LockedGoldTest_getDelegatorDelegateeExpectedAndRealAmount
{}

contract LockedGoldTest_updateDelegatedAmount is LockedGoldTest {
address delegator = actor("delegator");
address delegatee = actor("delegatee");
Expand Down Expand Up @@ -2404,6 +2464,11 @@ contract LockedGoldTest_updateDelegatedAmount is LockedGoldTest {
}
}

contract LockedGoldTest_updateDelegatedAmount_L2 is
LockedGoldTest_L2,
LockedGoldTest_updateDelegatedAmount
{}

contract LockedGoldTest_getTotalPendingWithdrawalsCount is LockedGoldTest {
uint256 value = 1000;
address account = actor("account");
Expand Down Expand Up @@ -2434,6 +2499,11 @@ contract LockedGoldTest_getTotalPendingWithdrawalsCount is LockedGoldTest {
}
}

contract LockedGoldTest_getTotalPendingWithdrawalsCount_L2 is
LockedGoldTest_L2,
LockedGoldTest_getTotalPendingWithdrawalsCount
{}

contract LockedGoldTestGetPendingWithdrawalsInBatch is LockedGoldTest {
uint256 value = 1000;

Expand Down Expand Up @@ -2516,3 +2586,8 @@ contract LockedGoldTestGetPendingWithdrawalsInBatch is LockedGoldTest {
assertEq(timestamps.length, 0);
}
}

contract LockedGoldTestGetPendingWithdrawalsInBatch_L2 is
LockedGoldTest_L2,
LockedGoldTestGetPendingWithdrawalsInBatch
{}
Loading