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

Proposal for Mantle USDe market #85

Open
wants to merge 38 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from 24 commits
Commits
Show all changes
38 commits
Select commit Hold shift + click to select a range
f9bcb26
wip
MishaShWoof Oct 1, 2024
b6697bc
wip
MishaShWoof Oct 2, 2024
74b436b
wip
MishaShWoof Oct 4, 2024
6e4a0d7
wip
MishaShWoof Oct 7, 2024
9fbe1b2
wip: working scenarios
MishaShWoof Oct 7, 2024
ed0dde2
feat: migration and fix for the redstone oracles
MishaShWoof Oct 8, 2024
6433f55
fix: pr link
MishaShWoof Oct 8, 2024
7fb3137
feat: udpate safe libs. deploy pauseGuardian for Mantel network. addr…
dmitriy-woof-software Oct 8, 2024
2205595
update caps and speeds to zero
dmitriy-woof-software Oct 8, 2024
45dab4c
Merge branch 'main' into woof-software/deploy-compound-mantle-usde
dmitriy-woof-software Oct 8, 2024
4f97f07
feat: update description
dmitriy-woof-software Oct 8, 2024
4462c80
remove safe lib yarn.lock update
dmitriy-woof-software Oct 8, 2024
62d748b
feat: update description
dmitriy-woof-software Oct 8, 2024
fccd37c
feat: update description
dmitriy-woof-software Oct 8, 2024
d833496
feat: update price feeds
dmitriy-woof-software Oct 8, 2024
f2ce5fa
feat: update price feeds
dmitriy-woof-software Oct 8, 2024
5ec3b62
feat: update MANTLE to MNT token name
dmitriy-woof-software Oct 8, 2024
4a3a857
add mantle into hardhat config
dmitriy-woof-software Oct 8, 2024
782522d
wip: deployment
dmitriy-woof-software Oct 9, 2024
c07ada8
Modified deployment roots from GitHub Actions
Oct 9, 2024
15c7f58
feat: add caps, speeds and update doc
dmitriy-woof-software Oct 9, 2024
d15c67d
feat: update seacrest
dmitriy-woof-software Oct 9, 2024
ca9253a
feat: update enact-migration
dmitriy-woof-software Oct 9, 2024
fe24058
fix: changes after audit
MishaShWoof Oct 22, 2024
f9a86e1
feat: add comments
dmitriy-woof-software Oct 23, 2024
197dc91
Merge branch 'main' into woof-software/deploy-compound-mantle-usde
dmitriy-woof-software Oct 23, 2024
e862fb9
feat: update config for deployment
dmitriy-woof-software Oct 23, 2024
34e4ab9
Merge branch 'woof-software/deploy-compound-mantle-usde' of github.co…
dmitriy-woof-software Oct 23, 2024
739c6df
Modified deployment roots from GitHub Actions
Oct 23, 2024
2f2257a
feat: update roots
dmitriy-woof-software Oct 23, 2024
0129b6c
Modified deployment roots from GitHub Actions
Oct 23, 2024
39b1986
update caps and speeds
dmitriy-woof-software Oct 23, 2024
0a13d2f
feat: update config for mantle scenarios
dmitriy-woof-software Oct 23, 2024
d70364b
feat: comment USDS ENS, as it is not executed yet
dmitriy-woof-software Oct 23, 2024
9085b8a
Proposal for Mainnet USDS market (#942)
MishaShWoof Oct 24, 2024
d34ec5f
Merge branch 'main' of github.com:woof-software/comet into woof-softw…
MishaShWoof Oct 31, 2024
32be792
fix: update
MishaShWoof Oct 31, 2024
86bc48d
Modified migration from GitHub Actions
Nov 1, 2024
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
4 changes: 3 additions & 1 deletion .github/workflows/deploy-market.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@ on:
- base-goerli
- linea-goerli
- optimism
- mantle
- scroll-goerli
- scroll
deployment:
Expand All @@ -42,13 +43,14 @@ jobs:
BASESCAN_KEY: ${{ secrets.BASESCAN_KEY }}
LINEASCAN_KEY: ${{ secrets.LINEASCAN_KEY }}
OPTIMISMSCAN_KEY: ${{ secrets.OPTIMISMSCAN_KEY }}
MANTLESCAN_KEY: ${{ secrets.MANTLESCAN_KEY }}
steps:
- name: Seacrest
uses: hayesgm/seacrest@5748b3a066f517973ca2ca03d0af39bbf2b82d10
with:
wallet_connect_project_id: ${{ secrets.WALLET_CONNECT_PROJECT_ID }}
requested_network: "${{ inputs.network }}"
ethereum_url: "${{ fromJSON('{\"optimism\":\"https://optimism-mainnet.infura.io/v3/$INFURA_KEY\",\"fuji\":\"https://api.avax-test.network/ext/bc/C/rpc\",\"mainnet\":\"https://mainnet.infura.io/v3/$INFURA_KEY\",\"goerli\":\"https://goerli.infura.io/v3/$INFURA_KEY\",\"sepolia\":\"https://sepolia.infura.io/v3/$INFURA_KEY\",\"mumbai\":\"https://polygon-mumbai.infura.io/v3/$INFURA_KEY\",\"polygon\":\"https://polygon-mainnet.infura.io/v3/$INFURA_KEY\",\"arbitrum-goerli\":\"https://arbitrum-goerli.infura.io/v3/$INFURA_KEY\",\"arbitrum\":\"https://arbitrum-mainnet.infura.io/v3/$INFURA_KEY\",\"base\":\"https://fluent-prettiest-scion.base-mainnet.quiknode.pro/$QUICKNODE_KEY\",\"base-goerli\":\"https://base-goerli.infura.io/v3/$INFURA_KEY\",\"linea-goerli\":\"https://linea-goerli.infura.io/v3/$INFURA_KEY\",\"scroll-goerli\":\"https://alpha-rpc.scroll.io/l2\",\"scroll\":\"https://rpc.scroll.io\"}')[inputs.network] }}"
ethereum_url: "${{ fromJSON('{\"mantle\":\"https://mantle-mainnet.infura.io/v3/$INFURA_KEY\",\"optimism\":\"https://optimism-mainnet.infura.io/v3/$INFURA_KEY\",\"fuji\":\"https://api.avax-test.network/ext/bc/C/rpc\",\"mainnet\":\"https://mainnet.infura.io/v3/$INFURA_KEY\",\"goerli\":\"https://goerli.infura.io/v3/$INFURA_KEY\",\"sepolia\":\"https://sepolia.infura.io/v3/$INFURA_KEY\",\"mumbai\":\"https://polygon-mumbai.infura.io/v3/$INFURA_KEY\",\"polygon\":\"https://polygon-mainnet.infura.io/v3/$INFURA_KEY\",\"arbitrum-goerli\":\"https://arbitrum-goerli.infura.io/v3/$INFURA_KEY\",\"arbitrum\":\"https://arbitrum-mainnet.infura.io/v3/$INFURA_KEY\",\"base\":\"https://fluent-prettiest-scion.base-mainnet.quiknode.pro/$QUICKNODE_KEY\",\"base-goerli\":\"https://base-goerli.infura.io/v3/$INFURA_KEY\",\"linea-goerli\":\"https://linea-goerli.infura.io/v3/$INFURA_KEY\",\"scroll-goerli\":\"https://alpha-rpc.scroll.io/l2\",\"scroll\":\"https://rpc.scroll.io\"}')[inputs.network] }}"
port: 8585
if: github.event.inputs.eth_pk == ''

Expand Down
14 changes: 8 additions & 6 deletions .github/workflows/enact-migration.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@ on:
- base-goerli
- linea-goerli
- optimism
- mantle
- scroll-goerli
- scroll
deployment:
Expand Down Expand Up @@ -59,11 +60,12 @@ jobs:
BASESCAN_KEY: ${{ secrets.BASESCAN_KEY }}
LINEASCAN_KEY: ${{ secrets.LINEASCAN_KEY }}
OPTIMISMSCAN_KEY: ${{ secrets.OPTIMISMSCAN_KEY }}
MANTLESCAN_KEY: ${{ secrets.MANTLESCAN_KEY }}
steps:
- name: Get governance network
run: |
case ${{ github.event.inputs.network }} in
polygon | arbitrum | base | optimism)
polygon | arbitrum | base | optimism | mantle)
echo "GOV_NETWORK=mainnet" >> $GITHUB_ENV ;;
mumbai | arbitrum-goerli | base-goerli | linea-goerli | scroll-goerli | scroll)
echo "GOV_NETWORK=goerli" >> $GITHUB_ENV ;;
Expand All @@ -72,22 +74,22 @@ jobs:
esac

