Skip to content

Commit

Permalink
Merge pull request #551 from ionicprotocol/development
Browse files Browse the repository at this point in the history
merge
  • Loading branch information
rhlsthrm authored Aug 27, 2024
2 parents 41aa32a + 99297bf commit ded82cb
Show file tree
Hide file tree
Showing 3,139 changed files with 737,914 additions and 19,258 deletions.
The diff you're trying to view is too large. We only load the first 3000 changed files.
3 changes: 1 addition & 2 deletions .github/workflows/deploy-bots.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,7 @@ jobs:
cache: 'yarn'

- name: Install `packages`
run: yarn install
run: yarn install --immutable
env:
# Fixes issue: `ethereumjs-abi: The remote archive doesn't match the expected checksum`
YARN_CHECKSUM_BEHAVIOR: update
Expand Down Expand Up @@ -346,4 +346,3 @@ jobs:
- name: Terraform Deploy
working-directory: ./ops
run: make prod-deploy

120 changes: 120 additions & 0 deletions .github/workflows/package-contracts-test.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,120 @@
name: Contracts - build, lint & test

on:
push:
branches:
- main
- development
paths:
- 'packages/contracts/**'
- '.github/workflows/package-contracts-test.yml'
- 'yarn.lock'
pull_request:
branches: [main, staging, development]
paths:
- 'packages/contracts/**'
- '.github/workflows/package-contracts-test.yml'
- 'yarn.lock'

env:
EXCLUDE_TESTS: "Abstract|BeefyERC4626Test|DotDotERC4626Test|ArrakisERC4626Test|JarvisERC4626Test|CurveERC4626Test|EllipsisERC4626Test|HelioERC4626Test|WombatERC4626Test|AaveV3ERC4626Test|ThenaERC4626Test|LeveredPositionLensTest|LeveredPositionFactoryTest|WmaticMaticXLeveredPositionTest|StkBnbWBnbLeveredPositionTest|Jbrl2BrlLeveredPositionTest|BombWbnbLeveredPositionTest|PearlUsdrWUsdrUsdrLpLeveredPositionTest|PearlUsdcUsdcUsdrLpLeveredPositionTest|PearlUsdrDaiUsdrLpLeveredPositionTest"
FLAKY_TESTS: "AnyLiquidationTest|LiquidityMiningTest"
SLOW_TESTS: "MaxBorrowTest|OraclesDecimalsScalingTest|MinBorrowTest|LeveredPositionTest|OraclesDecimalsScalingTest"

jobs:
lint:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4

- uses: actions/setup-node@v4
with:
node-version: '20'
cache: 'yarn'

- name: Install NPM packages
run: yarn install
env:
# Fixes issue: `ethereumjs-abi: The remote archive doesn't match the expected checksum`
YARN_CHECKSUM_BEHAVIOR: update

- name: Lint
run: yarn workspace @ionicprotocol/contracts lint

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@v4
with:
submodules: recursive

- name: Install Npm dependencies
run: yarn install

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

- name: Install Forge dependencies
run: yarn workspace @ionicprotocol/contracts forge install

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

- name: Run base tests for Mode mainnet
run: yarn workspace @ionicprotocol/contracts forge test -vv --no-match-contract '${{ env.EXCLUDE_TESTS }}|${{ env.FLAKY_TESTS }}|${{ env.SLOW_TESTS }}'
continue-on-error: true # Skip the job on test failure

- name: Run slow tests for Mode mainnet
if: always()
run: yarn workspace @ionicprotocol/contracts forge test -vv --match-contract '${{ env.SLOW_TESTS }}'
continue-on-error: true # Skip the job on test failure

- name: Run flaky tests for Mode mainnet
if: always()
run: yarn workspace @ionicprotocol/contracts forge test -vv --match-contract '${{ env.FLAKY_TESTS }}'
continue-on-error: true # Skip the job on test failure

build-and-test-local:
needs: [lint]
env:
MNEMONIC: "${{ secrets.MNEMONIC }}"
TEST_RUN_CHAINID: 0
TEST_RUN_LEVEL: ${{ github.event_name == 'pull_request' && '100' || '90' }}
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
with:
submodules: recursive

- name: Install Npm dependencies
run: yarn install

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

- name: Install Forge dependencies
run: yarn workspace @ionicprotocol/contracts forge install

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

