Skip to content

Commit

Permalink
Add engen badge mint script (#322)
Browse files Browse the repository at this point in the history
  • Loading branch information
ylv-io authored Dec 5, 2024
1 parent 9220f2d commit 885dae0
Show file tree
Hide file tree
Showing 6 changed files with 3,362 additions and 2 deletions.
1,457 changes: 1,457 additions & 0 deletions broadcast/mint-engen-badges.s.sol/7887/run-1733343329.json

Large diffs are not rendered by default.

1,457 changes: 1,457 additions & 0 deletions broadcast/mint-engen-badges.s.sol/7887/run-latest.json

Large diffs are not rendered by default.

88 changes: 88 additions & 0 deletions script/actions/mint-engen-badges.s.sol
Original file line number Diff line number Diff line change
@@ -0,0 +1,88 @@
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.18;

import "@kinto-core/tokens/EngenBadges.sol";

import {MigrationHelper} from "@kinto-core-script/utils/MigrationHelper.sol";
import {IKintoWallet} from "@kinto-core/interfaces/IKintoWallet.sol";
import {Strings} from "@openzeppelin/contracts/utils/Strings.sol";
import "@kinto-core-test/helpers/ArrayHelpers.sol";

import {stdJson} from "forge-std/StdJson.sol";
import "forge-std/Script.sol";
import "forge-std/console.sol";

contract MintEngenBadgesScript is MigrationHelper {
using stdJson for string;
using Strings for *;
using ArrayHelpers for *;

address[] users;
uint256[][] mintIds;

function run() public override {
super.run();

string memory userFile = vm.envString("USERS_FILE");

uint256 id = vm.envUint("BADGE_ID");
console2.log("BADGE_ID:", id);

EngenBadges badges = EngenBadges(_getChainDeployment("EngenBadges"));

while (true) {
string memory addrStr = vm.readLine(userFile);
// if empty string then end of the file
if (addrStr.equal("")) {
break;
}
address addr = vm.parseAddress(addrStr);
// if user have a badge, then do not mint
if (badges.balanceOf(addr, id) > 0) {
console2.log("addr has a badge already:", addr);
continue;
}
console2.log("addr:", addr);
users.push(addr);
uint256[] memory ids = new uint256[](1);
ids[0] = id;
mintIds.push(ids);
}

uint256[] memory privKeys = new uint256[](2);
privKeys[0] = deployerPrivateKey;
privKeys[1] = hardwareWalletType;

uint256 batchSize = 100;
uint256 totalBatches = (users.length + batchSize - 1) / batchSize;

for (uint256 batchIndex = 0; batchIndex < totalBatches; batchIndex++) {
uint256 start = batchIndex * batchSize;
uint256 end = start + batchSize;
if (end > users.length) {
end = users.length;
}

address[] memory batchUsers = new address[](end - start);
uint256[][] memory batchMintIds = new uint256[][](end - start);

for (uint256 i = start; i < end; i++) {
batchUsers[i - start] = users[i];
batchMintIds[i - start] = mintIds[i];
}

_handleOps(
abi.encodeWithSelector(EngenBadges.mintBadgesBatch.selector, batchUsers, batchMintIds),
kintoAdminWallet,
_getChainDeployment("EngenBadges"),
0,
address(0),
privKeys
);
}

for (uint256 index = 0; index < users.length; index++) {
assertEq(badges.balanceOf(users[index], id), 1, "Has more than one badge");
}
}
}
117 changes: 117 additions & 0 deletions script/data/black-friday-daimyo.csv
Original file line number Diff line number Diff line change
@@ -0,0 +1,117 @@
0x7D467D99028199D99B1c91850C4dea0c82aDDF52
0x422C02333c72CeD18d2E6b45C4a595C3135cd373
0x5A7150F73b2203dd01cDeA5DC5B20E99DbE3639B
0x033A6DF807c204697daE4EAa9CDC0880Fc4dDF02
0x85bD43dBb99A2290E4cD930fc6B952D903f83fFb
0xED31BeCD06fBFC54E9d4294059e473254265eAb2
0xc7dA9B99627163d0aFc06e5AdA323DDfaDA8FaDE
0x934cC16F2c7dfc0816e087d1C1A0647C9AB0694c
0x84Ef8eA33A39Da66839d7532bF11794355277634
0x337B9727E78C18b8D5111f787A9ae5Fdc7E54897
0x998c1e902ac23696F6fBA069a688487A89Ec3843
0x2690e0b5830Cd4c39083fa0c43EdA583d9f4B2D1
0x4f2204D3c9965F031f9147B0558D01D6b56ce442
0x4e3B22B00EedeDb66C1F62eedfceAE453Cea70f3
0x74046392a33a6aCeD83C1b37E69FDb155e567ff9
0x75E934ebfe57B08C9B0686f5AaAd72699c28c1C2
0x9dB44fb2f2d4B645443fada48Cea0899CA1B6640
0x517CDae9eB5e551FFF7a41cD94Df4a3BA64a6c0F
0x902402569DFdBd2E7Ca3D48a6447d7ED200E6d39
0x2a9d61E86f11FA11CAfcB084a4102E21bD87ccA6
0x6234805771Cf57590158B65e7731C6DC7e88d2Ff
0xAA38e3658D2544c523602aaF76e5C708fC35c183
0xa47d862092ea26e1Cf7a054a23f06EEa45Da2ACA
0xA38fA3dD33Ab59Ec465AF92dfCb0D164eA3Be735
0x90A549fa595fDF7d1EcC7ee3897f65DE91ceDC34
0xadB7D5838d4D3bD5F42a6A5d2d60b5Be01fFb3B1
0x24A0c470882E6Ef688B68aE2BA9859b9A4A114A8
0x810Ba41B703FbD1c846c6f6535A98B37f550fE6A
0x65D71fF160aa78efd391214387F03029eFF9F5A2
0xd358892B32E512F81a9a6D2F257A92e5dfbBd7b4
0xB609316dec60d2bB1B8f50DDc54a7D169F442158
0xE07dAE62455571d11E88ba83C2Bc934e8cd9BD51
0x41Fa78391a5A28587Da4458D7F8Db35f1F42B458
0x409471a16787D8e10dDD886D4c6E9785b73C16D4
0xD888E8a5931900791140fd8cC67B8b4Ef40d1992
0xc6f8324efc0565e44135500102Fa8c8E91Dd43CC
0x50A3153A47e645Ac00cbaf35719C42568825F5F7
0xBEC92C7c891D2E510A11fF82905B254499af8cE5
0x3a096D1Ae3A9369fbe6B5C473C7E4c8e2e5daafC
0xb73849f7963F5Fd8146A4ad99286716a6bc0B317
0x6d2e23324e4426846E02e38F1E8783c616640dF1
0xF7E383DbC19a765ed57340d28B018549ebFFb52d
0xea747a489343dfB974334c60ea42920a23245402
0x81Ce357383d70Da5a75c19C5E513BCC0a7591D33
0x7Ad347B971DCc2AC5818E507c72657C58127fd5b
0x5d87c78505bc446c1C88202e742554DcD5b617F5
0x3885253C88390F4b7f132ba829f2483467F3bF5D
0x90038C150d7528F88AD2B13780886f72e6Cb033e
0xF509547d00d2dD3C88b66366070a976D0b06A8Fb
0xf34e8a57f6fBD74235dCF35FE59B476f382B5E13
0xE9258507AD974A4E67a8312eEe8f47430d653080
0xaCCE22bfb928C44d73EB04aD53c15f2Ad2f0ff65
0x3C6386e7ED61c5e0AFCA304CC8a6eD0F349F7EEF
0x6C03a3A6a49C6e7262759aC20774Fa1446883A32
0x92757E7bc04CC00baF904657AD4a7e2f507569cB
0x36CdbbaFEAF6bfC03C32C31E9bA2E26f6D9218DF
0x497c2154Af7eeFa48943840DdFB7E3CFBb16549A
0xEe235965C8d7389ba2b210Fb0CabB45ef53E61bA
0x3f194Bc28d46E4Decfd740B7e8A124ccbb870b23
0xfb9d8C0bda29669fF9E6cBD66a793f2D2f7298D6
0x512bF8C80c7bEF18d53a33b496bbC5e700cAC1C7
0xEE69879105F5EcA104d5aAf94a032b3D4aFE2141
0xd90B733df9636f49A46AE7AFBBe26e04c42F1480
0x666BacF8630eBEB58900c73dAFeEEa9a96aa464f
0x56f809D1DbE35f2065b30D9d6175a916F6Ee8fe5
0x562aDCDCf5fEfA4ABaBA8d634125B20Ef643beC1
0x66007079aCbebB3Fb5261B4ED0818f4c0542Aa5A
0x467a3E952a3d3C2F73169Cc0446F2ed833cc5C33
0x1D4D6BE0cA6293F7d3728Ff9451F8eb9994C99C8
0xc873FEf77104A7b8f027770273c83D99f78A77c6
0xc37c0fE29f81E5362B14AC39747Fd46bef5cd5dD
0xb4d907E9039adEd6247a622Efb58378bd4eab307
0x775a48FC92163e9484f66bb5C4484a5929b54853
0x4d170c0fee00Cc5517293949aD573E34ef3D86cb
0x2f451B592F232b5e875012c36bbA4bad166473be
0xFb238b1e239741f53a76Fa619D1bCc44Bd62C0c7
0xb7D7F7Ed787a950080721E872Ddf2F9F38c13343
0x13D76e0289C402C182300b9405b374E21DbCD746
0x80dC764603B20c2C422286f37EA1588614b6Cb16
0xe3b574D6F2B0e40dFe06AFb0E082c9d56BA98Ed8
0x90F9f7503e7e22b6093fD96f7cB126480415BB56
0x0D8f627EF3235D6c14ECA98ba0C57e9100fBEef4
0x76C01C343Cb273506eacc13eaC384e4fBd7D126D
0xB449FDA152918dB7eb434f6717552867Be50d1e6
0xE1edb44D2cFe760EFe76DD251036e1c83eDEE4CB
0xb4aA027BA81DC57a0C667CeDc32415aB3101d198
0xEB7Cf358D7aCe856980F365e7B007aA681526fb8
0x0ECde1b4A53e2a0419968b3e1363Fe09b907322b
0x8c8354A13eC87DFe76d2D291E3FaC46323f1F2F3
0xe9b7d7Eb95629ba852c99E2203D36cdB08a0CAE5
0xB920272AD451419Eb2563885923fD48D33202641
0xc6104643b44D51c04Ed3ca2785A00DF67CEAc2C8
0x39f8F1d7b4aC6087eE65445355cfbc95Da62cb54
0xe70D804197627c7C6c495be5F0bC0fACfa98606E
0x9e33Db26B5F7f80271567dea4F40142664c2E7a6
0x0D7fc40fAAA5Ba87E00d67f164106D58DB2C4A7A
0xc9a65Bc041873826ed5ae864b27651eB683b4a56
0xC5F17131ca2aF653a659B1bbb6E65f8dC33b090A
0x63FA661C8B1F85DD7B9F66fbdAd4c4fA7FE97e00
0xbB575e4dD3Bb0ADf4b7511cad515Df6D9458E2F3
0xa0Bf2095fDb0e5B608068B5899eABdB6aC23bD74
0x9C186fF0556c7900B6Ae2dbE4A6867747E44EcCB
0x21d3e325a7B9D21F0753E558A05b51b011807218
0x58f04d848A10a68Fee67dC8D78b15EC19C14615A
0x1af08CFEA525667c975223A8c298e60a43e96A67
0x6Abe885abd99F061132701B55Bbaf86D8A0A443C
0x747C8e55dcDE4998A31d0535CB52A10e89083978
0x888DF46480bb61658159Fd36D320C44c06020Da6
0xD313f97d990738DE5968DD4D975B7B5bb280Bde1
0x02cd6dc554c5808780EB145404012Fb4606d040f
0x71543d5EC2fa5bc5229623D8Ee5390A58Cc40b26
0xCeF2209ba41962723EeE972Fbc015FaE348554F9
0x404C18dFA01D0b828b97b8Bd3C386763777381A1
0x54875bd23B33f46b7502420730b102539bb905F2
0x8104B1CBEbD1fe45D7EC28B1Aec4E4Ddf092609f
0xa9160CB8afa248e1E19bF59B21D654A84eC025F3
0xb14fBf93044fa716C9CF4bC8F112D1441aF2edad
Loading

0 comments on commit 885dae0

Please sign in to comment.