- name: Seacrest
uses: hayesgm/seacrest@0cab0fa2a2a8bf5b005956d70e3dad697d9fe013
uses: hayesgm/seacrest@5d8e5e3023669e93d197963273ae159ecda9d2b2
with:
wallet_connect_project_id: ${{ secrets.WALLET_CONNECT_PROJECT_ID }}
requested_network: "${{ inputs.network }}"
ethereum_url: "${{ fromJSON('{\"optimism\":\"https://optimism-mainnet.infura.io/v3/$INFURA_KEY\",\"fuji\":\"https://api.avax-test.network/ext/bc/C/rpc\",\"mainnet\":\"https://mainnet.infura.io/v3/$INFURA_KEY\",\"goerli\":\"https://goerli.infura.io/v3/$INFURA_KEY\",\"sepolia\":\"https://sepolia.infura.io/v3/$INFURA_KEY\",\"mumbai\":\"https://polygon-mumbai.infura.io/v3/$INFURA_KEY\",\"polygon\":\"https://polygon-mainnet.infura.io/v3/$INFURA_KEY\",\"arbitrum-goerli\":\"https://arbitrum-goerli.infura.io/v3/$INFURA_KEY\",\"arbitrum\":\"https://arbitrum-mainnet.infura.io/v3/$INFURA_KEY\",\"base\":\"https://fluent-prettiest-scion.base-mainnet.quiknode.pro/$QUICKNODE_KEY\",\"base-goerli\":\"https://base-goerli.infura.io/v3/$INFURA_KEY\",\"linea-goerli\":\"https://linea-goerli.infura.io/v3/$INFURA_KEY\",\"scroll-goerli\":\"https://alpha-rpc.scroll.io/l2\",\"scroll\":\"https://rpc.scroll.io\"}')[inputs.network] }}"
ethereum_url: "${{ fromJSON('{\"mantle\":\"https://mantle-mainnet.infura.io/v3/$INFURA_KEY\",\"optimism\":\"https://optimism-mainnet.infura.io/v3/$INFURA_KEY\",\"fuji\":\"https://api.avax-test.network/ext/bc/C/rpc\",\"mainnet\":\"https://mainnet.infura.io/v3/$INFURA_KEY\",\"goerli\":\"https://goerli.infura.io/v3/$INFURA_KEY\",\"sepolia\":\"https://sepolia.infura.io/v3/$INFURA_KEY\",\"mumbai\":\"https://polygon-mumbai.infura.io/v3/$INFURA_KEY\",\"polygon\":\"https://polygon-mainnet.infura.io/v3/$INFURA_KEY\",\"arbitrum-goerli\":\"https://arbitrum-goerli.infura.io/v3/$INFURA_KEY\",\"arbitrum\":\"https://arbitrum-mainnet.infura.io/v3/$INFURA_KEY\",\"base\":\"https://fluent-prettiest-scion.base-mainnet.quiknode.pro/$QUICKNODE_KEY\",\"base-goerli\":\"https://base-goerli.infura.io/v3/$INFURA_KEY\",\"linea-goerli\":\"https://linea-goerli.infura.io/v3/$INFURA_KEY\",\"scroll-goerli\":\"https://alpha-rpc.scroll.io/l2\",\"scroll\":\"https://rpc.scroll.io\"}')[inputs.network] }}"
port: 8585
if: github.event.inputs.eth_pk == ''