- name: Run forge tests locally
run: yarn workspace @ionicprotocol/contracts forge test -vv --no-match-contract '${{ env.EXCLUDE_TESTS }}|${{ env.FLAKY_TESTS }}|${{ env.SLOW_TESTS }}'
continue-on-error: true # Skip the job on test failure
5 changes: 5 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -38,3 +38,8 @@ cypress
ionic-monorepo.iml

.vscode
packages/contracts/artifacts/
packages/contracts/out/
packages/contracts/cache/
packages/contracts/cache_hardhat/
packages/contracts/transactions.json
24 changes: 24 additions & 0 deletions .gitmodules
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
[submodule "packages/contracts/lib/forge-std"]
path = packages/contracts/lib/forge-std
url = https://github.com/brockelmore/forge-std
[submodule "packages/contracts/lib/openzeppelin-contracts-upgradeable"]
path = packages/contracts/lib/openzeppelin-contracts-upgradeable
url = https://github.com/OpenZeppelin/openzeppelin-contracts-upgradeable
[submodule "packages/contracts/lib/solmate"]
path = packages/contracts/lib/solmate
url = https://github.com/rari-capital/solmate
[submodule "packages/contracts/lib/openzeppelin-contracts"]
path = packages/contracts/lib/openzeppelin-contracts
url = https://github.com/OpenZeppelin/openzeppelin-contracts
[submodule "packages/contracts/lib/pyth-sdk-solidity"]
path = packages/contracts/lib/pyth-sdk-solidity
url = https://github.com/pyth-network/pyth-sdk-solidity
[submodule "packages/contracts/lib/solidity-bytes-utils"]
path = packages/contracts/lib/solidity-bytes-utils
url = https://github.com/GNSPS/solidity-bytes-utils
[submodule "packages/contracts/lib/ops"]
path = packages/contracts/lib/ops
url = https://github.com/gelatodigital/ops
[submodule "packages/contracts/lib/adrastia-periphery"]
path = packages/contracts/lib/adrastia-periphery
url = https://github.com/adrastia-oracle/adrastia-periphery
2 changes: 1 addition & 1 deletion netlify.toml
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ package = "@netlify/plugin-nextjs"
[build]
base = "./"
publish = "./packages/ui/.next"
command = "yarn build:deploy:ui"
command = "yarn && yarn build:deploy:ui"

