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

upgrade to viem #3

Open
wants to merge 32 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
32 commits
Select commit Hold shift + click to select a range
8fa296d
fix: update project
Namaskar-1F64F Aug 1, 2024
8466dc6
feat: send all mp events
Namaskar-1F64F Aug 1, 2024
4e301a7
fix: remove db client
Namaskar-1F64F Aug 2, 2024
16842f8
fix: typing
Namaskar-1F64F Aug 2, 2024
7301425
fix: typing
Namaskar-1F64F Aug 2, 2024
08b80f7
fix: add webhook client
Namaskar-1F64F Aug 2, 2024
f019ec4
fix: fuji address
Namaskar-1F64F Aug 2, 2024
65b4843
fix: add different network for rpc
Namaskar-1F64F Aug 2, 2024
205d059
feat: alert slack on hw rented
Namaskar-1F64F Aug 2, 2024
755b57d
fix: disable steramlined mp launches
Namaskar-1F64F Aug 4, 2024
f113d4e
fix: lint
Namaskar-1F64F Aug 4, 2024
7d3b691
Update tenderly.yaml
0xju1ie Aug 5, 2024
ef172ec
feat: add mp launch event
Namaskar-1F64F Aug 5, 2024
e56bb21
fix: lint
Namaskar-1F64F Aug 5, 2024
df5428d
fix: update func name
Namaskar-1F64F Aug 5, 2024
e89b68d
fix: address
Namaskar-1F64F Aug 5, 2024
a291c2c
fix: launch state for relaunch
Namaskar-1F64F Aug 5, 2024
9df4468
Update tenderly.yaml artifactHardwareProvider
emersoncloud Aug 5, 2024
1670bad
fix: remove hw provider from template
Namaskar-1F64F Aug 5, 2024
0a4311d
fix: show only artifact nodes
Namaskar-1F64F Aug 6, 2024
833287a
Update tenderly.yaml with new addresses for minipoolmanager and artif…
0xju1ie Aug 6, 2024
34aea42
feat: make testnet/mainnet
Namaskar-1F64F Aug 6, 2024
fba3756
fix: send notifications to test channel
Namaskar-1F64F Aug 7, 2024
707d808
Update tenderly.yaml with new addresses for MinipoolManager and Artif…
0xju1ie Aug 7, 2024
8c625a3
fix: update ABIs
Namaskar-1F64F Aug 9, 2024
1512a8c
fix: update event
Namaskar-1F64F Aug 9, 2024
09f70f9
fix: update contracts
Namaskar-1F64F Aug 14, 2024
2b8ca64
fix: filter
Namaskar-1F64F Aug 14, 2024
c99152e
fix: package
Namaskar-1F64F Aug 14, 2024
d823356
fix: lint
Namaskar-1F64F Aug 14, 2024
67606d4
feat: different workflow keys for notifications
Namaskar-1F64F Aug 15, 2024
ae20f79
fix: undercollateralize emit filter on cycling nodes
Namaskar-1F64F Aug 23, 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
2 changes: 1 addition & 1 deletion example.env
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
JSON_RPC_URL="https://api.avax.network/ext/bc/C/rpc"

# Discord
STRAWBERRY_WEBHOOK_URL=
PROD_WEBHOOK_URL=

# Database
DATABASE_URI=
Expand Down
28 changes: 28 additions & 0 deletions src/actions-local/artifact.spec.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
import { config } from "dotenv";
import { TestRuntime } from "@tenderly/actions-test";

import { beforeAll, describe, test } from "vitest";

import { hardwareRented } from "../actions/artifact";

config();

describe("Artifact Hardware Provider", () => {
const testRuntime = new TestRuntime();
beforeAll(() => {
for (const [key, value] of Object.entries(process.env)) {
if (value) {
testRuntime.context.secrets.put(key, value);
}
}
});

describe("Hardware Rented", () => {
test.concurrent("hardware rented event", async () => {
await testRuntime.execute(
hardwareRented,
require("./payload/payload-artifact-rented.json")
);
});
});
});
49 changes: 20 additions & 29 deletions src/actions-local/minipool.spec.ts
Original file line number Diff line number Diff line change
@@ -1,9 +1,11 @@
import { config } from "dotenv";
import { TestRuntime } from "@tenderly/actions-test";

import { beforeAll, describe, test } from "vitest";
import { beforeAll, beforeEach, describe, expect, test, vi } from "vitest";

import { minipoolStatusChange } from "../actions/minipool";
import { undercollateralized } from "../actions/minipoolEjection";
import { emitter } from "../actions/emitter";

config();

