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

OZ Improvements #847

Open
wants to merge 33 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from 23 commits
Commits
Show all changes
33 commits
Select commit Hold shift + click to select a range
c9c50d9
use RPC_URL for base
peersky Feb 1, 2024
7ec781a
Merge branch 'compound-finance:main' into main
peersky Feb 29, 2024
dd63423
Merge branch 'compound-finance:main' into main
peersky Mar 18, 2024
0082066
Merge branch 'compound-finance:main' into main
peersky Mar 25, 2024
529c5ec
Merge branch 'compound-finance:main' into main
peersky Apr 2, 2024
0c8124d
added internal tx scrapping strategy for contract creation
peersky Apr 4, 2024
5d08935
Merge branch 'main' of github.com:peersky/comet
peersky Apr 16, 2024
600d644
Update import.ts
peersky Apr 17, 2024
900f98f
Update import.ts
peersky Apr 17, 2024
b6ef5d4
Update etherscan.ts
peersky Apr 18, 2024
55b5a4c
Update hardhat.config.ts
peersky Apr 18, 2024
4f98fb4
added api scrapping to strategy
peersky Apr 19, 2024
a60d250
Merge branch 'main' of github.com:peersky/comet
peersky Apr 19, 2024
5fff35e
happy linter - happy life
peersky Apr 19, 2024
ff83bee
100 print width
peersky Apr 19, 2024
8f84e2d
120 print width
peersky Apr 19, 2024
28728ae
happy linter - happy life
peersky Apr 19, 2024
8051de4
same format as main repo
peersky Apr 19, 2024
6fd612f
same formatting as main repo
peersky Apr 19, 2024
2cab2f9
same formatting as main repo
peersky Apr 19, 2024
cc9134b
manually fixing formatting to match main repository
peersky Apr 19, 2024
11a1a22
reset pullFirstTransactionForContract to be same as main repo
peersky Apr 19, 2024
7bc5688
added env variables to ci
peersky Apr 23, 2024
00da930
Update enact-migration.yaml
peersky May 21, 2024
13bbb6e
Update enact-migration.yaml
peersky May 21, 2024
46013d3
Merge branch 'compound-finance:main' into main
peersky Jun 19, 2024
c93a584
Merge branch 'compound-finance:main' into main
peersky Jun 24, 2024
d73e876
Merge branch 'compound-finance:main' into main
peersky Jun 27, 2024
313c253
bump hardhat version
peersky Jun 27, 2024
67bb42e
Merge branch 'main' of github.com:peersky/comet
peersky Jun 27, 2024
4321752
update lockfile
peersky Jun 27, 2024
41d7def
Merge branch 'main' of github.com:compound-finance/comet
peersky Jul 2, 2024
19ec80c
Merge branch 'compound-finance:main' into main
peersky Jul 9, 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
5 changes: 4 additions & 1 deletion .github/workflows/deploy-market.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -42,13 +42,16 @@ jobs:
BASESCAN_KEY: ${{ secrets.BASESCAN_KEY }}
LINEASCAN_KEY: ${{ secrets.LINEASCAN_KEY }}
OPTIMISMSCAN_KEY: ${{ secrets.OPTIMISMSCAN_KEY }}
SCROLLSCAN_KEY: ${{ secrets.SCROLLSCAN_KEY }}
BASE_RPC_URL: ${{ secrets.BASE_RPC_URL }}
SCROLL_RPC_URL: ${{ secrets.SCROLL_RPC_URL }}
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://clean-spring-wind.base-mainnet.discover.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('{\"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\":\"$BASE_RPC_URL\",\"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\":\"$SCROLL_RPC_URL\"}')[inputs.network] }}"
port: 8585
if: github.event.inputs.eth_pk == ''

Expand Down
8 changes: 5 additions & 3 deletions .github/workflows/enact-migration.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -50,6 +50,9 @@ jobs:
BASESCAN_KEY: ${{ secrets.BASESCAN_KEY }}
LINEASCAN_KEY: ${{ secrets.LINEASCAN_KEY }}
OPTIMISMSCAN_KEY: ${{ secrets.OPTIMISMSCAN_KEY }}
SCROLLSCAN_KEY: ${{ secrets.SCROLLSCAN_KEY }}
BASE_RPC_URL: ${{ secrets.BASE_RPC_URL }}
SCROLL_RPC_URL: ${{ secrets.SCROLL_RPC_URL }}
steps:
- name: Get governance network
run: |
Expand All @@ -67,9 +70,8 @@ jobs:
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://clean-spring-wind.base-mainnet.discover.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
peersky marked this conversation as resolved.
Show resolved Hide resolved
if: github.event.inputs.eth_pk == ''
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\":\"$BASE_RPC_URL\",\"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\":\"$SCROLL_RPC_URL\"}')[inputs.network] }}"
if: github.event.inputs.eth_pk == ''