- name: Seacrest (governance network)
uses: hayesgm/seacrest@0cab0fa2a2a8bf5b005956d70e3dad697d9fe013
uses: hayesgm/seacrest@5d8e5e3023669e93d197963273ae159ecda9d2b2
with:
wallet_connect_project_id: ${{ secrets.WALLET_CONNECT_PROJECT_ID }}
requested_network: "${{ env.GOV_NETWORK }}"
ethereum_url: "${{ fromJSON('{\"optimism\":\"https://optimism-mainnet.infura.io/v3/$INFURA_KEY\",\"fuji\":\"https://api.avax-test.network/ext/bc/C/rpc\",\"mainnet\":\"https://mainnet.infura.io/v3/$INFURA_KEY\",\"goerli\":\"https://goerli.infura.io/v3/$INFURA_KEY\",\"sepolia\":\"https://sepolia.infura.io/v3/$INFURA_KEY\",\"mumbai\":\"https://polygon-mumbai.infura.io/v3/$INFURA_KEY\",\"polygon\":\"https://polygon-mainnet.infura.io/v3/$INFURA_KEY\",\"arbitrum-goerli\":\"https://arbitrum-goerli.infura.io/v3/$INFURA_KEY\",\"arbitrum\":\"https://arbitrum-mainnet.infura.io/v3/$INFURA_KEY\"}')[env.GOV_NETWORK] }}"
ethereum_url: "${{ fromJSON('{\"mantle\":\"https://mantle-mainnet.infura.io/v3/$INFURA_KEY\",\"optimism\":\"https://optimism-mainnet.infura.io/v3/$INFURA_KEY\",\"fuji\":\"https://api.avax-test.network/ext/bc/C/rpc\",\"mainnet\":\"https://mainnet.infura.io/v3/$INFURA_KEY\",\"goerli\":\"https://goerli.infura.io/v3/$INFURA_KEY\",\"sepolia\":\"https://sepolia.infura.io/v3/$INFURA_KEY\",\"mumbai\":\"https://polygon-mumbai.infura.io/v3/$INFURA_KEY\",\"polygon\":\"https://polygon-mainnet.infura.io/v3/$INFURA_KEY\",\"arbitrum-goerli\":\"https://arbitrum-goerli.infura.io/v3/$INFURA_KEY\",\"arbitrum\":\"https://arbitrum-mainnet.infura.io/v3/$INFURA_KEY\"}')[env.GOV_NETWORK] }}"
port: 8685
if: github.event.inputs.eth_pk == '' && env.GOV_NETWORK != ''
if: github.event.inputs.eth_pk == '' && env.GOV_NETWORK != '' && github.event.inputs.impersonateAccount == ''

