Skip to content

Commit

Permalink
chore: migrate to Sepolia
Browse files Browse the repository at this point in the history
chore: migrate to Sepolia
  • Loading branch information
piesrtasty authored Feb 16, 2024
2 parents 680ca97 + 67cda8a commit 24c5ce7
Show file tree
Hide file tree
Showing 19 changed files with 129 additions and 81 deletions.
4 changes: 3 additions & 1 deletion .env.example
Original file line number Diff line number Diff line change
@@ -1,2 +1,4 @@
ALCHEMY_ID=
PRIVATE_KEY=
ETHERSCAN_KEY=
SEPOLIA_ALCHEMY_ID=
MAINNET_ALCHEMY_ID=
2 changes: 1 addition & 1 deletion .github/workflows/linting.yml
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ jobs:
- name: Use Node.js
uses: actions/setup-node@v3
with:
node-version: 16
node-version: 18
cache: "yarn"

- name: Install dependencies
Expand Down
14 changes: 8 additions & 6 deletions .github/workflows/test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ concurrency:

jobs:
tests:
if: false
name: Run tests
runs-on: ubuntu-latest
steps:
Expand All @@ -21,16 +22,17 @@ jobs:

- name: Install dependencies
run: yarn

- name: Create env file
run: |
touch .env
echo ALCHEMY_ID="${{ secrets.ALCHEMYKEY }}" >> .env
cat .env
touch .env
echo SEPOLIA_ALCHEMY_ID="${{ secrets.SEPOLIA_ALCHEMY_ID }}" >> .env
echo MAINNET_ALCHEMY_ID="${{ secrets.MAINNET_ALCHEMY_ID }}" >> .env
cat .env
- name: Build project
run: yarn build

- name: Run tests
shell: bash
run: yarn test
run: yarn test
18 changes: 10 additions & 8 deletions hardhat.config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -16,8 +16,11 @@ dotenv.config({ path: __dirname + "/.env" });
import assert from "assert";

// Process Env Variables
const ALCHEMY_ID = process.env.ALCHEMY_ID;
assert.ok(ALCHEMY_ID, "no Alchemy ID in process.env");
const MAINNET_ALCHEMY_ID = process.env.MAINNET_ALCHEMY_ID;
const SEPOLIA_ALCHEMY_ID = process.env.SEPOLIA_ALCHEMY_ID;

assert.ok(MAINNET_ALCHEMY_ID, "no Mainnet Alchemy ID in process.env");
assert.ok(SEPOLIA_ALCHEMY_ID, "no Sepolia Alchemy ID in process.env");