- name: Seacrest (governance network)
uses: hayesgm/seacrest@0cab0fa2a2a8bf5b005956d70e3dad697d9fe013
Expand Down
5 changes: 4 additions & 1 deletion .github/workflows/prepare-migration.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -42,13 +42,16 @@ jobs:
BASESCAN_KEY: ${{ secrets.BASESCAN_KEY }}
LINEASCAN_KEY: ${{ secrets.LINEASCAN_KEY }}
OPTIMISMSCAN_KEY: ${{ secrets.OPTIMISMSCAN_KEY }}
SCROLLSCAN_KEY: ${{ secrets.SCROLLSCAN_KEY }}
BASE_RPC_URL: ${{ secrets.BASE_RPC_URL }}
SCROLL_RPC_URL: ${{ secrets.SCROLL_RPC_URL }}
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://clean-spring-wind.base-mainnet.discover.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('{\"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\":\"$BASE_RPC_URL\",\"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\":\"$SCROLL_RPC_URL\"}')[inputs.network] }}"
port: 8585
if: github.event.inputs.eth_pk == ''

Expand Down
3 changes: 3 additions & 0 deletions .github/workflows/run-contract-linter.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,9 @@ jobs:
ARBISCAN_KEY: ${{ secrets.ARBISCAN_KEY }}
LINEASCAN_KEY: ${{ secrets.LINEASCAN_KEY }}
OPTIMISMSCAN_KEY: ${{ secrets.OPTIMISMSCAN_KEY }}
SCROLLSCAN_KEY: ${{ secrets.SCROLLSCAN_KEY }}
BASE_RPC_URL: ${{ secrets.BASE_RPC_URL }}
SCROLL_RPC_URL: ${{ secrets.SCROLL_RPC_URL }}
steps:
- uses: actions/checkout@v2
with:
Expand Down
3 changes: 3 additions & 0 deletions .github/workflows/run-coverage.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,9 @@ jobs:
ARBISCAN_KEY: ${{ secrets.ARBISCAN_KEY }}
LINEASCAN_KEY: ${{ secrets.LINEASCAN_KEY }}
OPTIMISMSCAN_KEY: ${{ secrets.OPTIMISMSCAN_KEY }}
SCROLLSCAN_KEY: ${{ secrets.SCROLLSCAN_KEY }}
BASE_RPC_URL: ${{ secrets.BASE_RPC_URL }}
SCROLL_RPC_URL: ${{ secrets.SCROLL_RPC_URL }}
steps:
- name: Checkout repository
uses: actions/checkout@v2
Expand Down
3 changes: 3 additions & 0 deletions .github/workflows/run-eslint.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,9 @@ jobs:
ARBISCAN_KEY: ${{ secrets.ARBISCAN_KEY }}
LINEASCAN_KEY: ${{ secrets.LINEASCAN_KEY }}
OPTIMISMSCAN_KEY: ${{ secrets.OPTIMISMSCAN_KEY }}
SCROLLSCAN_KEY: ${{ secrets.SCROLLSCAN_KEY }}
BASE_RPC_URL: ${{ secrets.BASE_RPC_URL }}
SCROLL_RPC_URL: ${{ secrets.SCROLL_RPC_URL }}
steps:
- name: Checkout repository
uses: actions/checkout@v2
Expand Down
3 changes: 3 additions & 0 deletions .github/workflows/run-forge-tests.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,9 @@ jobs:
ARBISCAN_KEY: ${{ secrets.ARBISCAN_KEY }}
LINEASCAN_KEY: ${{ secrets.LINEASCAN_KEY }}
OPTIMISMSCAN_KEY: ${{ secrets.OPTIMISMSCAN_KEY }}
SCROLLSCAN_KEY: ${{ secrets.SCROLLSCAN_KEY }}
BASE_RPC_URL: ${{ secrets.BASE_RPC_URL }}
SCROLL_RPC_URL: ${{ secrets.SCROLL_RPC_URL }}