[build.environment]
YARN_CHECKSUM_BEHAVIOR = "update"
Expand Down
12 changes: 8 additions & 4 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -11,23 +11,26 @@
"packages/sdk",
"packages/security",
"packages/types",
"packages/ui"
"packages/ui",
"packages/contracts"
],
"resolutions": {
"viem": "^2.16.3"
},
"devDependencies": {
"@istanbuljs/nyc-config-typescript": "^1.0.2",
"@tsconfig/recommended": "^1.0.6",
"@types/node": "^20.14.9",
"@types/rimraf": "^3",
"@typescript-eslint/eslint-plugin": "^6",
"@typescript-eslint/parser": "^6",
"eslint": "^9.6.0",
"eslint": "^8",
"eslint-config-prettier": "^9.1.0",
"netlify-cli": "^17.32.0",
"ts-node": "^10.9.1",
"tsc": "^2.0.4",
"tsup": "^8.1.0",
"typescript": "^5.5.3",
"viem": "^2.7.16"
"typescript": "^5.5.3"
},
"dependencies": {
"@next/react-dev-overlay": "^14.1.4",
Expand All @@ -41,6 +44,7 @@
"build:security": "yarn build:types && yarn build:chains && yarn workspace @ionicprotocol/security build",
"build:ui": "yarn workspace @ionicprotocol/ui build",
"build:functions": "yarn workspace @ionicprotocol/functions build",
"build:contracts": "yarn workspace @ionicprotocol/contracts build",
"build:liquidator": "yarn workspace @ionicprotocol/liquidator build",
"build:deploy:liquidator": "yarn build:sdk && yarn build:liquidator",
"build:oracles-monitor": "yarn workspace @ionicprotocol/oracles-monitor build",
Expand Down
3 changes: 2 additions & 1 deletion packages/bots/pyth-updater/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,8 @@
"dotenv": "^16.4.5",
"pino": "^9.2.0",
"pino-pretty": "^11.2.1",
"ts-node-dev": "^2.0.0"
"ts-node-dev": "^2.0.0",
"viem": "^2.16.3"
},
"devDependencies": {
"eslint": "^8",
Expand Down
1 change: 1 addition & 0 deletions packages/bots/pyth-updater/src/services/updater.ts
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,7 @@ export class Updater {
pythNetworkAddress: Address;
connection: EvmPriceServiceConnection;
assetConfigs: PythAssetConfig[] = [];
// @ts-ignore
pythContract: GetContractReturnType<typeof pythAbi, PublicClient> = {} as GetContractReturnType<
typeof pythAbi,
WalletClient<HttpTransport, Chain, LocalAccount<string, Address>, WalletRpcSchema>
Expand Down
2 changes: 1 addition & 1 deletion packages/chains/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@
"dependencies": {
"@ionicprotocol/types": "workspace:*",
"utf-8-validate": "^6.0.4",
"viem": "^2.16.5"
"viem": "^2.16.3"
},
"devDependencies": {
"eslint": "^8",
Expand Down
30 changes: 21 additions & 9 deletions packages/chains/src/mode/assets.ts
Original file line number Diff line number Diff line change
Expand Up @@ -26,10 +26,11 @@ export const weETH = "0x04C0599Ae5A44757c0af6F9eC3b93da8976c150A";
export const wrsETH = "0xe7903B1F75C534Dd8159b313d92cDCfbC62cB3Cd";
export const mBTC = "0x59889b7021243dB5B1e065385F918316cD90D46c";
export const MODE = "0xDfc7C877a950e49D2610114102175A06C2e3167a";
// export const ION = "0x18470019bf0e94611f15852f7e93cf5d65bc34ca";
export const ION = "0x18470019bf0e94611f15852f7e93cf5d65bc34ca";
export const KIM = "0x6863fb62Ed27A9DdF458105B507C15b5d741d62e";
export const sUSDe = "0x211Cc4DD073734dA055fbF44a2b4667d5E5fE5d2";
export const USDe = "0x5d3a1Ff2b6BAb83b63cd9AD0787074081a52ef34";
export const dMBTC = "0x93a397fb0db16BA4bb045a4C08Ee639Cb5639495";

export const assets: SupportedAsset[] = [
{
Expand Down Expand Up @@ -96,14 +97,14 @@ export const assets: SupportedAsset[] = [
oracle: OracleTypes.PythPriceOracle,
extraDocs: defaultDocs("https://explorer.mode.network", MODE)
},
// {
// symbol: assetSymbols.ION,
// underlying: ION,
// name: "Ionic Token",
// decimals: 18,
// oracle: OracleTypes.PythPriceOracle,
// extraDocs: defaultDocs("https://explorer.mode.network", ION)
// },
{
symbol: assetSymbols.ION,
underlying: ION,
name: "Ionic Token",
decimals: 18,
oracle: OracleTypes.VelodromePriceOracle,
extraDocs: defaultDocs("https://explorer.mode.network", ION)
},
// {
// symbol: assetSymbols.KIM,
// underlying: KIM,
Expand Down Expand Up @@ -144,6 +145,17 @@ export const assets: SupportedAsset[] = [
extraDocs: defaultDocs("https://explorer.mode.network", USDe),
initialSupplyCap: parseEther(String(5_000_000)).toString(),
initialBorrowCap: "1"
},
{
symbol: assetSymbols.dMBTC,
underlying: dMBTC,
name: "dMBTC",
decimals: 18,
oracle: OracleTypes.PythPriceOracle,
oracleSpecificParams: {
feed: "0xc9d8b075a5c69303365ae23633d4e085199bf5c520a3b90fed1322a0342ffc33"
} as PythSpecificParams,
extraDocs: defaultDocs("https://explorer.mode.network", dMBTC)
}
];

Expand Down
19 changes: 19 additions & 0 deletions packages/contracts/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
artifacts
artifacts_forge
cache
out/
typechain/
.DS_Store
.idea
.env
deployments/localhost/
deployments/hardhat/
deployments/rinkeby/
deployments/kovan/
contracts.iml
node_modules/
ionic-contracts.iml
cache_hardhat
transactions.json
*transactions.json
deployments/local
2 changes: 2 additions & 0 deletions packages/contracts/.prettierignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
contracts/oracles/keydonix/**
contracts/liquidators/BalancerPoolTokenLiquidator.sol
16 changes: 16 additions & 0 deletions packages/contracts/.prettierrc
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
{
"overrides": [
{
"files": ["*.sol", "*.ts", "*.tsx", ".js"],
"options": {
"printWidth": 120,
"tabWidth": 2,
"useTabs": false,
"singleQuote": false,
"bracketSpacing": true,
"explicitTypes": "always",
"trailingComma": "none"
}
}
]
}
Loading

0 comments on commit ded82cb

Please sign in to comment.