const PRIVATE_KEY = process.env.PRIVATE_KEY;
const ETHERSCAN_KEY = process.env.ETHERSCAN_KEY;
Expand All @@ -27,7 +30,7 @@ const config: HardhatUserConfig = {
w3f: {
rootDir: "./web3-functions",
debug: false,
networks: ["optimism", "optimismGoerli"], // (multiChainProvider) injects provider for these networks
networks: ["optimism", "optimismSepolia"], // (multiChainProvider) injects provider for these networks
},

namedAccounts: {
Expand All @@ -42,14 +45,13 @@ const config: HardhatUserConfig = {
// Prod
optimism: {
chainId: 10,
url: "https://mainnet.optimism.io",
url: `https://opt-mainnet.g.alchemy.com/v2/${MAINNET_ALCHEMY_ID}`,
accounts: PRIVATE_KEY ? [PRIVATE_KEY] : [],
},

// Staging
optimismGoerli: {
chainId: 420,
url: `https://opt-goerli.g.alchemy.com/v2/${ALCHEMY_ID}`,
optimismSepolia: {
chainId: 11155420,
url: `https://opt-sepolia.g.alchemy.com/v2/${SEPOLIA_ALCHEMY_ID}`,
accounts: PRIVATE_KEY ? [PRIVATE_KEY] : [],
},
},
Expand Down
15 changes: 9 additions & 6 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -17,9 +17,12 @@
"lint:sol": "solhint contracts/**/*.sol",
"test": "npx hardhat test",
"verify": "npx hardhat etherscan-verify",
"create-task:oracle": "npx hardhat run ./scripts/create-task-oracle.ts --network optimismGoerli",
"create-task:debt-popper": "npx hardhat run ./scripts/create-task-debt-popper.ts --network optimismGoerli",
"create-task:state-update": "npx hardhat run ./scripts/create-task-state-update.ts --network optimismGoerli"
"create-task:oracle:mainnet": "npx hardhat run ./scripts/create-task-oracle.ts --network optimism",
"create-task:debt-popper:mainnet": "npx hardhat run ./scripts/create-task-debt-popper.ts --network optimism",
"create-task:state-update:mainnet": "npx hardhat run ./scripts/create-task-state-update.ts --network optimism",
"create-task:oracle:sepolia": "npx hardhat run ./scripts/create-task-oracle.ts --network optimismSepolia",
"create-task:debt-popper:sepolia": "npx hardhat run ./scripts/create-task-debt-popper.ts --network optimismSepolia",
"create-task:state-update:sepolia": "npx hardhat run ./scripts/create-task-state-update.ts --network optimismSepolia"
},
"license": "ISC",
"devDependencies": {
Expand Down Expand Up @@ -61,9 +64,9 @@
"*.*{ts,js}": "eslint -c .eslintrc.json"
},
"dependencies": {
"@gelatonetwork/automate-sdk": "2.18.0-beta",
"@gelatonetwork/web3-functions-sdk": "2.1.3",
"@hai-on-op/abis": "0.1.2",
"@gelatonetwork/automate-sdk": "3.0.5",
"@gelatonetwork/web3-functions-sdk": "2.3.0",
"@hai-on-op/abis": "1.0.0",
"web3": "1.10.2"
}
}
6 changes: 2 additions & 4 deletions scripts/create-task-debt-popper.ts
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ const main = async () => {
// Create task using automate sdk
console.log(`Creating debt popper`);
const { taskId, tx } = await automate.createBatchExecTask({
name: "Web3Function - Debt Popper",
name: "Web3Fn() - HAI Mainnet Debt Popper v1.1",
web3FunctionHash: cid,
web3FunctionArgs: userArgs,
trigger: {
Expand All @@ -37,9 +37,7 @@ const main = async () => {
});
await tx.wait();
console.log(`Task created, taskId: ${taskId} (tx hash: ${tx.hash})`);
console.log(
`> https://beta.app.gelato.network/task/${taskId}?chainId=${chainId}`
);
console.log(`> https://app.gelato.network/task/${taskId}?chainId=${chainId}`);

// Set task specific secrets
const secrets = debtPopperW3f.getSecrets();
Expand Down
6 changes: 2 additions & 4 deletions scripts/create-task-oracle.ts
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ const main = async () => {
// Create task using automate sdk
console.log(`Creating oracle updater`);
const { taskId, tx } = await automate.createBatchExecTask({
name: "Web3Function - Update Oracle",
name: "Web3Fn() - HAI Mainnet Update Oracle v1",
web3FunctionHash: cid,
web3FunctionArgs: userArgs,
trigger: {
Expand All @@ -37,9 +37,7 @@ const main = async () => {
});
await tx.wait();
console.log(`Task created, taskId: ${taskId} (tx hash: ${tx.hash})`);
console.log(
`> https://beta.app.gelato.network/task/${taskId}?chainId=${chainId}`
);
console.log(`> https://app.gelato.network/task/${taskId}?chainId=${chainId}`);

// Set task specific secrets
const secrets = oracleW3f.getSecrets();
Expand Down
6 changes: 2 additions & 4 deletions scripts/create-task-state-update.ts
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ const main = async () => {
// Create task using automate sdk
console.log(`Creating state updater`);
const { taskId, tx } = await automate.createBatchExecTask({
name: "Web3Function - State Updater",
name: "Web3Fn() - HAI Mainnet State Updater v1.2",
web3FunctionHash: cid,
web3FunctionArgs: userArgs,
trigger: {
Expand All @@ -37,9 +37,7 @@ const main = async () => {
});
await tx.wait();
console.log(`Task created, taskId: ${taskId} (tx hash: ${tx.hash})`);
console.log(
`> https://beta.app.gelato.network/task/${taskId}?chainId=${chainId}`
);
console.log(`> https://app.gelato.network/task/${taskId}?chainId=${chainId}`);

// Set task specific secrets
const secrets = stateUpdateW3f.getSecrets();
Expand Down
2 changes: 1 addition & 1 deletion test/utils.ts
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ export async function forkBlock(block: number) {
params: [
{
forking: {
jsonRpcUrl: `https://opt-goerli.g.alchemy.com/v2/${process.env.ALCHEMY_ID}`,
jsonRpcUrl: `https://opt-sepolia.g.alchemy.com/v2/${process.env.SEPOLIA_ALCHEMY_ID}`,
blockNumber: block,
},
},
Expand Down
3 changes: 3 additions & 0 deletions web3-functions/debt-popper/mainnet.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
{
"accountingEngineAddress": "0xa4900795EbFfadc12790f05f7c4AC42CD765Bd10"
}
3 changes: 3 additions & 0 deletions web3-functions/debt-popper/sepolia.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
{
"accountingEngineAddress": "0xb189A796cC055B5B601AD843AB1BC4Dc2d86bb70"
}
2 changes: 1 addition & 1 deletion web3-functions/debt-popper/userArgs.json
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
{
"accountingEngineAddress": "0x1eC0925d31590dAE3bB9aB7DE65109090B2c510a"
"accountingEngineAddress": "0xb189A796cC055B5B601AD843AB1BC4Dc2d86bb70"
}
8 changes: 8 additions & 0 deletions web3-functions/oracle/mainnet.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
{
"collateralTypes": [
"0x5745544800000000000000000000000000000000000000000000000000000000",
"0x5753544554480000000000000000000000000000000000000000000000000000",
"0x4f50000000000000000000000000000000000000000000000000000000000000"
],
"oracleRelayerAddress": "0x6270403b908505F02Da05BE5c1956aBB59FDb3A6"
}
10 changes: 10 additions & 0 deletions web3-functions/oracle/sepolia.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
{
"collateralTypes": [
"0x5745544800000000000000000000000000000000000000000000000000000000",
"0x4f50000000000000000000000000000000000000000000000000000000000000",
"0x5742544300000000000000000000000000000000000000000000000000000000",
"0x53544f4e45530000000000000000000000000000000000000000000000000000",
"0x544f54454d000000000000000000000000000000000000000000000000000000"
],
"oracleRelayerAddress": "0x404fca0DA6C5af0bF0429153c577B05622A130aC"
}
2 changes: 1 addition & 1 deletion web3-functions/oracle/userArgs.json
Original file line number Diff line number Diff line change
Expand Up @@ -6,5 +6,5 @@
"0x53544f4e45530000000000000000000000000000000000000000000000000000",
"0x544f54454d000000000000000000000000000000000000000000000000000000"
],
"oracleRelayerAddress": "0xB6AA4B291ff95565dd6ECd9F7C811372468520ff"
"oracleRelayerAddress": "0x404fca0DA6C5af0bF0429153c577B05622A130aC"
}
4 changes: 4 additions & 0 deletions web3-functions/state-update/mainnet.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
{
"accountingEngineAddress": "0xa4900795EbFfadc12790f05f7c4AC42CD765Bd10",
"pidRateSetterAddress": "0x1F76F20C9D9075dc160d0E47cd214dF0B7434d2f"
}
4 changes: 4 additions & 0 deletions web3-functions/state-update/sepolia.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
{
"accountingEngineAddress": "0xb189A796cC055B5B601AD843AB1BC4Dc2d86bb70",
"pidRateSetterAddress": "0x3122224d48f38c4952489af9dba4f097E9fca1e3"
}
4 changes: 2 additions & 2 deletions web3-functions/state-update/userArgs.json
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
{
"accountingEngineAddress": "0x1eC0925d31590dAE3bB9aB7DE65109090B2c510a",
"pidRateSetterAddress": "0xAafd9E0f3f3afD662bBE6819eaaEB7099bf22E4E"
"accountingEngineAddress": "0xb189A796cC055B5B601AD843AB1BC4Dc2d86bb70",
"pidRateSetterAddress": "0x3122224d48f38c4952489af9dba4f097E9fca1e3"
}
Loading

0 comments on commit 24c5ce7

Please sign in to comment.