- name: Checkout repository
uses: actions/checkout@v4
Expand Down
4 changes: 3 additions & 1 deletion .github/workflows/prepare-migration.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@ on:
- base
- base-goerli
- optimism
- mantle
deployment:
description: Deployment Name (e.g. "usdc")
required: true
Expand All @@ -42,13 +43,14 @@ jobs:
BASESCAN_KEY: ${{ secrets.BASESCAN_KEY }}
LINEASCAN_KEY: ${{ secrets.LINEASCAN_KEY }}
OPTIMISMSCAN_KEY: ${{ secrets.OPTIMISMSCAN_KEY }}
MANTLESCAN_KEY: ${{ secrets.MANTLESCAN_KEY }}
steps:
- name: Seacrest
uses: hayesgm/seacrest@5748b3a066f517973ca2ca03d0af39bbf2b82d10
with:
wallet_connect_project_id: ${{ secrets.WALLET_CONNECT_PROJECT_ID }}
requested_network: "${{ inputs.network }}"
ethereum_url: "${{ fromJSON('{\"optimism\":\"https://optimism-mainnet.infura.io/v3/$INFURA_KEY\",\"fuji\":\"https://api.avax-test.network/ext/bc/C/rpc\",\"mainnet\":\"https://mainnet.infura.io/v3/$INFURA_KEY\",\"goerli\":\"https://goerli.infura.io/v3/$INFURA_KEY\",\"sepolia\":\"https://sepolia.infura.io/v3/$INFURA_KEY\",\"mumbai\":\"https://polygon-mumbai.infura.io/v3/$INFURA_KEY\",\"polygon\":\"https://polygon-mainnet.infura.io/v3/$INFURA_KEY\",\"arbitrum-goerli\":\"https://arbitrum-goerli.infura.io/v3/$INFURA_KEY\",\"arbitrum\":\"https://arbitrum-mainnet.infura.io/v3/$INFURA_KEY\",\"base\":\"https://fluent-prettiest-scion.base-mainnet.quiknode.pro/$QUICKNODE_KEY\",\"base-goerli\":\"https://base-goerli.infura.io/v3/$INFURA_KEY\",\"linea-goerli\":\"https://linea-goerli.infura.io/v3/$INFURA_KEY\",\"scroll-goerli\":\"https://alpha-rpc.scroll.io/l2\",\"scroll\":\"https://rpc.scroll.io\"}')[inputs.network] }}"
ethereum_url: "${{ fromJSON('{\"mantle\":\"https://mantle-mainnet.infura.io/v3/$INFURA_KEY\",\"optimism\":\"https://optimism-mainnet.infura.io/v3/$INFURA_KEY\",\"fuji\":\"https://api.avax-test.network/ext/bc/C/rpc\",\"mainnet\":\"https://mainnet.infura.io/v3/$INFURA_KEY\",\"goerli\":\"https://goerli.infura.io/v3/$INFURA_KEY\",\"sepolia\":\"https://sepolia.infura.io/v3/$INFURA_KEY\",\"mumbai\":\"https://polygon-mumbai.infura.io/v3/$INFURA_KEY\",\"polygon\":\"https://polygon-mainnet.infura.io/v3/$INFURA_KEY\",\"arbitrum-goerli\":\"https://arbitrum-goerli.infura.io/v3/$INFURA_KEY\",\"arbitrum\":\"https://arbitrum-mainnet.infura.io/v3/$INFURA_KEY\",\"base\":\"https://fluent-prettiest-scion.base-mainnet.quiknode.pro/$QUICKNODE_KEY\",\"base-goerli\":\"https://base-goerli.infura.io/v3/$INFURA_KEY\",\"linea-goerli\":\"https://linea-goerli.infura.io/v3/$INFURA_KEY\",\"scroll-goerli\":\"https://alpha-rpc.scroll.io/l2\",\"scroll\":\"https://rpc.scroll.io\"}')[inputs.network] }}"
port: 8585
if: github.event.inputs.eth_pk == ''

