Skip to content
This repository has been archived by the owner on Aug 26, 2024. It is now read-only.

Commit

Permalink
Merge pull request #35 from ionicprotocol/feat/mode-network
Browse files Browse the repository at this point in the history
mode network forge config
  • Loading branch information
vminkov authored Jan 3, 2024
2 parents b19aa43 + d750bd8 commit c981a50
Show file tree
Hide file tree
Showing 5 changed files with 54 additions and 3 deletions.
39 changes: 39 additions & 0 deletions .github/workflows/pull-request-build-and-test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -306,6 +306,45 @@ jobs:
if: always()
run: forge test -vv --match-contract '${{ env.FLAKY_TESTS }}'

build-and-test-mode:
needs: [lint]
env:
MNEMONIC: "${{ secrets.MNEMONIC }}"
TEST_RUN_CHAINID: 34443
TEST_RUN_LEVEL: ${{ github.event_name == 'pull_request' && '100' || '90' }}
MODE_MAINNET_RPC_URL: https://mainnet.mode.network/
MODE_ARCHIVE_RPC_URL: https://mainnet.mode.network/
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
with:
submodules: recursive

- name: Install Foundry
uses: onbjerg/foundry-toolchain@v1
with:
version: nightly

- name: Install Forge dependencies
run: forge install

- name: Forge RPC cache
uses: actions/cache@v3
with:
path: "~/.foundry/cache"
key: rpc-cache-local-${{ hashFiles('rpc-cache-keyfile') }}

- name: Run base tests for Mode mainnet
run: forge test -vv --no-match-contract '${{ env.EXCLUDE_TESTS }}|${{ env.FLAKY_TESTS }}|${{ env.SLOW_TESTS }}'

- name: Run slow tests for Mode mainnet
if: always()
run: forge test -vv --match-contract '${{ env.SLOW_TESTS }}'

- name: Run flaky tests for Mode mainnet
if: always()
run: forge test -vv --match-contract '${{ env.FLAKY_TESTS }}'

build-and-test-zkevm:
needs: [lint]
env:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -79,7 +79,9 @@ contract LeveredPositionFactorySecondExtension is
uint256 _leverageRatio
) external returns (LeveredPosition) {
LeveredPosition position = createAndFundPosition(_collateralMarket, _stableMarket, _fundingAsset, _fundingAmount);
position.adjustLeverageRatio(_leverageRatio);
if (_leverageRatio > 1e18) {
position.adjustLeverageRatio(_leverageRatio);
}
return position;
}
}
2 changes: 1 addition & 1 deletion contracts/ionic/levered/LeveredPositionsLens.sol
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,7 @@ contract LeveredPositionsLens is Initializable {
}

/// @notice this is a lens fn, it is not intended to be used on-chain
/// @dev returns the Rate for the chosen borrowable at the specified leverage ratio and supply amount
/// @dev returns the Rate for the chosen borrowable at the specified leverage ratio and supply amount
function getBorrowRateAtRatio(
ICErc20 _collateralMarket,
ICErc20 _stableMarket,
Expand Down
10 changes: 9 additions & 1 deletion contracts/test/config/BaseTest.t.sol
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@ abstract contract BaseTest is Test {
uint128 constant NEON_MAINNET = 245022934;
uint128 constant LINEA_MAINNET = 59144;
uint128 constant ZKEVM_MAINNET = 1101;
uint128 constant MODE_MAINNET = 34443;

// taken from ERC1967Upgrade
bytes32 internal constant _ADMIN_SLOT = 0xb53127684a568b3173ae13b9f8a6016e243e63b6e8ee1178d6a717850b5d6103;
Expand Down Expand Up @@ -125,6 +126,8 @@ abstract contract BaseTest is Test {
forkIds[chainid] = vm.createFork(vm.rpcUrl("linea")) + 100;
} else if (chainid == ZKEVM_MAINNET) {
forkIds[chainid] = vm.createFork(vm.rpcUrl("zkevm")) + 100;
} else if (chainid == MODE_MAINNET) {
forkIds[chainid] = vm.createFork(vm.rpcUrl("mode")) + 100;
}
}

Expand All @@ -151,6 +154,8 @@ abstract contract BaseTest is Test {
forkIds[chainidWithOffset] = vm.createFork(vm.rpcUrl("linea_archive")) + 100;
} else if (chainid == ZKEVM_MAINNET) {
forkIds[chainidWithOffset] = vm.createFork(vm.rpcUrl("zkevm_archive")) + 100;
} else if (chainid == MODE_MAINNET) {
forkIds[chainidWithOffset] = vm.createFork(vm.rpcUrl("mode_archive")) + 100;
}
}
return forkIds[chainidWithOffset] - 100;
Expand All @@ -173,6 +178,9 @@ abstract contract BaseTest is Test {
ap = AddressesProvider(0x914694DA0bED80e74ef1a28029f016119782C0f1);
} else if (chainid == ZKEVM_MAINNET) {
ap = AddressesProvider(0x27aA55A3D55959261e119d75256aadAB79aE897C);
} else if (chainid == MODE_MAINNET) {
// TODO deploy AP
ap = AddressesProvider(address(555));
} else {
dpa = new ProxyAdmin();
AddressesProvider logic = new AddressesProvider();
Expand All @@ -190,7 +198,7 @@ abstract contract BaseTest is Test {
}
if (ap.getAddress("deployer") == address(0)) {
vm.prank(ap.owner());
ap.setAddress("deployer", 0x9308dddeC9B5cCd8a2685A46E913C892FE31C826);
ap.setAddress("deployer", 0x1155b614971f16758C92c4890eD338C9e3ede6b7);
}
}

Expand Down
2 changes: 2 additions & 0 deletions foundry.toml
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@ neon = "${NEON_RPC_URL}"
linea = "${LINEA_RPC_URL}"
ethereum = "${ETHEREUM_MAINNET_RPC_URL}"
zkevm = "${ZKEVM_MAINNET_RPC_URL}"
mode = "${MODE_MAINNET_RPC_URL}"

bsc_archive = "${BSC_MAINNET_ARCHIVE_RPC_URL}"
bsc_chapel_archive = "${BSC_CHAPEL_ARCHIVE_RPC_URL}"
Expand All @@ -22,5 +23,6 @@ neon_archive = "${NEON_ARCHIVE_RPC_URL}"
linea_archive = "${LINEA_ARCHIVE_RPC_URL}"
ethereum_archive = "${ETHEREUM_MAINNET_ARCHIVE_RPC_URL}"
zkevm_archive = "${ZKEVM_MAINNET_ARCHIVE_RPC_URL}"
mode_archive = "${MODE_MAINNET_ARCHIVE_RPC_URL}"

# See more config options https://github.com/gakonst/foundry/tree/master/config

0 comments on commit c981a50

Please sign in to comment.