From 1688fccf8d7ac42e462d47f37c78cd2e4e4cebf7 Mon Sep 17 00:00:00 2001 From: Kyle Date: Tue, 9 Apr 2024 06:49:43 +0800 Subject: [PATCH 1/5] fix: new mp address, streamline relaunch support --- src/actions/constants.ts | 3 +-- src/actions/minipool.ts | 17 +++++++++++++++++ src/actions/templates.ts | 7 +++++-- src/actions/types.ts | 1 + tenderly.yaml | 2 +- 5 files changed, 25 insertions(+), 5 deletions(-) diff --git a/src/actions/constants.ts b/src/actions/constants.ts index c802b20..bee3032 100644 --- a/src/actions/constants.ts +++ b/src/actions/constants.ts @@ -45,8 +45,7 @@ export const CLAIM_NODE_OP_ADDRESS = "0xb42CfaD450B46FDc9cAC5FBF14Bc2e6091AfC35c"; export const CLAIM_PROTOCOL_DAO_ADDRESS = "0x4169CF88c7Ed811E6f6e61917c5b915BeA49476c"; -export const MINIPOOL_MANAGER_ADDRESS = - "0xb84fA022c7fE1CE3a1F94C49f2F13236C3d1Ed08"; +export const MINIPOOL_MANAGER_ADDRESS = "0x17395Ad76b236FABeaC3634b78fF8F6970222199"; export const MULTISIG_MANAGER_ADDRESS = "0x7fff419c562Dd8b3cf16C335a01CDb37ea1B6a3B"; export const OCYTICUS_ADDRESS = "0x9189d18F453b1Ec1F02E40A8e3711334f9eA210B"; diff --git a/src/actions/minipool.ts b/src/actions/minipool.ts index 5f798f7..6709022 100644 --- a/src/actions/minipool.ts +++ b/src/actions/minipool.ts @@ -129,6 +129,16 @@ const getMessageFromStatusChangedEvent = async ( duration.toString() ); + case MinipoolStatus.STREAMLINE_RELAUNCH: + return MINIPOOL_RESTAKE_TEMPLATE( + transactionEvent, + nodeID, + owner, + duration.toString(), + startTime.add(duration).toString(), + true + ); + default: throw new Error("unknown status"); } @@ -154,6 +164,13 @@ export const minipoolStatusChange = async (context: Context, event: Event) => { "NewStreamlinedMinipoolMade" )?.length > 0; if (hasNewStreamlinedMinipoolMadeEvent) { + if(transactionEvent.logs.length > 5) { + message = await getMessageFromStatusChangedEvent( + statusChangedEvents[0], + transactionEvent, + MinipoolStatus.STREAMLINE_RELAUNCH + ); + } message = await getMessageFromStatusChangedEvent( statusChangedEvents[0], transactionEvent, diff --git a/src/actions/templates.ts b/src/actions/templates.ts index 0847222..2330bdf 100644 --- a/src/actions/templates.ts +++ b/src/actions/templates.ts @@ -555,7 +555,8 @@ export const MINIPOOL_RESTAKE_TEMPLATE = ( nodeId: string, owner: string, duration: string, - endTime: string + endTime: string, + isOneClick: boolean = false ) => { return { components: [ @@ -569,7 +570,9 @@ export const MINIPOOL_RESTAKE_TEMPLATE = ( new EmbedBuilder() .setTitle("♻️ Another Adventure Begins") .setDescription( - "The minipool has completed it's flight and is going out for another. Enjoy the ride!\n[📄 the life of a minipool](https://docs.gogopool.com/design/how-minipools-work/the-life-of-a-minipool) [📄 minipool statuses](https://docs.gogopool.com/design/how-minipools-work/minipooldesign)" + `The ${ + isOneClick ? "streamlined " : "" + }minipool has completed it's flight and is going out for another. Enjoy the ride!\n[📄 the life of a minipool](https://docs.gogopool.com/design/how-minipools-work/the-life-of-a-minipool) [📄 minipool statuses](https://docs.gogopool.com/design/how-minipools-work/minipooldesign)` ) .addFields( pilotField(owner), diff --git a/src/actions/types.ts b/src/actions/types.ts index 8009d22..98a193d 100644 --- a/src/actions/types.ts +++ b/src/actions/types.ts @@ -59,6 +59,7 @@ export enum MinipoolStatus { CANCELED = "5", FINISHED = "6", STREAMLINE_PRELAUNCH = "10", + STREAMLINE_RELAUNCH = "12", RESTAKE = "11", } diff --git a/tenderly.yaml b/tenderly.yaml index 3ecfc66..7dbcf94 100644 --- a/tenderly.yaml +++ b/tenderly.yaml @@ -13,7 +13,7 @@ actions: filters: - eventEmitted: contract: - address: 0xb84fA022c7fE1CE3a1F94C49f2F13236C3d1Ed08 + address: 0x17395Ad76b236FABeaC3634b78fF8F6970222199 name: MinipoolStatusChanged status: success network: 43114 From e965768ee469643ccd47fea198f62a5aa292c174 Mon Sep 17 00:00:00 2001 From: Kyle Date: Wed, 10 Apr 2024 08:25:17 +0800 Subject: [PATCH 2/5] fix: temp remove duration --- src/actions/templates.ts | 18 +++++++++--------- 1 file changed, 9 insertions(+), 9 deletions(-) diff --git a/src/actions/templates.ts b/src/actions/templates.ts index 2330bdf..c80967c 100644 --- a/src/actions/templates.ts +++ b/src/actions/templates.ts @@ -298,7 +298,7 @@ export const MINIPOOL_PRELAUNCH_TEMPLATE = ( .addFields( pilotField(owner), balloonField(nodeId), - tripDurationField(duration), +// tripDurationField(duration), minipoolStatusField("prelaunch") ) @@ -333,7 +333,7 @@ export const MINIPOOL_STREAMLINE_TEMPLATE = ( .addFields( pilotField(owner), balloonField(nodeId), - tripDurationField(duration), +// tripDurationField(duration), minipoolStatusField("prelaunch") ) .setColor(0x7ddbd5) @@ -366,7 +366,7 @@ export const MINIPOOL_LAUNCH_TEMPLATE = ( .addFields( pilotField(owner), balloonField(nodeId), - tripDurationField(duration), +// tripDurationField(duration), minipoolStatusField("launched") ) @@ -400,7 +400,7 @@ export const MINIPOOL_STAKING_TEMPLATE = ( .addFields( pilotField(owner), balloonField(nodeId), - tripDurationField(duration), +// tripDurationField(duration), endTimeField(endTime), minipoolStatusField("staking") ) @@ -435,7 +435,7 @@ export const MINIPOOL_WITHDRAWABLE_TEMPLATE = ( .addFields( pilotField(owner), balloonField(nodeId), - tripDurationField(duration), +// tripDurationField(duration), minipoolStatusField("withdrawable") ) @@ -469,7 +469,7 @@ export const MINIPOOL_FINISHED_TEMPLATE = ( .addFields( pilotField(owner), balloonField(nodeId), - tripDurationField(duration), +// tripDurationField(duration), endTimeField(endTime), minipoolStatusField("finished") ) @@ -504,7 +504,7 @@ export const MINIPOOL_CANCELED_TEMPLATE = ( .addFields( pilotField(owner), balloonField(nodeId), - tripDurationField(duration), +// tripDurationField(duration), endTimeField(endTime), minipoolStatusField("canceled") ) @@ -539,7 +539,7 @@ export const MINIPOOL_ERROR_TEMPLATE = ( .addFields( pilotField(owner), balloonField(nodeId), - tripDurationField(duration), +// tripDurationField(duration), endTimeField(endTime), minipoolStatusField("error") ) @@ -577,7 +577,7 @@ export const MINIPOOL_RESTAKE_TEMPLATE = ( .addFields( pilotField(owner), balloonField(nodeId), - tripDurationField(duration), +// tripDurationField(duration), minipoolStatusField("finished -> prelaunch -> launched") ) .setColor(0x7ddbd5) From fb72231323193711a3f84c721f1816e627d7ac95 Mon Sep 17 00:00:00 2001 From: Kyle Date: Wed, 10 Apr 2024 08:32:42 +0800 Subject: [PATCH 3/5] fix: streamlined message --- src/actions/minipool.ts | 13 +++++++------ 1 file changed, 7 insertions(+), 6 deletions(-) diff --git a/src/actions/minipool.ts b/src/actions/minipool.ts index 6709022..485ecd8 100644 --- a/src/actions/minipool.ts +++ b/src/actions/minipool.ts @@ -164,18 +164,19 @@ export const minipoolStatusChange = async (context: Context, event: Event) => { "NewStreamlinedMinipoolMade" )?.length > 0; if (hasNewStreamlinedMinipoolMadeEvent) { - if(transactionEvent.logs.length > 5) { + if (transactionEvent.logs.length > 5) { message = await getMessageFromStatusChangedEvent( statusChangedEvents[0], transactionEvent, MinipoolStatus.STREAMLINE_RELAUNCH ); + } else { + message = await getMessageFromStatusChangedEvent( + statusChangedEvents[0], + transactionEvent, + MinipoolStatus.STREAMLINE_PRELAUNCH + ); } - message = await getMessageFromStatusChangedEvent( - statusChangedEvents[0], - transactionEvent, - MinipoolStatus.STREAMLINE_PRELAUNCH - ); } else { message = await getMessageFromStatusChangedEvent( statusChangedEvents[0], From 9f9d24c065b5fd4c8f738d92372a2cbe2219beab Mon Sep 17 00:00:00 2001 From: Kyle Date: Wed, 10 Apr 2024 13:32:40 +0800 Subject: [PATCH 4/5] lint --- src/actions/templates.ts | 30 +++++++++++++++--------------- 1 file changed, 15 insertions(+), 15 deletions(-) diff --git a/src/actions/templates.ts b/src/actions/templates.ts index c80967c..7f3a12c 100644 --- a/src/actions/templates.ts +++ b/src/actions/templates.ts @@ -1,5 +1,5 @@ import { TransactionEvent } from "@tenderly/actions"; -import { formatDistance } from "date-fns"; +// import { formatDistance } from "date-fns"; import { APIEmbedField, ActionRowBuilder, @@ -74,20 +74,20 @@ const balloonField = (nodeId: string): APIEmbedField => { }; }; -const tripDurationField = (duration: string): APIEmbedField => { - const now = new Date(); - return { - name: "📅 trip duration", - value: `${formatDistance( - now, - new Date(now.getTime() + parseInt(duration) * 1000), - { - addSuffix: false, - } - )}`, - inline: true, - }; -}; +// const tripDurationField = (duration: string): APIEmbedField => { +// const now = new Date(); +// return { +// name: "📅 trip duration", +// value: `${formatDistance( +// now, +// new Date(now.getTime() + parseInt(duration) * 1000), +// { +// addSuffix: false, +// } +// )}`, +// inline: true, +// }; +// }; const endTimeField = (endTime: string): APIEmbedField => { return { From d565be2be0ffc401f716601906478b80a7d05c49 Mon Sep 17 00:00:00 2001 From: Kyle Date: Thu, 25 Apr 2024 13:12:22 -0400 Subject: [PATCH 5/5] =?UTF-8?q?chore:=20update=20ABIs=20=F0=9F=9B=A0?= =?UTF-8?q?=EF=B8=8F?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/actions/abis/minipoolManager.ts | 745 +++++++----------------- src/actions/abis/minipoolStreamliner.ts | 179 ++---- src/actions/constants.ts | 3 +- src/actions/minipool.ts | 18 +- src/actions/templates.ts | 22 +- 5 files changed, 296 insertions(+), 671 deletions(-) diff --git a/src/actions/abis/minipoolManager.ts b/src/actions/abis/minipoolManager.ts index 6d8ec1c..5101995 100644 --- a/src/actions/abis/minipoolManager.ts +++ b/src/actions/abis/minipoolManager.ts @@ -10,120 +10,49 @@ export const abi = [ stateMutability: "nonpayable", type: "constructor", }, + { inputs: [], name: "CancellationTooEarly", type: "error" }, + { inputs: [], name: "ContractNotFound", type: "error" }, + { inputs: [], name: "ContractPaused", type: "error" }, + { inputs: [], name: "DelegationFeeOutOfBounds", type: "error" }, + { inputs: [], name: "DurationOutOfBounds", type: "error" }, + { inputs: [], name: "InsufficientAVAXForMinipoolCreation", type: "error" }, + { inputs: [], name: "InsufficientGGPCollateralization", type: "error" }, + { inputs: [], name: "InvalidAVAXAssignmentRequest", type: "error" }, + { inputs: [], name: "InvalidAmount", type: "error" }, + { inputs: [], name: "InvalidEndTime", type: "error" }, + { inputs: [], name: "InvalidMultisigAddress", type: "error" }, + { inputs: [], name: "InvalidNodeID", type: "error" }, + { inputs: [], name: "InvalidOrOutdatedContract", type: "error" }, + { inputs: [], name: "InvalidStartTime", type: "error" }, + { inputs: [], name: "InvalidStateTransition", type: "error" }, + { inputs: [], name: "MinipoolDurationExceeded", type: "error" }, + { inputs: [], name: "MinipoolNotFound", type: "error" }, + { inputs: [], name: "MustBeGuardian", type: "error" }, + { inputs: [], name: "MustBeGuardianOrValidContract", type: "error" }, + { inputs: [], name: "MustBeMultisig", type: "error" }, + { inputs: [], name: "NegativeCycleDuration", type: "error" }, + { inputs: [], name: "OnlyOwner", type: "error" }, + { inputs: [], name: "OnlyRole", type: "error" }, + { inputs: [], name: "WithdrawAmountTooLarge", type: "error" }, + { inputs: [], name: "WithdrawForDelegationDisabled", type: "error" }, { - inputs: [], - name: "CancellationTooEarly", - type: "error", - }, - { - inputs: [], - name: "ContractNotFound", - type: "error", - }, - { - inputs: [], - name: "ContractPaused", - type: "error", - }, - { - inputs: [], - name: "DelegationFeeOutOfBounds", - type: "error", - }, - { - inputs: [], - name: "DurationOutOfBounds", - type: "error", - }, - { - inputs: [], - name: "InsufficientAVAXForMinipoolCreation", - type: "error", - }, - { - inputs: [], - name: "InsufficientGGPCollateralization", - type: "error", - }, - { - inputs: [], - name: "InvalidAVAXAssignmentRequest", - type: "error", - }, - { - inputs: [], - name: "InvalidAmount", - type: "error", - }, - { - inputs: [], - name: "InvalidEndTime", - type: "error", - }, - { - inputs: [], - name: "InvalidMultisigAddress", - type: "error", - }, - { - inputs: [], - name: "InvalidNodeID", - type: "error", - }, - { - inputs: [], - name: "InvalidOrOutdatedContract", - type: "error", - }, - { - inputs: [], - name: "InvalidStartTime", - type: "error", - }, - { - inputs: [], - name: "InvalidStateTransition", - type: "error", - }, - { - inputs: [], - name: "MinipoolDurationExceeded", - type: "error", - }, - { - inputs: [], - name: "MinipoolNotFound", - type: "error", - }, - { - inputs: [], - name: "MustBeGuardian", - type: "error", - }, - { - inputs: [], - name: "MustBeGuardianOrValidContract", - type: "error", - }, - { - inputs: [], - name: "MustBeMultisig", - type: "error", - }, - { - inputs: [], - name: "NegativeCycleDuration", - type: "error", - }, - { - inputs: [], - name: "OnlyOwner", - type: "error", - }, - { - inputs: [], - name: "WithdrawAmountTooLarge", - type: "error", + anonymous: false, + inputs: [ + { + indexed: true, + internalType: "address", + name: "nodeID", + type: "address", + }, + { + indexed: false, + internalType: "bytes", + name: "blsPubkeyAndSig", + type: "bytes", + }, + ], + name: "BLSKeysAdded", + type: "event", }, { anonymous: false, @@ -137,9 +66,29 @@ export const abi = [ { indexed: false, internalType: "uint256", - name: "ggp", + name: "amount", type: "uint256", }, + { + indexed: false, + internalType: "uint256", + name: "rewardsAmount", + type: "uint256", + }, + ], + name: "DepositFromDelegation", + type: "event", + }, + { + anonymous: false, + inputs: [ + { + indexed: true, + internalType: "address", + name: "nodeID", + type: "address", + }, + { indexed: false, internalType: "uint256", name: "ggp", type: "uint256" }, ], name: "GGPSlashed", type: "event", @@ -164,51 +113,42 @@ export const abi = [ type: "event", }, { + anonymous: false, inputs: [ { - internalType: "uint256", - name: "avaxRewardAmt", - type: "uint256", + indexed: true, + internalType: "address", + name: "nodeID", + type: "address", }, - ], - name: "calculateGGPSlashAmt", - outputs: [ { + indexed: false, internalType: "uint256", - name: "", + name: "amount", type: "uint256", }, ], - stateMutability: "view", - type: "function", + name: "WithdrawForDelegation", + type: "event", }, { inputs: [ - { - internalType: "address", - name: "nodeID", - type: "address", - }, + { internalType: "uint256", name: "avaxRewardAmt", type: "uint256" }, ], + name: "calculateGGPSlashAmt", + outputs: [{ internalType: "uint256", name: "", type: "uint256" }], + stateMutability: "view", + type: "function", + }, + { + inputs: [{ internalType: "address", name: "nodeID", type: "address" }], name: "canClaimAndInitiateStaking", - outputs: [ - { - internalType: "bool", - name: "", - type: "bool", - }, - ], + outputs: [{ internalType: "bool", name: "", type: "bool" }], stateMutability: "view", type: "function", }, { - inputs: [ - { - internalType: "address", - name: "nodeID", - type: "address", - }, - ], + inputs: [{ internalType: "address", name: "nodeID", type: "address" }], name: "cancelMinipool", outputs: [], stateMutability: "nonpayable", @@ -216,16 +156,8 @@ export const abi = [ }, { inputs: [ - { - internalType: "address", - name: "nodeID", - type: "address", - }, - { - internalType: "bytes32", - name: "errorCode", - type: "bytes32", - }, + { internalType: "address", name: "nodeID", type: "address" }, + { internalType: "bytes32", name: "errorCode", type: "bytes32" }, ], name: "cancelMinipoolByMultisig", outputs: [], @@ -233,13 +165,7 @@ export const abi = [ type: "function", }, { - inputs: [ - { - internalType: "address", - name: "nodeID", - type: "address", - }, - ], + inputs: [{ internalType: "address", name: "nodeID", type: "address" }], name: "claimAndInitiateStaking", outputs: [], stateMutability: "nonpayable", @@ -247,26 +173,15 @@ export const abi = [ }, { inputs: [ - { - internalType: "address", - name: "nodeID", - type: "address", - }, - { - internalType: "uint256", - name: "duration", - type: "uint256", - }, - { - internalType: "uint256", - name: "delegationFee", - type: "uint256", - }, + { internalType: "address", name: "nodeID", type: "address" }, + { internalType: "uint256", name: "duration", type: "uint256" }, + { internalType: "uint256", name: "delegationFee", type: "uint256" }, { internalType: "uint256", name: "avaxAssignmentRequest", type: "uint256", }, + { internalType: "bytes", name: "blsPubkeyAndSig", type: "bytes" }, ], name: "createMinipool", outputs: [], @@ -275,99 +190,63 @@ export const abi = [ }, { inputs: [ + { internalType: "address", name: "owner", type: "address" }, + { internalType: "address", name: "nodeID", type: "address" }, + { internalType: "uint256", name: "duration", type: "uint256" }, + { internalType: "uint256", name: "delegationFee", type: "uint256" }, { internalType: "uint256", - name: "duration", - type: "uint256", - }, - { - internalType: "uint256", - name: "avaxAmt", + name: "avaxAssignmentRequest", type: "uint256", }, + { internalType: "bytes", name: "blsPubkeyAndSig", type: "bytes" }, ], - name: "getExpectedAVAXRewardsAmt", - outputs: [ - { - internalType: "uint256", - name: "", - type: "uint256", - }, + name: "createMinipoolOnBehalfOf", + outputs: [], + stateMutability: "payable", + type: "function", + }, + { + inputs: [ + { internalType: "uint256", name: "rewards", type: "uint256" }, + { internalType: "address", name: "nodeID", type: "address" }, ], - stateMutability: "view", + name: "depositFromDelegation", + outputs: [], + stateMutability: "payable", type: "function", }, { inputs: [ - { - internalType: "address", - name: "nodeID", - type: "address", - }, + { internalType: "uint256", name: "duration", type: "uint256" }, + { internalType: "uint256", name: "avaxAmt", type: "uint256" }, ], + name: "getExpectedAVAXRewardsAmt", + outputs: [{ internalType: "uint256", name: "", type: "uint256" }], + stateMutability: "view", + type: "function", + }, + { + inputs: [{ internalType: "address", name: "nodeID", type: "address" }], name: "getIndexOf", - outputs: [ - { - internalType: "int256", - name: "", - type: "int256", - }, - ], + outputs: [{ internalType: "int256", name: "", type: "int256" }], stateMutability: "view", type: "function", }, { - inputs: [ - { - internalType: "int256", - name: "index", - type: "int256", - }, - ], + inputs: [{ internalType: "int256", name: "index", type: "int256" }], name: "getMinipool", outputs: [ { components: [ - { - internalType: "int256", - name: "index", - type: "int256", - }, - { - internalType: "address", - name: "nodeID", - type: "address", - }, - { - internalType: "uint256", - name: "status", - type: "uint256", - }, - { - internalType: "uint256", - name: "duration", - type: "uint256", - }, - { - internalType: "uint256", - name: "delegationFee", - type: "uint256", - }, - { - internalType: "address", - name: "owner", - type: "address", - }, - { - internalType: "address", - name: "multisigAddr", - type: "address", - }, - { - internalType: "uint256", - name: "avaxNodeOpAmt", - type: "uint256", - }, + { internalType: "int256", name: "index", type: "int256" }, + { internalType: "address", name: "nodeID", type: "address" }, + { internalType: "uint256", name: "status", type: "uint256" }, + { internalType: "uint256", name: "duration", type: "uint256" }, + { internalType: "uint256", name: "delegationFee", type: "uint256" }, + { internalType: "address", name: "owner", type: "address" }, + { internalType: "address", name: "multisigAddr", type: "address" }, + { internalType: "uint256", name: "avaxNodeOpAmt", type: "uint256" }, { internalType: "uint256", name: "avaxNodeOpInitialAmt", @@ -378,46 +257,23 @@ export const abi = [ name: "avaxLiquidStakerAmt", type: "uint256", }, - { - internalType: "bytes32", - name: "txID", - type: "bytes32", - }, - { - internalType: "uint256", - name: "creationTime", - type: "uint256", - }, + { internalType: "bytes", name: "blsPubkeyAndSig", type: "bytes" }, + { internalType: "bytes32", name: "txID", type: "bytes32" }, + { internalType: "uint256", name: "creationTime", type: "uint256" }, { internalType: "uint256", name: "initialStartTime", type: "uint256", }, - { - internalType: "uint256", - name: "startTime", - type: "uint256", - }, - { - internalType: "uint256", - name: "endTime", - type: "uint256", - }, + { internalType: "uint256", name: "startTime", type: "uint256" }, + { internalType: "uint256", name: "endTime", type: "uint256" }, { internalType: "uint256", name: "avaxTotalRewardAmt", type: "uint256", }, - { - internalType: "bytes32", - name: "errorCode", - type: "bytes32", - }, - { - internalType: "uint256", - name: "ggpSlashAmt", - type: "uint256", - }, + { internalType: "bytes32", name: "errorCode", type: "bytes32" }, + { internalType: "uint256", name: "ggpSlashAmt", type: "uint256" }, { internalType: "uint256", name: "avaxNodeOpRewardAmt", @@ -438,57 +294,19 @@ export const abi = [ type: "function", }, { - inputs: [ - { - internalType: "address", - name: "nodeID", - type: "address", - }, - ], + inputs: [{ internalType: "address", name: "nodeID", type: "address" }], name: "getMinipoolByNodeID", outputs: [ { components: [ - { - internalType: "int256", - name: "index", - type: "int256", - }, - { - internalType: "address", - name: "nodeID", - type: "address", - }, - { - internalType: "uint256", - name: "status", - type: "uint256", - }, - { - internalType: "uint256", - name: "duration", - type: "uint256", - }, - { - internalType: "uint256", - name: "delegationFee", - type: "uint256", - }, - { - internalType: "address", - name: "owner", - type: "address", - }, - { - internalType: "address", - name: "multisigAddr", - type: "address", - }, - { - internalType: "uint256", - name: "avaxNodeOpAmt", - type: "uint256", - }, + { internalType: "int256", name: "index", type: "int256" }, + { internalType: "address", name: "nodeID", type: "address" }, + { internalType: "uint256", name: "status", type: "uint256" }, + { internalType: "uint256", name: "duration", type: "uint256" }, + { internalType: "uint256", name: "delegationFee", type: "uint256" }, + { internalType: "address", name: "owner", type: "address" }, + { internalType: "address", name: "multisigAddr", type: "address" }, + { internalType: "uint256", name: "avaxNodeOpAmt", type: "uint256" }, { internalType: "uint256", name: "avaxNodeOpInitialAmt", @@ -499,46 +317,23 @@ export const abi = [ name: "avaxLiquidStakerAmt", type: "uint256", }, - { - internalType: "bytes32", - name: "txID", - type: "bytes32", - }, - { - internalType: "uint256", - name: "creationTime", - type: "uint256", - }, + { internalType: "bytes", name: "blsPubkeyAndSig", type: "bytes" }, + { internalType: "bytes32", name: "txID", type: "bytes32" }, + { internalType: "uint256", name: "creationTime", type: "uint256" }, { internalType: "uint256", name: "initialStartTime", type: "uint256", }, - { - internalType: "uint256", - name: "startTime", - type: "uint256", - }, - { - internalType: "uint256", - name: "endTime", - type: "uint256", - }, + { internalType: "uint256", name: "startTime", type: "uint256" }, + { internalType: "uint256", name: "endTime", type: "uint256" }, { internalType: "uint256", name: "avaxTotalRewardAmt", type: "uint256", }, - { - internalType: "bytes32", - name: "errorCode", - type: "bytes32", - }, - { - internalType: "uint256", - name: "ggpSlashAmt", - type: "uint256", - }, + { internalType: "bytes32", name: "errorCode", type: "bytes32" }, + { internalType: "uint256", name: "ggpSlashAmt", type: "uint256" }, { internalType: "uint256", name: "avaxNodeOpRewardAmt", @@ -561,78 +356,28 @@ export const abi = [ { inputs: [], name: "getMinipoolCount", - outputs: [ - { - internalType: "uint256", - name: "", - type: "uint256", - }, - ], + outputs: [{ internalType: "uint256", name: "", type: "uint256" }], stateMutability: "view", type: "function", }, { inputs: [ - { - internalType: "enum MinipoolStatus", - name: "status", - type: "uint8", - }, - { - internalType: "uint256", - name: "offset", - type: "uint256", - }, - { - internalType: "uint256", - name: "limit", - type: "uint256", - }, + { internalType: "enum MinipoolStatus", name: "status", type: "uint8" }, + { internalType: "uint256", name: "offset", type: "uint256" }, + { internalType: "uint256", name: "limit", type: "uint256" }, ], name: "getMinipools", outputs: [ { components: [ - { - internalType: "int256", - name: "index", - type: "int256", - }, - { - internalType: "address", - name: "nodeID", - type: "address", - }, - { - internalType: "uint256", - name: "status", - type: "uint256", - }, - { - internalType: "uint256", - name: "duration", - type: "uint256", - }, - { - internalType: "uint256", - name: "delegationFee", - type: "uint256", - }, - { - internalType: "address", - name: "owner", - type: "address", - }, - { - internalType: "address", - name: "multisigAddr", - type: "address", - }, - { - internalType: "uint256", - name: "avaxNodeOpAmt", - type: "uint256", - }, + { internalType: "int256", name: "index", type: "int256" }, + { internalType: "address", name: "nodeID", type: "address" }, + { internalType: "uint256", name: "status", type: "uint256" }, + { internalType: "uint256", name: "duration", type: "uint256" }, + { internalType: "uint256", name: "delegationFee", type: "uint256" }, + { internalType: "address", name: "owner", type: "address" }, + { internalType: "address", name: "multisigAddr", type: "address" }, + { internalType: "uint256", name: "avaxNodeOpAmt", type: "uint256" }, { internalType: "uint256", name: "avaxNodeOpInitialAmt", @@ -643,46 +388,23 @@ export const abi = [ name: "avaxLiquidStakerAmt", type: "uint256", }, - { - internalType: "bytes32", - name: "txID", - type: "bytes32", - }, - { - internalType: "uint256", - name: "creationTime", - type: "uint256", - }, + { internalType: "bytes", name: "blsPubkeyAndSig", type: "bytes" }, + { internalType: "bytes32", name: "txID", type: "bytes32" }, + { internalType: "uint256", name: "creationTime", type: "uint256" }, { internalType: "uint256", name: "initialStartTime", type: "uint256", }, - { - internalType: "uint256", - name: "startTime", - type: "uint256", - }, - { - internalType: "uint256", - name: "endTime", - type: "uint256", - }, + { internalType: "uint256", name: "startTime", type: "uint256" }, + { internalType: "uint256", name: "endTime", type: "uint256" }, { internalType: "uint256", name: "avaxTotalRewardAmt", type: "uint256", }, - { - internalType: "bytes32", - name: "errorCode", - type: "bytes32", - }, - { - internalType: "uint256", - name: "ggpSlashAmt", - type: "uint256", - }, + { internalType: "bytes32", name: "errorCode", type: "bytes32" }, + { internalType: "uint256", name: "ggpSlashAmt", type: "uint256" }, { internalType: "uint256", name: "avaxNodeOpRewardAmt", @@ -705,26 +427,14 @@ export const abi = [ { inputs: [], name: "getTotalAVAXLiquidStakerAmt", - outputs: [ - { - internalType: "uint256", - name: "", - type: "uint256", - }, - ], + outputs: [{ internalType: "uint256", name: "", type: "uint256" }], stateMutability: "view", type: "function", }, { inputs: [], name: "minStakingDuration", - outputs: [ - { - internalType: "uint256", - name: "", - type: "uint256", - }, - ], + outputs: [{ internalType: "uint256", name: "", type: "uint256" }], stateMutability: "view", type: "function", }, @@ -737,21 +447,9 @@ export const abi = [ }, { inputs: [ - { - internalType: "address", - name: "nodeID", - type: "address", - }, - { - internalType: "uint256", - name: "endTime", - type: "uint256", - }, - { - internalType: "uint256", - name: "avaxTotalRewardAmt", - type: "uint256", - }, + { internalType: "address", name: "nodeID", type: "address" }, + { internalType: "uint256", name: "endTime", type: "uint256" }, + { internalType: "uint256", name: "avaxTotalRewardAmt", type: "uint256" }, ], name: "recordStakingEnd", outputs: [], @@ -760,21 +458,9 @@ export const abi = [ }, { inputs: [ - { - internalType: "address", - name: "nodeID", - type: "address", - }, - { - internalType: "uint256", - name: "endTime", - type: "uint256", - }, - { - internalType: "uint256", - name: "avaxTotalRewardAmt", - type: "uint256", - }, + { internalType: "address", name: "nodeID", type: "address" }, + { internalType: "uint256", name: "endTime", type: "uint256" }, + { internalType: "uint256", name: "avaxTotalRewardAmt", type: "uint256" }, ], name: "recordStakingEndThenMaybeCycle", outputs: [], @@ -783,16 +469,8 @@ export const abi = [ }, { inputs: [ - { - internalType: "address", - name: "nodeID", - type: "address", - }, - { - internalType: "bytes32", - name: "errorCode", - type: "bytes32", - }, + { internalType: "address", name: "nodeID", type: "address" }, + { internalType: "bytes32", name: "errorCode", type: "bytes32" }, ], name: "recordStakingError", outputs: [], @@ -801,51 +479,64 @@ export const abi = [ }, { inputs: [ - { - internalType: "address", - name: "nodeID", - type: "address", - }, - { - internalType: "bytes32", - name: "txID", - type: "bytes32", - }, - { - internalType: "uint256", - name: "startTime", - type: "uint256", - }, + { internalType: "address", name: "nodeID", type: "address" }, + { internalType: "bytes32", name: "txID", type: "bytes32" }, + { internalType: "uint256", name: "startTime", type: "uint256" }, ], name: "recordStakingStart", outputs: [], stateMutability: "nonpayable", type: "function", }, + { + inputs: [{ internalType: "address", name: "nodeID", type: "address" }], + name: "requireValidMinipool", + outputs: [{ internalType: "int256", name: "", type: "int256" }], + stateMutability: "view", + type: "function", + }, + { + inputs: [ + { internalType: "address", name: "nodeID", type: "address" }, + { internalType: "bytes", name: "blsPubkeyAndSig", type: "bytes" }, + ], + name: "setBLSKeys", + outputs: [], + stateMutability: "nonpayable", + type: "function", + }, { inputs: [], name: "version", - outputs: [ - { - internalType: "uint8", - name: "", - type: "uint8", - }, - ], + outputs: [{ internalType: "uint8", name: "", type: "uint8" }], stateMutability: "view", type: "function", }, { inputs: [ - { - internalType: "address", - name: "nodeID", - type: "address", - }, + { internalType: "uint256", name: "amount", type: "uint256" }, + { internalType: "address", name: "nodeID", type: "address" }, ], + name: "withdrawForDelegation", + outputs: [], + stateMutability: "nonpayable", + type: "function", + }, + { + inputs: [{ internalType: "address", name: "nodeID", type: "address" }], name: "withdrawMinipoolFunds", outputs: [], stateMutability: "nonpayable", type: "function", }, + { + inputs: [ + { internalType: "address", name: "nodeID", type: "address" }, + { internalType: "uint256", name: "duration", type: "uint256" }, + ], + name: "withdrawRewardsAndRelaunchMinipool", + outputs: [], + stateMutability: "nonpayable", + type: "function", + }, ]; diff --git a/src/actions/abis/minipoolStreamliner.ts b/src/actions/abis/minipoolStreamliner.ts index 43b62ce..9106169 100644 --- a/src/actions/abis/minipoolStreamliner.ts +++ b/src/actions/abis/minipoolStreamliner.ts @@ -6,80 +6,22 @@ export const abi = [ name: "storageAddress", type: "address", }, - { - internalType: "address", - name: "WAVAX", - type: "address", - }, - { - internalType: "address", - name: "USDC", - type: "address", - }, - { - internalType: "address", - name: "TJRouter", - type: "address", - }, - { - internalType: "address", - name: "Oonodz", - type: "address", - }, + { internalType: "address", name: "WAVAX", type: "address" }, + { internalType: "address", name: "TJRouter", type: "address" }, ], stateMutability: "nonpayable", type: "constructor", }, - { - inputs: [], - name: "ContractNotFound", - type: "error", - }, - { - inputs: [], - name: "ContractPaused", - type: "error", - }, - { - inputs: [], - name: "IncorrectNodeIDFormat", - type: "error", - }, - { - inputs: [], - name: "IncorrectNodeIDLength", - type: "error", - }, - { - inputs: [], - name: "InvalidOrOutdatedContract", - type: "error", - }, - { - inputs: [], - name: "MismatchedFunds", - type: "error", - }, - { - inputs: [], - name: "MustBeGuardian", - type: "error", - }, - { - inputs: [], - name: "MustBeGuardianOrValidContract", - type: "error", - }, - { - inputs: [], - name: "MustBeMultisig", - type: "error", - }, - { - inputs: [], - name: "SwapFailed", - type: "error", - }, + { inputs: [], name: "ContractNotFound", type: "error" }, + { inputs: [], name: "ContractPaused", type: "error" }, + { inputs: [], name: "InvalidOrOutdatedContract", type: "error" }, + { inputs: [], name: "MismatchedFunds", type: "error" }, + { inputs: [], name: "MustBeGuardian", type: "error" }, + { inputs: [], name: "MustBeGuardianOrValidContract", type: "error" }, + { inputs: [], name: "MustBeMultisig", type: "error" }, + { inputs: [], name: "NotApprovedHardwareProvider", type: "error" }, + { inputs: [], name: "OnlyOwner", type: "error" }, + { inputs: [], name: "SwapFailed", type: "error" }, { anonymous: false, inputs: [ @@ -97,12 +39,12 @@ export const abi = [ }, { indexed: false, - internalType: "bool", - name: "isUsingOonodz", - type: "bool", + internalType: "address", + name: "hardwareProviderContract", + type: "address", }, ], - name: "NewStreamlinedMinipoolMade", + name: "MinipoolRelaunched", type: "event", }, { @@ -111,48 +53,38 @@ export const abi = [ { indexed: false, internalType: "address", - name: "reciever", + name: "nodeID", + type: "address", + }, + { + indexed: false, + internalType: "address", + name: "owner", type: "address", }, { indexed: false, - internalType: "uint256", - name: "amount", - type: "uint256", + internalType: "address", + name: "hardwareProviderContract", + type: "address", }, ], - name: "USDCRefunded", + name: "NewStreamlinedMinipoolMade", type: "event", }, { inputs: [ { components: [ - { - internalType: "address", - name: "nodeID", - type: "address", - }, - { - internalType: "uint256", - name: "duration", - type: "uint256", - }, - { - internalType: "uint16", - name: "countryOfResidence", - type: "uint16", - }, + { internalType: "address", name: "nodeID", type: "address" }, + { internalType: "bytes", name: "blsPubkeyAndSig", type: "bytes" }, + { internalType: "uint256", name: "duration", type: "uint256" }, { internalType: "uint256", name: "avaxForMinipool", type: "uint256", }, - { - internalType: "uint256", - name: "avaxForGGP", - type: "uint256", - }, + { internalType: "uint256", name: "avaxForGGP", type: "uint256" }, { internalType: "uint256", name: "minGGPAmountOut", @@ -164,19 +96,14 @@ export const abi = [ type: "uint256", }, { - internalType: "uint256", - name: "minUSDCAmountOut", - type: "uint256", - }, - { - internalType: "bool", - name: "bestRate", - type: "bool", + internalType: "address", + name: "hardwareProviderContract", + type: "address", }, { - internalType: "bool", - name: "withdrawalRightWaiver", - type: "bool", + internalType: "bytes", + name: "hardwareProviderInformation", + type: "bytes", }, ], internalType: "struct MinipoolStreamliner.StreamlinedMinipool", @@ -184,11 +111,20 @@ export const abi = [ type: "tuple", }, ], - name: "createStreamlinedMinipool", + name: "createOrRelaunchStreamlinedMinipool", outputs: [], stateMutability: "payable", type: "function", }, + { + inputs: [ + { internalType: "address", name: "contractAddress", type: "address" }, + ], + name: "isApprovedHardwareProvider", + outputs: [{ internalType: "bool", name: "", type: "bool" }], + stateMutability: "view", + type: "function", + }, { inputs: [], name: "receiveWithdrawalAVAX", @@ -197,15 +133,22 @@ export const abi = [ type: "function", }, { - inputs: [], - name: "version", + inputs: [ + { internalType: "address", name: "user", type: "address" }, + { internalType: "uint256", name: "avaxForGGP", type: "uint256" }, + { internalType: "uint256", name: "minGGPAmountOut", type: "uint256" }, + ], + name: "swapAndStakeGGPOnBehalfOf", outputs: [ - { - internalType: "uint8", - name: "", - type: "uint8", - }, + { internalType: "uint256", name: "ggpPurchased", type: "uint256" }, ], + stateMutability: "payable", + type: "function", + }, + { + inputs: [], + name: "version", + outputs: [{ internalType: "uint8", name: "", type: "uint8" }], stateMutability: "view", type: "function", }, diff --git a/src/actions/constants.ts b/src/actions/constants.ts index bee3032..e60a3ab 100644 --- a/src/actions/constants.ts +++ b/src/actions/constants.ts @@ -61,8 +61,7 @@ export const TOKENGGP_ADDRESS = "0x69260B9483F9871ca57f81A90D91E2F96c2Cd11d"; export const TOKENGG_AVAX_ADDRESS = "0xA25EaF2906FA1a3a13EdAc9B9657108Af7B703e3"; export const WAVAX_ADDRESS = "0xB31f66AA3C1e785363F0875A1B74E27b85FD66c7"; -export const MINIPOOL_STREAMLINER = - "0x0A75a480Af4ADC81b20b1664A1Da2bd7caEFA430"; +export const MINIPOOL_STREAMLINER = "0x8C05D78066431C3b11bBFB6f3546fD3F1396115C"; export const CLAIM_NODE_OP_INTERFACE = new utils.Interface(ClaimNodeOpAbi); export const CLAIM_PROTOCOL_DAO_INTERFACE = new utils.Interface( diff --git a/src/actions/minipool.ts b/src/actions/minipool.ts index 485ecd8..45bfe59 100644 --- a/src/actions/minipool.ts +++ b/src/actions/minipool.ts @@ -164,19 +164,11 @@ export const minipoolStatusChange = async (context: Context, event: Event) => { "NewStreamlinedMinipoolMade" )?.length > 0; if (hasNewStreamlinedMinipoolMadeEvent) { - if (transactionEvent.logs.length > 5) { - message = await getMessageFromStatusChangedEvent( - statusChangedEvents[0], - transactionEvent, - MinipoolStatus.STREAMLINE_RELAUNCH - ); - } else { - message = await getMessageFromStatusChangedEvent( - statusChangedEvents[0], - transactionEvent, - MinipoolStatus.STREAMLINE_PRELAUNCH - ); - } + message = await getMessageFromStatusChangedEvent( + statusChangedEvents[0], + transactionEvent, + MinipoolStatus.STREAMLINE_PRELAUNCH + ); } else { message = await getMessageFromStatusChangedEvent( statusChangedEvents[0], diff --git a/src/actions/templates.ts b/src/actions/templates.ts index 7f3a12c..da982bf 100644 --- a/src/actions/templates.ts +++ b/src/actions/templates.ts @@ -298,7 +298,7 @@ export const MINIPOOL_PRELAUNCH_TEMPLATE = ( .addFields( pilotField(owner), balloonField(nodeId), -// tripDurationField(duration), + // tripDurationField(duration), minipoolStatusField("prelaunch") ) @@ -333,7 +333,7 @@ export const MINIPOOL_STREAMLINE_TEMPLATE = ( .addFields( pilotField(owner), balloonField(nodeId), -// tripDurationField(duration), + // tripDurationField(duration), minipoolStatusField("prelaunch") ) .setColor(0x7ddbd5) @@ -366,7 +366,7 @@ export const MINIPOOL_LAUNCH_TEMPLATE = ( .addFields( pilotField(owner), balloonField(nodeId), -// tripDurationField(duration), + // tripDurationField(duration), minipoolStatusField("launched") ) @@ -400,7 +400,7 @@ export const MINIPOOL_STAKING_TEMPLATE = ( .addFields( pilotField(owner), balloonField(nodeId), -// tripDurationField(duration), + // tripDurationField(duration), endTimeField(endTime), minipoolStatusField("staking") ) @@ -435,7 +435,7 @@ export const MINIPOOL_WITHDRAWABLE_TEMPLATE = ( .addFields( pilotField(owner), balloonField(nodeId), -// tripDurationField(duration), + // tripDurationField(duration), minipoolStatusField("withdrawable") ) @@ -469,7 +469,7 @@ export const MINIPOOL_FINISHED_TEMPLATE = ( .addFields( pilotField(owner), balloonField(nodeId), -// tripDurationField(duration), + // tripDurationField(duration), endTimeField(endTime), minipoolStatusField("finished") ) @@ -504,7 +504,7 @@ export const MINIPOOL_CANCELED_TEMPLATE = ( .addFields( pilotField(owner), balloonField(nodeId), -// tripDurationField(duration), + // tripDurationField(duration), endTimeField(endTime), minipoolStatusField("canceled") ) @@ -539,7 +539,7 @@ export const MINIPOOL_ERROR_TEMPLATE = ( .addFields( pilotField(owner), balloonField(nodeId), -// tripDurationField(duration), + // tripDurationField(duration), endTimeField(endTime), minipoolStatusField("error") ) @@ -577,7 +577,7 @@ export const MINIPOOL_RESTAKE_TEMPLATE = ( .addFields( pilotField(owner), balloonField(nodeId), -// tripDurationField(duration), + // tripDurationField(duration), minipoolStatusField("finished -> prelaunch -> launched") ) .setColor(0x7ddbd5) @@ -618,7 +618,7 @@ export const GGP_STAKING_STAKE_TEMPLATE = ( ggpAmountField(amount, { name: "stake amount", }), - ggpDifferenceField(amount, totalStake, false, { + ggpAmountField(totalStake, { name: "total stake", }) ) @@ -659,7 +659,7 @@ export const GGP_STAKING_WITHDRAW_TEMPLATE = ( ggpAmountField(amount, { name: "un-stake amount", }), - ggpDifferenceField(amount, totalStake, true, { + ggpAmountField(totalStake, { name: "total stake", }) )