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-feehandlerseller-test #11278

Merged
merged 3 commits into from
Nov 21, 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
31 changes: 23 additions & 8 deletions packages/protocol/test-sol/unit/common/FeeHandlerSeller.t.sol
Original file line number Diff line number Diff line change
Expand Up @@ -3,19 +3,16 @@ pragma solidity ^0.5.13;
pragma experimental ABIEncoderV2;

// Helper contracts
import { Test } from "celo-foundry/Test.sol";
import { TestConstants } from "@test-sol/constants.sol";

import { CeloTokenMock } from "@test-sol/unit/common/CeloTokenMock.sol";
import { FeeHandlerSeller } from "@celo-contracts/common/FeeHandlerSeller.sol";
import { MentoFeeHandlerSeller } from "@celo-contracts/common/MentoFeeHandlerSeller.sol";
import { UniswapFeeHandlerSeller } from "@celo-contracts/common/UniswapFeeHandlerSeller.sol";

import "@celo-contracts/common/interfaces/IRegistry.sol";

contract FeeHandlerSellerTest is Test, TestConstants {
event OracleAddressSet(address _token, address _oracle);
import { TestWithUtils } from "@test-sol/TestWithUtils.sol";
import "@test-sol/utils/WhenL2.sol";

contract FeeHandlerSellerTest is TestWithUtils {
// Actors
address RECEIVER_ADDRESS = actor("Arbitrary Receiver");
address NON_OWNER_ADDRESS = actor("Arbitrary Non-Owner");
Expand All @@ -31,9 +28,10 @@ contract FeeHandlerSellerTest is Test, TestConstants {
// Helper data structures
FeeHandlerSeller[] feeHandlerSellerInstances;

event OracleAddressSet(address _token, address _oracle);

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

celoToken = new CeloTokenMock();
oracle = actor("oracle");
Expand All @@ -49,6 +47,8 @@ contract FeeHandlerSellerTest is Test, TestConstants {
}
}

contract FeeHandlerSellerTest_L2 is WhenL2, FeeHandlerSellerTest {}

contract FeeHandlerSellerTest_Transfer is FeeHandlerSellerTest {
uint256 constant ZERO_CELOTOKEN = 0;
uint256 constant ONE_CELOTOKEN = 1e18;
Expand Down Expand Up @@ -94,6 +94,11 @@ contract FeeHandlerSellerTest_Transfer is FeeHandlerSellerTest {
}
}

contract FeeHandlerSellerTest_Transfer_L2 is
FeeHandlerSellerTest_L2,
FeeHandlerSellerTest_Transfer
{}

contract FeeHandlerSellerTest_SetMinimumReports is FeeHandlerSellerTest {
address ARBITRARY_TOKEN_ADDRESS = actor("Arbitrary Token Address");
uint256 constant ARBITRARY_NR_OF_MINIMUM_REPORTS = 15;
Expand Down Expand Up @@ -128,6 +133,11 @@ contract FeeHandlerSellerTest_SetMinimumReports is FeeHandlerSellerTest {
}
}

contract FeeHandlerSellerTest_SetMinimumReports_L2 is
FeeHandlerSellerTest_L2,
FeeHandlerSellerTest_SetMinimumReports
{}

contract FeeHandlerSellerTest_setOracleAddress is FeeHandlerSellerTest {
function test_Reverts_WhenCalledByNonOwner() public {
vm.prank(NON_OWNER_ADDRESS);
Expand All @@ -151,3 +161,8 @@ contract FeeHandlerSellerTest_setOracleAddress is FeeHandlerSellerTest {
uniswapFeeHandlerSeller.setOracleAddress(address(celoToken), oracle);
}
}

contract FeeHandlerSellerTest_setOracleAddress_L2 is
FeeHandlerSellerTest_L2,
FeeHandlerSellerTest_setOracleAddress
{}
Loading