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

whitelist pt 2 #10

Merged
merged 3 commits into from
Dec 31, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
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
3 changes: 2 additions & 1 deletion addresses.txt
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
0x3097403b64fe672467345bf159f4c9c5464bd89e,
0x1c0f0af3262a7213e59be7f1440282279d788335,
0xe8170282c5bc6e7c5b2d984cd5d897a05e0afafb,
0xe8170282c5bc6e7c5b2d984cd5d897a05e0afafb,
0xb97eea0763611d1abaae833b3e99a5e269ec314e
8 changes: 4 additions & 4 deletions darkforest.toml
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
[initializers]
ADMIN_CAN_ADD_PLANETS = true
WORLD_RADIUS_LOCKED = false
TOKEN_MINT_END_TIMESTAMP = 2022-01-04T15:35:00.000Z # Jan 4, 2022, 11:59:00 PM (EST)
TOKEN_MINT_END_TIMESTAMP = 2022-01-05T07:59:59.000Z # Jan 4, 2022, 11:59:59 PM (PST)
TARGET4_RADIUS = 1600
INITIAL_WORLD_RADIUS = 8000

Expand All @@ -23,9 +23,9 @@ PERLIN_LENGTH_SCALE = 16384 # must be a power of two no greater than 16384
# Game configuration #
######################
SHRINK = 2 # No shrink if 0
# SHRINK_START: withDefault(dateInSeconds, Math.floor(Date.now() / 1000)), // Current time in seconds
# ROUND_END: withDefault(dateInSeconds, Math.floor(Date.now() / 1000) + 600), // 10 minute round is default
MIN_RADIUS = 1
# SHRINK_START = # 2022-01-01T20:00:00.000Z Jan 1, 2022, 12:00:00 PM
# ROUND_END = 2022-01-05T07:59:59.000Z # Jan 4, 2022, 11:59:59 PM (PST)
MIN_RADIUS = 400 # SHOULD be 5% of INITIAL_WORLD_RADIUS.
DESTROY_THRESHOLD = 2
MAX_NATURAL_PLANET_LEVEL = 256
TIME_FACTOR_HUNDREDTHS = 6000 # speedup/slowdown game
Expand Down
14 changes: 9 additions & 5 deletions tasks/whitelist.ts
Original file line number Diff line number Diff line change
Expand Up @@ -147,8 +147,9 @@ async function noKeyWhitelistRegister(args: { path: string }, hre: HardhatRuntim
const prevPlayers = await whitelist.numPlayers();
console.log('num whitelisted players before adding:', prevPlayers.toNumber());

const allowedAccounts = await whitelist.bulkGetWhitelistIds(hre.ethers.constants.Zero, prevPlayers);
/// console.log('allowed accounts', allowedAccounts);
const allowedAccounts = await whitelist.bulkGetWhitelistIds(hre.ethers.constants.Zero, prevPlayers) as string[];
const lowerCaseAccounts = allowedAccounts.map(acc => acc.toLowerCase());
console.log('allowed accounts', allowedAccounts);

let addresses = "";
console.log("path", args.path);
Expand All @@ -164,13 +165,15 @@ async function noKeyWhitelistRegister(args: { path: string }, hre: HardhatRuntim

// also filter for whitelisted addresses that are already in game.
let validAddresses = finalAddresses
.map(acc => acc.toLowerCase())
.filter(hre.ethers.utils.isAddress)
.filter(acc => !allowedAccounts.includes(acc)); // Filter out accounts that are already whitelisted.
.filter(acc => !lowerCaseAccounts.includes(acc)); // Filter out accounts that are already whitelisted.

const slice = 100;

validAddresses = validAddresses.slice(0,500);
validAddresses = validAddresses.slice(0,slice);

console.log('validAddresses', validAddresses)
console.log("total players to add", validAddresses.length);
console.log(`require ${parseFloat(drip) * validAddresses.length} < ${prevBalanceEth} in contract`);

Expand Down Expand Up @@ -201,10 +204,11 @@ async function noKeyWhitelistRegister(args: { path: string }, hre: HardhatRuntim
console.log(parseFloat(drip));
console.log("expected amount in whitelist", parseFloat(drip) * addressChunk.length);

if( parseFloat(drip) * addressChunk.length > parseFloat(hre.ethers.utils.formatEther(prevBalance))) {
if(parseFloat(drip) * addressChunk.length > parseFloat(hre.ethers.utils.formatEther(prevBalance))) {
console.log("not enough eth in contract. Add more before whitelisting");
break;
}

console.log('whitelist balance before adding:', parseFloat(hre.ethers.utils.formatEther(prevBalance)));

const prevPlayers = await whitelist.numPlayers();
Expand Down