Skip to content

Commit

Permalink
min-spend for distribute
Browse files Browse the repository at this point in the history
  • Loading branch information
killroy192 committed Jul 27, 2024
1 parent 187695b commit c7483eb
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 4 deletions.
4 changes: 2 additions & 2 deletions .apprc
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"cli": {
"cluster_id": "symbioticYT2",
"cluster_id": "fuelDust2",
"funding": {
"chain": "eth",
"filters": [
Expand All @@ -16,7 +16,7 @@
},
"distribute": {
"chain": "mainnet",
"token": "0xa2b4c479c98163bbdbd3987a9f3474bb7bc72f84",
"token": "0x8c9532a60E0E7C6BbD2B2c1303F63aCE1c3E9811",
"miller": "0x0000000000000000000000000000000000000000"
},
"fuel": {
Expand Down
8 changes: 6 additions & 2 deletions src/core/distribution/distributeNative.ts
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
import { parseEther } from "viem";
import { privateKeyToAccount } from "viem/accounts";
import { Chain } from "viem/chains";
import { getClient } from "src/libs/clients";
Expand All @@ -6,6 +7,8 @@ import { getEVMWallets } from "src/libs/configs";
import { sleep, getRandomArbitrary } from "src/libs/shared";
import { logger } from "src/logger";

const MIN_SPEND = parseEther("0.0015");

export const distributeNative = async (chain: Chain) => {
const wallets = await getEVMWallets();

Expand All @@ -21,10 +24,11 @@ export const distributeNative = async (chain: Chain) => {

const config = wallets.slice(1).map(({ address }, index) => {
const amount = (valueLeft / 100n) * BigInt(index + 1);
valueLeft -= amount;
const amountToSpend = amount > MIN_SPEND ? amount : MIN_SPEND;
valueLeft -= amountToSpend;
return {
to: address,
amount,
amount: amountToSpend,
};
});

Expand Down

0 comments on commit c7483eb

Please sign in to comment.