Expand Down
1 change: 1 addition & 0 deletions .github/workflows/run-contract-linter.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@ jobs:
ARBISCAN_KEY: ${{ secrets.ARBISCAN_KEY }}
LINEASCAN_KEY: ${{ secrets.LINEASCAN_KEY }}
OPTIMISMSCAN_KEY: ${{ secrets.OPTIMISMSCAN_KEY }}
MANTLESCAN_KEY: ${{ secrets.MANTLESCAN_KEY }}
steps:
- uses: actions/checkout@v4
with:
Expand Down
1 change: 1 addition & 0 deletions .github/workflows/run-coverage.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@ jobs:
ARBISCAN_KEY: ${{ secrets.ARBISCAN_KEY }}
LINEASCAN_KEY: ${{ secrets.LINEASCAN_KEY }}
OPTIMISMSCAN_KEY: ${{ secrets.OPTIMISMSCAN_KEY }}
MANTLESCAN_KEY: ${{ secrets.MANTLESCAN_KEY }}
steps:
- name: Checkout repository
uses: actions/checkout@v4
Expand Down
1 change: 1 addition & 0 deletions .github/workflows/run-eslint.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@ jobs:
ARBISCAN_KEY: ${{ secrets.ARBISCAN_KEY }}
LINEASCAN_KEY: ${{ secrets.LINEASCAN_KEY }}
OPTIMISMSCAN_KEY: ${{ secrets.OPTIMISMSCAN_KEY }}
MANTLESCAN_KEY: ${{ secrets.MANTLESCAN_KEY }}
steps:
- name: Checkout repository
uses: actions/checkout@v4
Expand Down
1 change: 1 addition & 0 deletions .github/workflows/run-forge-tests.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,7 @@ jobs:
ARBISCAN_KEY: ${{ secrets.ARBISCAN_KEY }}
LINEASCAN_KEY: ${{ secrets.LINEASCAN_KEY }}
OPTIMISMSCAN_KEY: ${{ secrets.OPTIMISMSCAN_KEY }}
MANTLESCAN_KEY: ${{ secrets.MANTLESCAN_KEY }}

