-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
add top up functionality to balance monitor (#626)
* add try fill functionality to balance monitor * changeset add * fix num comp by using bigint not ethers big number * dry up * fix monitor condition
- Loading branch information
1 parent
4631ea2
commit 2a0c971
Showing
5 changed files
with
139 additions
and
20 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
--- | ||
"@nocturne-xyz/balance-monitor": minor | ||
--- | ||
|
||
add ETH top up functionality to monitor |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1 +1,2 @@ | ||
RPC_URL= | ||
RPC_URL= | ||
TX_SIGNER_KEY= |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1 +1,62 @@ | ||
import { Address } from "@nocturne-xyz/core"; | ||
import { ethers } from "ethers"; | ||
|
||
export const ACTOR_NAME = "balance-monitor"; | ||
|
||
export type ActorToCheck = | ||
| "BalanceMonitor" | ||
| "Bundler" | ||
| "SubtreeUpdater" | ||
| "DepositScreener"; | ||
|
||
export interface ActorAddresses { | ||
bundler: Address; | ||
updater: Address; | ||
screener: Address; | ||
} | ||
|
||
export interface BalanceThresholdInfo { | ||
address: Address; | ||
minBalance: bigint; | ||
targetBalance: bigint; | ||
} | ||
|
||
export const BALANCE_THRESHOLDS = ( | ||
balanceMonitorAddress: Address, | ||
actorAddresses: ActorAddresses | ||
): Map<ActorToCheck, BalanceThresholdInfo> => { | ||
return new Map<ActorToCheck, BalanceThresholdInfo>([ | ||
[ | ||
"BalanceMonitor", | ||
{ | ||
address: balanceMonitorAddress, | ||
minBalance: ethers.utils.parseEther("1.0").toBigInt(), | ||
targetBalance: ethers.utils.parseEther("2.0").toBigInt(), | ||
}, | ||
], | ||
[ | ||
"Bundler", | ||
{ | ||
address: actorAddresses.bundler, | ||
minBalance: ethers.utils.parseEther("0.4").toBigInt(), | ||
targetBalance: ethers.utils.parseEther("0.8").toBigInt(), | ||
}, | ||
], | ||
[ | ||
"SubtreeUpdater", | ||
{ | ||
address: actorAddresses.updater, | ||
minBalance: ethers.utils.parseEther("0.2").toBigInt(), | ||
targetBalance: ethers.utils.parseEther("0.8").toBigInt(), | ||
}, | ||
], | ||
[ | ||
"DepositScreener", | ||
{ | ||
address: actorAddresses.screener, | ||
minBalance: ethers.utils.parseEther("0.4").toBigInt(), | ||
targetBalance: ethers.utils.parseEther("0.5").toBigInt(), | ||
}, | ||
], | ||
]); | ||
}; |