Expand All @@ -21,36 +23,25 @@ describe("Minipool", () => {
}
}
});
describe("Statuses", () => {
test.concurrent("0 [prelaunch].", async () => {
describe("Undercollateralized", () => {
test.concurrent("emits for recordStakingEnd", async () => {
const emitSpy = vi.spyOn(emitter, "emit");
await testRuntime.execute(
minipoolStatusChange,
require("./payload/payload-prelaunch-minipool.json")
);
});
test.concurrent("1 [launched].", async () => {
await testRuntime.execute(
minipoolStatusChange,
require("./payload/payload-launched-minipool.json")
);
});
test.concurrent("2 [staking].", async () => {
await testRuntime.execute(
minipoolStatusChange,
require("./payload/payload-staking-minipool.json")
);
});
test.concurrent("3 [withdrawable].", async () => {
await testRuntime.execute(
minipoolStatusChange,
require("./payload/payload-withdrawable-minipool.json")
);
});
test.concurrent("[streamlined].", async () => {
await testRuntime.execute(
minipoolStatusChange,
require("./payload/payload-streamline-minipool.json")
undercollateralized,
require("./payload/payload-minipool-undercollateralized.json")
);
expect(emitSpy).toHaveBeenCalled();
});
test.concurrent(
"[negative] recordStakingEndThenMaybeCycle shouoldn't emit",
async () => {
const emitSpy = vi.spyOn(emitter, "emit");
await testRuntime.execute(
undercollateralized,
require("./payload/payload-minipool-undercollateralized-negative.json")
);
expect(emitSpy).not.toHaveBeenCalled();
}
);
});
});
51 changes: 51 additions & 0 deletions src/actions-local/mplaunch.spec.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,51 @@
import { config } from "dotenv";
import { TestRuntime } from "@tenderly/actions-test";

import { beforeAll, describe, test } from "vitest";

import { minipoolLaunched } from "../actions/minipoolLaunch";
import { Network } from "@tenderly/actions";

config();

describe("Minipool Launch", () => {
const testRuntime = new TestRuntime();
beforeAll(() => {
for (const [key, value] of Object.entries(process.env)) {
if (value) {
testRuntime.context.secrets.put(key, value);
}
}
});

describe("Minipool Launch", () => {
test.concurrent("manual launch", async () => {
testRuntime.context.metadata.getNetwork = () => Network.MAINNET
await testRuntime.execute(
minipoolLaunched,
require("./payload/payload-manual-launch.json")
);
});
test.concurrent("fuji launch", async () => {
testRuntime.context.metadata.getNetwork = () => Network.FUJI
await testRuntime.execute(
minipoolLaunched,
require("./payload/payload-manual-launch.json")
);
})
test.concurrent("artifact launch", async () => {
testRuntime.context.metadata.getNetwork = () => Network.MAINNET
await testRuntime.execute(
minipoolLaunched,
require("./payload/payload-artifact-launch.json")
);
});
test.concurrent("artifact fuji launch", async () => {
testRuntime.context.metadata.getNetwork = () => Network.FUJI
await testRuntime.execute(
minipoolLaunched,
require("./payload/payload-artifact-launch-fuji.json")
);
})
});
});
61 changes: 61 additions & 0 deletions src/actions-local/payload/payload-artifact-launch-fuji.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,61 @@
{
"network": "43113",
"blockHash": "0x93c6f6529599c9ad8d90ceda473c471370766db1d4e56d8800ed2469acfb4b4a",
"blockNumber": 35228917,
"hash": "0xc84cbc54b12cfb52a79452fe381c36af0aac99b9175be4a155a9efc011aad560",
"from": "0x5e32bAb27EC0B44d490066385f827838C49b61E1",
"to": "0x4C4B2663ad02E6A25ee96CCC15cd5eca1A8407cf",
"logs": [
{
"address": "0x2630D024c0D34766E194E79C0fb079bDfFeb37dc",
"topics": [
"0x14438a8606c512fda07a1e9dfefc371418ed542946338bfa1c87788e903b4d68",
"0x0000000000000000000000004c4b2663ad02e6a25ee96ccc15cd5eca1a8407cf"
],
"data": "0x0000000000000000000000000000000000000000000000000de0b6b3a7640000"
},
{
"address": "0xd00ae08403B9bbb9124bB305C09058E32C39A48c",
"topics": [
"0x7fcf532c15f0a6db0bd6d0e038bea71d30d808c7d98cb3bf7268a95bf5081b65",
"0x0000000000000000000000002630d024c0d34766e194e79c0fb079bdffeb37dc"
],
"data": "0x0000000000000000000000000000000000000000000000000de0b6b3a7640000"
},
{
"address": "0x4C4B2663ad02E6A25ee96CCC15cd5eca1A8407cf",
"topics": [
"0xc9c043637725967252aedd2704cc65fee962e7b8a1e3cf8098587a66601e50c5",
"0x000000000000000000000000676328187e06d1a7f6fdf75c7049a25e018e3019",
"0x0000000000000000000000000000000000000000000000000000000000000001"
],
"data": "0x"
},
{
"address": "0x4C4B2663ad02E6A25ee96CCC15cd5eca1A8407cf",
"topics": [
"0x60089039570e67d4e4e0f7f06be8ef92be8b5f70c72524c58491350983a5e10a",
"0x000000000000000000000000676328187e06d1a7f6fdf75c7049a25e018e3019"
],
"data": "0x9e8a01bb951fb38ff9aa0ddecfcda59c7d92b7e1569928f14e6d7bd3cce2f860"
},
{
"address": "0xaaA95D2E271a8293FC16E339080DB83C9bEB6Fcf",
"topics": [
"0xf2cef7bfb552886daf5034c34174362dca0ce32c5d844a0d384c2d4c41bd0696",
"0xdc9f46fd71d4bf9bb05b835608e68c9394b627d9f45ac7ee85b2772e827e321e"
],
"data": "0x0000000000000000000000000000000000000000000000000de0b6b3a7640000"
}
],
"input": "0x809784c5000000000000000000000000676328187e06d1a7f6fdf75c7049a25e018e3019",
"value": "0x0",
"nonce": "0xbe9",
"gas": "0x44af2",
"gasUsed": "0x2fa5b",
"cumulativeGasUsed": "0x2fa5b",
"gasPrice": "0x6fc23ac00",
"gasTipCap": "0x12a05f200",
"gasFeeCap": "0xcce416600",
"alertId": null
}
61 changes: 61 additions & 0 deletions src/actions-local/payload/payload-artifact-launch.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,61 @@
{
"network": "43114",
"blockHash": "0xde94241b8aa40ccc0f9fe58e20b9676261990c8521d23e9991ad003b2b12a27e",
"blockNumber": 49019234,
"hash": "0x47c31c2642cd62326c32cc8db38f3831b4221a1926aed36399b7482c08368c60",
"from": "0xb486738fa5859d08c841c7eb20b5ef2b5502f38b",
"to": "0xc300bc9b4b690ba7a182126299a0618ece268ee7",
"logs": [
{
"address": "0xa25eaf2906fa1a3a13edac9b9657108af7b703e3",
"topics": [
"0x14438a8606c512fda07a1e9dfefc371418ed542946338bfa1c87788e903b4d68",
"0x000000000000000000000000c300bc9b4b690ba7a182126299a0618ece268ee7"
],
"data": "0x00000000000000000000000000000000000000000000003635c9adc5dea00000"
},
{
"address": "0xb31f66aa3c1e785363f0875a1b74e27b85fd66c7",
"topics": [
"0x7fcf532c15f0a6db0bd6d0e038bea71d30d808c7d98cb3bf7268a95bf5081b65",
"0x000000000000000000000000a25eaf2906fa1a3a13edac9b9657108af7b703e3"
],
"data": "0x00000000000000000000000000000000000000000000003635c9adc5dea00000"
},
{
"address": "0xc300bc9b4b690ba7a182126299a0618ece268ee7",
"topics": [
"0xc9c043637725967252aedd2704cc65fee962e7b8a1e3cf8098587a66601e50c5",
"0x0000000000000000000000006c1d9d6a4c11d4ff76ee44cae41a8e9d0624183e",
"0x0000000000000000000000000000000000000000000000000000000000000001"
],
"data": "0x"
},
{
"address": "0xc300bc9b4b690ba7a182126299a0618ece268ee7",
"topics": [
"0x051432f8fe60e16e77c7d63dd8fbec40600ab62c8ab79ad5e332a41db28158ab",
"0x0000000000000000000000006c1d9d6a4c11d4ff76ee44cae41a8e9d0624183e"
],
"data": "0x9e8a01bb951fb38ff9aa0ddecfcda59c7d92b7e1569928f14e6d7bd3cce2f8600000000000000000000000000000000000000000000000000000000000ed4e00"
},
{
"address": "0xd45cb6f5aca41afaaaebdbe4efba49c1bc41e6ba",
"topics": [
"0xf2cef7bfb552886daf5034c34174362dca0ce32c5d844a0d384c2d4c41bd0696",
"0xdc9f46fd71d4bf9bb05b835608e68c9394b627d9f45ac7ee85b2772e827e321e"
],
"data": "0x00000000000000000000000000000000000000000000003635c9adc5dea00000"
}
],
"input": "0x809784c50000000000000000000000006c1d9d6a4c11d4ff76ee44cae41a8e9d0624183e",
"value": "0x",
"nonce": "0x7d65",
"gas": "0x31443",
"gasUsed": "0x30988",
"cumulativeGasUsed": "0x4076ec",
"gasPrice": "0x05d21dba00",
"gasTipCap": "0x",
"gasFeeCap": "0x0ba43b7400",
"alertId": null
}
Loading