- name: Build Comet with older solc versions
run: |
Expand Down
1 change: 1 addition & 0 deletions .github/workflows/run-gas-profiler.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@ jobs:
ARBISCAN_KEY: ${{ secrets.ARBISCAN_KEY }}
LINEASCAN_KEY: ${{ secrets.LINEASCAN_KEY }}
OPTIMISMSCAN_KEY: ${{ secrets.OPTIMISMSCAN_KEY }}
MANTLESCAN_KEY: ${{ secrets.MANTLESCAN_KEY }}
steps:
- name: Checkout repository
uses: actions/checkout@v4
Expand Down
3 changes: 2 additions & 1 deletion .github/workflows/run-scenarios.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ jobs:
strategy:
fail-fast: false
matrix:
bases: [ development, mainnet, mainnet-weth, mainnet-usdt, mainnet-wsteth, goerli, goerli-weth, sepolia-usdc, sepolia-weth, fuji, mumbai, polygon, polygon-usdt, arbitrum-usdc.e, arbitrum-usdc, arbitrum-weth, arbitrum-usdt, arbitrum-goerli-usdc, arbitrum-goerli-usdc.e, base-usdbc, base-weth, base-usdc, base-goerli, base-goerli-weth, linea-goerli, optimism-usdc, optimism-usdt, optimism-weth, scroll-goerli, scroll-usdc]
bases: [ development, mainnet, mainnet-weth, mainnet-usdt, mainnet-wsteth, goerli, goerli-weth, sepolia-usdc, sepolia-weth, fuji, mumbai, polygon, polygon-usdt, arbitrum-usdc.e, arbitrum-usdc, arbitrum-weth, arbitrum-usdt, arbitrum-goerli-usdc, arbitrum-goerli-usdc.e, base-usdbc, base-weth, base-usdc, base-goerli, base-goerli-weth, linea-goerli, optimism-usdc, optimism-usdt, optimism-weth, mantle-usde, scroll-goerli, scroll-usdc]
name: Run scenarios
env:
ETHERSCAN_KEY: ${{ secrets.ETHERSCAN_KEY }}
Expand All @@ -19,6 +19,7 @@ jobs:
BASESCAN_KEY: ${{ secrets.BASESCAN_KEY }}
LINEASCAN_KEY: ${{ secrets.LINEASCAN_KEY }}
OPTIMISMSCAN_KEY: ${{ secrets.OPTIMISMSCAN_KEY }}
MANTLESCAN_KEY: ${{ secrets.MANTLESCAN_KEY }}
runs-on: ubuntu-latest
steps:
- name: Checkout repository
Expand Down
1 change: 1 addition & 0 deletions .github/workflows/run-semgrep.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@ jobs:
INFURA_KEY: ${{ secrets.INFURA_KEY }}
POLYGONSCAN_KEY: ${{ secrets.POLYGONSCAN_KEY }}
OPTIMISMSCAN_KEY: ${{ secrets.OPTIMISMSCAN_KEY }}
MANTLESCAN_KEY: ${{ secrets.MANTLESCAN_KEY }}
container:
# A Docker image with Semgrep installed. Do not change this.
image: returntocorp/semgrep
Expand Down
1 change: 1 addition & 0 deletions .github/workflows/run-unit-tests.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@ jobs:
ARBISCAN_KEY: ${{ secrets.ARBISCAN_KEY }}
LINEASCAN_KEY: ${{ secrets.LINEASCAN_KEY }}
OPTIMISMSCAN_KEY: ${{ secrets.OPTIMISMSCAN_KEY }}
MANTLESCAN_KEY: ${{ secrets.MANTLESCAN_KEY }}
steps:
- name: Checkout repository
uses: actions/checkout@v4
Expand Down
12 changes: 6 additions & 6 deletions contracts/pricefeeds/ScalingPriceFeed.sol
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ import "../IPriceFeed.sol";