- name: Build Comet with older solc versions
run: |
Expand Down
3 changes: 3 additions & 0 deletions .github/workflows/run-gas-profiler.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,9 @@ jobs:
ARBISCAN_KEY: ${{ secrets.ARBISCAN_KEY }}
LINEASCAN_KEY: ${{ secrets.LINEASCAN_KEY }}
OPTIMISMSCAN_KEY: ${{ secrets.OPTIMISMSCAN_KEY }}
SCROLLSCAN_KEY: ${{ secrets.SCROLLSCAN_KEY }}
BASE_RPC_URL: ${{ secrets.BASE_RPC_URL }}
SCROLL_RPC_URL: ${{ secrets.SCROLL_RPC_URL }}
steps:
- name: Checkout repository
uses: actions/checkout@v2
Expand Down
3 changes: 3 additions & 0 deletions .github/workflows/run-scenarios.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,9 @@ jobs:
BASESCAN_KEY: ${{ secrets.BASESCAN_KEY }}
LINEASCAN_KEY: ${{ secrets.LINEASCAN_KEY }}
OPTIMISMSCAN_KEY: ${{ secrets.OPTIMISMSCAN_KEY }}
SCROLLSCAN_KEY: ${{ secrets.SCROLLSCAN_KEY }}
BASE_RPC_URL: ${{ secrets.BASE_RPC_URL }}
SCROLL_RPC_URL: ${{ secrets.SCROLL_RPC_URL }}
runs-on: ubuntu-latest
steps:
- name: Checkout repository
Expand Down
3 changes: 3 additions & 0 deletions .github/workflows/run-semgrep.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,9 @@ jobs:
INFURA_KEY: ${{ secrets.INFURA_KEY }}
POLYGONSCAN_KEY: ${{ secrets.POLYGONSCAN_KEY }}
OPTIMISMSCAN_KEY: ${{ secrets.OPTIMISMSCAN_KEY }}
SCROLLSCAN_KEY: ${{ secrets.SCROLLSCAN_KEY }}
BASE_RPC_URL: ${{ secrets.BASE_RPC_URL }}
SCROLL_RPC_URL: ${{ secrets.SCROLL_RPC_URL }}
container:
# A Docker image with Semgrep installed. Do not change this.
image: returntocorp/semgrep
Expand Down
3 changes: 3 additions & 0 deletions .github/workflows/run-unit-tests.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,9 @@ jobs:
ARBISCAN_KEY: ${{ secrets.ARBISCAN_KEY }}
LINEASCAN_KEY: ${{ secrets.LINEASCAN_KEY }}
OPTIMISMSCAN_KEY: ${{ secrets.OPTIMISMSCAN_KEY }}
SCROLLSCAN_KEY: ${{ secrets.SCROLLSCAN_KEY }}
BASE_RPC_URL: ${{ secrets.BASE_RPC_URL }}
SCROLL_RPC_URL: ${{ secrets.SCROLL_RPC_URL }}
steps:
- name: Checkout repository
uses: actions/checkout@v2
Expand Down
7 changes: 4 additions & 3 deletions hardhat.config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,8 @@ const {
LINEASCAN_KEY,
OPTIMISMSCAN_KEY,
INFURA_KEY,
QUICKNODE_KEY,
BASE_RPC_URL,
SCROLL_RPC_URL,
MNEMONIC = 'myth like bonus scare over problem client lizard pioneer submit female collect',
REPORT_GAS = 'false',
NETWORK_PROVIDER = '',
Expand Down Expand Up @@ -117,7 +118,7 @@ const networkConfigs: NetworkConfig[] = [
{
network: 'base',
chainId: 8453,
url: `https://clean-spring-wind.base-mainnet.discover.quiknode.pro/${QUICKNODE_KEY}`,
url: `${BASE_RPC_URL}`,
},
{
network: 'arbitrum',
Expand Down Expand Up @@ -162,7 +163,7 @@ const networkConfigs: NetworkConfig[] = [
{
network: 'scroll',
chainId: 534352,
url: 'https://rpc.scroll.io',
url: `${SCROLL_RPC_URL}`,
}
];

Expand Down
2 changes: 1 addition & 1 deletion plugins/import/etherscan.ts
Original file line number Diff line number Diff line change
Expand Up @@ -80,7 +80,7 @@ export function getEtherscanApiKey(network: string): string {
'linea-goerli': process.env.LINEASCAN_KEY,
optimism: process.env.OPTIMISMSCAN_KEY,
'scroll-goerli': process.env.ETHERSCAN_KEY,
scroll: process.env.ETHERSCAN_KEY
scroll: process.env.SCROLLSCAN_KEY
}[network];

if (!apiKey) {
Expand Down
28 changes: 28 additions & 0 deletions plugins/import/import.ts
Original file line number Diff line number Diff line change
Expand Up @@ -153,11 +153,39 @@ async function pullFirstTransactionForContract(network: string, address: string)
return contractCreationCode.slice(2);
}

async function pullFirstInternalTransactionForContract(
network: string,
address: string,
startblock = 0,
endblock = 99999999
) {
const params = {
module: 'account',
action: 'txlistinternal',
address,
startblock: startblock,
endblock: endblock,
page: 1,
offset: 10,
sort: 'asc',
apikey: getEtherscanApiKey(network),
};
const url = `${getEtherscanApiUrl(network)}?${paramString(params)}`;
const debugUrl = `${getEtherscanApiUrl(network)}?${paramString({
...params,
...{ apikey: '[API_KEY]' },
})}`;
debug(`Attempting to pull Contract Creation code from first internal tx at ${debugUrl}`);
const response = await get(url, {});
return response.result.find((tx) => tx.isError == '0').input;
}

async function getContractCreationCode(network: string, address: string) {
const strategies = [
scrapeContractCreationCodeFromEtherscan,
scrapeContractCreationCodeFromEtherscanApi,
pullFirstTransactionForContract,
pullFirstInternalTransactionForContract
];
let errors = [];
for (const strategy of strategies) {
Expand Down