/**
* @title Scaling price feed
* @notice A custom price feed that scales up or down the price received from an underlying Chainlink price feed and returns the result
* @notice A custom price feed that scales up or down the price received from an underlying price feed and returns the result
* @author Compound
*/
contract ScalingPriceFeed is IPriceFeed {
Expand All @@ -22,7 +22,7 @@ contract ScalingPriceFeed is IPriceFeed {
/// @notice Number of decimals for returned prices
uint8 public immutable override decimals;

/// @notice Underlying Chainlink price feed where prices are fetched from
/// @notice Underlying price feed where prices are fetched from
address public immutable underlyingPriceFeed;

/// @notice Whether or not the price should be upscaled
Expand All @@ -41,12 +41,12 @@ contract ScalingPriceFeed is IPriceFeed {
decimals = decimals_;
description = AggregatorV3Interface(underlyingPriceFeed_).description();

uint8 chainlinkPriceFeedDecimals = AggregatorV3Interface(underlyingPriceFeed_).decimals();
uint8 underlyingPriceFeedDecimals = AggregatorV3Interface(underlyingPriceFeed_).decimals();
// Note: Solidity does not allow setting immutables in if/else statements
shouldUpscale = chainlinkPriceFeedDecimals < decimals_ ? true : false;
shouldUpscale = underlyingPriceFeedDecimals < decimals_ ? true : false;
rescaleFactor = (shouldUpscale
? signed256(10 ** (decimals_ - chainlinkPriceFeedDecimals))
: signed256(10 ** (chainlinkPriceFeedDecimals - decimals_))
? signed256(10 ** (decimals_ - underlyingPriceFeedDecimals))
: signed256(10 ** (underlyingPriceFeedDecimals - decimals_))
);
}

Expand Down
86 changes: 86 additions & 0 deletions contracts/pricefeeds/ScalingPriceFeedWithCustomDescription.sol
Original file line number Diff line number Diff line change
@@ -0,0 +1,86 @@
// SPDX-License-Identifier: BUSL-1.1
pragma solidity 0.8.15;

import "../vendor/@chainlink/contracts/src/v0.8/interfaces/AggregatorV3Interface.sol";
import "../IPriceFeed.sol";

/**
* @title Scaling price feed
* @notice A custom price feed that scales up or down the price received from an underlying price feed and returns the result
* @author Compound
*/
contract ScalingPriceFeedWithCustomDescription is IPriceFeed {
/** Custom errors **/
error InvalidInt256();

/// @notice Version of the price feed
uint public constant override version = 1;

Check warning

Code scanning / Semgrep OSS

A constant name is not in UPPER_CASE like other constant variables. Warning

A constant name is not in UPPER_CASE like other constant variables.

/// @notice Description of the price feed
string public description;

/// @notice Number of decimals for returned prices
uint8 public immutable override decimals;

/// @notice Underlying price feed where prices are fetched from
address public immutable underlyingPriceFeed;

/// @notice Whether or not the price should be upscaled
bool internal immutable shouldUpscale;

/// @notice The amount to upscale or downscale the price by
int256 internal immutable rescaleFactor;

/**
* @notice Construct a new scaling price feed
* @param underlyingPriceFeed_ The address of the underlying price feed to fetch prices from
* @param decimals_ The number of decimals for the returned prices
**/
constructor(address underlyingPriceFeed_, uint8 decimals_, string memory description_) {
underlyingPriceFeed = underlyingPriceFeed_;
decimals = decimals_;
description = description_;

uint8 underlyingPriceFeedDecimals = AggregatorV3Interface(underlyingPriceFeed_).decimals();
// Note: Solidity does not allow setting immutables in if/else statements
shouldUpscale = underlyingPriceFeedDecimals < decimals_ ? true : false;
rescaleFactor = (shouldUpscale
? signed256(10 ** (decimals_ - underlyingPriceFeedDecimals))
: signed256(10 ** (underlyingPriceFeedDecimals - decimals_))
);
}
Comment on lines +39 to +51

Check warning

Code scanning / Semgrep OSS

There're no sanity checks for the constructor argument decimals_. Warning

There're no sanity checks for the constructor argument decimals_.
Comment on lines +39 to +51

Check warning

Code scanning / Semgrep OSS

There're no sanity checks for the constructor argument description_. Warning

There're no sanity checks for the constructor argument description_.
Comment on lines +39 to +51

Check warning

Code scanning / Semgrep OSS

There're no sanity checks for the constructor argument underlyingPriceFeed_. Warning

There're no sanity checks for the constructor argument underlyingPriceFeed_.
Comment on lines +39 to +51

Check warning

Code scanning / Semgrep OSS

Consider making costructor payable to save gas. Warning

Consider making costructor payable to save gas.

/**
* @notice Price for the latest round
* @return roundId Round id from the underlying price feed
* @return answer Latest price for the asset in terms of ETH
* @return startedAt Timestamp when the round was started; passed on from underlying price feed
* @return updatedAt Timestamp when the round was last updated; passed on from underlying price feed
* @return answeredInRound Round id in which the answer was computed; passed on from underlying price feed
**/
function latestRoundData() override external view returns (
uint80 roundId,
int256 answer,
uint256 startedAt,
uint256 updatedAt,
uint80 answeredInRound
) {
(uint80 roundId_, int256 price, uint256 startedAt_, uint256 updatedAt_, uint80 answeredInRound_) = AggregatorV3Interface(underlyingPriceFeed).latestRoundData();
return (roundId_, scalePrice(price), startedAt_, updatedAt_, answeredInRound_);
}

function signed256(uint256 n) internal pure returns (int256) {
if (n > uint256(type(int256).max)) revert InvalidInt256();
return int256(n);
}

function scalePrice(int256 price) internal view returns (int256) {
int256 scaledPrice;
if (shouldUpscale) {
scaledPrice = price * rescaleFactor;
} else {
scaledPrice = price / rescaleFactor;
}
return scaledPrice;
}
}
Loading
Loading