From ab12c49532e5f536d87aa7037c023d2131481cb4 Mon Sep 17 00:00:00 2001 From: Josh Levine Date: Wed, 16 Oct 2024 14:19:11 -0700 Subject: [PATCH 01/16] feat: add set redemption script fnc --- contracts/script/PointTokenVault.s.sol | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) diff --git a/contracts/script/PointTokenVault.s.sol b/contracts/script/PointTokenVault.s.sol index c6f6f8a..57b7a9d 100644 --- a/contracts/script/PointTokenVault.s.sol +++ b/contracts/script/PointTokenVault.s.sol @@ -118,6 +118,22 @@ contract PointTokenVaultScripts is BatchScript { vm.stopBroadcast(); } + function setRedemptionENA18Oct24() public { + address POINT_TOKEN_VAULT_PROXY_V_0_1_0 = 0x1EeEBa76f211C4Dce994b9c5A74BDF25DB649Fa1; + PointTokenVault pointTokenVault = PointTokenVault(payable(POINT_TOKEN_VAULT_PROXY_V_0_1_0)); + + bytes32 POINTS_ID_ETHENA_SATS_S2 = LibString.packTwo("Rumpel kPt: Ethena S2", "kpSATS-2"); + ERC20 ENA = ERC20(0x57e114B691Db790C35207b2e685D4A43181e6061); + uint256 EXCHANGE_RATE = 2e18; + bool REDEMPTION_RIGHTS = true; + + pointTokenVault.setRedemption(POINTS_ID_ETHENA_SATS_S2, ENA, EXCHANGE_RATE, REDEMPTION_RIGHTS); + + // bytes32 MERKLE_ROOT_WIT_REDEMPTION_RIGHTS = 0x882aaf07b6b16e5f021a498e1a8c5de540e6ffe9345fdc48b51dd79dc894a059; + + // pointTokenVault.updateRoot(MERKLE_ROOT_WIT_REDEMPTION_RIGHTS); + } + // Useful for emergencies, where we need to override both the current and previous root at once // For example, if minting for a specific pToken needs to be stopped, a root without any claim rights for the pToken would need to be pushed twice function doublePushRoot(address pointTokenVaultAddress, bytes32 newRoot, address merkleUpdaterSafe) public { From 8f987845ae0b9687a9e2d0cdb670a686d1f87b0a Mon Sep 17 00:00:00 2001 From: Josh Levine Date: Wed, 16 Oct 2024 14:54:06 -0700 Subject: [PATCH 02/16] feat: add redemption rights script, update reward per p token --- bun.lockb | Bin 0 -> 32049 bytes contracts/script/PointTokenVault.s.sol | 4 +- js-scripts/generateRedemptionRights.ts | 171 +++++++++++++++++++++++++ package.json | 19 +++ 4 files changed, 192 insertions(+), 2 deletions(-) create mode 100755 bun.lockb create mode 100644 js-scripts/generateRedemptionRights.ts create mode 100644 package.json diff --git a/bun.lockb b/bun.lockb new file mode 100755 index 0000000000000000000000000000000000000000..cbaa428741dec383e4d36cf71d11f27c8a03eae8 GIT binary patch literal 32049 zcmeHw2{=^W8$TK?q$p`sNK(w$MM;)WN_*O*EQ7HOX2#m4qEHG^(yD0Frah&7Lt4

V2(dCz;6d+xc{JAGAkg18(VR~B1` z$qrU=4PwiH(0%>gd^}jbOuC0Z$IpdF57w2Dl8}(dksckjTKRt9vR=#Eo_V^UdtJ9f zXI%SLuNhlbKYDz^xS45lArpkLf=Hrmqc}o%zG{r{fFG$yNJIp)n0|PY3!(()Cn1)D zc%LxdB8*o<+#aqggF3Ph#|qC~Tv@!Z0Hy?s>mR~}Yy3YDj~1pMY$YKf1Nkjz0)E1) z1?OGhdSiaV+Y{2|A$?$L35kvnt3ZrA9pO6aQ4QyqZr4VT?#gC(WBD{lNB!i$1Q>r2 zmQT`ycpfH@O@hZ^GFcvB61yP19pqaNaR-RwAx3^C&x^?cLQ)?d*O%oAI2R_Djs+=$ zGRWT={$PGmFH#?3Pj`PFw6BDO0bsjBzGBGS4PtLDo$KXdAh83^72$k07#;0#Qkd=l z%3!|LaNY@GIv4@lM-gJ=k%YK2#JXSv#8p6kOfP_Q%-;#(-Vg^WNJywa+zT$^bxHWs z6XI-$dqC{v!u3MSO#w3GW3i#$EFPEX>&pt@vE1}PIV?{TVziSh$DiZEc9$UbdFq|KK_dvaz~&a>H+F~9uYi1C+$mF^54s6GFxc}h^8(+`b4q2xs#c-zj z_pUruc+mFxZDqtDXlPf^T-2k8k6%z#bj?cwMo3WI3Z=-#m+-@ zM)l0Jy7t;>b@`%$~?Me9#|9egg?H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)CKA7Z1_;)kOk|=0#3zC-0~GLA1a73Ai@Q6A$!*+Oa6~rB2(1#p`!K`A*OCH)awun_VwxetaRZO(fD|6_7mNHGm>-MH!W}3s z{1h$S1^4WD%@F+}H<13~s#xnmvXu)I+STfFp;ns)4O*{>{tJ#f|RH zarOK`E8$|drOk*YF^y|UcrD$ie|!Rg=Pof;Uq9Y7 z$hd=o$)Q+7q+$CNH6~lJe4P#WN(7MC*Ahp1%g>Z++_t+PLXGTk295pwv^) z9`?vvTmlM;7Cj%pUOa!vE7;%`Y-%^tIr(t@mNXPEI)TFRJ3d%43bwod_x}DLFE0!N literal 0 HcmV?d00001 diff --git a/contracts/script/PointTokenVault.s.sol b/contracts/script/PointTokenVault.s.sol index 57b7a9d..1d96b8a 100644 --- a/contracts/script/PointTokenVault.s.sol +++ b/contracts/script/PointTokenVault.s.sol @@ -124,10 +124,10 @@ contract PointTokenVaultScripts is BatchScript { bytes32 POINTS_ID_ETHENA_SATS_S2 = LibString.packTwo("Rumpel kPt: Ethena S2", "kpSATS-2"); ERC20 ENA = ERC20(0x57e114B691Db790C35207b2e685D4A43181e6061); - uint256 EXCHANGE_RATE = 2e18; + uint256 REWARDS_PER_P_TOKEN = 63381137368827226; bool REDEMPTION_RIGHTS = true; - pointTokenVault.setRedemption(POINTS_ID_ETHENA_SATS_S2, ENA, EXCHANGE_RATE, REDEMPTION_RIGHTS); + pointTokenVault.setRedemption(POINTS_ID_ETHENA_SATS_S2, ENA, REWARDS_PER_P_TOKEN, REDEMPTION_RIGHTS); // bytes32 MERKLE_ROOT_WIT_REDEMPTION_RIGHTS = 0x882aaf07b6b16e5f021a498e1a8c5de540e6ffe9345fdc48b51dd79dc894a059; diff --git a/js-scripts/generateRedemptionRights.ts b/js-scripts/generateRedemptionRights.ts new file mode 100644 index 0000000..0c1fb0e --- /dev/null +++ b/js-scripts/generateRedemptionRights.ts @@ -0,0 +1,171 @@ +import * as fs from "fs"; +import * as dotenv from "dotenv"; +import { + keccak256, + encodePacked, + createPublicClient, + http, + parseAbiItem, + Address, + zeroAddress, +} from "viem"; +import { mainnet } from "viem/chains"; +import { MerkleTree } from "merkletreejs"; + +function solidityKeccak256(types: string[], values: any[]) { + return keccak256(encodePacked(types, values)); +} + +dotenv.config({ path: "./scripts/.env" }); + +const MAINNET_RPC_URL = process.env.MAINNET_RPC_URL; +const PTOKEN_ADDRESSES = (process.env.PTOKEN_ADDRESSES as string).split( + "," +) as Address[]; +const POINTS_IDS = (process.env.POINTS_IDS as string).split( + "," +) as `0x${string}`[]; + +const REDEMPTION_RIGHTS_PREFIX = solidityKeccak256( + ["string"], + ["REDEMPTION_RIGHTS"] +); + +if ( + !MAINNET_RPC_URL || + PTOKEN_ADDRESSES.length === 0 || + POINTS_IDS.length === 0 +) { + console.error( + "Please set MAINNET_RPC_URL, PTOKEN_ADDRESSES, and POINTS_IDS in your .env file" + ); + process.exit(1); +} + +if (PTOKEN_ADDRESSES.length !== POINTS_IDS.length) { + console.error( + "The number of PTOKEN_ADDRESSES must match the number of POINTS_IDS" + ); + process.exit(1); +} + +async function generateMerkleTree() { + const publicClient = createPublicClient({ + chain: mainnet, + transport: http(MAINNET_RPC_URL), + }); + + const latestBlock = await publicClient.getBlockNumber(); + console.log(`latest block #: ${latestBlock}`); + + const allHolders = new Map>(); + + for (let i = 0; i < PTOKEN_ADDRESSES.length; i++) { + const pTokenAddress = PTOKEN_ADDRESSES[i]; + const pointsId = POINTS_IDS[i]; + + console.log( + `Processing pToken: ${pTokenAddress} with Points ID: ${pointsId}` + ); + + const logs = await publicClient.getLogs({ + address: pTokenAddress, + event: parseAbiItem( + "event Transfer(address indexed from, address indexed to, uint256)" + ), + fromBlock: 0n, + toBlock: "latest", + }); + + const holders = new Map(); + + for (const log of logs) { + const [from, to, value] = log.args as [Address, Address, bigint]; + if (!from || !to || value === undefined) { + throw new Error("Transfer event args are undefined"); + } + + if (from !== zeroAddress) { + const fromBalance = (holders.get(from) || 0n) - value; + holders.set(from, fromBalance); + } + + if (to !== zeroAddress) { + const toBalance = (holders.get(to) || 0n) + value; + holders.set(to, toBalance); + } + } + + for (const [address, balance] of holders.entries()) { + if (balance > 0n) { + if (!allHolders.has(address)) { + allHolders.set(address, new Map()); + } + allHolders.get(address)!.set(pointsId, balance); + } + } + } + + // TODO: for ptokens being LP'd in Uni, give the redemption rights to the LPs themselves rather than the pool address + + console.log("Generating Merkle tree..."); + + const leaves = Array.from(allHolders.entries()).flatMap( + ([address, balances]) => + Array.from(balances.entries()).map(([pointsId, balance]) => + solidityKeccak256( + ["bytes32", "address", "bytes32", "uint256"], + [REDEMPTION_RIGHTS_PREFIX, address, pointsId, balance.toString()] + ) + ) + ); + + const sortedLeaves = leaves.sort((a, b) => a.localeCompare(b)); + const tree = new MerkleTree(sortedLeaves, keccak256, { sortPairs: true }); + const root = tree.getHexRoot(); + + const merklizedPointsData = { + wallets: Object.fromEntries( + Array.from(allHolders.entries()).map(([userAddress, balances]) => [ + userAddress, + Object.fromEntries( + Array.from(balances.entries()).map(([pointsId, balance]) => { + const leaf = solidityKeccak256( + ["bytes32", "address", "bytes32", "uint256"], + [ + REDEMPTION_RIGHTS_PREFIX, + userAddress, + pointsId, + balance.toString(), + ] + ); + return [ + pointsId, + { + amount: balance.toString(), + proof: tree.getHexProof(leaf), + }, + ]; + }) + ), + ]) + ), + root, + }; + + console.log("Merkle tree generated successfully."); + console.log("Root:", root); + console.log( + "Total number of holders:", + Object.keys(merklizedPointsData.wallets).length + ); + + // Save the merklizedPointsData to a JSON file + fs.writeFileSync( + "merklizedPointsData.json", + JSON.stringify(merklizedPointsData, null, 2) + ); + console.log("Merkle data saved to merklizedPointsData.json"); +} + +generateMerkleTree().catch(console.error); diff --git a/package.json b/package.json new file mode 100644 index 0000000..82ff711 --- /dev/null +++ b/package.json @@ -0,0 +1,19 @@ +{ + "name": "point-tokenization-vault-scripts", + "module": "index.ts", + "type": "module", + "scripts": { + "generate-merkle-tree": "bun run js-scripts/generateRedemptionRights.ts" + }, + "devDependencies": { + "bun-types": "latest" + }, + "peerDependencies": { + "typescript": "^5.0.0" + }, + "dependencies": { + "dotenv": "^16.3.1", + "merkletreejs": "^0.4.0", + "viem": "^2.21.25" + } +} From 01468477939850f187ed011ae3eba1118e9b1101 Mon Sep 17 00:00:00 2001 From: Josh Levine Date: Mon, 28 Oct 2024 19:58:14 -0700 Subject: [PATCH 03/16] chore: merge redemption rights into existing distribution, finish forge script sanity check --- contracts/script/PointTokenVault.s.sol | 46 ++-- js-scripts/generateRedemptionRights.ts | 171 ------------ js-scripts/generateRedemptionRights/index.ts | 246 ++++++++++++++++++ .../last-alpha-distribution.json | 201 ++++++++++++++ package.json | 2 +- 5 files changed, 479 insertions(+), 187 deletions(-) delete mode 100644 js-scripts/generateRedemptionRights.ts create mode 100644 js-scripts/generateRedemptionRights/index.ts create mode 100644 js-scripts/generateRedemptionRights/last-alpha-distribution.json diff --git a/contracts/script/PointTokenVault.s.sol b/contracts/script/PointTokenVault.s.sol index 1d96b8a..190adf5 100644 --- a/contracts/script/PointTokenVault.s.sol +++ b/contracts/script/PointTokenVault.s.sol @@ -4,12 +4,11 @@ pragma solidity =0.8.24; import {BatchScript} from "forge-safe/src/BatchScript.sol"; import {PointTokenVault} from "../PointTokenVault.sol"; -import {ERC1967Proxy} from "@openzeppelin/contracts/proxy/ERC1967/ERC1967Proxy.sol"; import {MockERC20} from "solmate/test/utils/mocks/MockERC20.sol"; import {ERC20} from "solmate/tokens/ERC20.sol"; -import {CREATE3} from "solmate/utils/CREATE3.sol"; import {LibString} from "solady/utils/LibString.sol"; +import {MerkleProof} from "@openzeppelin/contracts/utils/cryptography/MerkleProof.sol"; import {Upgrades} from "openzeppelin-foundry-upgrades/Upgrades.sol"; import {console} from "forge-std/console.sol"; @@ -97,11 +96,12 @@ contract PointTokenVaultScripts is BatchScript { } function deployPToken() public { - vm.startBroadcast(JIM_PRIVATE_KEY); + uint256 deployerPrivateKey = vm.envUint("PRIVATE_KEY"); + vm.startBroadcast(deployerPrivateKey); - PointTokenVault pointTokenVault = PointTokenVault(payable(0xbff7Fb79efC49504afc97e74F83EE618768e63E9)); + PointTokenVault pointTokenVault = PointTokenVault(payable(0xe47F9Dbbfe98d6930562017ee212C1A1Ae45ba61)); - pointTokenVault.deployPToken(LibString.packTwo("ETHERFI Points", "pEF")); + pointTokenVault.deployPToken(LibString.packTwo("Rumpel kPt: ETHERFI S4", "kpEF-4")); vm.stopBroadcast(); } @@ -118,20 +118,36 @@ contract PointTokenVaultScripts is BatchScript { vm.stopBroadcast(); } - function setRedemptionENA18Oct24() public { - address POINT_TOKEN_VAULT_PROXY_V_0_1_0 = 0x1EeEBa76f211C4Dce994b9c5A74BDF25DB649Fa1; - PointTokenVault pointTokenVault = PointTokenVault(payable(POINT_TOKEN_VAULT_PROXY_V_0_1_0)); + function setRedemptionENA30Oct24() public { + // Core contract and token setup + PointTokenVault vaultV0_1_0 = PointTokenVault(payable(0x1EeEBa76f211C4Dce994b9c5A74BDF25DB649Fa1)); + bytes32 pointsId = LibString.packTwo("Rumpel kPoint: Ethena S2", "kpSATS"); + ERC20 senaToken = ERC20(0x8bE3460A480c80728a8C4D7a5D5303c85ba7B3b9); + uint256 rewardsPerPToken = 63381137368827226; - bytes32 POINTS_ID_ETHENA_SATS_S2 = LibString.packTwo("Rumpel kPt: Ethena S2", "kpSATS-2"); - ERC20 ENA = ERC20(0x57e114B691Db790C35207b2e685D4A43181e6061); - uint256 REWARDS_PER_P_TOKEN = 63381137368827226; - bool REDEMPTION_RIGHTS = true; + // Set redemption parameters + vm.startBroadcast(MAINNET_OPERATOR); + vaultV0_1_0.setRedemption(pointsId, senaToken, rewardsPerPToken, true); + vm.stopBroadcast(); + + // Update merkle root + vm.startBroadcast(MAINNET_MERKLE_UPDATER); + vaultV0_1_0.updateRoot(0x602cdd6dd4f1c6f7bb049ce8b23a49e5177dc84830c7f00cc09eb0f11f03d9be); + vm.stopBroadcast(); - pointTokenVault.setRedemption(POINTS_ID_ETHENA_SATS_S2, ENA, REWARDS_PER_P_TOKEN, REDEMPTION_RIGHTS); + // Test redemption + bytes32[] memory proof = new bytes32[](5); + proof[0] = 0xc1a70bb7d5c4ddf647114cb36083bca867a80e37e187aa1d6705f3b12357d7cf; + proof[1] = 0x04a635b0e5b8e5ac70059fb9dc2682f5102a3b4a2f8b2c0d6f1ea43b1e04272f; + proof[2] = 0xab802966e4277e85c878dad4c849c7632735a56c3710c197470de81707286069; + proof[3] = 0x7c0bd8bd630d01f1a459f6cd963cfc5f58487dec582339b1d8f29edbbd41d8ab; + proof[4] = 0x0fe239692610c805880a540ea359a0f3f8314f94bb95cd4ec53d712ae6cdc63d; - // bytes32 MERKLE_ROOT_WIT_REDEMPTION_RIGHTS = 0x882aaf07b6b16e5f021a498e1a8c5de540e6ffe9345fdc48b51dd79dc894a059; + address testUser = 0x25E426b153e74Ab36b2685c3A464272De60888Ae; + uint256 claimAmount = 52792622186481736164; - // pointTokenVault.updateRoot(MERKLE_ROOT_WIT_REDEMPTION_RIGHTS); + vm.prank(testUser); + vaultV0_1_0.redeemRewards(PointTokenVault.Claim(pointsId, claimAmount, claimAmount, proof), testUser); } // Useful for emergencies, where we need to override both the current and previous root at once diff --git a/js-scripts/generateRedemptionRights.ts b/js-scripts/generateRedemptionRights.ts deleted file mode 100644 index 0c1fb0e..0000000 --- a/js-scripts/generateRedemptionRights.ts +++ /dev/null @@ -1,171 +0,0 @@ -import * as fs from "fs"; -import * as dotenv from "dotenv"; -import { - keccak256, - encodePacked, - createPublicClient, - http, - parseAbiItem, - Address, - zeroAddress, -} from "viem"; -import { mainnet } from "viem/chains"; -import { MerkleTree } from "merkletreejs"; - -function solidityKeccak256(types: string[], values: any[]) { - return keccak256(encodePacked(types, values)); -} - -dotenv.config({ path: "./scripts/.env" }); - -const MAINNET_RPC_URL = process.env.MAINNET_RPC_URL; -const PTOKEN_ADDRESSES = (process.env.PTOKEN_ADDRESSES as string).split( - "," -) as Address[]; -const POINTS_IDS = (process.env.POINTS_IDS as string).split( - "," -) as `0x${string}`[]; - -const REDEMPTION_RIGHTS_PREFIX = solidityKeccak256( - ["string"], - ["REDEMPTION_RIGHTS"] -); - -if ( - !MAINNET_RPC_URL || - PTOKEN_ADDRESSES.length === 0 || - POINTS_IDS.length === 0 -) { - console.error( - "Please set MAINNET_RPC_URL, PTOKEN_ADDRESSES, and POINTS_IDS in your .env file" - ); - process.exit(1); -} - -if (PTOKEN_ADDRESSES.length !== POINTS_IDS.length) { - console.error( - "The number of PTOKEN_ADDRESSES must match the number of POINTS_IDS" - ); - process.exit(1); -} - -async function generateMerkleTree() { - const publicClient = createPublicClient({ - chain: mainnet, - transport: http(MAINNET_RPC_URL), - }); - - const latestBlock = await publicClient.getBlockNumber(); - console.log(`latest block #: ${latestBlock}`); - - const allHolders = new Map>(); - - for (let i = 0; i < PTOKEN_ADDRESSES.length; i++) { - const pTokenAddress = PTOKEN_ADDRESSES[i]; - const pointsId = POINTS_IDS[i]; - - console.log( - `Processing pToken: ${pTokenAddress} with Points ID: ${pointsId}` - ); - - const logs = await publicClient.getLogs({ - address: pTokenAddress, - event: parseAbiItem( - "event Transfer(address indexed from, address indexed to, uint256)" - ), - fromBlock: 0n, - toBlock: "latest", - }); - - const holders = new Map(); - - for (const log of logs) { - const [from, to, value] = log.args as [Address, Address, bigint]; - if (!from || !to || value === undefined) { - throw new Error("Transfer event args are undefined"); - } - - if (from !== zeroAddress) { - const fromBalance = (holders.get(from) || 0n) - value; - holders.set(from, fromBalance); - } - - if (to !== zeroAddress) { - const toBalance = (holders.get(to) || 0n) + value; - holders.set(to, toBalance); - } - } - - for (const [address, balance] of holders.entries()) { - if (balance > 0n) { - if (!allHolders.has(address)) { - allHolders.set(address, new Map()); - } - allHolders.get(address)!.set(pointsId, balance); - } - } - } - - // TODO: for ptokens being LP'd in Uni, give the redemption rights to the LPs themselves rather than the pool address - - console.log("Generating Merkle tree..."); - - const leaves = Array.from(allHolders.entries()).flatMap( - ([address, balances]) => - Array.from(balances.entries()).map(([pointsId, balance]) => - solidityKeccak256( - ["bytes32", "address", "bytes32", "uint256"], - [REDEMPTION_RIGHTS_PREFIX, address, pointsId, balance.toString()] - ) - ) - ); - - const sortedLeaves = leaves.sort((a, b) => a.localeCompare(b)); - const tree = new MerkleTree(sortedLeaves, keccak256, { sortPairs: true }); - const root = tree.getHexRoot(); - - const merklizedPointsData = { - wallets: Object.fromEntries( - Array.from(allHolders.entries()).map(([userAddress, balances]) => [ - userAddress, - Object.fromEntries( - Array.from(balances.entries()).map(([pointsId, balance]) => { - const leaf = solidityKeccak256( - ["bytes32", "address", "bytes32", "uint256"], - [ - REDEMPTION_RIGHTS_PREFIX, - userAddress, - pointsId, - balance.toString(), - ] - ); - return [ - pointsId, - { - amount: balance.toString(), - proof: tree.getHexProof(leaf), - }, - ]; - }) - ), - ]) - ), - root, - }; - - console.log("Merkle tree generated successfully."); - console.log("Root:", root); - console.log( - "Total number of holders:", - Object.keys(merklizedPointsData.wallets).length - ); - - // Save the merklizedPointsData to a JSON file - fs.writeFileSync( - "merklizedPointsData.json", - JSON.stringify(merklizedPointsData, null, 2) - ); - console.log("Merkle data saved to merklizedPointsData.json"); -} - -generateMerkleTree().catch(console.error); diff --git a/js-scripts/generateRedemptionRights/index.ts b/js-scripts/generateRedemptionRights/index.ts new file mode 100644 index 0000000..55449a1 --- /dev/null +++ b/js-scripts/generateRedemptionRights/index.ts @@ -0,0 +1,246 @@ +import * as fs from "fs"; +import * as dotenv from "dotenv"; +import { + keccak256, + encodePacked, + createPublicClient, + http, + parseAbiItem, + Address, + zeroAddress, + PublicClient, +} from "viem"; +import { mainnet } from "viem/chains"; +import { MerkleTree } from "merkletreejs"; + +// Core types +type PointsBalance = Map<`0x${string}`, bigint>; +type RedemptionRightsMap = Map; + +interface AlphaDistributionData { + pTokens: { + [address: Address]: { + [pointsId: `0x${string}`]: { + accumulatingPoints: string; + }; + }; + }; +} + +interface MerklizedData { + root: `0x${string}`; + redemptionRights: { + [address: Address]: { + [pointsId: `0x${string}`]: { + amount: string; + proof: `0x${string}`[]; + }; + }; + }; + pTokens: { + [address: Address]: { + [pointsId: `0x${string}`]: { + amount: string; + proof: `0x${string}`[]; + }; + }; + }; +} + +// Load config +dotenv.config({ path: "./js-scripts/generateRedemptionRights/.env" }); +const config = { + rpcUrl: process.env.MAINNET_RPC_URL, + pTokenAddresses: (process.env.PTOKEN_ADDRESSES as string)?.split( + "," + ) as Address[], + pointsIds: (process.env.POINTS_IDS as string)?.split(",") as `0x${string}`[], + rewardsPerPToken: process.env.REWARDS_PER_P_TOKEN as string, +}; + +// Core functions +async function calculateRedemptionRights( + client: PublicClient, + pTokenAddress: Address +): Promise> { + const redemptionRights = new Map(); + const rewardsMultiplier = BigInt(config.rewardsPerPToken); + + const logs = await client.getLogs({ + address: pTokenAddress, + event: parseAbiItem( + "event Transfer(address indexed from, address indexed to, uint256)" + ), + fromBlock: 0n, + toBlock: "latest", + }); + + for (const log of logs) { + const [from, to, value] = log.args as [Address, Address, bigint]; + + if (from !== zeroAddress) { + redemptionRights.set( + from, + (redemptionRights.get(from) || 0n) - + (value * rewardsMultiplier) / BigInt(1e18) + ); + } + if (to !== zeroAddress) { + redemptionRights.set( + to, + (redemptionRights.get(to) || 0n) + + (value * rewardsMultiplier) / BigInt(1e18) + ); + } + } + + return new Map( + Array.from(redemptionRights.entries()).filter( + ([_, balance]) => balance > 0n + ) + ); +} + +function generateMerkleData( + allRights: RedemptionRightsMap, + previousDistribution: AlphaDistributionData +): MerklizedData { + const prefix = keccak256(encodePacked(["string"], ["REDEMPTION_RIGHTS"])); + + // Generate leaves + const rightsLeaves = Array.from(allRights.entries()).flatMap( + ([address, balances]) => + Array.from(balances.entries()).map(([pointsId, balance]) => + keccak256( + encodePacked( + ["bytes32", "address", "bytes32", "uint256"], + [prefix, address, pointsId, balance] + ) + ) + ) + ); + + const pTokenLeaves = Object.entries(previousDistribution.pTokens).flatMap( + ([address, pointsData]) => + Object.entries(pointsData).map(([pointsId, data]) => + keccak256( + encodePacked( + ["address", "bytes32", "uint256"], + [ + address as Address, + pointsId as `0x${string}`, + BigInt(data.accumulatingPoints), + ] + ) + ) + ) + ); + + // Build tree + const tree = new MerkleTree( + [...rightsLeaves, ...pTokenLeaves].sort(), + keccak256, + { sortPairs: true } + ); + + return { + root: tree.getHexRoot() as `0x${string}`, + redemptionRights: Object.fromEntries( + Array.from(allRights.entries()).map(([addr, balances]) => [ + addr, + Object.fromEntries( + Array.from(balances.entries()).map(([pointsId, balance]) => [ + pointsId, + { + amount: balance.toString(), + proof: tree.getHexProof( + keccak256( + encodePacked( + ["bytes32", "address", "bytes32", "uint256"], + [prefix, addr, pointsId, balance] + ) + ) + ) as `0x${string}`[], + }, + ]) + ), + ]) + ), + pTokens: Object.fromEntries( + Object.entries(previousDistribution.pTokens).map(([addr, pointsData]) => [ + addr, + Object.fromEntries( + Object.entries(pointsData).map(([pointsId, data]) => [ + pointsId, + { + amount: data.accumulatingPoints, + proof: tree.getHexProof( + keccak256( + encodePacked( + ["address", "bytes32", "uint256"], + [ + addr as Address, + pointsId as `0x${string}`, + BigInt(data.accumulatingPoints), + ] + ) + ) + ) as `0x${string}`[], + }, + ]) + ), + ]) + ), + }; +} + +// Main execution +async function generateMerkleTree(): Promise { + const client = createPublicClient({ + chain: mainnet, + transport: http(config.rpcUrl), + }); + + // Validate inputs + if ( + !config.rpcUrl || + !config.pTokenAddresses.length || + !config.pointsIds.length || + config.pTokenAddresses.length !== config.pointsIds.length + ) { + throw new Error("Invalid configuration"); + } + + console.log(`Processing at block #${await client.getBlockNumber()}`); + + // Calculate rights for each token + const allRights: RedemptionRightsMap = new Map(); + for (let i = 0; i < config.pTokenAddresses.length; i++) { + const rights = await calculateRedemptionRights( + client, + config.pTokenAddresses[i] + ); + for (const [addr, balance] of rights.entries()) { + if (!allRights.has(addr)) allRights.set(addr, new Map()); + allRights.get(addr)!.set(config.pointsIds[i], balance); + } + } + + // Generate merkle data + const previousDistribution = JSON.parse( + fs.readFileSync( + "js-scripts/generateRedemptionRights/last-alpha-distribution.json", + "utf8" + ) + ) as AlphaDistributionData; + + const merklizedData = generateMerkleData(allRights, previousDistribution); + + console.log("Merkle root:", merklizedData.root); + fs.writeFileSync( + "js-scripts/generateRedemptionRights/out/merged-distribution.json", + JSON.stringify(merklizedData, null, 2) + ); +} + +generateMerkleTree().catch(console.error); diff --git a/js-scripts/generateRedemptionRights/last-alpha-distribution.json b/js-scripts/generateRedemptionRights/last-alpha-distribution.json new file mode 100644 index 0000000..d136d98 --- /dev/null +++ b/js-scripts/generateRedemptionRights/last-alpha-distribution.json @@ -0,0 +1,201 @@ +{ + "root": "0x97f82b0ee5efab39ef6c19fe98d952ec782980ac43ded92eb91e2faa3aeaa401", + "pTokens": { + "0x25E426b153e74Ab36b2685c3A464272De60888Ae": { + "0x1852756d70656c206b506f696e743a20457468656e61205332066b7053415453": { + "newPoints": 66498274627767680425, + "accumulatingPoints": 833020026897918484874, + "breakdown": { + "0x1e3d13932C31d7355fCb3FEc680b0cD159dC1A07": { + "newPoints": 232746777808705188, + "accumulatingPoints": 4426555656895776038 + }, + "0x40357b9f22B4DfF0Bf56A90661b8eC106C259d29": { + "newPoints": 66265527849958975237, + "accumulatingPoints": 828593471241022708836 + } + }, + "proof": [ + "0x991fd8976022911aeb40e40bcb5754f9529f2080710f7ec1db8ace85c4f7b7f8", + "0x5e6196d0d89859247b3b230f0e6dab21f74e08cf42053a8c1e0543830ebc546c", + "0x20271d72a5dba7cd6a536181de172105226f3cff0a42bc7a2dc91d8a902baae5", + "0x9fd5c3acd497da629b3a4513eb0924ebb12244b90781194c0f1d092777f14bc3" + ] + }, + "0x1552756d70656c20506f696e743a205a69726375697408705a49524355495400": { + "newPoints": 0, + "accumulatingPoints": 335440188667996950000, + "breakdown": { + "0x40357b9f22B4DfF0Bf56A90661b8eC106C259d29": { + "newPoints": 0, + "accumulatingPoints": 335440188667996950000 + } + }, + "proof": [ + "0xa11fb0c1a4d796bcb6fa408ad7fead1f27c139ee194686098410c137f2d5d224", + "0x5e6196d0d89859247b3b230f0e6dab21f74e08cf42053a8c1e0543830ebc546c", + "0x20271d72a5dba7cd6a536181de172105226f3cff0a42bc7a2dc91d8a902baae5", + "0x9fd5c3acd497da629b3a4513eb0924ebb12244b90781194c0f1d092777f14bc3" + ] + } + }, + "0x24C694d193B19119bcDea9D40a3b0bfaFb281E6D": { + "0x1852756d70656c206b506f696e743a20457468656e61205332066b7053415453": { + "newPoints": 7930031840109298837, + "accumulatingPoints": 152407798291890457882, + "breakdown": { + "0x1e3d13932C31d7355fCb3FEc680b0cD159dC1A07": { + "newPoints": 7930031840109298837, + "accumulatingPoints": 152407798291890457882 + } + }, + "proof": [ + "0x22bd0a3dd00ce6d39746f618e1314a076f69dc34b7f13b915a642b5600e25305", + "0xec7d2e07249c1b63f1cbafebe4b19b2a4aede14f630e574c65700ea8211055d9", + "0x20271d72a5dba7cd6a536181de172105226f3cff0a42bc7a2dc91d8a902baae5", + "0x9fd5c3acd497da629b3a4513eb0924ebb12244b90781194c0f1d092777f14bc3" + ] + } + }, + "0xe2C3445a84de723Ef4425922165a58D22AD06e33": { + "0x1852756d70656c206b506f696e743a20457468656e61205332066b7053415453": { + "newPoints": 6827238815722018869, + "accumulatingPoints": 131187337543613434191, + "breakdown": { + "0x1e3d13932C31d7355fCb3FEc680b0cD159dC1A07": { + "newPoints": 6827238815722018869, + "accumulatingPoints": 131187337543613434191 + } + }, + "proof": [ + "0x7c1140f479d8f8e1295f0da50f5554de0c77b7b73783022f63b840e186a69c3d", + "0xec7d2e07249c1b63f1cbafebe4b19b2a4aede14f630e574c65700ea8211055d9", + "0x20271d72a5dba7cd6a536181de172105226f3cff0a42bc7a2dc91d8a902baae5", + "0x9fd5c3acd497da629b3a4513eb0924ebb12244b90781194c0f1d092777f14bc3" + ] + } + }, + "0xD6633c1382896079D3576eC43519d844a8C80B56": { + "0x1852756d70656c206b506f696e743a20457468656e61205332066b7053415453": { + "newPoints": 3879112963478419812, + "accumulatingPoints": 73286503362495655536, + "breakdown": { + "0x1e3d13932C31d7355fCb3FEc680b0cD159dC1A07": { + "newPoints": 3879112963478419812, + "accumulatingPoints": 73286503362495655536 + } + }, + "proof": [ + "0xb605c6d24f4591b726ca75a2244f789388c19ffebedd76217fe0eda994f0a8a4", + "0x743739b6e27a07d7a5886e91fa6165fa506e429f2835baf69d8460908941415a", + "0x5cfaa3d3f456943535a68a9513a8cf801c67279e8ac417ba63e383e4611adc57", + "0x9fd5c3acd497da629b3a4513eb0924ebb12244b90781194c0f1d092777f14bc3" + ] + } + }, + "0x028CC8E3Ff248Dc59052eaAD2a1e749F3B835B99": { + "0x1852756d70656c206b506f696e743a20457468656e61205332066b7053415453": { + "newPoints": 0, + "accumulatingPoints": 4977606283426392328730, + "breakdown": { + "0x1e3d13932C31d7355fCb3FEc680b0cD159dC1A07": { + "newPoints": 0, + "accumulatingPoints": 4977606283426392328730 + } + }, + "proof": [ + "0xdc6743cb29d00ac8467f33ac244256f40e5d7fc8e8813cfc8d3c0ab87f1df4d2", + "0x743739b6e27a07d7a5886e91fa6165fa506e429f2835baf69d8460908941415a", + "0x5cfaa3d3f456943535a68a9513a8cf801c67279e8ac417ba63e383e4611adc57", + "0x9fd5c3acd497da629b3a4513eb0924ebb12244b90781194c0f1d092777f14bc3" + ] + } + }, + "0x6CD72B1E6E300340A48943d6aF34EF5AE07D3577": { + "0x1852756d70656c206b506f696e743a20457468656e61205332066b7053415453": { + "newPoints": 155164518539136792484, + "accumulatingPoints": 2830357527081490335359, + "breakdown": { + "0x1e3d13932C31d7355fCb3FEc680b0cD159dC1A07": { + "newPoints": 155164518539136792484, + "accumulatingPoints": 2830357527081490335359 + } + }, + "proof": [ + "0x191a3f5a1c7f9b1657f56cf44eb79a72b47ad4be40fae5ced80af9e38731e10c", + "0x2edc92e0f7721f84ac287a3d576011980a1c14d2055e9471d23704d678db8f27", + "0x5cfaa3d3f456943535a68a9513a8cf801c67279e8ac417ba63e383e4611adc57", + "0x9fd5c3acd497da629b3a4513eb0924ebb12244b90781194c0f1d092777f14bc3" + ] + } + }, + "0xAF9e4E01525C4856E00Cb0F363AFc34E7decD6a7": { + "0x1852756d70656c206b506f696e743a20457468656e61205332066b7053415453": { + "newPoints": 28652027175284595239052, + "accumulatingPoints": 522530241238727636619443, + "breakdown": { + "0x1e3d13932C31d7355fCb3FEc680b0cD159dC1A07": { + "newPoints": 28652027175284595239052, + "accumulatingPoints": 522530241238727636619443 + } + }, + "proof": [ + "0x6a69b863aea1e9a735f460a6fb449a28b7398f958c4792872d7764700936b79d", + "0x2edc92e0f7721f84ac287a3d576011980a1c14d2055e9471d23704d678db8f27", + "0x5cfaa3d3f456943535a68a9513a8cf801c67279e8ac417ba63e383e4611adc57", + "0x9fd5c3acd497da629b3a4513eb0924ebb12244b90781194c0f1d092777f14bc3" + ] + } + }, + "0x0e7518B332F469a6A2F59E690F225cef5157cca9": { + "0x1852756d70656c206b506f696e743a20457468656e61205332066b7053415453": { + "newPoints": 15878352062127404025676, + "accumulatingPoints": 262106044120029423561824, + "breakdown": { + "0x1e3d13932C31d7355fCb3FEc680b0cD159dC1A07": { + "newPoints": 15878352062127404025676, + "accumulatingPoints": 262106044120029423561824 + } + }, + "proof": [ + "0x8b788cab342842ae529d8efac9659e1af9367270c13caaf4c8b5ef4c67a51402", + "0x6258fb3ee01fe8edb76a1ee2cb317cd32b8464c63e31903826acd02863982f31", + "0x13b53859bd6223b750a1ee9cd1c58ef7dad44cf4c74daee9c688e5fa65e5fca3" + ] + } + }, + "0x347ab2e403710583Ade28Ef0871e73581599C8C8": { + "0x1852756d70656c206b506f696e743a20457468656e61205332066b7053415453": { + "newPoints": 89545954046664994040243, + "accumulatingPoints": 988835303595225079157382, + "breakdown": { + "0x1e3d13932C31d7355fCb3FEc680b0cD159dC1A07": { + "newPoints": 89545954046664994040243, + "accumulatingPoints": 988835303595225079157382 + } + }, + "proof": [ + "0x4e0230e7a7546148f373efe52256490c04ea0019e199f2256a375e75cf2b6b96", + "0x6258fb3ee01fe8edb76a1ee2cb317cd32b8464c63e31903826acd02863982f31", + "0x13b53859bd6223b750a1ee9cd1c58ef7dad44cf4c74daee9c688e5fa65e5fca3" + ] + } + }, + "0x1d848bf0dcF1b48f5621c37d062f2696D9d71AC4": { + "0x1852756d70656c206b506f696e743a20457468656e61205332066b7053415453": { + "newPoints": 155164518539136792484597, + "accumulatingPoints": 2396414216569414059964695, + "breakdown": { + "0x1e3d13932C31d7355fCb3FEc680b0cD159dC1A07": { + "newPoints": 155164518539136792484597, + "accumulatingPoints": 2396414216569414059964695 + } + }, + "proof": [ + "0x55efa11ff2efbae089ab7fa8e3cd7080098947f5727af0e0c2b4d4de47467a4a", + "0x13b53859bd6223b750a1ee9cd1c58ef7dad44cf4c74daee9c688e5fa65e5fca3" + ] + } + } + } +} diff --git a/package.json b/package.json index 82ff711..33c842f 100644 --- a/package.json +++ b/package.json @@ -3,7 +3,7 @@ "module": "index.ts", "type": "module", "scripts": { - "generate-merkle-tree": "bun run js-scripts/generateRedemptionRights.ts" + "generate-merkle-tree": "bun run js-scripts/generateRedemptionRights/index.ts" }, "devDependencies": { "bun-types": "latest" From f5797dcc8c1d7974c132f1d88d79116a8846c534 Mon Sep 17 00:00:00 2001 From: Josh Levine Date: Mon, 28 Oct 2024 20:01:02 -0700 Subject: [PATCH 04/16] chore: add redemption rights var for clarity --- contracts/script/PointTokenVault.s.sol | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/contracts/script/PointTokenVault.s.sol b/contracts/script/PointTokenVault.s.sol index 190adf5..9a6058a 100644 --- a/contracts/script/PointTokenVault.s.sol +++ b/contracts/script/PointTokenVault.s.sol @@ -124,10 +124,11 @@ contract PointTokenVaultScripts is BatchScript { bytes32 pointsId = LibString.packTwo("Rumpel kPoint: Ethena S2", "kpSATS"); ERC20 senaToken = ERC20(0x8bE3460A480c80728a8C4D7a5D5303c85ba7B3b9); uint256 rewardsPerPToken = 63381137368827226; + bool usesRedemptionRights = true; // Set redemption parameters vm.startBroadcast(MAINNET_OPERATOR); - vaultV0_1_0.setRedemption(pointsId, senaToken, rewardsPerPToken, true); + vaultV0_1_0.setRedemption(pointsId, senaToken, rewardsPerPToken, usesRedemptionRights); vm.stopBroadcast(); // Update merkle root From dc22dd22a2a6f697937d0bc969d377249b1e8288 Mon Sep 17 00:00:00 2001 From: Josh Levine Date: Mon, 28 Oct 2024 20:08:34 -0700 Subject: [PATCH 05/16] feat: store ptoken balance snapshots --- .gitignore | 2 +- js-scripts/generateRedemptionRights/index.ts | 53 ++++- .../out/merged-distribution.json | 215 ++++++++++++++++++ .../out/ptoken-snapshots.json | 14 ++ 4 files changed, 276 insertions(+), 8 deletions(-) create mode 100644 js-scripts/generateRedemptionRights/out/merged-distribution.json create mode 100644 js-scripts/generateRedemptionRights/out/ptoken-snapshots.json diff --git a/.gitignore b/.gitignore index a9cbde5..2c26010 100644 --- a/.gitignore +++ b/.gitignore @@ -1,6 +1,6 @@ # Compiler files cache/ -out/ +/out/ # Ignores development broadcast logs !/broadcast diff --git a/js-scripts/generateRedemptionRights/index.ts b/js-scripts/generateRedemptionRights/index.ts index 55449a1..72f1810 100644 --- a/js-scripts/generateRedemptionRights/index.ts +++ b/js-scripts/generateRedemptionRights/index.ts @@ -47,6 +47,15 @@ interface MerklizedData { }; } +interface PTokenSnapshot { + blockNumber: string; + balances: { + [address: string]: string; // Using string for BigInt serialization + }; +} + +// TODO: account for LPs + // Load config dotenv.config({ path: "./js-scripts/generateRedemptionRights/.env" }); const config = { @@ -62,9 +71,10 @@ const config = { async function calculateRedemptionRights( client: PublicClient, pTokenAddress: Address -): Promise> { +): Promise<[Map, PTokenSnapshot]> { const redemptionRights = new Map(); const rewardsMultiplier = BigInt(config.rewardsPerPToken); + const blockNumber = await client.getBlockNumber(); const logs = await client.getLogs({ address: pTokenAddress, @@ -75,15 +85,20 @@ async function calculateRedemptionRights( toBlock: "latest", }); + // Track raw pToken balances separately + const pTokenBalances = new Map(); + for (const log of logs) { const [from, to, value] = log.args as [Address, Address, bigint]; + // Update redemption rights if (from !== zeroAddress) { redemptionRights.set( from, (redemptionRights.get(from) || 0n) - (value * rewardsMultiplier) / BigInt(1e18) ); + pTokenBalances.set(from, (pTokenBalances.get(from) || 0n) - value); } if (to !== zeroAddress) { redemptionRights.set( @@ -91,14 +106,28 @@ async function calculateRedemptionRights( (redemptionRights.get(to) || 0n) + (value * rewardsMultiplier) / BigInt(1e18) ); + pTokenBalances.set(to, (pTokenBalances.get(to) || 0n) + value); } } - return new Map( - Array.from(redemptionRights.entries()).filter( - ([_, balance]) => balance > 0n - ) - ); + // Create snapshot object + const snapshot: PTokenSnapshot = { + blockNumber: blockNumber.toString(), + balances: Object.fromEntries( + Array.from(pTokenBalances.entries()) + .filter(([_, balance]) => balance > 0n) + .map(([addr, balance]) => [addr, balance.toString()]) + ), + }; + + return [ + new Map( + Array.from(redemptionRights.entries()).filter( + ([_, balance]) => balance > 0n + ) + ), + snapshot, + ]; } function generateMerkleData( @@ -215,17 +244,27 @@ async function generateMerkleTree(): Promise { // Calculate rights for each token const allRights: RedemptionRightsMap = new Map(); + const snapshots: { [address: string]: PTokenSnapshot } = {}; + for (let i = 0; i < config.pTokenAddresses.length; i++) { - const rights = await calculateRedemptionRights( + const [rights, snapshot] = await calculateRedemptionRights( client, config.pTokenAddresses[i] ); + snapshots[config.pTokenAddresses[i]] = snapshot; + for (const [addr, balance] of rights.entries()) { if (!allRights.has(addr)) allRights.set(addr, new Map()); allRights.get(addr)!.set(config.pointsIds[i], balance); } } + // Save snapshots + fs.writeFileSync( + "js-scripts/generateRedemptionRights/out/ptoken-snapshots.json", + JSON.stringify(snapshots, null, 2) + ); + // Generate merkle data const previousDistribution = JSON.parse( fs.readFileSync( diff --git a/js-scripts/generateRedemptionRights/out/merged-distribution.json b/js-scripts/generateRedemptionRights/out/merged-distribution.json new file mode 100644 index 0000000..cb26a8e --- /dev/null +++ b/js-scripts/generateRedemptionRights/out/merged-distribution.json @@ -0,0 +1,215 @@ +{ + "root": "0x602cdd6dd4f1c6f7bb049ce8b23a49e5177dc84830c7f00cc09eb0f11f03d9be", + "redemptionRights": { + "0x25E426b153e74Ab36b2685c3A464272De60888Ae": { + "0x1852756d70656c206b506f696e743a20457468656e61205332066b7053415453": { + "amount": "52792622186481736164", + "proof": [ + "0xc1a70bb7d5c4ddf647114cb36083bca867a80e37e187aa1d6705f3b12357d7cf", + "0x04a635b0e5b8e5ac70059fb9dc2682f5102a3b4a2f8b2c0d6f1ea43b1e04272f", + "0xab802966e4277e85c878dad4c849c7632735a56c3710c197470de81707286069", + "0x7c0bd8bd630d01f1a459f6cd963cfc5f58487dec582339b1d8f29edbbd41d8ab", + "0x0fe239692610c805880a540ea359a0f3f8314f94bb95cd4ec53d712ae6cdc63d" + ] + } + }, + "0x597a1b0515bbeEe6796B89a6f403c3fD41BB626C": { + "0x1852756d70656c206b506f696e743a20457468656e61205332066b7053415453": { + "amount": "1749589083544816554749", + "proof": [ + "0xf17cd78fb91097d6d817f63f61884a91c8d5ceedefd3ff761ad4621db6cdb688", + "0xc7cee474205709d43f4e6496b9ac27153bc2588c648cf86cef7dfa86f2c440a1" + ] + } + }, + "0xAF9e4E01525C4856E00Cb0F363AFc34E7decD6a7": { + "0x1852756d70656c206b506f696e743a20457468656e61205332066b7053415453": { + "amount": "76680445415417303410317", + "proof": [ + "0x0b9dba6343a79836c09a8fe2151dfaeab44a90e1c590e664e142a46c5251c3e4", + "0x3aaef79be826edf6d7035f8ece860c534e8fa43b5d7a32581664fd7d9761fe39", + "0x4cd045546ad35fb4ffbe7efabeb3d5e2cfe57317600c887220d3614239de3cdb", + "0xc2a23d2ce2d64e086666994505249bdf18e495b91c1e019ae349a3f6001d6423", + "0x0fe239692610c805880a540ea359a0f3f8314f94bb95cd4ec53d712ae6cdc63d" + ] + } + }, + "0x6CD72B1E6E300340A48943d6aF34EF5AE07D3577": { + "0x1852756d70656c206b506f696e743a20457468656e61205332066b7053415453": { + "amount": "19621036792277125819", + "proof": [ + "0x1b9305567ae250a289d9c9a662f2470db6a5b9396d0358bfebe9250f336348b0", + "0x41ea528f3d329e1491631bb9a5a3a1632f5f1c9b308d70c53c855c7cf90924c3", + "0xbb77a1bb065bc346c4f39dfaff16a845fb2f151394251a08a942b3aa793b654a", + "0xc2a23d2ce2d64e086666994505249bdf18e495b91c1e019ae349a3f6001d6423", + "0x0fe239692610c805880a540ea359a0f3f8314f94bb95cd4ec53d712ae6cdc63d" + ] + } + }, + "0x1d848bf0dcF1b48f5621c37d062f2696D9d71AC4": { + "0x1852756d70656c206b506f696e743a20457468656e61205332066b7053415453": { + "amount": "7377567032082737967061", + "proof": [ + "0x33b677140d55397d85f1c789cd35975f28bdbb973fa125c5d895a95c1026266b", + "0x9a562114e5173cb1802e3635ab3bed9c3c56c74532d5f34d57784f005ded3c36", + "0xbb77a1bb065bc346c4f39dfaff16a845fb2f151394251a08a942b3aa793b654a", + "0xc2a23d2ce2d64e086666994505249bdf18e495b91c1e019ae349a3f6001d6423", + "0x0fe239692610c805880a540ea359a0f3f8314f94bb95cd4ec53d712ae6cdc63d" + ] + } + }, + "0x76DB9edf1451933711fc0A0c622E013ebD229EaB": { + "0x1852756d70656c206b506f696e743a20457468656e61205332066b7053415453": { + "amount": "28648231580558995600834", + "proof": [ + "0xee2c966b96d8429ef64a79f7d8cb46647213dbb723885eb7a7826c0434797d2a", + "0xc7cee474205709d43f4e6496b9ac27153bc2588c648cf86cef7dfa86f2c440a1" + ] + } + }, + "0xB6462B67fe692223DFFb61C8DC8Ad080CBa180Cc": { + "0x1852756d70656c206b506f696e743a20457468656e61205332066b7053415453": { + "amount": "12394117929023949073263", + "proof": [ + "0x1aabefcbeb1ba41043ba86b6019b4f0e9eda103bd89334b2dbd385b4b6fd0fb1", + "0xb1b1d68fe165491c5e58654565c779c68f1e0909168fb478480f1ebb22479b4d", + "0x4cd045546ad35fb4ffbe7efabeb3d5e2cfe57317600c887220d3614239de3cdb", + "0xc2a23d2ce2d64e086666994505249bdf18e495b91c1e019ae349a3f6001d6423", + "0x0fe239692610c805880a540ea359a0f3f8314f94bb95cd4ec53d712ae6cdc63d" + ] + } + } + }, + "pTokens": { + "0x25E426b153e74Ab36b2685c3A464272De60888Ae": { + "0x1852756d70656c206b506f696e743a20457468656e61205332066b7053415453": { + "amount": 833020026897918500000, + "proof": [ + "0x6ffeeee822b04a5714526489a1b1e6e84d8548d7a8b5cb829fd8d22d86779dde", + "0x9202bdda11a41be9ebfe610247d3e971e65959936bdf2d9186395b70d25d8d84", + "0xfa81e644f935a7f197b15079d105fd9c34398e9f304c0f24a7cdd9a321aa7525", + "0x7c0bd8bd630d01f1a459f6cd963cfc5f58487dec582339b1d8f29edbbd41d8ab", + "0x0fe239692610c805880a540ea359a0f3f8314f94bb95cd4ec53d712ae6cdc63d" + ] + }, + "0x1552756d70656c20506f696e743a205a69726375697408705a49524355495400": { + "amount": 335440188667996900000, + "proof": [ + "0x0fcd36341455485e89dbfc035b03be7d9ec5ceb7edfcb4849c51a457f4585ce7", + "0xb1b1d68fe165491c5e58654565c779c68f1e0909168fb478480f1ebb22479b4d", + "0x4cd045546ad35fb4ffbe7efabeb3d5e2cfe57317600c887220d3614239de3cdb", + "0xc2a23d2ce2d64e086666994505249bdf18e495b91c1e019ae349a3f6001d6423", + "0x0fe239692610c805880a540ea359a0f3f8314f94bb95cd4ec53d712ae6cdc63d" + ] + } + }, + "0x24C694d193B19119bcDea9D40a3b0bfaFb281E6D": { + "0x1852756d70656c206b506f696e743a20457468656e61205332066b7053415453": { + "amount": 152407798291890470000, + "proof": [ + "0x9dd5c63d7a85ebb90ea35dd0f5fb54974ae79d761c86e3c469616d0b2eaeff67", + "0x42a2346cc718889c9be2af3a107d12cb3900c221558ef5c0b3631f5c3ae2e5d4", + "0xfa81e644f935a7f197b15079d105fd9c34398e9f304c0f24a7cdd9a321aa7525", + "0x7c0bd8bd630d01f1a459f6cd963cfc5f58487dec582339b1d8f29edbbd41d8ab", + "0x0fe239692610c805880a540ea359a0f3f8314f94bb95cd4ec53d712ae6cdc63d" + ] + } + }, + "0xe2C3445a84de723Ef4425922165a58D22AD06e33": { + "0x1852756d70656c206b506f696e743a20457468656e61205332066b7053415453": { + "amount": 131187337543613430000, + "proof": [ + "0x73c25d42a5988fcc27384ecf9fbc2f810c9f862e977db0f73e9cabf68ac9e5b6", + "0x42a2346cc718889c9be2af3a107d12cb3900c221558ef5c0b3631f5c3ae2e5d4", + "0xfa81e644f935a7f197b15079d105fd9c34398e9f304c0f24a7cdd9a321aa7525", + "0x7c0bd8bd630d01f1a459f6cd963cfc5f58487dec582339b1d8f29edbbd41d8ab", + "0x0fe239692610c805880a540ea359a0f3f8314f94bb95cd4ec53d712ae6cdc63d" + ] + } + }, + "0xD6633c1382896079D3576eC43519d844a8C80B56": { + "0x1852756d70656c206b506f696e743a20457468656e61205332066b7053415453": { + "amount": 73286503362495650000, + "proof": [ + "0x6b691008971e9ab0b1581861b6e542943b4ea3ef91df9fd3e3167e16dfe61eab", + "0x9202bdda11a41be9ebfe610247d3e971e65959936bdf2d9186395b70d25d8d84", + "0xfa81e644f935a7f197b15079d105fd9c34398e9f304c0f24a7cdd9a321aa7525", + "0x7c0bd8bd630d01f1a459f6cd963cfc5f58487dec582339b1d8f29edbbd41d8ab", + "0x0fe239692610c805880a540ea359a0f3f8314f94bb95cd4ec53d712ae6cdc63d" + ] + } + }, + "0x028CC8E3Ff248Dc59052eaAD2a1e749F3B835B99": { + "0x1852756d70656c206b506f696e743a20457468656e61205332066b7053415453": { + "amount": 4.977606283426392e+21, + "proof": [ + "0xd1c3a5f261d26002eb7ea89e24b742b91b073fd272fadc4384323899b277f04e", + "0x403c3bb7b0ff32cb4e934edd9801aa0eec0ff624fe9a0845cb35a7375e02c25d", + "0xab802966e4277e85c878dad4c849c7632735a56c3710c197470de81707286069", + "0x7c0bd8bd630d01f1a459f6cd963cfc5f58487dec582339b1d8f29edbbd41d8ab", + "0x0fe239692610c805880a540ea359a0f3f8314f94bb95cd4ec53d712ae6cdc63d" + ] + } + }, + "0x6CD72B1E6E300340A48943d6aF34EF5AE07D3577": { + "0x1852756d70656c206b506f696e743a20457468656e61205332066b7053415453": { + "amount": 2.8303575270814903e+21, + "proof": [ + "0x3e7e8dbf133ff6472d8567b24ea2be55e0400118c6a72d46442e54bf47351187", + "0x9a562114e5173cb1802e3635ab3bed9c3c56c74532d5f34d57784f005ded3c36", + "0xbb77a1bb065bc346c4f39dfaff16a845fb2f151394251a08a942b3aa793b654a", + "0xc2a23d2ce2d64e086666994505249bdf18e495b91c1e019ae349a3f6001d6423", + "0x0fe239692610c805880a540ea359a0f3f8314f94bb95cd4ec53d712ae6cdc63d" + ] + } + }, + "0xAF9e4E01525C4856E00Cb0F363AFc34E7decD6a7": { + "0x1852756d70656c206b506f696e743a20457468656e61205332066b7053415453": { + "amount": 5.225302412387277e+23, + "proof": [ + "0xd6edec91605da1894e0fa3cdbb82e2005d9b05584aacb82d8c407725b9b3641d", + "0x403c3bb7b0ff32cb4e934edd9801aa0eec0ff624fe9a0845cb35a7375e02c25d", + "0xab802966e4277e85c878dad4c849c7632735a56c3710c197470de81707286069", + "0x7c0bd8bd630d01f1a459f6cd963cfc5f58487dec582339b1d8f29edbbd41d8ab", + "0x0fe239692610c805880a540ea359a0f3f8314f94bb95cd4ec53d712ae6cdc63d" + ] + } + }, + "0x0e7518B332F469a6A2F59E690F225cef5157cca9": { + "0x1852756d70656c206b506f696e743a20457468656e61205332066b7053415453": { + "amount": 2.621060441200294e+23, + "proof": [ + "0x9f06e030a1a0be00f37013433e8d97e2d1cf5ee1ad68da103114e6e82ab92c5f", + "0x04a635b0e5b8e5ac70059fb9dc2682f5102a3b4a2f8b2c0d6f1ea43b1e04272f", + "0xab802966e4277e85c878dad4c849c7632735a56c3710c197470de81707286069", + "0x7c0bd8bd630d01f1a459f6cd963cfc5f58487dec582339b1d8f29edbbd41d8ab", + "0x0fe239692610c805880a540ea359a0f3f8314f94bb95cd4ec53d712ae6cdc63d" + ] + } + }, + "0x347ab2e403710583Ade28Ef0871e73581599C8C8": { + "0x1852756d70656c206b506f696e743a20457468656e61205332066b7053415453": { + "amount": 9.888353035952251e+23, + "proof": [ + "0x317c7eb5a0fffec11dd2d7b3d0bfd2fe201bf9ff67627a43990ad1ad51714da3", + "0x41ea528f3d329e1491631bb9a5a3a1632f5f1c9b308d70c53c855c7cf90924c3", + "0xbb77a1bb065bc346c4f39dfaff16a845fb2f151394251a08a942b3aa793b654a", + "0xc2a23d2ce2d64e086666994505249bdf18e495b91c1e019ae349a3f6001d6423", + "0x0fe239692610c805880a540ea359a0f3f8314f94bb95cd4ec53d712ae6cdc63d" + ] + } + }, + "0x1d848bf0dcF1b48f5621c37d062f2696D9d71AC4": { + "0x1852756d70656c206b506f696e743a20457468656e61205332066b7053415453": { + "amount": 2.396414216569414e+24, + "proof": [ + "0x0d204e0c13988dc6ad8a13ec4b0ed7ad17ab5a668edc8accfcce7f2bfdade628", + "0x3aaef79be826edf6d7035f8ece860c534e8fa43b5d7a32581664fd7d9761fe39", + "0x4cd045546ad35fb4ffbe7efabeb3d5e2cfe57317600c887220d3614239de3cdb", + "0xc2a23d2ce2d64e086666994505249bdf18e495b91c1e019ae349a3f6001d6423", + "0x0fe239692610c805880a540ea359a0f3f8314f94bb95cd4ec53d712ae6cdc63d" + ] + } + } + } +} \ No newline at end of file diff --git a/js-scripts/generateRedemptionRights/out/ptoken-snapshots.json b/js-scripts/generateRedemptionRights/out/ptoken-snapshots.json new file mode 100644 index 0000000..f2c350b --- /dev/null +++ b/js-scripts/generateRedemptionRights/out/ptoken-snapshots.json @@ -0,0 +1,14 @@ +{ + "0xdFa21ceC8A46386F5d36F4b07E18BcCcA59f425B": { + "blockNumber": "21068499", + "balances": { + "0x25E426b153e74Ab36b2685c3A464272De60888Ae": "832939015897918484874", + "0x597a1b0515bbeEe6796B89a6f403c3fD41BB626C": "27604255085604029567224", + "0xAF9e4E01525C4856E00Cb0F363AFc34E7decD6a7": "1209830694094345523934847", + "0x6CD72B1E6E300340A48943d6aF34EF5AE07D3577": "309572178834508409860", + "0x1d848bf0dcF1b48f5621c37d062f2696D9d71AC4": "116400041689867972616256", + "0x76DB9edf1451933711fc0A0c622E013ebD229EaB": "451999329293340648396874", + "0xB6462B67fe692223DFFb61C8DC8Ad080CBa180Cc": "195548998385752443216151" + } + } +} \ No newline at end of file From d69c5b8fccb5ce5efe18fef75a706e8b5de4f277 Mon Sep 17 00:00:00 2001 From: Josh Levine Date: Tue, 29 Oct 2024 12:35:30 -0700 Subject: [PATCH 06/16] refactor: add uni pool overrides, create ptoken snapshot json per token --- js-scripts/generateRedemptionRights/index.ts | 163 ++++++++++++------ .../out/merged-distribution.json | 157 +++++++++-------- .../out/ptoken-snapshot-kpsats.json | 14 ++ .../out/ptoken-snapshots.json | 14 -- 4 files changed, 213 insertions(+), 135 deletions(-) create mode 100644 js-scripts/generateRedemptionRights/out/ptoken-snapshot-kpsats.json delete mode 100644 js-scripts/generateRedemptionRights/out/ptoken-snapshots.json diff --git a/js-scripts/generateRedemptionRights/index.ts b/js-scripts/generateRedemptionRights/index.ts index 72f1810..09e20ce 100644 --- a/js-scripts/generateRedemptionRights/index.ts +++ b/js-scripts/generateRedemptionRights/index.ts @@ -9,11 +9,13 @@ import { Address, zeroAddress, PublicClient, + getContract, + erc20Abi, } from "viem"; import { mainnet } from "viem/chains"; import { MerkleTree } from "merkletreejs"; -// Core types +// Types type PointsBalance = Map<`0x${string}`, bigint>; type RedemptionRightsMap = Map; @@ -48,15 +50,22 @@ interface MerklizedData { } interface PTokenSnapshot { + address: Address; blockNumber: string; balances: { - [address: string]: string; // Using string for BigInt serialization + [address: string]: string; }; } -// TODO: account for LPs +// Overrides +const UNI_POOL_OVERRIDES = { + "0x597a1b0515bbeEe6796B89a6f403c3fD41BB626C": { + "0x24C694d193B19119bcDea9D40a3b0bfaFb281E6D": 6487631537430741114, + "0x44Cb2d713BDa3858001f038645fD05E23E5DE03D": 27597767454066598826095, + }, +}; -// Load config +// Config dotenv.config({ path: "./js-scripts/generateRedemptionRights/.env" }); const config = { rpcUrl: process.env.MAINNET_RPC_URL, @@ -64,16 +73,19 @@ const config = { "," ) as Address[], pointsIds: (process.env.POINTS_IDS as string)?.split(",") as `0x${string}`[], - rewardsPerPToken: process.env.REWARDS_PER_P_TOKEN as string, + rewardsPerPToken: (process.env.REWARDS_PER_P_TOKEN as string)?.split( + "," + ) as string[], }; // Core functions async function calculateRedemptionRights( client: PublicClient, - pTokenAddress: Address + pTokenAddress: Address, + rewardsMultiplier: string ): Promise<[Map, PTokenSnapshot]> { const redemptionRights = new Map(); - const rewardsMultiplier = BigInt(config.rewardsPerPToken); + const rewardsMultiplierBigInt = BigInt(rewardsMultiplier); const blockNumber = await client.getBlockNumber(); const logs = await client.getLogs({ @@ -96,7 +108,7 @@ async function calculateRedemptionRights( redemptionRights.set( from, (redemptionRights.get(from) || 0n) - - (value * rewardsMultiplier) / BigInt(1e18) + (value * rewardsMultiplierBigInt) / BigInt(1e18) ); pTokenBalances.set(from, (pTokenBalances.get(from) || 0n) - value); } @@ -104,14 +116,44 @@ async function calculateRedemptionRights( redemptionRights.set( to, (redemptionRights.get(to) || 0n) + - (value * rewardsMultiplier) / BigInt(1e18) + (value * rewardsMultiplierBigInt) / BigInt(1e18) ); pTokenBalances.set(to, (pTokenBalances.get(to) || 0n) + value); } } + // Apply UNI pool overrides after processing all transfers + for (const [poolAddress, redistributions] of Object.entries( + UNI_POOL_OVERRIDES + )) { + const poolBalance = pTokenBalances.get(poolAddress as Address) || 0n; + if (poolBalance > 0n) { + // Remove balance from pool + pTokenBalances.set(poolAddress as Address, 0n); + redemptionRights.set(poolAddress as Address, 0n); + + // Redistribute to specified addresses + for (const [recipient, amount] of Object.entries(redistributions)) { + const recipientAddress = recipient as Address; + const overrideAmount = BigInt(amount); + + pTokenBalances.set( + recipientAddress, + (pTokenBalances.get(recipientAddress) || 0n) + overrideAmount + ); + + redemptionRights.set( + recipientAddress, + (redemptionRights.get(recipientAddress) || 0n) + + (overrideAmount * rewardsMultiplierBigInt) / BigInt(1e18) + ); + } + } + } + // Create snapshot object const snapshot: PTokenSnapshot = { + address: pTokenAddress, blockNumber: blockNumber.toString(), balances: Object.fromEntries( Array.from(pTokenBalances.entries()) @@ -131,13 +173,13 @@ async function calculateRedemptionRights( } function generateMerkleData( - allRights: RedemptionRightsMap, + allRedemptionRights: RedemptionRightsMap, previousDistribution: AlphaDistributionData ): MerklizedData { const prefix = keccak256(encodePacked(["string"], ["REDEMPTION_RIGHTS"])); - // Generate leaves - const rightsLeaves = Array.from(allRights.entries()).flatMap( + // Generate redemption rights leaves + const rightsLeaves = Array.from(allRedemptionRights.entries()).flatMap( ([address, balances]) => Array.from(balances.entries()).map(([pointsId, balance]) => keccak256( @@ -149,6 +191,7 @@ function generateMerkleData( ) ); + // Generate pTokens leaves const pTokenLeaves = Object.entries(previousDistribution.pTokens).flatMap( ([address, pointsData]) => Object.entries(pointsData).map(([pointsId, data]) => @@ -175,8 +218,8 @@ function generateMerkleData( return { root: tree.getHexRoot() as `0x${string}`, redemptionRights: Object.fromEntries( - Array.from(allRights.entries()).map(([addr, balances]) => [ - addr, + Array.from(allRedemptionRights.entries()).map(([address, balances]) => [ + address, Object.fromEntries( Array.from(balances.entries()).map(([pointsId, balance]) => [ pointsId, @@ -186,7 +229,7 @@ function generateMerkleData( keccak256( encodePacked( ["bytes32", "address", "bytes32", "uint256"], - [prefix, addr, pointsId, balance] + [prefix, address, pointsId, balance] ) ) ) as `0x${string}`[], @@ -196,29 +239,31 @@ function generateMerkleData( ]) ), pTokens: Object.fromEntries( - Object.entries(previousDistribution.pTokens).map(([addr, pointsData]) => [ - addr, - Object.fromEntries( - Object.entries(pointsData).map(([pointsId, data]) => [ - pointsId, - { - amount: data.accumulatingPoints, - proof: tree.getHexProof( - keccak256( - encodePacked( - ["address", "bytes32", "uint256"], - [ - addr as Address, - pointsId as `0x${string}`, - BigInt(data.accumulatingPoints), - ] + Object.entries(previousDistribution.pTokens).map( + ([address, pointsData]) => [ + address, + Object.fromEntries( + Object.entries(pointsData).map(([pointsId, data]) => [ + pointsId, + { + amount: data.accumulatingPoints, + proof: tree.getHexProof( + keccak256( + encodePacked( + ["address", "bytes32", "uint256"], + [ + address as Address, + pointsId as `0x${string}`, + BigInt(data.accumulatingPoints), + ] + ) ) - ) - ) as `0x${string}`[], - }, - ]) - ), - ]) + ) as `0x${string}`[], + }, + ]) + ), + ] + ) ), }; } @@ -230,7 +275,7 @@ async function generateMerkleTree(): Promise { transport: http(config.rpcUrl), }); - // Validate inputs + // Validate config if ( !config.rpcUrl || !config.pTokenAddresses.length || @@ -243,27 +288,46 @@ async function generateMerkleTree(): Promise { console.log(`Processing at block #${await client.getBlockNumber()}`); // Calculate rights for each token - const allRights: RedemptionRightsMap = new Map(); + const allRedemptionRights: RedemptionRightsMap = new Map(); const snapshots: { [address: string]: PTokenSnapshot } = {}; for (let i = 0; i < config.pTokenAddresses.length; i++) { const [rights, snapshot] = await calculateRedemptionRights( client, - config.pTokenAddresses[i] + config.pTokenAddresses[i], + config.rewardsPerPToken[i] ); snapshots[config.pTokenAddresses[i]] = snapshot; for (const [addr, balance] of rights.entries()) { - if (!allRights.has(addr)) allRights.set(addr, new Map()); - allRights.get(addr)!.set(config.pointsIds[i], balance); + if (!allRedemptionRights.has(addr)) + allRedemptionRights.set(addr, new Map()); + allRedemptionRights.get(addr)!.set(config.pointsIds[i], balance); } } - // Save snapshots - fs.writeFileSync( - "js-scripts/generateRedemptionRights/out/ptoken-snapshots.json", - JSON.stringify(snapshots, null, 2) - ); + // Save individual snapshots for each pToken + for (const [pTokenAddress, snapshot] of Object.entries(snapshots)) { + const pTokenContract = getContract({ + address: pTokenAddress as Address, + abi: erc20Abi, + client, + }); + + const symbol = await pTokenContract.read.symbol(); + const fileName = `ptoken-snapshot-${symbol.toLowerCase()}.json`; + + // Add address to the snapshot data + const snapshotWithAddress: PTokenSnapshot = { + address: pTokenAddress as Address, + ...snapshot, + }; + + fs.writeFileSync( + `js-scripts/generateRedemptionRights/out/${fileName}`, + JSON.stringify(snapshotWithAddress, null, 2) + ); + } // Generate merkle data const previousDistribution = JSON.parse( @@ -273,7 +337,10 @@ async function generateMerkleTree(): Promise { ) ) as AlphaDistributionData; - const merklizedData = generateMerkleData(allRights, previousDistribution); + const merklizedData = generateMerkleData( + allRedemptionRights, + previousDistribution + ); console.log("Merkle root:", merklizedData.root); fs.writeFileSync( diff --git a/js-scripts/generateRedemptionRights/out/merged-distribution.json b/js-scripts/generateRedemptionRights/out/merged-distribution.json index cb26a8e..1fae8dc 100644 --- a/js-scripts/generateRedemptionRights/out/merged-distribution.json +++ b/js-scripts/generateRedemptionRights/out/merged-distribution.json @@ -1,24 +1,15 @@ { - "root": "0x602cdd6dd4f1c6f7bb049ce8b23a49e5177dc84830c7f00cc09eb0f11f03d9be", + "root": "0xc6097e6fdabc5c6207fa640553853c9d884cff674602c382f15660914b6d40c7", "redemptionRights": { "0x25E426b153e74Ab36b2685c3A464272De60888Ae": { "0x1852756d70656c206b506f696e743a20457468656e61205332066b7053415453": { "amount": "52792622186481736164", "proof": [ "0xc1a70bb7d5c4ddf647114cb36083bca867a80e37e187aa1d6705f3b12357d7cf", - "0x04a635b0e5b8e5ac70059fb9dc2682f5102a3b4a2f8b2c0d6f1ea43b1e04272f", - "0xab802966e4277e85c878dad4c849c7632735a56c3710c197470de81707286069", - "0x7c0bd8bd630d01f1a459f6cd963cfc5f58487dec582339b1d8f29edbbd41d8ab", - "0x0fe239692610c805880a540ea359a0f3f8314f94bb95cd4ec53d712ae6cdc63d" - ] - } - }, - "0x597a1b0515bbeEe6796B89a6f403c3fD41BB626C": { - "0x1852756d70656c206b506f696e743a20457468656e61205332066b7053415453": { - "amount": "1749589083544816554749", - "proof": [ - "0xf17cd78fb91097d6d817f63f61884a91c8d5ceedefd3ff761ad4621db6cdb688", - "0xc7cee474205709d43f4e6496b9ac27153bc2588c648cf86cef7dfa86f2c440a1" + "0x9202bdda11a41be9ebfe610247d3e971e65959936bdf2d9186395b70d25d8d84", + "0x17c86983941dc9f87b11f6cd1f6f260f2c76f90e16024ad475204e07d99eedf4", + "0xf1dd87dc63132095adce8c1a5ad749892d389821e1d1bf28c5eee065e358695d", + "0xacbcf9b5c8a4d773b3d3fe2e93390fb4b7cb390fd39511981bb1ceed154456fc" ] } }, @@ -28,9 +19,9 @@ "proof": [ "0x0b9dba6343a79836c09a8fe2151dfaeab44a90e1c590e664e142a46c5251c3e4", "0x3aaef79be826edf6d7035f8ece860c534e8fa43b5d7a32581664fd7d9761fe39", - "0x4cd045546ad35fb4ffbe7efabeb3d5e2cfe57317600c887220d3614239de3cdb", - "0xc2a23d2ce2d64e086666994505249bdf18e495b91c1e019ae349a3f6001d6423", - "0x0fe239692610c805880a540ea359a0f3f8314f94bb95cd4ec53d712ae6cdc63d" + "0xd045aba11e229f57f22207671f583c9fd3468713a70ce7237b486653d19d0bc0", + "0x7b0041a106ae3fb142ab4e6da9f6b9958fc667e110122e6e9a7a77c9a574d585", + "0xacbcf9b5c8a4d773b3d3fe2e93390fb4b7cb390fd39511981bb1ceed154456fc" ] } }, @@ -38,11 +29,11 @@ "0x1852756d70656c206b506f696e743a20457468656e61205332066b7053415453": { "amount": "19621036792277125819", "proof": [ - "0x1b9305567ae250a289d9c9a662f2470db6a5b9396d0358bfebe9250f336348b0", - "0x41ea528f3d329e1491631bb9a5a3a1632f5f1c9b308d70c53c855c7cf90924c3", + "0x33b677140d55397d85f1c789cd35975f28bdbb973fa125c5d895a95c1026266b", + "0x6b5537a4b44653f34378b50792bbe235eef8f48b5456fff6eaae8fdce431b45c", "0xbb77a1bb065bc346c4f39dfaff16a845fb2f151394251a08a942b3aa793b654a", - "0xc2a23d2ce2d64e086666994505249bdf18e495b91c1e019ae349a3f6001d6423", - "0x0fe239692610c805880a540ea359a0f3f8314f94bb95cd4ec53d712ae6cdc63d" + "0x7b0041a106ae3fb142ab4e6da9f6b9958fc667e110122e6e9a7a77c9a574d585", + "0xacbcf9b5c8a4d773b3d3fe2e93390fb4b7cb390fd39511981bb1ceed154456fc" ] } }, @@ -50,11 +41,11 @@ "0x1852756d70656c206b506f696e743a20457468656e61205332066b7053415453": { "amount": "7377567032082737967061", "proof": [ - "0x33b677140d55397d85f1c789cd35975f28bdbb973fa125c5d895a95c1026266b", - "0x9a562114e5173cb1802e3635ab3bed9c3c56c74532d5f34d57784f005ded3c36", - "0xbb77a1bb065bc346c4f39dfaff16a845fb2f151394251a08a942b3aa793b654a", - "0xc2a23d2ce2d64e086666994505249bdf18e495b91c1e019ae349a3f6001d6423", - "0x0fe239692610c805880a540ea359a0f3f8314f94bb95cd4ec53d712ae6cdc63d" + "0x5697b38b5bd873ff3a8132059568adf332a3e70b8a5ca3e14c596b4fc43e6671", + "0x42a2346cc718889c9be2af3a107d12cb3900c221558ef5c0b3631f5c3ae2e5d4", + "0xa014a7c4ba0e9689e0f02bf17bc6eeff5d299ddf9dbd54459a03c318237e8e1b", + "0xf1dd87dc63132095adce8c1a5ad749892d389821e1d1bf28c5eee065e358695d", + "0xacbcf9b5c8a4d773b3d3fe2e93390fb4b7cb390fd39511981bb1ceed154456fc" ] } }, @@ -62,8 +53,8 @@ "0x1852756d70656c206b506f696e743a20457468656e61205332066b7053415453": { "amount": "28648231580558995600834", "proof": [ - "0xee2c966b96d8429ef64a79f7d8cb46647213dbb723885eb7a7826c0434797d2a", - "0xc7cee474205709d43f4e6496b9ac27153bc2588c648cf86cef7dfa86f2c440a1" + "0x04a635b0e5b8e5ac70059fb9dc2682f5102a3b4a2f8b2c0d6f1ea43b1e04272f", + "0x5eeefedc919f5dec8d28214722f476b6e1a18460f90e03a3fc4889cae667fb44" ] } }, @@ -73,9 +64,33 @@ "proof": [ "0x1aabefcbeb1ba41043ba86b6019b4f0e9eda103bd89334b2dbd385b4b6fd0fb1", "0xb1b1d68fe165491c5e58654565c779c68f1e0909168fb478480f1ebb22479b4d", - "0x4cd045546ad35fb4ffbe7efabeb3d5e2cfe57317600c887220d3614239de3cdb", - "0xc2a23d2ce2d64e086666994505249bdf18e495b91c1e019ae349a3f6001d6423", - "0x0fe239692610c805880a540ea359a0f3f8314f94bb95cd4ec53d712ae6cdc63d" + "0xd045aba11e229f57f22207671f583c9fd3468713a70ce7237b486653d19d0bc0", + "0x7b0041a106ae3fb142ab4e6da9f6b9958fc667e110122e6e9a7a77c9a574d585", + "0xacbcf9b5c8a4d773b3d3fe2e93390fb4b7cb390fd39511981bb1ceed154456fc" + ] + } + }, + "0x24C694d193B19119bcDea9D40a3b0bfaFb281E6D": { + "0x1852756d70656c206b506f696e743a20457468656e61205332066b7053415453": { + "amount": "411193465672233566", + "proof": [ + "0x3e7e8dbf133ff6472d8567b24ea2be55e0400118c6a72d46442e54bf47351187", + "0x42a2346cc718889c9be2af3a107d12cb3900c221558ef5c0b3631f5c3ae2e5d4", + "0xa014a7c4ba0e9689e0f02bf17bc6eeff5d299ddf9dbd54459a03c318237e8e1b", + "0xf1dd87dc63132095adce8c1a5ad749892d389821e1d1bf28c5eee065e358695d", + "0xacbcf9b5c8a4d773b3d3fe2e93390fb4b7cb390fd39511981bb1ceed154456fc" + ] + } + }, + "0x44Cb2d713BDa3858001f038645fD05E23E5DE03D": { + "0x1852756d70656c206b506f696e743a20457468656e61205332066b7053415453": { + "amount": "1749177890079144448658", + "proof": [ + "0x1b9305567ae250a289d9c9a662f2470db6a5b9396d0358bfebe9250f336348b0", + "0xdcb5ba69bfb574629504575bbbd60386f2a6fade3778baa3d30c24ed53cc754c", + "0xbb77a1bb065bc346c4f39dfaff16a845fb2f151394251a08a942b3aa793b654a", + "0x7b0041a106ae3fb142ab4e6da9f6b9958fc667e110122e6e9a7a77c9a574d585", + "0xacbcf9b5c8a4d773b3d3fe2e93390fb4b7cb390fd39511981bb1ceed154456fc" ] } } @@ -86,10 +101,10 @@ "amount": 833020026897918500000, "proof": [ "0x6ffeeee822b04a5714526489a1b1e6e84d8548d7a8b5cb829fd8d22d86779dde", - "0x9202bdda11a41be9ebfe610247d3e971e65959936bdf2d9186395b70d25d8d84", - "0xfa81e644f935a7f197b15079d105fd9c34398e9f304c0f24a7cdd9a321aa7525", - "0x7c0bd8bd630d01f1a459f6cd963cfc5f58487dec582339b1d8f29edbbd41d8ab", - "0x0fe239692610c805880a540ea359a0f3f8314f94bb95cd4ec53d712ae6cdc63d" + "0x8fd22ab3c90380b53854a307ae16e6cc910904eb906e7f9538a6afb1ead790ce", + "0xa014a7c4ba0e9689e0f02bf17bc6eeff5d299ddf9dbd54459a03c318237e8e1b", + "0xf1dd87dc63132095adce8c1a5ad749892d389821e1d1bf28c5eee065e358695d", + "0xacbcf9b5c8a4d773b3d3fe2e93390fb4b7cb390fd39511981bb1ceed154456fc" ] }, "0x1552756d70656c20506f696e743a205a69726375697408705a49524355495400": { @@ -97,9 +112,9 @@ "proof": [ "0x0fcd36341455485e89dbfc035b03be7d9ec5ceb7edfcb4849c51a457f4585ce7", "0xb1b1d68fe165491c5e58654565c779c68f1e0909168fb478480f1ebb22479b4d", - "0x4cd045546ad35fb4ffbe7efabeb3d5e2cfe57317600c887220d3614239de3cdb", - "0xc2a23d2ce2d64e086666994505249bdf18e495b91c1e019ae349a3f6001d6423", - "0x0fe239692610c805880a540ea359a0f3f8314f94bb95cd4ec53d712ae6cdc63d" + "0xd045aba11e229f57f22207671f583c9fd3468713a70ce7237b486653d19d0bc0", + "0x7b0041a106ae3fb142ab4e6da9f6b9958fc667e110122e6e9a7a77c9a574d585", + "0xacbcf9b5c8a4d773b3d3fe2e93390fb4b7cb390fd39511981bb1ceed154456fc" ] } }, @@ -108,10 +123,10 @@ "amount": 152407798291890470000, "proof": [ "0x9dd5c63d7a85ebb90ea35dd0f5fb54974ae79d761c86e3c469616d0b2eaeff67", - "0x42a2346cc718889c9be2af3a107d12cb3900c221558ef5c0b3631f5c3ae2e5d4", - "0xfa81e644f935a7f197b15079d105fd9c34398e9f304c0f24a7cdd9a321aa7525", - "0x7c0bd8bd630d01f1a459f6cd963cfc5f58487dec582339b1d8f29edbbd41d8ab", - "0x0fe239692610c805880a540ea359a0f3f8314f94bb95cd4ec53d712ae6cdc63d" + "0x403c3bb7b0ff32cb4e934edd9801aa0eec0ff624fe9a0845cb35a7375e02c25d", + "0x17c86983941dc9f87b11f6cd1f6f260f2c76f90e16024ad475204e07d99eedf4", + "0xf1dd87dc63132095adce8c1a5ad749892d389821e1d1bf28c5eee065e358695d", + "0xacbcf9b5c8a4d773b3d3fe2e93390fb4b7cb390fd39511981bb1ceed154456fc" ] } }, @@ -120,10 +135,10 @@ "amount": 131187337543613430000, "proof": [ "0x73c25d42a5988fcc27384ecf9fbc2f810c9f862e977db0f73e9cabf68ac9e5b6", - "0x42a2346cc718889c9be2af3a107d12cb3900c221558ef5c0b3631f5c3ae2e5d4", - "0xfa81e644f935a7f197b15079d105fd9c34398e9f304c0f24a7cdd9a321aa7525", - "0x7c0bd8bd630d01f1a459f6cd963cfc5f58487dec582339b1d8f29edbbd41d8ab", - "0x0fe239692610c805880a540ea359a0f3f8314f94bb95cd4ec53d712ae6cdc63d" + "0x403c3bb7b0ff32cb4e934edd9801aa0eec0ff624fe9a0845cb35a7375e02c25d", + "0x17c86983941dc9f87b11f6cd1f6f260f2c76f90e16024ad475204e07d99eedf4", + "0xf1dd87dc63132095adce8c1a5ad749892d389821e1d1bf28c5eee065e358695d", + "0xacbcf9b5c8a4d773b3d3fe2e93390fb4b7cb390fd39511981bb1ceed154456fc" ] } }, @@ -132,10 +147,10 @@ "amount": 73286503362495650000, "proof": [ "0x6b691008971e9ab0b1581861b6e542943b4ea3ef91df9fd3e3167e16dfe61eab", - "0x9202bdda11a41be9ebfe610247d3e971e65959936bdf2d9186395b70d25d8d84", - "0xfa81e644f935a7f197b15079d105fd9c34398e9f304c0f24a7cdd9a321aa7525", - "0x7c0bd8bd630d01f1a459f6cd963cfc5f58487dec582339b1d8f29edbbd41d8ab", - "0x0fe239692610c805880a540ea359a0f3f8314f94bb95cd4ec53d712ae6cdc63d" + "0x8fd22ab3c90380b53854a307ae16e6cc910904eb906e7f9538a6afb1ead790ce", + "0xa014a7c4ba0e9689e0f02bf17bc6eeff5d299ddf9dbd54459a03c318237e8e1b", + "0xf1dd87dc63132095adce8c1a5ad749892d389821e1d1bf28c5eee065e358695d", + "0xacbcf9b5c8a4d773b3d3fe2e93390fb4b7cb390fd39511981bb1ceed154456fc" ] } }, @@ -144,10 +159,8 @@ "amount": 4.977606283426392e+21, "proof": [ "0xd1c3a5f261d26002eb7ea89e24b742b91b073fd272fadc4384323899b277f04e", - "0x403c3bb7b0ff32cb4e934edd9801aa0eec0ff624fe9a0845cb35a7375e02c25d", - "0xab802966e4277e85c878dad4c849c7632735a56c3710c197470de81707286069", - "0x7c0bd8bd630d01f1a459f6cd963cfc5f58487dec582339b1d8f29edbbd41d8ab", - "0x0fe239692610c805880a540ea359a0f3f8314f94bb95cd4ec53d712ae6cdc63d" + "0xf17cd78fb91097d6d817f63f61884a91c8d5ceedefd3ff761ad4621db6cdb688", + "0x5eeefedc919f5dec8d28214722f476b6e1a18460f90e03a3fc4889cae667fb44" ] } }, @@ -155,11 +168,11 @@ "0x1852756d70656c206b506f696e743a20457468656e61205332066b7053415453": { "amount": 2.8303575270814903e+21, "proof": [ - "0x3e7e8dbf133ff6472d8567b24ea2be55e0400118c6a72d46442e54bf47351187", - "0x9a562114e5173cb1802e3635ab3bed9c3c56c74532d5f34d57784f005ded3c36", + "0x317c7eb5a0fffec11dd2d7b3d0bfd2fe201bf9ff67627a43990ad1ad51714da3", + "0x6b5537a4b44653f34378b50792bbe235eef8f48b5456fff6eaae8fdce431b45c", "0xbb77a1bb065bc346c4f39dfaff16a845fb2f151394251a08a942b3aa793b654a", - "0xc2a23d2ce2d64e086666994505249bdf18e495b91c1e019ae349a3f6001d6423", - "0x0fe239692610c805880a540ea359a0f3f8314f94bb95cd4ec53d712ae6cdc63d" + "0x7b0041a106ae3fb142ab4e6da9f6b9958fc667e110122e6e9a7a77c9a574d585", + "0xacbcf9b5c8a4d773b3d3fe2e93390fb4b7cb390fd39511981bb1ceed154456fc" ] } }, @@ -168,10 +181,8 @@ "amount": 5.225302412387277e+23, "proof": [ "0xd6edec91605da1894e0fa3cdbb82e2005d9b05584aacb82d8c407725b9b3641d", - "0x403c3bb7b0ff32cb4e934edd9801aa0eec0ff624fe9a0845cb35a7375e02c25d", - "0xab802966e4277e85c878dad4c849c7632735a56c3710c197470de81707286069", - "0x7c0bd8bd630d01f1a459f6cd963cfc5f58487dec582339b1d8f29edbbd41d8ab", - "0x0fe239692610c805880a540ea359a0f3f8314f94bb95cd4ec53d712ae6cdc63d" + "0xf17cd78fb91097d6d817f63f61884a91c8d5ceedefd3ff761ad4621db6cdb688", + "0x5eeefedc919f5dec8d28214722f476b6e1a18460f90e03a3fc4889cae667fb44" ] } }, @@ -180,10 +191,10 @@ "amount": 2.621060441200294e+23, "proof": [ "0x9f06e030a1a0be00f37013433e8d97e2d1cf5ee1ad68da103114e6e82ab92c5f", - "0x04a635b0e5b8e5ac70059fb9dc2682f5102a3b4a2f8b2c0d6f1ea43b1e04272f", - "0xab802966e4277e85c878dad4c849c7632735a56c3710c197470de81707286069", - "0x7c0bd8bd630d01f1a459f6cd963cfc5f58487dec582339b1d8f29edbbd41d8ab", - "0x0fe239692610c805880a540ea359a0f3f8314f94bb95cd4ec53d712ae6cdc63d" + "0x9202bdda11a41be9ebfe610247d3e971e65959936bdf2d9186395b70d25d8d84", + "0x17c86983941dc9f87b11f6cd1f6f260f2c76f90e16024ad475204e07d99eedf4", + "0xf1dd87dc63132095adce8c1a5ad749892d389821e1d1bf28c5eee065e358695d", + "0xacbcf9b5c8a4d773b3d3fe2e93390fb4b7cb390fd39511981bb1ceed154456fc" ] } }, @@ -191,11 +202,11 @@ "0x1852756d70656c206b506f696e743a20457468656e61205332066b7053415453": { "amount": 9.888353035952251e+23, "proof": [ - "0x317c7eb5a0fffec11dd2d7b3d0bfd2fe201bf9ff67627a43990ad1ad51714da3", - "0x41ea528f3d329e1491631bb9a5a3a1632f5f1c9b308d70c53c855c7cf90924c3", + "0x2baa966a98f9d55368c9d2f23afeea2683b639aeb56babe41bd7f4d0d727970e", + "0xdcb5ba69bfb574629504575bbbd60386f2a6fade3778baa3d30c24ed53cc754c", "0xbb77a1bb065bc346c4f39dfaff16a845fb2f151394251a08a942b3aa793b654a", - "0xc2a23d2ce2d64e086666994505249bdf18e495b91c1e019ae349a3f6001d6423", - "0x0fe239692610c805880a540ea359a0f3f8314f94bb95cd4ec53d712ae6cdc63d" + "0x7b0041a106ae3fb142ab4e6da9f6b9958fc667e110122e6e9a7a77c9a574d585", + "0xacbcf9b5c8a4d773b3d3fe2e93390fb4b7cb390fd39511981bb1ceed154456fc" ] } }, @@ -205,9 +216,9 @@ "proof": [ "0x0d204e0c13988dc6ad8a13ec4b0ed7ad17ab5a668edc8accfcce7f2bfdade628", "0x3aaef79be826edf6d7035f8ece860c534e8fa43b5d7a32581664fd7d9761fe39", - "0x4cd045546ad35fb4ffbe7efabeb3d5e2cfe57317600c887220d3614239de3cdb", - "0xc2a23d2ce2d64e086666994505249bdf18e495b91c1e019ae349a3f6001d6423", - "0x0fe239692610c805880a540ea359a0f3f8314f94bb95cd4ec53d712ae6cdc63d" + "0xd045aba11e229f57f22207671f583c9fd3468713a70ce7237b486653d19d0bc0", + "0x7b0041a106ae3fb142ab4e6da9f6b9958fc667e110122e6e9a7a77c9a574d585", + "0xacbcf9b5c8a4d773b3d3fe2e93390fb4b7cb390fd39511981bb1ceed154456fc" ] } } diff --git a/js-scripts/generateRedemptionRights/out/ptoken-snapshot-kpsats.json b/js-scripts/generateRedemptionRights/out/ptoken-snapshot-kpsats.json new file mode 100644 index 0000000..82c6f4f --- /dev/null +++ b/js-scripts/generateRedemptionRights/out/ptoken-snapshot-kpsats.json @@ -0,0 +1,14 @@ +{ + "address": "0xdFa21ceC8A46386F5d36F4b07E18BcCcA59f425B", + "blockNumber": "21073410", + "balances": { + "0x25E426b153e74Ab36b2685c3A464272De60888Ae": "832939015897918484874", + "0xAF9e4E01525C4856E00Cb0F363AFc34E7decD6a7": "1209830694094345523934847", + "0x6CD72B1E6E300340A48943d6aF34EF5AE07D3577": "309572178834508409860", + "0x1d848bf0dcF1b48f5621c37d062f2696D9d71AC4": "116400041689867972616256", + "0x76DB9edf1451933711fc0A0c622E013ebD229EaB": "451999329293340648396874", + "0xB6462B67fe692223DFFb61C8DC8Ad080CBa180Cc": "195548998385752443216151", + "0x24C694d193B19119bcDea9D40a3b0bfaFb281E6D": "6487631537430740992", + "0x44Cb2d713BDa3858001f038645fD05E23E5DE03D": "27597767454066600837120" + } +} \ No newline at end of file diff --git a/js-scripts/generateRedemptionRights/out/ptoken-snapshots.json b/js-scripts/generateRedemptionRights/out/ptoken-snapshots.json deleted file mode 100644 index f2c350b..0000000 --- a/js-scripts/generateRedemptionRights/out/ptoken-snapshots.json +++ /dev/null @@ -1,14 +0,0 @@ -{ - "0xdFa21ceC8A46386F5d36F4b07E18BcCcA59f425B": { - "blockNumber": "21068499", - "balances": { - "0x25E426b153e74Ab36b2685c3A464272De60888Ae": "832939015897918484874", - "0x597a1b0515bbeEe6796B89a6f403c3fD41BB626C": "27604255085604029567224", - "0xAF9e4E01525C4856E00Cb0F363AFc34E7decD6a7": "1209830694094345523934847", - "0x6CD72B1E6E300340A48943d6aF34EF5AE07D3577": "309572178834508409860", - "0x1d848bf0dcF1b48f5621c37d062f2696D9d71AC4": "116400041689867972616256", - "0x76DB9edf1451933711fc0A0c622E013ebD229EaB": "451999329293340648396874", - "0xB6462B67fe692223DFFb61C8DC8Ad080CBa180Cc": "195548998385752443216151" - } - } -} \ No newline at end of file From 79419843f9654694e2eec7a315ad0dc1ef76c37f Mon Sep 17 00:00:00 2001 From: Josh Levine Date: Tue, 29 Oct 2024 12:45:58 -0700 Subject: [PATCH 07/16] fix: avoid ts warning --- js-scripts/generateRedemptionRights/index.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/js-scripts/generateRedemptionRights/index.ts b/js-scripts/generateRedemptionRights/index.ts index 09e20ce..1a21d7f 100644 --- a/js-scripts/generateRedemptionRights/index.ts +++ b/js-scripts/generateRedemptionRights/index.ts @@ -319,8 +319,8 @@ async function generateMerkleTree(): Promise { // Add address to the snapshot data const snapshotWithAddress: PTokenSnapshot = { - address: pTokenAddress as Address, ...snapshot, + address: pTokenAddress as Address, }; fs.writeFileSync( From b1a59d482b15b985d3d0d7db751d612623003ff9 Mon Sep 17 00:00:00 2001 From: Josh Levine Date: Sun, 3 Nov 2024 00:29:27 -0700 Subject: [PATCH 08/16] chore: account for unclaimed ptokens in red rights calc --- bun.lockb | Bin 32049 -> 17502 bytes .../abis/point-token-vault.ts | 914 ++++++++++++++++++ js-scripts/generateRedemptionRights/index.ts | 64 +- .../out/merged-distribution.json | 204 ++-- .../out/ptoken-snapshot-kpsats.json | 13 +- package.json | 1 + 6 files changed, 1074 insertions(+), 122 deletions(-) create mode 100644 js-scripts/generateRedemptionRights/abis/point-token-vault.ts diff --git a/bun.lockb b/bun.lockb index cbaa428741dec383e4d36cf71d11f27c8a03eae8..13f08c74db040a528cb794a4f511137e3f636225 100755 GIT binary patch delta 2846 zcmds3X>3$g6n=Ngw0$#_g00YD>I`e4%e=PJWoBBL*HS=alS<39h(M6CRBVAE4MU+V z5sWM<^#~FoAQVJNFl|baffU3Aeh4Hei$p{!e+aU;L_&)czw>5ZB9i#WA10pU-0z;{ zo_p`PYfG27^19flB*!Vm*`uCWvwr8k4s+e8vXg~pSFhSI@8CFJ$tktQq{wHAB#j)6 zKKuC2w2%-g2S`#w&4P+oSZW9Nh1?8`0XBtka~RhFdqUsGAW3FmUE^_keL+~cH$sw3 zP-gcC1<@PZAwLQI--FbJ+r`4(8+KcyB*g;bfgC3SdhYBRWVYu=h3vDdluAF^-a~&F zgsDM9hemUo76^OkcBo~zZv^%Nt_E_LEHvRc&8c2mQB@;JDUjLkUG&9sxeR2#H-V4o zTW=XsMel}b`7<`$Tzj{+W%}FowdZfsSmS`+jp@_gNNOA5k*l9Raie(a5t?tDEGAIU zsETi>6Q!Lzk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*Ahp1%g>Z++_t+PLXGTk295pwv^) z9`?vvTmlM;7Cj%pUOa!vE7;%`Y-%^tIr(t@mNXPEI)TFRJ3d%43bwod_x}DLFE0!N diff --git a/js-scripts/generateRedemptionRights/abis/point-token-vault.ts b/js-scripts/generateRedemptionRights/abis/point-token-vault.ts new file mode 100644 index 0000000..197a192 --- /dev/null +++ b/js-scripts/generateRedemptionRights/abis/point-token-vault.ts @@ -0,0 +1,914 @@ +export const pointTokenVaultABI = [ + { type: "constructor", inputs: [], stateMutability: "nonpayable" }, + { type: "receive", stateMutability: "payable" }, + { + type: "function", + name: "DEFAULT_ADMIN_ROLE", + inputs: [], + outputs: [{ name: "", type: "bytes32", internalType: "bytes32" }], + stateMutability: "view", + }, + { + type: "function", + name: "MERKLE_UPDATER_ROLE", + inputs: [], + outputs: [{ name: "", type: "bytes32", internalType: "bytes32" }], + stateMutability: "view", + }, + { + type: "function", + name: "OPERATOR_ROLE", + inputs: [], + outputs: [{ name: "", type: "bytes32", internalType: "bytes32" }], + stateMutability: "view", + }, + { + type: "function", + name: "REDEMPTION_RIGHTS_PREFIX", + inputs: [], + outputs: [{ name: "", type: "bytes32", internalType: "bytes32" }], + stateMutability: "view", + }, + { + type: "function", + name: "UPGRADE_INTERFACE_VERSION", + inputs: [], + outputs: [{ name: "", type: "string", internalType: "string" }], + stateMutability: "view", + }, + { + type: "function", + name: "balances", + inputs: [ + { name: "", type: "address", internalType: "address" }, + { name: "", type: "address", internalType: "contract ERC20" }, + ], + outputs: [{ name: "", type: "uint256", internalType: "uint256" }], + stateMutability: "view", + }, + { + type: "function", + name: "caps", + inputs: [{ name: "", type: "address", internalType: "address" }], + outputs: [{ name: "", type: "uint256", internalType: "uint256" }], + stateMutability: "view", + }, + { + type: "function", + name: "claimPTokens", + inputs: [ + { + name: "_claim", + type: "tuple", + internalType: "struct PointTokenVault.Claim", + components: [ + { name: "pointsId", type: "bytes32", internalType: "bytes32" }, + { name: "totalClaimable", type: "uint256", internalType: "uint256" }, + { name: "amountToClaim", type: "uint256", internalType: "uint256" }, + { name: "proof", type: "bytes32[]", internalType: "bytes32[]" }, + ], + }, + { name: "_account", type: "address", internalType: "address" }, + { name: "_receiver", type: "address", internalType: "address" }, + ], + outputs: [], + stateMutability: "nonpayable", + }, + { + type: "function", + name: "claimedPTokens", + inputs: [ + { name: "", type: "address", internalType: "address" }, + { name: "", type: "bytes32", internalType: "bytes32" }, + ], + outputs: [{ name: "", type: "uint256", internalType: "uint256" }], + stateMutability: "view", + }, + { + type: "function", + name: "claimedRedemptionRights", + inputs: [ + { name: "", type: "address", internalType: "address" }, + { name: "", type: "bytes32", internalType: "bytes32" }, + ], + outputs: [{ name: "", type: "uint256", internalType: "uint256" }], + stateMutability: "view", + }, + { + type: "function", + name: "collectFees", + inputs: [{ name: "_pointsId", type: "bytes32", internalType: "bytes32" }], + outputs: [], + stateMutability: "nonpayable", + }, + { + type: "function", + name: "convertRewardsToPTokens", + inputs: [ + { name: "_receiver", type: "address", internalType: "address" }, + { name: "_pointsId", type: "bytes32", internalType: "bytes32" }, + { name: "_amountToConvert", type: "uint256", internalType: "uint256" }, + ], + outputs: [], + stateMutability: "nonpayable", + }, + { + type: "function", + name: "currRoot", + inputs: [], + outputs: [{ name: "", type: "bytes32", internalType: "bytes32" }], + stateMutability: "view", + }, + { + type: "function", + name: "deployPToken", + inputs: [{ name: "_pointsId", type: "bytes32", internalType: "bytes32" }], + outputs: [ + { name: "pToken", type: "address", internalType: "contract PToken" }, + ], + stateMutability: "nonpayable", + }, + { + type: "function", + name: "deposit", + inputs: [ + { name: "_token", type: "address", internalType: "contract ERC20" }, + { name: "_amount", type: "uint256", internalType: "uint256" }, + { name: "_receiver", type: "address", internalType: "address" }, + ], + outputs: [], + stateMutability: "nonpayable", + }, + { + type: "function", + name: "execute", + inputs: [ + { name: "_to", type: "address", internalType: "address" }, + { name: "_data", type: "bytes", internalType: "bytes" }, + { name: "_txGas", type: "uint256", internalType: "uint256" }, + ], + outputs: [{ name: "success", type: "bool", internalType: "bool" }], + stateMutability: "nonpayable", + }, + { + type: "function", + name: "feeCollector", + inputs: [], + outputs: [{ name: "", type: "address", internalType: "address" }], + stateMutability: "view", + }, + { + type: "function", + name: "feelesslyRedeemedPTokens", + inputs: [ + { name: "", type: "address", internalType: "address" }, + { name: "", type: "bytes32", internalType: "bytes32" }, + ], + outputs: [{ name: "", type: "uint256", internalType: "uint256" }], + stateMutability: "view", + }, + { + type: "function", + name: "getRoleAdmin", + inputs: [{ name: "role", type: "bytes32", internalType: "bytes32" }], + outputs: [{ name: "", type: "bytes32", internalType: "bytes32" }], + stateMutability: "view", + }, + { + type: "function", + name: "grantRole", + inputs: [ + { name: "role", type: "bytes32", internalType: "bytes32" }, + { name: "account", type: "address", internalType: "address" }, + ], + outputs: [], + stateMutability: "nonpayable", + }, + { + type: "function", + name: "hasRole", + inputs: [ + { name: "role", type: "bytes32", internalType: "bytes32" }, + { name: "account", type: "address", internalType: "address" }, + ], + outputs: [{ name: "", type: "bool", internalType: "bool" }], + stateMutability: "view", + }, + { + type: "function", + name: "initialize", + inputs: [ + { name: "_admin", type: "address", internalType: "address" }, + { name: "_feeCollector", type: "address", internalType: "address" }, + ], + outputs: [], + stateMutability: "nonpayable", + }, + { + type: "function", + name: "mintFee", + inputs: [], + outputs: [{ name: "", type: "uint256", internalType: "uint256" }], + stateMutability: "view", + }, + { + type: "function", + name: "multicall", + inputs: [{ name: "data", type: "bytes[]", internalType: "bytes[]" }], + outputs: [{ name: "results", type: "bytes[]", internalType: "bytes[]" }], + stateMutability: "nonpayable", + }, + { + type: "function", + name: "pTokenFeeAcc", + inputs: [{ name: "", type: "bytes32", internalType: "bytes32" }], + outputs: [{ name: "", type: "uint256", internalType: "uint256" }], + stateMutability: "view", + }, + { + type: "function", + name: "pTokens", + inputs: [{ name: "", type: "bytes32", internalType: "bytes32" }], + outputs: [{ name: "", type: "address", internalType: "contract PToken" }], + stateMutability: "view", + }, + { + type: "function", + name: "pausePToken", + inputs: [{ name: "_pointsId", type: "bytes32", internalType: "bytes32" }], + outputs: [], + stateMutability: "nonpayable", + }, + { + type: "function", + name: "prevRoot", + inputs: [], + outputs: [{ name: "", type: "bytes32", internalType: "bytes32" }], + stateMutability: "view", + }, + { + type: "function", + name: "proxiableUUID", + inputs: [], + outputs: [{ name: "", type: "bytes32", internalType: "bytes32" }], + stateMutability: "view", + }, + { + type: "function", + name: "redeemRewards", + inputs: [ + { + name: "_claim", + type: "tuple", + internalType: "struct PointTokenVault.Claim", + components: [ + { name: "pointsId", type: "bytes32", internalType: "bytes32" }, + { name: "totalClaimable", type: "uint256", internalType: "uint256" }, + { name: "amountToClaim", type: "uint256", internalType: "uint256" }, + { name: "proof", type: "bytes32[]", internalType: "bytes32[]" }, + ], + }, + { name: "_receiver", type: "address", internalType: "address" }, + ], + outputs: [], + stateMutability: "nonpayable", + }, + { + type: "function", + name: "redemptionFee", + inputs: [], + outputs: [{ name: "", type: "uint256", internalType: "uint256" }], + stateMutability: "view", + }, + { + type: "function", + name: "redemptions", + inputs: [{ name: "", type: "bytes32", internalType: "bytes32" }], + outputs: [ + { name: "rewardToken", type: "address", internalType: "contract ERC20" }, + { name: "rewardsPerPToken", type: "uint256", internalType: "uint256" }, + { name: "isMerkleBased", type: "bool", internalType: "bool" }, + ], + stateMutability: "view", + }, + { + type: "function", + name: "renouncePauseRole", + inputs: [{ name: "_pointsId", type: "bytes32", internalType: "bytes32" }], + outputs: [], + stateMutability: "nonpayable", + }, + { + type: "function", + name: "renounceRole", + inputs: [ + { name: "role", type: "bytes32", internalType: "bytes32" }, + { name: "callerConfirmation", type: "address", internalType: "address" }, + ], + outputs: [], + stateMutability: "nonpayable", + }, + { + type: "function", + name: "revokeRole", + inputs: [ + { name: "role", type: "bytes32", internalType: "bytes32" }, + { name: "account", type: "address", internalType: "address" }, + ], + outputs: [], + stateMutability: "nonpayable", + }, + { + type: "function", + name: "rewardTokenFeeAcc", + inputs: [{ name: "", type: "bytes32", internalType: "bytes32" }], + outputs: [{ name: "", type: "uint256", internalType: "uint256" }], + stateMutability: "view", + }, + { + type: "function", + name: "setCap", + inputs: [ + { name: "_token", type: "address", internalType: "address" }, + { name: "_cap", type: "uint256", internalType: "uint256" }, + ], + outputs: [], + stateMutability: "nonpayable", + }, + { + type: "function", + name: "setFeeCollector", + inputs: [ + { name: "_feeCollector", type: "address", internalType: "address" }, + ], + outputs: [], + stateMutability: "nonpayable", + }, + { + type: "function", + name: "setMintFee", + inputs: [{ name: "_mintFee", type: "uint256", internalType: "uint256" }], + outputs: [], + stateMutability: "nonpayable", + }, + { + type: "function", + name: "setRedemption", + inputs: [ + { name: "_pointsId", type: "bytes32", internalType: "bytes32" }, + { name: "_rewardToken", type: "address", internalType: "contract ERC20" }, + { name: "_rewardsPerPToken", type: "uint256", internalType: "uint256" }, + { name: "_isMerkleBased", type: "bool", internalType: "bool" }, + ], + outputs: [], + stateMutability: "nonpayable", + }, + { + type: "function", + name: "setRedemptionFee", + inputs: [ + { name: "_redemptionFee", type: "uint256", internalType: "uint256" }, + ], + outputs: [], + stateMutability: "nonpayable", + }, + { + type: "function", + name: "supportsInterface", + inputs: [{ name: "interfaceId", type: "bytes4", internalType: "bytes4" }], + outputs: [{ name: "", type: "bool", internalType: "bool" }], + stateMutability: "view", + }, + { + type: "function", + name: "totalDeposited", + inputs: [{ name: "", type: "address", internalType: "address" }], + outputs: [{ name: "", type: "uint256", internalType: "uint256" }], + stateMutability: "view", + }, + { + type: "function", + name: "trustReceiver", + inputs: [ + { name: "_account", type: "address", internalType: "address" }, + { name: "_isTrusted", type: "bool", internalType: "bool" }, + ], + outputs: [], + stateMutability: "nonpayable", + }, + { + type: "function", + name: "trustedReceivers", + inputs: [ + { name: "", type: "address", internalType: "address" }, + { name: "", type: "address", internalType: "address" }, + ], + outputs: [{ name: "", type: "bool", internalType: "bool" }], + stateMutability: "view", + }, + { + type: "function", + name: "unpausePToken", + inputs: [{ name: "_pointsId", type: "bytes32", internalType: "bytes32" }], + outputs: [], + stateMutability: "nonpayable", + }, + { + type: "function", + name: "updateRoot", + inputs: [{ name: "_newRoot", type: "bytes32", internalType: "bytes32" }], + outputs: [], + stateMutability: "nonpayable", + }, + { + type: "function", + name: "upgradeToAndCall", + inputs: [ + { name: "newImplementation", type: "address", internalType: "address" }, + { name: "data", type: "bytes", internalType: "bytes" }, + ], + outputs: [], + stateMutability: "payable", + }, + { + type: "function", + name: "withdraw", + inputs: [ + { name: "_token", type: "address", internalType: "contract ERC20" }, + { name: "_amount", type: "uint256", internalType: "uint256" }, + { name: "_receiver", type: "address", internalType: "address" }, + ], + outputs: [], + stateMutability: "nonpayable", + }, + { + type: "event", + name: "CapSet", + inputs: [ + { + name: "token", + type: "address", + indexed: true, + internalType: "address", + }, + { + name: "prevCap", + type: "uint256", + indexed: false, + internalType: "uint256", + }, + { name: "cap", type: "uint256", indexed: false, internalType: "uint256" }, + ], + anonymous: false, + }, + { + type: "event", + name: "Deposit", + inputs: [ + { + name: "depositor", + type: "address", + indexed: true, + internalType: "address", + }, + { + name: "receiver", + type: "address", + indexed: true, + internalType: "address", + }, + { + name: "token", + type: "address", + indexed: true, + internalType: "address", + }, + { + name: "amount", + type: "uint256", + indexed: false, + internalType: "uint256", + }, + ], + anonymous: false, + }, + { + type: "event", + name: "FeeCollectorSet", + inputs: [ + { + name: "feeCollector", + type: "address", + indexed: false, + internalType: "address", + }, + ], + anonymous: false, + }, + { + type: "event", + name: "FeesCollected", + inputs: [ + { + name: "pointsId", + type: "bytes32", + indexed: true, + internalType: "bytes32", + }, + { + name: "feeCollector", + type: "address", + indexed: true, + internalType: "address", + }, + { + name: "pTokenFee", + type: "uint256", + indexed: false, + internalType: "uint256", + }, + { + name: "rewardTokenFee", + type: "uint256", + indexed: false, + internalType: "uint256", + }, + ], + anonymous: false, + }, + { + type: "event", + name: "Initialized", + inputs: [ + { + name: "version", + type: "uint64", + indexed: false, + internalType: "uint64", + }, + ], + anonymous: false, + }, + { + type: "event", + name: "MintFeeSet", + inputs: [ + { + name: "mintFee", + type: "uint256", + indexed: false, + internalType: "uint256", + }, + ], + anonymous: false, + }, + { + type: "event", + name: "PTokenDeployed", + inputs: [ + { + name: "pointsId", + type: "bytes32", + indexed: true, + internalType: "bytes32", + }, + { + name: "pToken", + type: "address", + indexed: true, + internalType: "address", + }, + ], + anonymous: false, + }, + { + type: "event", + name: "PTokensClaimed", + inputs: [ + { + name: "account", + type: "address", + indexed: true, + internalType: "address", + }, + { + name: "receiver", + type: "address", + indexed: true, + internalType: "address", + }, + { + name: "pointsId", + type: "bytes32", + indexed: true, + internalType: "bytes32", + }, + { + name: "amount", + type: "uint256", + indexed: false, + internalType: "uint256", + }, + { name: "fee", type: "uint256", indexed: false, internalType: "uint256" }, + ], + anonymous: false, + }, + { + type: "event", + name: "RedemptionFeeSet", + inputs: [ + { + name: "redemptionFee", + type: "uint256", + indexed: false, + internalType: "uint256", + }, + ], + anonymous: false, + }, + { + type: "event", + name: "RewardRedemptionSet", + inputs: [ + { + name: "pointsId", + type: "bytes32", + indexed: true, + internalType: "bytes32", + }, + { + name: "rewardToken", + type: "address", + indexed: false, + internalType: "contract ERC20", + }, + { + name: "rewardsPerPToken", + type: "uint256", + indexed: false, + internalType: "uint256", + }, + { + name: "isMerkleBased", + type: "bool", + indexed: false, + internalType: "bool", + }, + ], + anonymous: false, + }, + { + type: "event", + name: "RewardsClaimed", + inputs: [ + { + name: "owner", + type: "address", + indexed: true, + internalType: "address", + }, + { + name: "receiver", + type: "address", + indexed: true, + internalType: "address", + }, + { + name: "pointsId", + type: "bytes32", + indexed: true, + internalType: "bytes32", + }, + { + name: "amount", + type: "uint256", + indexed: false, + internalType: "uint256", + }, + { name: "fee", type: "uint256", indexed: false, internalType: "uint256" }, + ], + anonymous: false, + }, + { + type: "event", + name: "RewardsConverted", + inputs: [ + { + name: "owner", + type: "address", + indexed: true, + internalType: "address", + }, + { + name: "receiver", + type: "address", + indexed: true, + internalType: "address", + }, + { + name: "pointsId", + type: "bytes32", + indexed: true, + internalType: "bytes32", + }, + { + name: "amount", + type: "uint256", + indexed: false, + internalType: "uint256", + }, + ], + anonymous: false, + }, + { + type: "event", + name: "RoleAdminChanged", + inputs: [ + { name: "role", type: "bytes32", indexed: true, internalType: "bytes32" }, + { + name: "previousAdminRole", + type: "bytes32", + indexed: true, + internalType: "bytes32", + }, + { + name: "newAdminRole", + type: "bytes32", + indexed: true, + internalType: "bytes32", + }, + ], + anonymous: false, + }, + { + type: "event", + name: "RoleGranted", + inputs: [ + { name: "role", type: "bytes32", indexed: true, internalType: "bytes32" }, + { + name: "account", + type: "address", + indexed: true, + internalType: "address", + }, + { + name: "sender", + type: "address", + indexed: true, + internalType: "address", + }, + ], + anonymous: false, + }, + { + type: "event", + name: "RoleRevoked", + inputs: [ + { name: "role", type: "bytes32", indexed: true, internalType: "bytes32" }, + { + name: "account", + type: "address", + indexed: true, + internalType: "address", + }, + { + name: "sender", + type: "address", + indexed: true, + internalType: "address", + }, + ], + anonymous: false, + }, + { + type: "event", + name: "RootUpdated", + inputs: [ + { + name: "prevRoot", + type: "bytes32", + indexed: false, + internalType: "bytes32", + }, + { + name: "newRoot", + type: "bytes32", + indexed: false, + internalType: "bytes32", + }, + ], + anonymous: false, + }, + { + type: "event", + name: "TrustReceiver", + inputs: [ + { + name: "owner", + type: "address", + indexed: true, + internalType: "address", + }, + { + name: "delegate", + type: "address", + indexed: true, + internalType: "address", + }, + { name: "isTrusted", type: "bool", indexed: false, internalType: "bool" }, + ], + anonymous: false, + }, + { + type: "event", + name: "Upgraded", + inputs: [ + { + name: "implementation", + type: "address", + indexed: true, + internalType: "address", + }, + ], + anonymous: false, + }, + { + type: "event", + name: "Withdraw", + inputs: [ + { + name: "withdrawer", + type: "address", + indexed: true, + internalType: "address", + }, + { + name: "receiver", + type: "address", + indexed: true, + internalType: "address", + }, + { + name: "token", + type: "address", + indexed: true, + internalType: "address", + }, + { + name: "amount", + type: "uint256", + indexed: false, + internalType: "uint256", + }, + ], + anonymous: false, + }, + { type: "error", name: "AccessControlBadConfirmation", inputs: [] }, + { + type: "error", + name: "AccessControlUnauthorizedAccount", + inputs: [ + { name: "account", type: "address", internalType: "address" }, + { name: "neededRole", type: "bytes32", internalType: "bytes32" }, + ], + }, + { + type: "error", + name: "AddressEmptyCode", + inputs: [{ name: "target", type: "address", internalType: "address" }], + }, + { type: "error", name: "AmountTooSmall", inputs: [] }, + { type: "error", name: "CantConvertMerkleRedemption", inputs: [] }, + { type: "error", name: "ClaimTooLarge", inputs: [] }, + { type: "error", name: "DepositExceedsCap", inputs: [] }, + { + type: "error", + name: "ERC1967InvalidImplementation", + inputs: [ + { name: "implementation", type: "address", internalType: "address" }, + ], + }, + { type: "error", name: "ERC1967NonPayable", inputs: [] }, + { + type: "error", + name: "ExecutionFailed", + inputs: [ + { name: "to", type: "address", internalType: "address" }, + { name: "data", type: "bytes", internalType: "bytes" }, + ], + }, + { type: "error", name: "FailedCall", inputs: [] }, + { type: "error", name: "InvalidInitialization", inputs: [] }, + { type: "error", name: "NotInitializing", inputs: [] }, + { type: "error", name: "NotTrustedReceiver", inputs: [] }, + { type: "error", name: "PTokenAlreadyDeployed", inputs: [] }, + { type: "error", name: "PTokenNotDeployed", inputs: [] }, + { type: "error", name: "ProofInvalidOrExpired", inputs: [] }, + { type: "error", name: "RewardsNotLive", inputs: [] }, + { type: "error", name: "UUPSUnauthorizedCallContext", inputs: [] }, + { + type: "error", + name: "UUPSUnsupportedProxiableUUID", + inputs: [{ name: "slot", type: "bytes32", internalType: "bytes32" }], + }, +]; diff --git a/js-scripts/generateRedemptionRights/index.ts b/js-scripts/generateRedemptionRights/index.ts index 1a21d7f..dc8c0d1 100644 --- a/js-scripts/generateRedemptionRights/index.ts +++ b/js-scripts/generateRedemptionRights/index.ts @@ -14,6 +14,8 @@ import { } from "viem"; import { mainnet } from "viem/chains"; import { MerkleTree } from "merkletreejs"; +import { pointTokenVaultABI } from "./abis/point-token-vault.ts"; +import { LosslessNumber, parse, stringify } from "lossless-json"; // Types type PointsBalance = Map<`0x${string}`, bigint>; @@ -23,7 +25,7 @@ interface AlphaDistributionData { pTokens: { [address: Address]: { [pointsId: `0x${string}`]: { - accumulatingPoints: string; + accumulatingPoints: LosslessNumber; }; }; }; @@ -60,8 +62,8 @@ interface PTokenSnapshot { // Overrides const UNI_POOL_OVERRIDES = { "0x597a1b0515bbeEe6796B89a6f403c3fD41BB626C": { - "0x24C694d193B19119bcDea9D40a3b0bfaFb281E6D": 6487631537430741114, - "0x44Cb2d713BDa3858001f038645fD05E23E5DE03D": 27597767454066598826095, + "0x24C694d193B19119bcDea9D40a3b0bfaFb281E6D": "6487631537430741114", + "0x44Cb2d713BDa3858001f038645fD05E23E5DE03D": "27597767454066598826095", }, }; @@ -76,13 +78,16 @@ const config = { rewardsPerPToken: (process.env.REWARDS_PER_P_TOKEN as string)?.split( "," ) as string[], + pointTokenVaultAddress: process.env.POINT_TOKEN_VAULT_ADDRESS as Address, }; // Core functions async function calculateRedemptionRights( client: PublicClient, pTokenAddress: Address, - rewardsMultiplier: string + rewardsMultiplier: string, + pointsId: `0x${string}`, + previousDistribution: AlphaDistributionData ): Promise<[Map, PTokenSnapshot]> { const redemptionRights = new Map(); const rewardsMultiplierBigInt = BigInt(rewardsMultiplier); @@ -151,6 +156,33 @@ async function calculateRedemptionRights( } } + // Add unclaimed pToken balances + const pointTokenVault = getContract({ + address: config.pointTokenVaultAddress, + abi: pointTokenVaultABI, + client, + }); + for (const [userAddress, addressPointsData] of Object.entries( + previousDistribution.pTokens + )) { + const { accumulatingPoints } = addressPointsData[pointsId]; + + const claimedPtokens = (await pointTokenVault.read.claimedPTokens([ + userAddress, + pointsId, + ])) as bigint; + + const unclaimedPtokens = + BigInt(accumulatingPoints.toString()) - claimedPtokens; + + if (unclaimedPtokens > 0n) { + pTokenBalances.set( + userAddress as Address, + (pTokenBalances.get(userAddress as Address) || 0n) + unclaimedPtokens + ); + } + } + // Create snapshot object const snapshot: PTokenSnapshot = { address: pTokenAddress, @@ -201,7 +233,7 @@ function generateMerkleData( [ address as Address, pointsId as `0x${string}`, - BigInt(data.accumulatingPoints), + BigInt(data.accumulatingPoints.toString()), ] ) ) @@ -246,7 +278,7 @@ function generateMerkleData( Object.entries(pointsData).map(([pointsId, data]) => [ pointsId, { - amount: data.accumulatingPoints, + amount: data.accumulatingPoints.toString(), proof: tree.getHexProof( keccak256( encodePacked( @@ -254,7 +286,7 @@ function generateMerkleData( [ address as Address, pointsId as `0x${string}`, - BigInt(data.accumulatingPoints), + BigInt(data.accumulatingPoints.toString()), ] ) ) @@ -287,6 +319,13 @@ async function generateMerkleTree(): Promise { console.log(`Processing at block #${await client.getBlockNumber()}`); + const previousDistribution = parse( + fs.readFileSync( + "js-scripts/generateRedemptionRights/last-alpha-distribution.json", + "utf8" + ) + ) as AlphaDistributionData; + // Calculate rights for each token const allRedemptionRights: RedemptionRightsMap = new Map(); const snapshots: { [address: string]: PTokenSnapshot } = {}; @@ -295,7 +334,9 @@ async function generateMerkleTree(): Promise { const [rights, snapshot] = await calculateRedemptionRights( client, config.pTokenAddresses[i], - config.rewardsPerPToken[i] + config.rewardsPerPToken[i], + config.pointsIds[i], + previousDistribution ); snapshots[config.pTokenAddresses[i]] = snapshot; @@ -330,13 +371,6 @@ async function generateMerkleTree(): Promise { } // Generate merkle data - const previousDistribution = JSON.parse( - fs.readFileSync( - "js-scripts/generateRedemptionRights/last-alpha-distribution.json", - "utf8" - ) - ) as AlphaDistributionData; - const merklizedData = generateMerkleData( allRedemptionRights, previousDistribution diff --git a/js-scripts/generateRedemptionRights/out/merged-distribution.json b/js-scripts/generateRedemptionRights/out/merged-distribution.json index 1fae8dc..d01ac8d 100644 --- a/js-scripts/generateRedemptionRights/out/merged-distribution.json +++ b/js-scripts/generateRedemptionRights/out/merged-distribution.json @@ -1,15 +1,15 @@ { - "root": "0xc6097e6fdabc5c6207fa640553853c9d884cff674602c382f15660914b6d40c7", + "root": "0x50420fa89bbefa971ffb968dc2547a8b5db8061d62dd3794ccc975531a127292", "redemptionRights": { "0x25E426b153e74Ab36b2685c3A464272De60888Ae": { "0x1852756d70656c206b506f696e743a20457468656e61205332066b7053415453": { "amount": "52792622186481736164", "proof": [ - "0xc1a70bb7d5c4ddf647114cb36083bca867a80e37e187aa1d6705f3b12357d7cf", - "0x9202bdda11a41be9ebfe610247d3e971e65959936bdf2d9186395b70d25d8d84", - "0x17c86983941dc9f87b11f6cd1f6f260f2c76f90e16024ad475204e07d99eedf4", - "0xf1dd87dc63132095adce8c1a5ad749892d389821e1d1bf28c5eee065e358695d", - "0xacbcf9b5c8a4d773b3d3fe2e93390fb4b7cb390fd39511981bb1ceed154456fc" + "0x991fd8976022911aeb40e40bcb5754f9529f2080710f7ec1db8ace85c4f7b7f8", + "0xc6f15a7cbd986873c6b761e81c98ee8ac4afd1c9885b7d8e0ae4de752040ab12", + "0xca808b743099c608cd9b81872c528c521d76505c116bedabfdcc6307c9c92bfb", + "0x703f21e968e8791afb70bcf780821f479ea90632b109016d8b24c8637771383c", + "0x0f76084b6c6777c64b0f591ee64d8c66c54c0bdeb5ce44142823c0f74b856267" ] } }, @@ -17,11 +17,11 @@ "0x1852756d70656c206b506f696e743a20457468656e61205332066b7053415453": { "amount": "76680445415417303410317", "proof": [ - "0x0b9dba6343a79836c09a8fe2151dfaeab44a90e1c590e664e142a46c5251c3e4", - "0x3aaef79be826edf6d7035f8ece860c534e8fa43b5d7a32581664fd7d9761fe39", - "0xd045aba11e229f57f22207671f583c9fd3468713a70ce7237b486653d19d0bc0", - "0x7b0041a106ae3fb142ab4e6da9f6b9958fc667e110122e6e9a7a77c9a574d585", - "0xacbcf9b5c8a4d773b3d3fe2e93390fb4b7cb390fd39511981bb1ceed154456fc" + "0x0fcd36341455485e89dbfc035b03be7d9ec5ceb7edfcb4849c51a457f4585ce7", + "0x6bc9d004dee53061026e4e1815702fb93d554919be92428cff828d781c5ffa10", + "0x91e627ae1924b31d3a4824be2d8c42333b484d534271b550b988067cda6b4e2b", + "0x990cf688331d86fc70ed92f961ec56ac4475b63c79aaa3bcfd65b53aa844604d", + "0x0f76084b6c6777c64b0f591ee64d8c66c54c0bdeb5ce44142823c0f74b856267" ] } }, @@ -29,11 +29,11 @@ "0x1852756d70656c206b506f696e743a20457468656e61205332066b7053415453": { "amount": "19621036792277125819", "proof": [ - "0x33b677140d55397d85f1c789cd35975f28bdbb973fa125c5d895a95c1026266b", - "0x6b5537a4b44653f34378b50792bbe235eef8f48b5456fff6eaae8fdce431b45c", - "0xbb77a1bb065bc346c4f39dfaff16a845fb2f151394251a08a942b3aa793b654a", - "0x7b0041a106ae3fb142ab4e6da9f6b9958fc667e110122e6e9a7a77c9a574d585", - "0xacbcf9b5c8a4d773b3d3fe2e93390fb4b7cb390fd39511981bb1ceed154456fc" + "0x22bd0a3dd00ce6d39746f618e1314a076f69dc34b7f13b915a642b5600e25305", + "0xf7033b41fc290a5b758662d3eab9a4374237da4badfd05f39206b8ccac3fdf56", + "0x2731916afd68e9c7aef75ccf55786ba22a4eff7ec17fa4f8eb052cdc9656ba95", + "0x990cf688331d86fc70ed92f961ec56ac4475b63c79aaa3bcfd65b53aa844604d", + "0x0f76084b6c6777c64b0f591ee64d8c66c54c0bdeb5ce44142823c0f74b856267" ] } }, @@ -41,11 +41,11 @@ "0x1852756d70656c206b506f696e743a20457468656e61205332066b7053415453": { "amount": "7377567032082737967061", "proof": [ - "0x5697b38b5bd873ff3a8132059568adf332a3e70b8a5ca3e14c596b4fc43e6671", - "0x42a2346cc718889c9be2af3a107d12cb3900c221558ef5c0b3631f5c3ae2e5d4", - "0xa014a7c4ba0e9689e0f02bf17bc6eeff5d299ddf9dbd54459a03c318237e8e1b", - "0xf1dd87dc63132095adce8c1a5ad749892d389821e1d1bf28c5eee065e358695d", - "0xacbcf9b5c8a4d773b3d3fe2e93390fb4b7cb390fd39511981bb1ceed154456fc" + "0x4e0230e7a7546148f373efe52256490c04ea0019e199f2256a375e75cf2b6b96", + "0x252017ca2570f4903a5cbd454065e1e9b8e001ddd0b97fc206ef8b210b271253", + "0x2731916afd68e9c7aef75ccf55786ba22a4eff7ec17fa4f8eb052cdc9656ba95", + "0x990cf688331d86fc70ed92f961ec56ac4475b63c79aaa3bcfd65b53aa844604d", + "0x0f76084b6c6777c64b0f591ee64d8c66c54c0bdeb5ce44142823c0f74b856267" ] } }, @@ -53,8 +53,8 @@ "0x1852756d70656c206b506f696e743a20457468656e61205332066b7053415453": { "amount": "28648231580558995600834", "proof": [ - "0x04a635b0e5b8e5ac70059fb9dc2682f5102a3b4a2f8b2c0d6f1ea43b1e04272f", - "0x5eeefedc919f5dec8d28214722f476b6e1a18460f90e03a3fc4889cae667fb44" + "0x8e78f2719f3104ae9a6076b62c6f52bd9d814a7800bd1b77e5d058c65ccff978", + "0xc28bab8bdcae524c3a93e5f8f22a947a41012462f21c11029a1de392ae32742d" ] } }, @@ -62,35 +62,33 @@ "0x1852756d70656c206b506f696e743a20457468656e61205332066b7053415453": { "amount": "12394117929023949073263", "proof": [ - "0x1aabefcbeb1ba41043ba86b6019b4f0e9eda103bd89334b2dbd385b4b6fd0fb1", - "0xb1b1d68fe165491c5e58654565c779c68f1e0909168fb478480f1ebb22479b4d", - "0xd045aba11e229f57f22207671f583c9fd3468713a70ce7237b486653d19d0bc0", - "0x7b0041a106ae3fb142ab4e6da9f6b9958fc667e110122e6e9a7a77c9a574d585", - "0xacbcf9b5c8a4d773b3d3fe2e93390fb4b7cb390fd39511981bb1ceed154456fc" + "0x0d204e0c13988dc6ad8a13ec4b0ed7ad17ab5a668edc8accfcce7f2bfdade628", + "0x6bc9d004dee53061026e4e1815702fb93d554919be92428cff828d781c5ffa10", + "0x91e627ae1924b31d3a4824be2d8c42333b484d534271b550b988067cda6b4e2b", + "0x990cf688331d86fc70ed92f961ec56ac4475b63c79aaa3bcfd65b53aa844604d", + "0x0f76084b6c6777c64b0f591ee64d8c66c54c0bdeb5ce44142823c0f74b856267" ] } }, "0x24C694d193B19119bcDea9D40a3b0bfaFb281E6D": { "0x1852756d70656c206b506f696e743a20457468656e61205332066b7053415453": { - "amount": "411193465672233566", + "amount": "411193465672233573", "proof": [ - "0x3e7e8dbf133ff6472d8567b24ea2be55e0400118c6a72d46442e54bf47351187", - "0x42a2346cc718889c9be2af3a107d12cb3900c221558ef5c0b3631f5c3ae2e5d4", - "0xa014a7c4ba0e9689e0f02bf17bc6eeff5d299ddf9dbd54459a03c318237e8e1b", - "0xf1dd87dc63132095adce8c1a5ad749892d389821e1d1bf28c5eee065e358695d", - "0xacbcf9b5c8a4d773b3d3fe2e93390fb4b7cb390fd39511981bb1ceed154456fc" + "0xdc6743cb29d00ac8467f33ac244256f40e5d7fc8e8813cfc8d3c0ab87f1df4d2", + "0xf17cd78fb91097d6d817f63f61884a91c8d5ceedefd3ff761ad4621db6cdb688", + "0xc28bab8bdcae524c3a93e5f8f22a947a41012462f21c11029a1de392ae32742d" ] } }, "0x44Cb2d713BDa3858001f038645fD05E23E5DE03D": { "0x1852756d70656c206b506f696e743a20457468656e61205332066b7053415453": { - "amount": "1749177890079144448658", + "amount": "1749177890079144321197", "proof": [ - "0x1b9305567ae250a289d9c9a662f2470db6a5b9396d0358bfebe9250f336348b0", - "0xdcb5ba69bfb574629504575bbbd60386f2a6fade3778baa3d30c24ed53cc754c", - "0xbb77a1bb065bc346c4f39dfaff16a845fb2f151394251a08a942b3aa793b654a", - "0x7b0041a106ae3fb142ab4e6da9f6b9958fc667e110122e6e9a7a77c9a574d585", - "0xacbcf9b5c8a4d773b3d3fe2e93390fb4b7cb390fd39511981bb1ceed154456fc" + "0x191a3f5a1c7f9b1657f56cf44eb79a72b47ad4be40fae5ced80af9e38731e10c", + "0x927dca4efe8d82dcf231fc14c5b1847b3059bd93046b4a7a191a831b8e08ee41", + "0x91e627ae1924b31d3a4824be2d8c42333b484d534271b550b988067cda6b4e2b", + "0x990cf688331d86fc70ed92f961ec56ac4475b63c79aaa3bcfd65b53aa844604d", + "0x0f76084b6c6777c64b0f591ee64d8c66c54c0bdeb5ce44142823c0f74b856267" ] } } @@ -98,127 +96,129 @@ "pTokens": { "0x25E426b153e74Ab36b2685c3A464272De60888Ae": { "0x1852756d70656c206b506f696e743a20457468656e61205332066b7053415453": { - "amount": 833020026897918500000, + "amount": "833020026897918484874", "proof": [ - "0x6ffeeee822b04a5714526489a1b1e6e84d8548d7a8b5cb829fd8d22d86779dde", - "0x8fd22ab3c90380b53854a307ae16e6cc910904eb906e7f9538a6afb1ead790ce", - "0xa014a7c4ba0e9689e0f02bf17bc6eeff5d299ddf9dbd54459a03c318237e8e1b", - "0xf1dd87dc63132095adce8c1a5ad749892d389821e1d1bf28c5eee065e358695d", - "0xacbcf9b5c8a4d773b3d3fe2e93390fb4b7cb390fd39511981bb1ceed154456fc" + "0xb605c6d24f4591b726ca75a2244f789388c19ffebedd76217fe0eda994f0a8a4", + "0xcbb0daa6752f707c4e36e3763fcb74f4eaccb42e2cd8bcbdb7feb39c1bf55c2a", + "0xca808b743099c608cd9b81872c528c521d76505c116bedabfdcc6307c9c92bfb", + "0x703f21e968e8791afb70bcf780821f479ea90632b109016d8b24c8637771383c", + "0x0f76084b6c6777c64b0f591ee64d8c66c54c0bdeb5ce44142823c0f74b856267" ] }, "0x1552756d70656c20506f696e743a205a69726375697408705a49524355495400": { - "amount": 335440188667996900000, + "amount": "335440188667996950000", "proof": [ - "0x0fcd36341455485e89dbfc035b03be7d9ec5ceb7edfcb4849c51a457f4585ce7", - "0xb1b1d68fe165491c5e58654565c779c68f1e0909168fb478480f1ebb22479b4d", - "0xd045aba11e229f57f22207671f583c9fd3468713a70ce7237b486653d19d0bc0", - "0x7b0041a106ae3fb142ab4e6da9f6b9958fc667e110122e6e9a7a77c9a574d585", - "0xacbcf9b5c8a4d773b3d3fe2e93390fb4b7cb390fd39511981bb1ceed154456fc" + "0x9f06e030a1a0be00f37013433e8d97e2d1cf5ee1ad68da103114e6e82ab92c5f", + "0xc6f15a7cbd986873c6b761e81c98ee8ac4afd1c9885b7d8e0ae4de752040ab12", + "0xca808b743099c608cd9b81872c528c521d76505c116bedabfdcc6307c9c92bfb", + "0x703f21e968e8791afb70bcf780821f479ea90632b109016d8b24c8637771383c", + "0x0f76084b6c6777c64b0f591ee64d8c66c54c0bdeb5ce44142823c0f74b856267" ] } }, "0x24C694d193B19119bcDea9D40a3b0bfaFb281E6D": { "0x1852756d70656c206b506f696e743a20457468656e61205332066b7053415453": { - "amount": 152407798291890470000, + "amount": "152407798291890457882", "proof": [ - "0x9dd5c63d7a85ebb90ea35dd0f5fb54974ae79d761c86e3c469616d0b2eaeff67", - "0x403c3bb7b0ff32cb4e934edd9801aa0eec0ff624fe9a0845cb35a7375e02c25d", - "0x17c86983941dc9f87b11f6cd1f6f260f2c76f90e16024ad475204e07d99eedf4", - "0xf1dd87dc63132095adce8c1a5ad749892d389821e1d1bf28c5eee065e358695d", - "0xacbcf9b5c8a4d773b3d3fe2e93390fb4b7cb390fd39511981bb1ceed154456fc" + "0x8b788cab342842ae529d8efac9659e1af9367270c13caaf4c8b5ef4c67a51402", + "0xfaca43636023a73bf06295aa693c262efe0bb3231357a68b8ad7eec7e901c8ef", + "0x2eec07dc470578d8beb2eb4edf89d2309714b87ea0b9e9b2f119df39a28278c7", + "0x703f21e968e8791afb70bcf780821f479ea90632b109016d8b24c8637771383c", + "0x0f76084b6c6777c64b0f591ee64d8c66c54c0bdeb5ce44142823c0f74b856267" ] } }, "0xe2C3445a84de723Ef4425922165a58D22AD06e33": { "0x1852756d70656c206b506f696e743a20457468656e61205332066b7053415453": { - "amount": 131187337543613430000, + "amount": "131187337543613434191", "proof": [ - "0x73c25d42a5988fcc27384ecf9fbc2f810c9f862e977db0f73e9cabf68ac9e5b6", - "0x403c3bb7b0ff32cb4e934edd9801aa0eec0ff624fe9a0845cb35a7375e02c25d", - "0x17c86983941dc9f87b11f6cd1f6f260f2c76f90e16024ad475204e07d99eedf4", - "0xf1dd87dc63132095adce8c1a5ad749892d389821e1d1bf28c5eee065e358695d", - "0xacbcf9b5c8a4d773b3d3fe2e93390fb4b7cb390fd39511981bb1ceed154456fc" + "0x317c7eb5a0fffec11dd2d7b3d0bfd2fe201bf9ff67627a43990ad1ad51714da3", + "0xf7033b41fc290a5b758662d3eab9a4374237da4badfd05f39206b8ccac3fdf56", + "0x2731916afd68e9c7aef75ccf55786ba22a4eff7ec17fa4f8eb052cdc9656ba95", + "0x990cf688331d86fc70ed92f961ec56ac4475b63c79aaa3bcfd65b53aa844604d", + "0x0f76084b6c6777c64b0f591ee64d8c66c54c0bdeb5ce44142823c0f74b856267" ] } }, "0xD6633c1382896079D3576eC43519d844a8C80B56": { "0x1852756d70656c206b506f696e743a20457468656e61205332066b7053415453": { - "amount": 73286503362495650000, + "amount": "73286503362495655536", "proof": [ - "0x6b691008971e9ab0b1581861b6e542943b4ea3ef91df9fd3e3167e16dfe61eab", - "0x8fd22ab3c90380b53854a307ae16e6cc910904eb906e7f9538a6afb1ead790ce", - "0xa014a7c4ba0e9689e0f02bf17bc6eeff5d299ddf9dbd54459a03c318237e8e1b", - "0xf1dd87dc63132095adce8c1a5ad749892d389821e1d1bf28c5eee065e358695d", - "0xacbcf9b5c8a4d773b3d3fe2e93390fb4b7cb390fd39511981bb1ceed154456fc" + "0xbd310aa3212d836ae9846fdd973ebb0a4e934af1d9241d2b740ec700d9caa2a3", + "0xf17cd78fb91097d6d817f63f61884a91c8d5ceedefd3ff761ad4621db6cdb688", + "0xc28bab8bdcae524c3a93e5f8f22a947a41012462f21c11029a1de392ae32742d" ] } }, "0x028CC8E3Ff248Dc59052eaAD2a1e749F3B835B99": { "0x1852756d70656c206b506f696e743a20457468656e61205332066b7053415453": { - "amount": 4.977606283426392e+21, + "amount": "4977606283426392328730", "proof": [ - "0xd1c3a5f261d26002eb7ea89e24b742b91b073fd272fadc4384323899b277f04e", - "0xf17cd78fb91097d6d817f63f61884a91c8d5ceedefd3ff761ad4621db6cdb688", - "0x5eeefedc919f5dec8d28214722f476b6e1a18460f90e03a3fc4889cae667fb44" + "0xa11fb0c1a4d796bcb6fa408ad7fead1f27c139ee194686098410c137f2d5d224", + "0xcbb0daa6752f707c4e36e3763fcb74f4eaccb42e2cd8bcbdb7feb39c1bf55c2a", + "0xca808b743099c608cd9b81872c528c521d76505c116bedabfdcc6307c9c92bfb", + "0x703f21e968e8791afb70bcf780821f479ea90632b109016d8b24c8637771383c", + "0x0f76084b6c6777c64b0f591ee64d8c66c54c0bdeb5ce44142823c0f74b856267" ] } }, "0x6CD72B1E6E300340A48943d6aF34EF5AE07D3577": { "0x1852756d70656c206b506f696e743a20457468656e61205332066b7053415453": { - "amount": 2.8303575270814903e+21, + "amount": "2830357527081490335359", "proof": [ - "0x317c7eb5a0fffec11dd2d7b3d0bfd2fe201bf9ff67627a43990ad1ad51714da3", - "0x6b5537a4b44653f34378b50792bbe235eef8f48b5456fff6eaae8fdce431b45c", - "0xbb77a1bb065bc346c4f39dfaff16a845fb2f151394251a08a942b3aa793b654a", - "0x7b0041a106ae3fb142ab4e6da9f6b9958fc667e110122e6e9a7a77c9a574d585", - "0xacbcf9b5c8a4d773b3d3fe2e93390fb4b7cb390fd39511981bb1ceed154456fc" + "0x6258fb3ee01fe8edb76a1ee2cb317cd32b8464c63e31903826acd02863982f31", + "0x9fcad9eaad9b566f6c3bbd4cf63e1ecdd1ae8f5ae46730804df189d86fd83fe6", + "0x2eec07dc470578d8beb2eb4edf89d2309714b87ea0b9e9b2f119df39a28278c7", + "0x703f21e968e8791afb70bcf780821f479ea90632b109016d8b24c8637771383c", + "0x0f76084b6c6777c64b0f591ee64d8c66c54c0bdeb5ce44142823c0f74b856267" ] } }, "0xAF9e4E01525C4856E00Cb0F363AFc34E7decD6a7": { "0x1852756d70656c206b506f696e743a20457468656e61205332066b7053415453": { - "amount": 5.225302412387277e+23, + "amount": "522530241238727636619443", "proof": [ - "0xd6edec91605da1894e0fa3cdbb82e2005d9b05584aacb82d8c407725b9b3641d", - "0xf17cd78fb91097d6d817f63f61884a91c8d5ceedefd3ff761ad4621db6cdb688", - "0x5eeefedc919f5dec8d28214722f476b6e1a18460f90e03a3fc4889cae667fb44" + "0x12eacdb80b635c5670c04a96fbf72a8ec14cbf96300fa76d5ee0373bc98e01b7", + "0x927dca4efe8d82dcf231fc14c5b1847b3059bd93046b4a7a191a831b8e08ee41", + "0x91e627ae1924b31d3a4824be2d8c42333b484d534271b550b988067cda6b4e2b", + "0x990cf688331d86fc70ed92f961ec56ac4475b63c79aaa3bcfd65b53aa844604d", + "0x0f76084b6c6777c64b0f591ee64d8c66c54c0bdeb5ce44142823c0f74b856267" ] } }, "0x0e7518B332F469a6A2F59E690F225cef5157cca9": { "0x1852756d70656c206b506f696e743a20457468656e61205332066b7053415453": { - "amount": 2.621060441200294e+23, + "amount": "262106044120029423561824", "proof": [ - "0x9f06e030a1a0be00f37013433e8d97e2d1cf5ee1ad68da103114e6e82ab92c5f", - "0x9202bdda11a41be9ebfe610247d3e971e65959936bdf2d9186395b70d25d8d84", - "0x17c86983941dc9f87b11f6cd1f6f260f2c76f90e16024ad475204e07d99eedf4", - "0xf1dd87dc63132095adce8c1a5ad749892d389821e1d1bf28c5eee065e358695d", - "0xacbcf9b5c8a4d773b3d3fe2e93390fb4b7cb390fd39511981bb1ceed154456fc" + "0x3e7e8dbf133ff6472d8567b24ea2be55e0400118c6a72d46442e54bf47351187", + "0x252017ca2570f4903a5cbd454065e1e9b8e001ddd0b97fc206ef8b210b271253", + "0x2731916afd68e9c7aef75ccf55786ba22a4eff7ec17fa4f8eb052cdc9656ba95", + "0x990cf688331d86fc70ed92f961ec56ac4475b63c79aaa3bcfd65b53aa844604d", + "0x0f76084b6c6777c64b0f591ee64d8c66c54c0bdeb5ce44142823c0f74b856267" ] } }, "0x347ab2e403710583Ade28Ef0871e73581599C8C8": { "0x1852756d70656c206b506f696e743a20457468656e61205332066b7053415453": { - "amount": 9.888353035952251e+23, + "amount": "988835303595225079157382", "proof": [ - "0x2baa966a98f9d55368c9d2f23afeea2683b639aeb56babe41bd7f4d0d727970e", - "0xdcb5ba69bfb574629504575bbbd60386f2a6fade3778baa3d30c24ed53cc754c", - "0xbb77a1bb065bc346c4f39dfaff16a845fb2f151394251a08a942b3aa793b654a", - "0x7b0041a106ae3fb142ab4e6da9f6b9958fc667e110122e6e9a7a77c9a574d585", - "0xacbcf9b5c8a4d773b3d3fe2e93390fb4b7cb390fd39511981bb1ceed154456fc" + "0x7c1140f479d8f8e1295f0da50f5554de0c77b7b73783022f63b840e186a69c3d", + "0xfaca43636023a73bf06295aa693c262efe0bb3231357a68b8ad7eec7e901c8ef", + "0x2eec07dc470578d8beb2eb4edf89d2309714b87ea0b9e9b2f119df39a28278c7", + "0x703f21e968e8791afb70bcf780821f479ea90632b109016d8b24c8637771383c", + "0x0f76084b6c6777c64b0f591ee64d8c66c54c0bdeb5ce44142823c0f74b856267" ] } }, "0x1d848bf0dcF1b48f5621c37d062f2696D9d71AC4": { "0x1852756d70656c206b506f696e743a20457468656e61205332066b7053415453": { - "amount": 2.396414216569414e+24, + "amount": "2396414216569414059964695", "proof": [ - "0x0d204e0c13988dc6ad8a13ec4b0ed7ad17ab5a668edc8accfcce7f2bfdade628", - "0x3aaef79be826edf6d7035f8ece860c534e8fa43b5d7a32581664fd7d9761fe39", - "0xd045aba11e229f57f22207671f583c9fd3468713a70ce7237b486653d19d0bc0", - "0x7b0041a106ae3fb142ab4e6da9f6b9958fc667e110122e6e9a7a77c9a574d585", - "0xacbcf9b5c8a4d773b3d3fe2e93390fb4b7cb390fd39511981bb1ceed154456fc" + "0x6a69b863aea1e9a735f460a6fb449a28b7398f958c4792872d7764700936b79d", + "0x9fcad9eaad9b566f6c3bbd4cf63e1ecdd1ae8f5ae46730804df189d86fd83fe6", + "0x2eec07dc470578d8beb2eb4edf89d2309714b87ea0b9e9b2f119df39a28278c7", + "0x703f21e968e8791afb70bcf780821f479ea90632b109016d8b24c8637771383c", + "0x0f76084b6c6777c64b0f591ee64d8c66c54c0bdeb5ce44142823c0f74b856267" ] } } diff --git a/js-scripts/generateRedemptionRights/out/ptoken-snapshot-kpsats.json b/js-scripts/generateRedemptionRights/out/ptoken-snapshot-kpsats.json index 82c6f4f..b443e14 100644 --- a/js-scripts/generateRedemptionRights/out/ptoken-snapshot-kpsats.json +++ b/js-scripts/generateRedemptionRights/out/ptoken-snapshot-kpsats.json @@ -1,14 +1,17 @@ { "address": "0xdFa21ceC8A46386F5d36F4b07E18BcCcA59f425B", - "blockNumber": "21073410", + "blockNumber": "21105619", "balances": { "0x25E426b153e74Ab36b2685c3A464272De60888Ae": "832939015897918484874", "0xAF9e4E01525C4856E00Cb0F363AFc34E7decD6a7": "1209830694094345523934847", - "0x6CD72B1E6E300340A48943d6aF34EF5AE07D3577": "309572178834508409860", - "0x1d848bf0dcF1b48f5621c37d062f2696D9d71AC4": "116400041689867972616256", + "0x028CC8E3Ff248Dc59052eaAD2a1e749F3B835B99": "448829276324349797275", + "0x6CD72B1E6E300340A48943d6aF34EF5AE07D3577": "2830357527081490335359", + "0x1d848bf0dcF1b48f5621c37d062f2696D9d71AC4": "2289431386682455596719703", "0x76DB9edf1451933711fc0A0c622E013ebD229EaB": "451999329293340648396874", "0xB6462B67fe692223DFFb61C8DC8Ad080CBa180Cc": "195548998385752443216151", - "0x24C694d193B19119bcDea9D40a3b0bfaFb281E6D": "6487631537430740992", - "0x44Cb2d713BDa3858001f038645fD05E23E5DE03D": "27597767454066600837120" + "0x24C694d193B19119bcDea9D40a3b0bfaFb281E6D": "158895429829321198996", + "0x44Cb2d713BDa3858001f038645fD05E23E5DE03D": "27597767454066598826095", + "0xe2C3445a84de723Ef4425922165a58D22AD06e33": "131187337543613434191", + "0xD6633c1382896079D3576eC43519d844a8C80B56": "73286503362495655536" } } \ No newline at end of file diff --git a/package.json b/package.json index 33c842f..d13c087 100644 --- a/package.json +++ b/package.json @@ -13,6 +13,7 @@ }, "dependencies": { "dotenv": "^16.3.1", + "lossless-json": "^4.0.2", "merkletreejs": "^0.4.0", "viem": "^2.21.25" } From 039ed653c08efa872bf8ad06fd18c916555282c8 Mon Sep 17 00:00:00 2001 From: Josh Levine Date: Mon, 4 Nov 2024 00:03:34 -0800 Subject: [PATCH 09/16] refactor: move script validation into separate test file --- contracts/script/PointTokenVault.s.sol | 19 +----- contracts/test/SetRedemptionENA4Nov24.t.sol | 59 +++++++++++++++++++ .../out/ptoken-snapshot-kpsats.json | 2 +- 3 files changed, 62 insertions(+), 18 deletions(-) create mode 100644 contracts/test/SetRedemptionENA4Nov24.t.sol diff --git a/contracts/script/PointTokenVault.s.sol b/contracts/script/PointTokenVault.s.sol index 9a6058a..0a7f2ab 100644 --- a/contracts/script/PointTokenVault.s.sol +++ b/contracts/script/PointTokenVault.s.sol @@ -8,7 +8,6 @@ import {MockERC20} from "solmate/test/utils/mocks/MockERC20.sol"; import {ERC20} from "solmate/tokens/ERC20.sol"; import {LibString} from "solady/utils/LibString.sol"; -import {MerkleProof} from "@openzeppelin/contracts/utils/cryptography/MerkleProof.sol"; import {Upgrades} from "openzeppelin-foundry-upgrades/Upgrades.sol"; import {console} from "forge-std/console.sol"; @@ -118,7 +117,7 @@ contract PointTokenVaultScripts is BatchScript { vm.stopBroadcast(); } - function setRedemptionENA30Oct24() public { + function setRedemptionENA4Nov24() public { // Core contract and token setup PointTokenVault vaultV0_1_0 = PointTokenVault(payable(0x1EeEBa76f211C4Dce994b9c5A74BDF25DB649Fa1)); bytes32 pointsId = LibString.packTwo("Rumpel kPoint: Ethena S2", "kpSATS"); @@ -133,22 +132,8 @@ contract PointTokenVaultScripts is BatchScript { // Update merkle root vm.startBroadcast(MAINNET_MERKLE_UPDATER); - vaultV0_1_0.updateRoot(0x602cdd6dd4f1c6f7bb049ce8b23a49e5177dc84830c7f00cc09eb0f11f03d9be); + vaultV0_1_0.updateRoot(0x50420fa89bbefa971ffb968dc2547a8b5db8061d62dd3794ccc975531a127292); vm.stopBroadcast(); - - // Test redemption - bytes32[] memory proof = new bytes32[](5); - proof[0] = 0xc1a70bb7d5c4ddf647114cb36083bca867a80e37e187aa1d6705f3b12357d7cf; - proof[1] = 0x04a635b0e5b8e5ac70059fb9dc2682f5102a3b4a2f8b2c0d6f1ea43b1e04272f; - proof[2] = 0xab802966e4277e85c878dad4c849c7632735a56c3710c197470de81707286069; - proof[3] = 0x7c0bd8bd630d01f1a459f6cd963cfc5f58487dec582339b1d8f29edbbd41d8ab; - proof[4] = 0x0fe239692610c805880a540ea359a0f3f8314f94bb95cd4ec53d712ae6cdc63d; - - address testUser = 0x25E426b153e74Ab36b2685c3A464272De60888Ae; - uint256 claimAmount = 52792622186481736164; - - vm.prank(testUser); - vaultV0_1_0.redeemRewards(PointTokenVault.Claim(pointsId, claimAmount, claimAmount, proof), testUser); } // Useful for emergencies, where we need to override both the current and previous root at once diff --git a/contracts/test/SetRedemptionENA4Nov24.t.sol b/contracts/test/SetRedemptionENA4Nov24.t.sol new file mode 100644 index 0000000..d777044 --- /dev/null +++ b/contracts/test/SetRedemptionENA4Nov24.t.sol @@ -0,0 +1,59 @@ +// SPDX-License-Identifier: AGPL-3.0-only +pragma solidity =0.8.24; + +import {Test} from "forge-std/Test.sol"; +import {LibString} from "solady/utils/LibString.sol"; +import {ERC20} from "solmate/test/utils/mocks/MockERC20.sol"; + +import {PointTokenVault} from "../PointTokenVault.sol"; +import {PointTokenVaultScripts} from "../script/PointTokenVault.s.sol"; + +contract SetRedemptionENA4Nov24Test is Test { + PointTokenVault vaultV0_1_0 = PointTokenVault(payable(0x1EeEBa76f211C4Dce994b9c5A74BDF25DB649Fa1)); + bytes32 pointsId = LibString.packTwo("Rumpel kPoint: Ethena S2", "kpSATS"); + + function setUp() public { + string memory MAINNET_RPC_URL = vm.envString("MAINNET_RPC_URL"); + uint256 forkId = vm.createFork(MAINNET_RPC_URL, 21_112_610); // Block mined at Nov-04-2024 06:51:59 AM +UTC + vm.selectFork(forkId); + + PointTokenVaultScripts scripts = new PointTokenVaultScripts(); + scripts.setRedemptionENA4Nov24(); + } + + function test_RedemptionRights1() public { + bytes32[] memory proof = new bytes32[](5); + proof[0] = 0x991fd8976022911aeb40e40bcb5754f9529f2080710f7ec1db8ace85c4f7b7f8; + proof[1] = 0xc6f15a7cbd986873c6b761e81c98ee8ac4afd1c9885b7d8e0ae4de752040ab12; + proof[2] = 0xca808b743099c608cd9b81872c528c521d76505c116bedabfdcc6307c9c92bfb; + proof[3] = 0x703f21e968e8791afb70bcf780821f479ea90632b109016d8b24c8637771383c; + proof[4] = 0x0f76084b6c6777c64b0f591ee64d8c66c54c0bdeb5ce44142823c0f74b856267; + + address USER = 0x25E426b153e74Ab36b2685c3A464272De60888Ae; + uint256 AMOUNT = 52792622186481736164; + + vm.prank(USER); + vaultV0_1_0.redeemRewards(PointTokenVault.Claim(pointsId, AMOUNT, AMOUNT, proof), USER); + } + + function test_NormalPTokenClaim() public { + bytes32[] memory proof = new bytes32[](5); + proof[0] = 0x8b788cab342842ae529d8efac9659e1af9367270c13caaf4c8b5ef4c67a51402; + proof[1] = 0xfaca43636023a73bf06295aa693c262efe0bb3231357a68b8ad7eec7e901c8ef; + proof[2] = 0x2eec07dc470578d8beb2eb4edf89d2309714b87ea0b9e9b2f119df39a28278c7; + proof[3] = 0x703f21e968e8791afb70bcf780821f479ea90632b109016d8b24c8637771383c; + proof[4] = 0x0f76084b6c6777c64b0f591ee64d8c66c54c0bdeb5ce44142823c0f74b856267; + + address USER = 0x24C694d193B19119bcDea9D40a3b0bfaFb281E6D; + uint256 AMOUNT = 152407798291890457882; + + vm.prank(USER); + OldVault(address(vaultV0_1_0)).claimPTokens(PointTokenVault.Claim(pointsId, AMOUNT, AMOUNT, proof), USER); + + assertEq(ERC20(address(vaultV0_1_0.pTokens(pointsId))).balanceOf(USER), AMOUNT); + } +} + +interface OldVault { + function claimPTokens(PointTokenVault.Claim calldata claim, address account) external; +} diff --git a/js-scripts/generateRedemptionRights/out/ptoken-snapshot-kpsats.json b/js-scripts/generateRedemptionRights/out/ptoken-snapshot-kpsats.json index b443e14..8ec48a8 100644 --- a/js-scripts/generateRedemptionRights/out/ptoken-snapshot-kpsats.json +++ b/js-scripts/generateRedemptionRights/out/ptoken-snapshot-kpsats.json @@ -1,6 +1,6 @@ { "address": "0xdFa21ceC8A46386F5d36F4b07E18BcCcA59f425B", - "blockNumber": "21105619", + "blockNumber": "21112349", "balances": { "0x25E426b153e74Ab36b2685c3A464272De60888Ae": "832939015897918484874", "0xAF9e4E01525C4856E00Cb0F363AFc34E7decD6a7": "1209830694094345523934847", From 085fa39476a81bcc6bf15bd70b93a5755827673c Mon Sep 17 00:00:00 2001 From: Josh Levine Date: Mon, 4 Nov 2024 00:35:34 -0800 Subject: [PATCH 10/16] chore: run ci test with mainnet rpc --- .github/workflows/test.yml | 2 ++ 1 file changed, 2 insertions(+) diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index a632b75..e14c4a2 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -32,3 +32,5 @@ jobs: run: | forge test -vvv id: test + env: + MAINNET_RPC_URL: ${{ secrets.MAINNET_RPC_URL }} \ No newline at end of file From 2831bf903595824d3633c2d7e1150078869bc502 Mon Sep 17 00:00:00 2001 From: Josh Levine Date: Mon, 4 Nov 2024 13:30:54 -0800 Subject: [PATCH 11/16] chore: post latest snapshot --- .../generateRedemptionRights/out/ptoken-snapshot-kpsats.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/js-scripts/generateRedemptionRights/out/ptoken-snapshot-kpsats.json b/js-scripts/generateRedemptionRights/out/ptoken-snapshot-kpsats.json index 8ec48a8..f49a6ae 100644 --- a/js-scripts/generateRedemptionRights/out/ptoken-snapshot-kpsats.json +++ b/js-scripts/generateRedemptionRights/out/ptoken-snapshot-kpsats.json @@ -1,6 +1,6 @@ { "address": "0xdFa21ceC8A46386F5d36F4b07E18BcCcA59f425B", - "blockNumber": "21112349", + "blockNumber": "21116981", "balances": { "0x25E426b153e74Ab36b2685c3A464272De60888Ae": "832939015897918484874", "0xAF9e4E01525C4856E00Cb0F363AFc34E7decD6a7": "1209830694094345523934847", From 3618514435a8781a3fbc82068149f658bbe6b120 Mon Sep 17 00:00:00 2001 From: Steven Valeri Date: Thu, 7 Nov 2024 22:12:26 -0500 Subject: [PATCH 12/16] feat: two additional tests expecting revert for claim --- contracts/test/SetRedemptionENA4Nov24.t.sol | 33 +++++++++++++++++++++ 1 file changed, 33 insertions(+) diff --git a/contracts/test/SetRedemptionENA4Nov24.t.sol b/contracts/test/SetRedemptionENA4Nov24.t.sol index d777044..4f93542 100644 --- a/contracts/test/SetRedemptionENA4Nov24.t.sol +++ b/contracts/test/SetRedemptionENA4Nov24.t.sol @@ -36,6 +36,39 @@ contract SetRedemptionENA4Nov24Test is Test { vaultV0_1_0.redeemRewards(PointTokenVault.Claim(pointsId, AMOUNT, AMOUNT, proof), USER); } + function test_FailedRedemptionRights1_BadProof() public { + bytes32[] memory proof = new bytes32[](5); + proof[0] = 0x000008976022911aeb40e40bcb5754f9529f2080710f7ec1db8ace85c4f7b7f8; + proof[1] = 0xc6f15a7cbd986873c6b761e81c98ee8ac4afd1c9885b7d8e0ae4de752040ab12; + proof[2] = 0xca808b743099c608cd9b81872c528c521d76505c116bedabfdcc6307c9c92bfb; + proof[3] = 0x703f21e968e8791afb70bcf780821f479ea90632b109016d8b24c8637771383c; + proof[4] = 0x0f76084b6c6777c64b0f591ee64d8c66c54c0bdeb5ce44142823c0f74b856267; + + address USER = 0x25E426b153e74Ab36b2685c3A464272De60888Ae; + uint256 AMOUNT = 52792622186481736164; + + vm.prank(USER); + vm.expectRevert(PointTokenVault.ProofInvalidOrExpired.selector); + vaultV0_1_0.redeemRewards(PointTokenVault.Claim(pointsId, AMOUNT, AMOUNT, proof), USER); + } + + function test_RedemptionRights1_ClaimTooMuch() public { + bytes32[] memory proof = new bytes32[](5); + proof[0] = 0x991fd8976022911aeb40e40bcb5754f9529f2080710f7ec1db8ace85c4f7b7f8; + proof[1] = 0xc6f15a7cbd986873c6b761e81c98ee8ac4afd1c9885b7d8e0ae4de752040ab12; + proof[2] = 0xca808b743099c608cd9b81872c528c521d76505c116bedabfdcc6307c9c92bfb; + proof[3] = 0x703f21e968e8791afb70bcf780821f479ea90632b109016d8b24c8637771383c; + proof[4] = 0x0f76084b6c6777c64b0f591ee64d8c66c54c0bdeb5ce44142823c0f74b856267; + + address USER = 0x25E426b153e74Ab36b2685c3A464272De60888Ae; + uint256 TOTAL_CLAIMABLE = 52792622186481736164; + uint256 CLAIM_AMOUNT = 52792622186481736164 + 10; + + vm.prank(USER); + vm.expectRevert(PointTokenVault.ClaimTooLarge.selector); + vaultV0_1_0.redeemRewards(PointTokenVault.Claim(pointsId, TOTAL_CLAIMABLE, CLAIM_AMOUNT, proof), USER); + } + function test_NormalPTokenClaim() public { bytes32[] memory proof = new bytes32[](5); proof[0] = 0x8b788cab342842ae529d8efac9659e1af9367270c13caaf4c8b5ef4c67a51402; From fc0ef9967fa03ca95b72164891287643e7e9189c Mon Sep 17 00:00:00 2001 From: Josh Levine Date: Fri, 8 Nov 2024 21:05:25 +0700 Subject: [PATCH 13/16] fix: account for vest size in redemption rights --- contracts/script/PointTokenVault.s.sol | 2 +- contracts/test/SetRedemptionENA4Nov24.t.sol | 22 +- js-scripts/generateRedemptionRights/index.ts | 18 +- .../out/merged-distribution.json | 194 +++++++++--------- .../out/ptoken-snapshot-kpsats.json | 2 +- 5 files changed, 121 insertions(+), 117 deletions(-) diff --git a/contracts/script/PointTokenVault.s.sol b/contracts/script/PointTokenVault.s.sol index 0a7f2ab..9fc0e9e 100644 --- a/contracts/script/PointTokenVault.s.sol +++ b/contracts/script/PointTokenVault.s.sol @@ -132,7 +132,7 @@ contract PointTokenVaultScripts is BatchScript { // Update merkle root vm.startBroadcast(MAINNET_MERKLE_UPDATER); - vaultV0_1_0.updateRoot(0x50420fa89bbefa971ffb968dc2547a8b5db8061d62dd3794ccc975531a127292); + vaultV0_1_0.updateRoot(0x8add61929f9038b9b001852126409672b6c4c12161be6caee4c4ce44fe59538c); vm.stopBroadcast(); } diff --git a/contracts/test/SetRedemptionENA4Nov24.t.sol b/contracts/test/SetRedemptionENA4Nov24.t.sol index 4f93542..369eb21 100644 --- a/contracts/test/SetRedemptionENA4Nov24.t.sol +++ b/contracts/test/SetRedemptionENA4Nov24.t.sol @@ -23,14 +23,14 @@ contract SetRedemptionENA4Nov24Test is Test { function test_RedemptionRights1() public { bytes32[] memory proof = new bytes32[](5); - proof[0] = 0x991fd8976022911aeb40e40bcb5754f9529f2080710f7ec1db8ace85c4f7b7f8; - proof[1] = 0xc6f15a7cbd986873c6b761e81c98ee8ac4afd1c9885b7d8e0ae4de752040ab12; - proof[2] = 0xca808b743099c608cd9b81872c528c521d76505c116bedabfdcc6307c9c92bfb; - proof[3] = 0x703f21e968e8791afb70bcf780821f479ea90632b109016d8b24c8637771383c; - proof[4] = 0x0f76084b6c6777c64b0f591ee64d8c66c54c0bdeb5ce44142823c0f74b856267; + proof[0] = 0x6258fb3ee01fe8edb76a1ee2cb317cd32b8464c63e31903826acd02863982f31; + proof[1] = 0xd9d5035f478e73b0e33ae1677a34fb215dd9f25d858d17265608acd57f066e48; + proof[2] = 0x65c2bc0496edc30a605d1618f867da252e88358e98d08d80ad0d485df4439055; + proof[3] = 0x9c4c736ac69fbbc0f510cbee646cfcb0a5186004dbb3c577d7c3ab658ddcf209; + proof[4] = 0x2129557061359b11c571b9a63f6363b144b6ae40058d9731d0e165463fc18438; address USER = 0x25E426b153e74Ab36b2685c3A464272De60888Ae; - uint256 AMOUNT = 52792622186481736164; + uint256 AMOUNT = 26396311093240867247; vm.prank(USER); vaultV0_1_0.redeemRewards(PointTokenVault.Claim(pointsId, AMOUNT, AMOUNT, proof), USER); @@ -71,11 +71,11 @@ contract SetRedemptionENA4Nov24Test is Test { function test_NormalPTokenClaim() public { bytes32[] memory proof = new bytes32[](5); - proof[0] = 0x8b788cab342842ae529d8efac9659e1af9367270c13caaf4c8b5ef4c67a51402; - proof[1] = 0xfaca43636023a73bf06295aa693c262efe0bb3231357a68b8ad7eec7e901c8ef; - proof[2] = 0x2eec07dc470578d8beb2eb4edf89d2309714b87ea0b9e9b2f119df39a28278c7; - proof[3] = 0x703f21e968e8791afb70bcf780821f479ea90632b109016d8b24c8637771383c; - proof[4] = 0x0f76084b6c6777c64b0f591ee64d8c66c54c0bdeb5ce44142823c0f74b856267; + proof[0] = 0x6a69b863aea1e9a735f460a6fb449a28b7398f958c4792872d7764700936b79d; + proof[1] = 0xf88a43494a509c28f8321582f54b7964fc2232a7f109d49a44631cbcfa5d30a9; + proof[2] = 0x65c2bc0496edc30a605d1618f867da252e88358e98d08d80ad0d485df4439055; + proof[3] = 0x9c4c736ac69fbbc0f510cbee646cfcb0a5186004dbb3c577d7c3ab658ddcf209; + proof[4] = 0x2129557061359b11c571b9a63f6363b144b6ae40058d9731d0e165463fc18438; address USER = 0x24C694d193B19119bcDea9D40a3b0bfaFb281E6D; uint256 AMOUNT = 152407798291890457882; diff --git a/js-scripts/generateRedemptionRights/index.ts b/js-scripts/generateRedemptionRights/index.ts index dc8c0d1..2ce0f53 100644 --- a/js-scripts/generateRedemptionRights/index.ts +++ b/js-scripts/generateRedemptionRights/index.ts @@ -78,19 +78,25 @@ const config = { rewardsPerPToken: (process.env.REWARDS_PER_P_TOKEN as string)?.split( "," ) as string[], + vestSizes: (process.env.VEST_SIZE as string)?.split(",") as string[], pointTokenVaultAddress: process.env.POINT_TOKEN_VAULT_ADDRESS as Address, }; // Core functions async function calculateRedemptionRights( client: PublicClient, - pTokenAddress: Address, - rewardsMultiplier: string, - pointsId: `0x${string}`, + iteration: number, previousDistribution: AlphaDistributionData ): Promise<[Map, PTokenSnapshot]> { + const pTokenAddress = config.pTokenAddresses[iteration]; + const rewardsMultiplier = config.rewardsPerPToken[iteration]; + const pointsId = config.pointsIds[iteration]; + const vestSize = config.vestSizes[iteration]; + const redemptionRights = new Map(); - const rewardsMultiplierBigInt = BigInt(rewardsMultiplier); + const rewardsMultiplierBigInt = BigInt( + Number(rewardsMultiplier) * Number(vestSize) + ); const blockNumber = await client.getBlockNumber(); const logs = await client.getLogs({ @@ -333,9 +339,7 @@ async function generateMerkleTree(): Promise { for (let i = 0; i < config.pTokenAddresses.length; i++) { const [rights, snapshot] = await calculateRedemptionRights( client, - config.pTokenAddresses[i], - config.rewardsPerPToken[i], - config.pointsIds[i], + i, previousDistribution ); snapshots[config.pTokenAddresses[i]] = snapshot; diff --git a/js-scripts/generateRedemptionRights/out/merged-distribution.json b/js-scripts/generateRedemptionRights/out/merged-distribution.json index d01ac8d..346dcc1 100644 --- a/js-scripts/generateRedemptionRights/out/merged-distribution.json +++ b/js-scripts/generateRedemptionRights/out/merged-distribution.json @@ -1,94 +1,97 @@ { - "root": "0x50420fa89bbefa971ffb968dc2547a8b5db8061d62dd3794ccc975531a127292", + "root": "0x8add61929f9038b9b001852126409672b6c4c12161be6caee4c4ce44fe59538c", "redemptionRights": { "0x25E426b153e74Ab36b2685c3A464272De60888Ae": { "0x1852756d70656c206b506f696e743a20457468656e61205332066b7053415453": { - "amount": "52792622186481736164", + "amount": "26396311093240867247", "proof": [ - "0x991fd8976022911aeb40e40bcb5754f9529f2080710f7ec1db8ace85c4f7b7f8", - "0xc6f15a7cbd986873c6b761e81c98ee8ac4afd1c9885b7d8e0ae4de752040ab12", - "0xca808b743099c608cd9b81872c528c521d76505c116bedabfdcc6307c9c92bfb", - "0x703f21e968e8791afb70bcf780821f479ea90632b109016d8b24c8637771383c", - "0x0f76084b6c6777c64b0f591ee64d8c66c54c0bdeb5ce44142823c0f74b856267" + "0x6258fb3ee01fe8edb76a1ee2cb317cd32b8464c63e31903826acd02863982f31", + "0xd9d5035f478e73b0e33ae1677a34fb215dd9f25d858d17265608acd57f066e48", + "0x65c2bc0496edc30a605d1618f867da252e88358e98d08d80ad0d485df4439055", + "0x9c4c736ac69fbbc0f510cbee646cfcb0a5186004dbb3c577d7c3ab658ddcf209", + "0x2129557061359b11c571b9a63f6363b144b6ae40058d9731d0e165463fc18438" ] } }, "0xAF9e4E01525C4856E00Cb0F363AFc34E7decD6a7": { "0x1852756d70656c206b506f696e743a20457468656e61205332066b7053415453": { - "amount": "76680445415417303410317", + "amount": "38340222707708650495326", "proof": [ - "0x0fcd36341455485e89dbfc035b03be7d9ec5ceb7edfcb4849c51a457f4585ce7", - "0x6bc9d004dee53061026e4e1815702fb93d554919be92428cff828d781c5ffa10", - "0x91e627ae1924b31d3a4824be2d8c42333b484d534271b550b988067cda6b4e2b", - "0x990cf688331d86fc70ed92f961ec56ac4475b63c79aaa3bcfd65b53aa844604d", - "0x0f76084b6c6777c64b0f591ee64d8c66c54c0bdeb5ce44142823c0f74b856267" + "0x191a3f5a1c7f9b1657f56cf44eb79a72b47ad4be40fae5ced80af9e38731e10c", + "0x6eea1cb929cbbb3470f1ecd4c6bc7eeffe80233e2832c56b2c355a395e758a37", + "0xb6c90adb569922bd45aac66a537d64fabe79a1dd423e5ed8b92f6840bb85f01b", + "0xa0e9cea52035069ab2ed309706310a8da4a4262651b77fc8873182a03a65a1be", + "0x2129557061359b11c571b9a63f6363b144b6ae40058d9731d0e165463fc18438" ] } }, "0x6CD72B1E6E300340A48943d6aF34EF5AE07D3577": { "0x1852756d70656c206b506f696e743a20457468656e61205332066b7053415453": { - "amount": "19621036792277125819", + "amount": "9810518396138562600", "proof": [ - "0x22bd0a3dd00ce6d39746f618e1314a076f69dc34b7f13b915a642b5600e25305", - "0xf7033b41fc290a5b758662d3eab9a4374237da4badfd05f39206b8ccac3fdf56", - "0x2731916afd68e9c7aef75ccf55786ba22a4eff7ec17fa4f8eb052cdc9656ba95", - "0x990cf688331d86fc70ed92f961ec56ac4475b63c79aaa3bcfd65b53aa844604d", - "0x0f76084b6c6777c64b0f591ee64d8c66c54c0bdeb5ce44142823c0f74b856267" + "0xb605c6d24f4591b726ca75a2244f789388c19ffebedd76217fe0eda994f0a8a4", + "0xdc6743cb29d00ac8467f33ac244256f40e5d7fc8e8813cfc8d3c0ab87f1df4d2", + "0x9b65a90d08a22d23d963d2a68a131ee4e4d5a61d9cb648b3644cb5b72bde48ba" ] } }, "0x1d848bf0dcF1b48f5621c37d062f2696D9d71AC4": { "0x1852756d70656c206b506f696e743a20457468656e61205332066b7053415453": { - "amount": "7377567032082737967061", + "amount": "3688783516041368867130", "proof": [ - "0x4e0230e7a7546148f373efe52256490c04ea0019e199f2256a375e75cf2b6b96", - "0x252017ca2570f4903a5cbd454065e1e9b8e001ddd0b97fc206ef8b210b271253", - "0x2731916afd68e9c7aef75ccf55786ba22a4eff7ec17fa4f8eb052cdc9656ba95", - "0x990cf688331d86fc70ed92f961ec56ac4475b63c79aaa3bcfd65b53aa844604d", - "0x0f76084b6c6777c64b0f591ee64d8c66c54c0bdeb5ce44142823c0f74b856267" + "0x8b788cab342842ae529d8efac9659e1af9367270c13caaf4c8b5ef4c67a51402", + "0xec7d2e07249c1b63f1cbafebe4b19b2a4aede14f630e574c65700ea8211055d9", + "0xeb5e5c658b3904864029aa2d7702a319436d658e2094408832173c6d565c88d4", + "0x9c4c736ac69fbbc0f510cbee646cfcb0a5186004dbb3c577d7c3ab658ddcf209", + "0x2129557061359b11c571b9a63f6363b144b6ae40058d9731d0e165463fc18438" ] } }, "0x76DB9edf1451933711fc0A0c622E013ebD229EaB": { "0x1852756d70656c206b506f696e743a20457468656e61205332066b7053415453": { - "amount": "28648231580558995600834", + "amount": "14324115790279497348417", "proof": [ - "0x8e78f2719f3104ae9a6076b62c6f52bd9d814a7800bd1b77e5d058c65ccff978", - "0xc28bab8bdcae524c3a93e5f8f22a947a41012462f21c11029a1de392ae32742d" + "0x4e0230e7a7546148f373efe52256490c04ea0019e199f2256a375e75cf2b6b96", + "0xce23b4c55a319d5d0b0adcc04b8aa71e95f05acd666f1d8f4e181e7fff0a4fac", + "0xf841623187465e7d387f63fe823bdf658c969e95fbfaff30008e0c7f18f38e4d", + "0xa0e9cea52035069ab2ed309706310a8da4a4262651b77fc8873182a03a65a1be", + "0x2129557061359b11c571b9a63f6363b144b6ae40058d9731d0e165463fc18438" ] } }, "0xB6462B67fe692223DFFb61C8DC8Ad080CBa180Cc": { "0x1852756d70656c206b506f696e743a20457468656e61205332066b7053415453": { - "amount": "12394117929023949073263", + "amount": "6197058964511974341082", "proof": [ - "0x0d204e0c13988dc6ad8a13ec4b0ed7ad17ab5a668edc8accfcce7f2bfdade628", - "0x6bc9d004dee53061026e4e1815702fb93d554919be92428cff828d781c5ffa10", - "0x91e627ae1924b31d3a4824be2d8c42333b484d534271b550b988067cda6b4e2b", - "0x990cf688331d86fc70ed92f961ec56ac4475b63c79aaa3bcfd65b53aa844604d", - "0x0f76084b6c6777c64b0f591ee64d8c66c54c0bdeb5ce44142823c0f74b856267" + "0x454cf71470140e5faf8b729495953c32594183b013bef3da2aab9f20e603f492", + "0xc239b9fd3aa0cf39df1880333a057f6ebfd29f85d15d1b9adf7fc2f072ffec91", + "0xf841623187465e7d387f63fe823bdf658c969e95fbfaff30008e0c7f18f38e4d", + "0xa0e9cea52035069ab2ed309706310a8da4a4262651b77fc8873182a03a65a1be", + "0x2129557061359b11c571b9a63f6363b144b6ae40058d9731d0e165463fc18438" ] } }, "0x24C694d193B19119bcDea9D40a3b0bfaFb281E6D": { "0x1852756d70656c206b506f696e743a20457468656e61205332066b7053415453": { - "amount": "411193465672233573", + "amount": "205596732836116780", "proof": [ - "0xdc6743cb29d00ac8467f33ac244256f40e5d7fc8e8813cfc8d3c0ab87f1df4d2", - "0xf17cd78fb91097d6d817f63f61884a91c8d5ceedefd3ff761ad4621db6cdb688", - "0xc28bab8bdcae524c3a93e5f8f22a947a41012462f21c11029a1de392ae32742d" + "0x4bf5c095f95a6461e2f3eb39058850cd65b02d1014ee5a1a12f85d088b5f0e80", + "0xc239b9fd3aa0cf39df1880333a057f6ebfd29f85d15d1b9adf7fc2f072ffec91", + "0xf841623187465e7d387f63fe823bdf658c969e95fbfaff30008e0c7f18f38e4d", + "0xa0e9cea52035069ab2ed309706310a8da4a4262651b77fc8873182a03a65a1be", + "0x2129557061359b11c571b9a63f6363b144b6ae40058d9731d0e165463fc18438" ] } }, "0x44Cb2d713BDa3858001f038645fD05E23E5DE03D": { "0x1852756d70656c206b506f696e743a20457468656e61205332066b7053415453": { - "amount": "1749177890079144321197", + "amount": "874588945039572133000", "proof": [ - "0x191a3f5a1c7f9b1657f56cf44eb79a72b47ad4be40fae5ced80af9e38731e10c", - "0x927dca4efe8d82dcf231fc14c5b1847b3059bd93046b4a7a191a831b8e08ee41", - "0x91e627ae1924b31d3a4824be2d8c42333b484d534271b550b988067cda6b4e2b", - "0x990cf688331d86fc70ed92f961ec56ac4475b63c79aaa3bcfd65b53aa844604d", - "0x0f76084b6c6777c64b0f591ee64d8c66c54c0bdeb5ce44142823c0f74b856267" + "0x22bd0a3dd00ce6d39746f618e1314a076f69dc34b7f13b915a642b5600e25305", + "0xc06e767d40c0f02f172dd70f160cfe7f9a54281fc7553a967c18e6ad6ffa7fc1", + "0xb6c90adb569922bd45aac66a537d64fabe79a1dd423e5ed8b92f6840bb85f01b", + "0xa0e9cea52035069ab2ed309706310a8da4a4262651b77fc8873182a03a65a1be", + "0x2129557061359b11c571b9a63f6363b144b6ae40058d9731d0e165463fc18438" ] } } @@ -98,21 +101,21 @@ "0x1852756d70656c206b506f696e743a20457468656e61205332066b7053415453": { "amount": "833020026897918484874", "proof": [ - "0xb605c6d24f4591b726ca75a2244f789388c19ffebedd76217fe0eda994f0a8a4", - "0xcbb0daa6752f707c4e36e3763fcb74f4eaccb42e2cd8bcbdb7feb39c1bf55c2a", - "0xca808b743099c608cd9b81872c528c521d76505c116bedabfdcc6307c9c92bfb", - "0x703f21e968e8791afb70bcf780821f479ea90632b109016d8b24c8637771383c", - "0x0f76084b6c6777c64b0f591ee64d8c66c54c0bdeb5ce44142823c0f74b856267" + "0x991fd8976022911aeb40e40bcb5754f9529f2080710f7ec1db8ace85c4f7b7f8", + "0x6f741517db6626510cd30ca65490b696d97e69c114ac78f9a11371f8639fc3d5", + "0xeb5e5c658b3904864029aa2d7702a319436d658e2094408832173c6d565c88d4", + "0x9c4c736ac69fbbc0f510cbee646cfcb0a5186004dbb3c577d7c3ab658ddcf209", + "0x2129557061359b11c571b9a63f6363b144b6ae40058d9731d0e165463fc18438" ] }, "0x1552756d70656c20506f696e743a205a69726375697408705a49524355495400": { "amount": "335440188667996950000", "proof": [ - "0x9f06e030a1a0be00f37013433e8d97e2d1cf5ee1ad68da103114e6e82ab92c5f", - "0xc6f15a7cbd986873c6b761e81c98ee8ac4afd1c9885b7d8e0ae4de752040ab12", - "0xca808b743099c608cd9b81872c528c521d76505c116bedabfdcc6307c9c92bfb", - "0x703f21e968e8791afb70bcf780821f479ea90632b109016d8b24c8637771383c", - "0x0f76084b6c6777c64b0f591ee64d8c66c54c0bdeb5ce44142823c0f74b856267" + "0xa11fb0c1a4d796bcb6fa408ad7fead1f27c139ee194686098410c137f2d5d224", + "0x6f741517db6626510cd30ca65490b696d97e69c114ac78f9a11371f8639fc3d5", + "0xeb5e5c658b3904864029aa2d7702a319436d658e2094408832173c6d565c88d4", + "0x9c4c736ac69fbbc0f510cbee646cfcb0a5186004dbb3c577d7c3ab658ddcf209", + "0x2129557061359b11c571b9a63f6363b144b6ae40058d9731d0e165463fc18438" ] } }, @@ -120,11 +123,11 @@ "0x1852756d70656c206b506f696e743a20457468656e61205332066b7053415453": { "amount": "152407798291890457882", "proof": [ - "0x8b788cab342842ae529d8efac9659e1af9367270c13caaf4c8b5ef4c67a51402", - "0xfaca43636023a73bf06295aa693c262efe0bb3231357a68b8ad7eec7e901c8ef", - "0x2eec07dc470578d8beb2eb4edf89d2309714b87ea0b9e9b2f119df39a28278c7", - "0x703f21e968e8791afb70bcf780821f479ea90632b109016d8b24c8637771383c", - "0x0f76084b6c6777c64b0f591ee64d8c66c54c0bdeb5ce44142823c0f74b856267" + "0x6a69b863aea1e9a735f460a6fb449a28b7398f958c4792872d7764700936b79d", + "0xf88a43494a509c28f8321582f54b7964fc2232a7f109d49a44631cbcfa5d30a9", + "0x65c2bc0496edc30a605d1618f867da252e88358e98d08d80ad0d485df4439055", + "0x9c4c736ac69fbbc0f510cbee646cfcb0a5186004dbb3c577d7c3ab658ddcf209", + "0x2129557061359b11c571b9a63f6363b144b6ae40058d9731d0e165463fc18438" ] } }, @@ -132,11 +135,11 @@ "0x1852756d70656c206b506f696e743a20457468656e61205332066b7053415453": { "amount": "131187337543613434191", "proof": [ - "0x317c7eb5a0fffec11dd2d7b3d0bfd2fe201bf9ff67627a43990ad1ad51714da3", - "0xf7033b41fc290a5b758662d3eab9a4374237da4badfd05f39206b8ccac3fdf56", - "0x2731916afd68e9c7aef75ccf55786ba22a4eff7ec17fa4f8eb052cdc9656ba95", - "0x990cf688331d86fc70ed92f961ec56ac4475b63c79aaa3bcfd65b53aa844604d", - "0x0f76084b6c6777c64b0f591ee64d8c66c54c0bdeb5ce44142823c0f74b856267" + "0x217b3e35b22b6bd3732704009f72c0e75d295787739b31e22f4eceb2aadb3b37", + "0xc06e767d40c0f02f172dd70f160cfe7f9a54281fc7553a967c18e6ad6ffa7fc1", + "0xb6c90adb569922bd45aac66a537d64fabe79a1dd423e5ed8b92f6840bb85f01b", + "0xa0e9cea52035069ab2ed309706310a8da4a4262651b77fc8873182a03a65a1be", + "0x2129557061359b11c571b9a63f6363b144b6ae40058d9731d0e165463fc18438" ] } }, @@ -144,9 +147,8 @@ "0x1852756d70656c206b506f696e743a20457468656e61205332066b7053415453": { "amount": "73286503362495655536", "proof": [ - "0xbd310aa3212d836ae9846fdd973ebb0a4e934af1d9241d2b740ec700d9caa2a3", - "0xf17cd78fb91097d6d817f63f61884a91c8d5ceedefd3ff761ad4621db6cdb688", - "0xc28bab8bdcae524c3a93e5f8f22a947a41012462f21c11029a1de392ae32742d" + "0xd4d61b57e16feaf70406fff80fc7d6b6f8141a7d60ccd01bc4085808d809dd14", + "0x9b65a90d08a22d23d963d2a68a131ee4e4d5a61d9cb648b3644cb5b72bde48ba" ] } }, @@ -154,11 +156,9 @@ "0x1852756d70656c206b506f696e743a20457468656e61205332066b7053415453": { "amount": "4977606283426392328730", "proof": [ - "0xa11fb0c1a4d796bcb6fa408ad7fead1f27c139ee194686098410c137f2d5d224", - "0xcbb0daa6752f707c4e36e3763fcb74f4eaccb42e2cd8bcbdb7feb39c1bf55c2a", - "0xca808b743099c608cd9b81872c528c521d76505c116bedabfdcc6307c9c92bfb", - "0x703f21e968e8791afb70bcf780821f479ea90632b109016d8b24c8637771383c", - "0x0f76084b6c6777c64b0f591ee64d8c66c54c0bdeb5ce44142823c0f74b856267" + "0xb0401a96d02a3441cb53ae8eb4f241b5b66ce510eb5c767e52c12e30ae576957", + "0xdc6743cb29d00ac8467f33ac244256f40e5d7fc8e8813cfc8d3c0ab87f1df4d2", + "0x9b65a90d08a22d23d963d2a68a131ee4e4d5a61d9cb648b3644cb5b72bde48ba" ] } }, @@ -166,11 +166,11 @@ "0x1852756d70656c206b506f696e743a20457468656e61205332066b7053415453": { "amount": "2830357527081490335359", "proof": [ - "0x6258fb3ee01fe8edb76a1ee2cb317cd32b8464c63e31903826acd02863982f31", - "0x9fcad9eaad9b566f6c3bbd4cf63e1ecdd1ae8f5ae46730804df189d86fd83fe6", - "0x2eec07dc470578d8beb2eb4edf89d2309714b87ea0b9e9b2f119df39a28278c7", - "0x703f21e968e8791afb70bcf780821f479ea90632b109016d8b24c8637771383c", - "0x0f76084b6c6777c64b0f591ee64d8c66c54c0bdeb5ce44142823c0f74b856267" + "0x7c1140f479d8f8e1295f0da50f5554de0c77b7b73783022f63b840e186a69c3d", + "0xf88a43494a509c28f8321582f54b7964fc2232a7f109d49a44631cbcfa5d30a9", + "0x65c2bc0496edc30a605d1618f867da252e88358e98d08d80ad0d485df4439055", + "0x9c4c736ac69fbbc0f510cbee646cfcb0a5186004dbb3c577d7c3ab658ddcf209", + "0x2129557061359b11c571b9a63f6363b144b6ae40058d9731d0e165463fc18438" ] } }, @@ -178,11 +178,11 @@ "0x1852756d70656c206b506f696e743a20457468656e61205332066b7053415453": { "amount": "522530241238727636619443", "proof": [ - "0x12eacdb80b635c5670c04a96fbf72a8ec14cbf96300fa76d5ee0373bc98e01b7", - "0x927dca4efe8d82dcf231fc14c5b1847b3059bd93046b4a7a191a831b8e08ee41", - "0x91e627ae1924b31d3a4824be2d8c42333b484d534271b550b988067cda6b4e2b", - "0x990cf688331d86fc70ed92f961ec56ac4475b63c79aaa3bcfd65b53aa844604d", - "0x0f76084b6c6777c64b0f591ee64d8c66c54c0bdeb5ce44142823c0f74b856267" + "0x204bc5b06a6b2d4f2756538646d437d08bd90b5261d351bbdb3f1a7b8e4257c3", + "0x6eea1cb929cbbb3470f1ecd4c6bc7eeffe80233e2832c56b2c355a395e758a37", + "0xb6c90adb569922bd45aac66a537d64fabe79a1dd423e5ed8b92f6840bb85f01b", + "0xa0e9cea52035069ab2ed309706310a8da4a4262651b77fc8873182a03a65a1be", + "0x2129557061359b11c571b9a63f6363b144b6ae40058d9731d0e165463fc18438" ] } }, @@ -190,11 +190,11 @@ "0x1852756d70656c206b506f696e743a20457468656e61205332066b7053415453": { "amount": "262106044120029423561824", "proof": [ - "0x3e7e8dbf133ff6472d8567b24ea2be55e0400118c6a72d46442e54bf47351187", - "0x252017ca2570f4903a5cbd454065e1e9b8e001ddd0b97fc206ef8b210b271253", - "0x2731916afd68e9c7aef75ccf55786ba22a4eff7ec17fa4f8eb052cdc9656ba95", - "0x990cf688331d86fc70ed92f961ec56ac4475b63c79aaa3bcfd65b53aa844604d", - "0x0f76084b6c6777c64b0f591ee64d8c66c54c0bdeb5ce44142823c0f74b856267" + "0x4bfe5e81e4d249db669aeb65109e2409cad5d9d0e4ebf9e58765b431d601b4b2", + "0xce23b4c55a319d5d0b0adcc04b8aa71e95f05acd666f1d8f4e181e7fff0a4fac", + "0xf841623187465e7d387f63fe823bdf658c969e95fbfaff30008e0c7f18f38e4d", + "0xa0e9cea52035069ab2ed309706310a8da4a4262651b77fc8873182a03a65a1be", + "0x2129557061359b11c571b9a63f6363b144b6ae40058d9731d0e165463fc18438" ] } }, @@ -202,11 +202,11 @@ "0x1852756d70656c206b506f696e743a20457468656e61205332066b7053415453": { "amount": "988835303595225079157382", "proof": [ - "0x7c1140f479d8f8e1295f0da50f5554de0c77b7b73783022f63b840e186a69c3d", - "0xfaca43636023a73bf06295aa693c262efe0bb3231357a68b8ad7eec7e901c8ef", - "0x2eec07dc470578d8beb2eb4edf89d2309714b87ea0b9e9b2f119df39a28278c7", - "0x703f21e968e8791afb70bcf780821f479ea90632b109016d8b24c8637771383c", - "0x0f76084b6c6777c64b0f591ee64d8c66c54c0bdeb5ce44142823c0f74b856267" + "0x8868fb0d626d9b7beb373860e043cef276e796a7e86e8070e5d3f5ac07e04d47", + "0xec7d2e07249c1b63f1cbafebe4b19b2a4aede14f630e574c65700ea8211055d9", + "0xeb5e5c658b3904864029aa2d7702a319436d658e2094408832173c6d565c88d4", + "0x9c4c736ac69fbbc0f510cbee646cfcb0a5186004dbb3c577d7c3ab658ddcf209", + "0x2129557061359b11c571b9a63f6363b144b6ae40058d9731d0e165463fc18438" ] } }, @@ -214,11 +214,11 @@ "0x1852756d70656c206b506f696e743a20457468656e61205332066b7053415453": { "amount": "2396414216569414059964695", "proof": [ - "0x6a69b863aea1e9a735f460a6fb449a28b7398f958c4792872d7764700936b79d", - "0x9fcad9eaad9b566f6c3bbd4cf63e1ecdd1ae8f5ae46730804df189d86fd83fe6", - "0x2eec07dc470578d8beb2eb4edf89d2309714b87ea0b9e9b2f119df39a28278c7", - "0x703f21e968e8791afb70bcf780821f479ea90632b109016d8b24c8637771383c", - "0x0f76084b6c6777c64b0f591ee64d8c66c54c0bdeb5ce44142823c0f74b856267" + "0x50aaf318ad53de9f666ad28cfe0153009fc3a94e2fa40f6ae674f9e6fd3e878c", + "0xd9d5035f478e73b0e33ae1677a34fb215dd9f25d858d17265608acd57f066e48", + "0x65c2bc0496edc30a605d1618f867da252e88358e98d08d80ad0d485df4439055", + "0x9c4c736ac69fbbc0f510cbee646cfcb0a5186004dbb3c577d7c3ab658ddcf209", + "0x2129557061359b11c571b9a63f6363b144b6ae40058d9731d0e165463fc18438" ] } } diff --git a/js-scripts/generateRedemptionRights/out/ptoken-snapshot-kpsats.json b/js-scripts/generateRedemptionRights/out/ptoken-snapshot-kpsats.json index f49a6ae..313f03c 100644 --- a/js-scripts/generateRedemptionRights/out/ptoken-snapshot-kpsats.json +++ b/js-scripts/generateRedemptionRights/out/ptoken-snapshot-kpsats.json @@ -1,6 +1,6 @@ { "address": "0xdFa21ceC8A46386F5d36F4b07E18BcCcA59f425B", - "blockNumber": "21116981", + "blockNumber": "21143365", "balances": { "0x25E426b153e74Ab36b2685c3A464272De60888Ae": "832939015897918484874", "0xAF9e4E01525C4856E00Cb0F363AFc34E7decD6a7": "1209830694094345523934847", From b2cd629808183e4881d600b2c14e65cee637ba85 Mon Sep 17 00:00:00 2001 From: Josh Levine Date: Fri, 8 Nov 2024 21:09:53 +0700 Subject: [PATCH 14/16] chore: use new proofs in fail test --- contracts/test/SetRedemptionENA4Nov24.t.sol | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/contracts/test/SetRedemptionENA4Nov24.t.sol b/contracts/test/SetRedemptionENA4Nov24.t.sol index 369eb21..0006871 100644 --- a/contracts/test/SetRedemptionENA4Nov24.t.sol +++ b/contracts/test/SetRedemptionENA4Nov24.t.sol @@ -54,15 +54,15 @@ contract SetRedemptionENA4Nov24Test is Test { function test_RedemptionRights1_ClaimTooMuch() public { bytes32[] memory proof = new bytes32[](5); - proof[0] = 0x991fd8976022911aeb40e40bcb5754f9529f2080710f7ec1db8ace85c4f7b7f8; - proof[1] = 0xc6f15a7cbd986873c6b761e81c98ee8ac4afd1c9885b7d8e0ae4de752040ab12; - proof[2] = 0xca808b743099c608cd9b81872c528c521d76505c116bedabfdcc6307c9c92bfb; - proof[3] = 0x703f21e968e8791afb70bcf780821f479ea90632b109016d8b24c8637771383c; - proof[4] = 0x0f76084b6c6777c64b0f591ee64d8c66c54c0bdeb5ce44142823c0f74b856267; + proof[0] = 0x6258fb3ee01fe8edb76a1ee2cb317cd32b8464c63e31903826acd02863982f31; + proof[1] = 0xd9d5035f478e73b0e33ae1677a34fb215dd9f25d858d17265608acd57f066e48; + proof[2] = 0x65c2bc0496edc30a605d1618f867da252e88358e98d08d80ad0d485df4439055; + proof[3] = 0x9c4c736ac69fbbc0f510cbee646cfcb0a5186004dbb3c577d7c3ab658ddcf209; + proof[4] = 0x2129557061359b11c571b9a63f6363b144b6ae40058d9731d0e165463fc18438; address USER = 0x25E426b153e74Ab36b2685c3A464272De60888Ae; - uint256 TOTAL_CLAIMABLE = 52792622186481736164; - uint256 CLAIM_AMOUNT = 52792622186481736164 + 10; + uint256 TOTAL_CLAIMABLE = 26396311093240867247; + uint256 CLAIM_AMOUNT = 26396311093240867247 + 10; vm.prank(USER); vm.expectRevert(PointTokenVault.ClaimTooLarge.selector); From 8decaff548adf10f9f4d595519bf9e7cedc268c7 Mon Sep 17 00:00:00 2001 From: Josh Levine Date: Sat, 9 Nov 2024 17:01:46 +0700 Subject: [PATCH 15/16] fix: account for redemption rights when updating for unclaimed pTokens --- js-scripts/generateRedemptionRights/index.ts | 6 + .../out/merged-distribution.json | 219 ++++++++++-------- .../out/ptoken-snapshot-kpsats.json | 2 +- 3 files changed, 134 insertions(+), 93 deletions(-) diff --git a/js-scripts/generateRedemptionRights/index.ts b/js-scripts/generateRedemptionRights/index.ts index 2ce0f53..2ff8d10 100644 --- a/js-scripts/generateRedemptionRights/index.ts +++ b/js-scripts/generateRedemptionRights/index.ts @@ -186,6 +186,12 @@ async function calculateRedemptionRights( userAddress as Address, (pTokenBalances.get(userAddress as Address) || 0n) + unclaimedPtokens ); + + redemptionRights.set( + userAddress as Address, + (redemptionRights.get(userAddress as Address) || 0n) + + (unclaimedPtokens * rewardsMultiplierBigInt) / BigInt(1e18) + ); } } diff --git a/js-scripts/generateRedemptionRights/out/merged-distribution.json b/js-scripts/generateRedemptionRights/out/merged-distribution.json index 346dcc1..5fc2bce 100644 --- a/js-scripts/generateRedemptionRights/out/merged-distribution.json +++ b/js-scripts/generateRedemptionRights/out/merged-distribution.json @@ -1,15 +1,15 @@ { - "root": "0x8add61929f9038b9b001852126409672b6c4c12161be6caee4c4ce44fe59538c", + "root": "0xa1c76e2c6f7ac8300b288ff758b8a83c4a19e12780ca7ac5f61182f64ef8edf6", "redemptionRights": { "0x25E426b153e74Ab36b2685c3A464272De60888Ae": { "0x1852756d70656c206b506f696e743a20457468656e61205332066b7053415453": { "amount": "26396311093240867247", "proof": [ - "0x6258fb3ee01fe8edb76a1ee2cb317cd32b8464c63e31903826acd02863982f31", - "0xd9d5035f478e73b0e33ae1677a34fb215dd9f25d858d17265608acd57f066e48", - "0x65c2bc0496edc30a605d1618f867da252e88358e98d08d80ad0d485df4439055", - "0x9c4c736ac69fbbc0f510cbee646cfcb0a5186004dbb3c577d7c3ab658ddcf209", - "0x2129557061359b11c571b9a63f6363b144b6ae40058d9731d0e165463fc18438" + "0x4e0230e7a7546148f373efe52256490c04ea0019e199f2256a375e75cf2b6b96", + "0xfaca43636023a73bf06295aa693c262efe0bb3231357a68b8ad7eec7e901c8ef", + "0x03c4c7f992659d2c405eb95248d21dfd7f66c7bdef49d9d33cb97b0b5d35c37a", + "0x617d803c581341b5720c7932932ca45ebfb90e87a122f801b0d5fe53b747db51", + "0x620f05d3b25d35da47076de4dceb31f95567ff863138ae7d1fe416ea0bc2ff41" ] } }, @@ -17,33 +17,44 @@ "0x1852756d70656c206b506f696e743a20457468656e61205332066b7053415453": { "amount": "38340222707708650495326", "proof": [ - "0x191a3f5a1c7f9b1657f56cf44eb79a72b47ad4be40fae5ced80af9e38731e10c", - "0x6eea1cb929cbbb3470f1ecd4c6bc7eeffe80233e2832c56b2c355a395e758a37", - "0xb6c90adb569922bd45aac66a537d64fabe79a1dd423e5ed8b92f6840bb85f01b", - "0xa0e9cea52035069ab2ed309706310a8da4a4262651b77fc8873182a03a65a1be", - "0x2129557061359b11c571b9a63f6363b144b6ae40058d9731d0e165463fc18438" + "0x217b3e35b22b6bd3732704009f72c0e75d295787739b31e22f4eceb2aadb3b37", + "0x25adc46cf5c2f7012dc1c4e2f45ed46fe6b0937d4f45b69007541a847eac9dd4", + "0x4439e29397d45eb830afb7d52dfc37d8972adbe4eefd9df3c64126153422857d", + "0x185833bfc67ae1d1e405a88dfe822e59dcaec373305b2e76c80db6a7091905d7", + "0x620f05d3b25d35da47076de4dceb31f95567ff863138ae7d1fe416ea0bc2ff41" + ] + } + }, + "0x028CC8E3Ff248Dc59052eaAD2a1e749F3B835B99": { + "0x1852756d70656c206b506f696e743a20457468656e61205332066b7053415453": { + "amount": "14223655008932463486", + "proof": [ + "0x22bd0a3dd00ce6d39746f618e1314a076f69dc34b7f13b915a642b5600e25305", + "0xeda910c5f504e63aafb87a8104f5af92636f2c57e1061ff3e9b4aa12a5544172", + "0x0a0e4a23e7565c93ebd635c41c01005c5bf44908500e9820600784a695ad7768", + "0x185833bfc67ae1d1e405a88dfe822e59dcaec373305b2e76c80db6a7091905d7", + "0x620f05d3b25d35da47076de4dceb31f95567ff863138ae7d1fe416ea0bc2ff41" ] } }, "0x6CD72B1E6E300340A48943d6aF34EF5AE07D3577": { "0x1852756d70656c206b506f696e743a20457468656e61205332066b7053415453": { - "amount": "9810518396138562600", + "amount": "89695639613423029375", "proof": [ - "0xb605c6d24f4591b726ca75a2244f789388c19ffebedd76217fe0eda994f0a8a4", - "0xdc6743cb29d00ac8467f33ac244256f40e5d7fc8e8813cfc8d3c0ab87f1df4d2", - "0x9b65a90d08a22d23d963d2a68a131ee4e4d5a61d9cb648b3644cb5b72bde48ba" + "0xea937ecfc7483e67cfddb5b77c31285fbb7a1b617b616b0bfa2bc10ecf2632dd", + "0x61be1ce59f6e838eae374c35dc5a4d0d596bd8a909863cc6a052608df95bd026", + "0x68ab2a2acfc0717fe2f1a2d72d08932d87ba90aa7c673fc5f7f3d24a75cfa445" ] } }, "0x1d848bf0dcF1b48f5621c37d062f2696D9d71AC4": { "0x1852756d70656c206b506f696e743a20457468656e61205332066b7053415453": { - "amount": "3688783516041368867130", + "amount": "72553382607912658280333", "proof": [ - "0x8b788cab342842ae529d8efac9659e1af9367270c13caaf4c8b5ef4c67a51402", - "0xec7d2e07249c1b63f1cbafebe4b19b2a4aede14f630e574c65700ea8211055d9", - "0xeb5e5c658b3904864029aa2d7702a319436d658e2094408832173c6d565c88d4", - "0x9c4c736ac69fbbc0f510cbee646cfcb0a5186004dbb3c577d7c3ab658ddcf209", - "0x2129557061359b11c571b9a63f6363b144b6ae40058d9731d0e165463fc18438" + "0xdc6743cb29d00ac8467f33ac244256f40e5d7fc8e8813cfc8d3c0ab87f1df4d2", + "0xc6f15a7cbd986873c6b761e81c98ee8ac4afd1c9885b7d8e0ae4de752040ab12", + "0x9b0c4a7e606c4fd8857fd20d901299bfc87aad79ceaaef4ec5961f5c943e92c1", + "0x68ab2a2acfc0717fe2f1a2d72d08932d87ba90aa7c673fc5f7f3d24a75cfa445" ] } }, @@ -51,11 +62,11 @@ "0x1852756d70656c206b506f696e743a20457468656e61205332066b7053415453": { "amount": "14324115790279497348417", "proof": [ - "0x4e0230e7a7546148f373efe52256490c04ea0019e199f2256a375e75cf2b6b96", - "0xce23b4c55a319d5d0b0adcc04b8aa71e95f05acd666f1d8f4e181e7fff0a4fac", - "0xf841623187465e7d387f63fe823bdf658c969e95fbfaff30008e0c7f18f38e4d", - "0xa0e9cea52035069ab2ed309706310a8da4a4262651b77fc8873182a03a65a1be", - "0x2129557061359b11c571b9a63f6363b144b6ae40058d9731d0e165463fc18438" + "0x4bf5c095f95a6461e2f3eb39058850cd65b02d1014ee5a1a12f85d088b5f0e80", + "0xca9b6a744ecb364652014258339103f4e460257a674bf19262c9f824dd17d86e", + "0x0a0e4a23e7565c93ebd635c41c01005c5bf44908500e9820600784a695ad7768", + "0x185833bfc67ae1d1e405a88dfe822e59dcaec373305b2e76c80db6a7091905d7", + "0x620f05d3b25d35da47076de4dceb31f95567ff863138ae7d1fe416ea0bc2ff41" ] } }, @@ -63,23 +74,23 @@ "0x1852756d70656c206b506f696e743a20457468656e61205332066b7053415453": { "amount": "6197058964511974341082", "proof": [ - "0x454cf71470140e5faf8b729495953c32594183b013bef3da2aab9f20e603f492", - "0xc239b9fd3aa0cf39df1880333a057f6ebfd29f85d15d1b9adf7fc2f072ffec91", - "0xf841623187465e7d387f63fe823bdf658c969e95fbfaff30008e0c7f18f38e4d", - "0xa0e9cea52035069ab2ed309706310a8da4a4262651b77fc8873182a03a65a1be", - "0x2129557061359b11c571b9a63f6363b144b6ae40058d9731d0e165463fc18438" + "0x4bfe5e81e4d249db669aeb65109e2409cad5d9d0e4ebf9e58765b431d601b4b2", + "0xca9b6a744ecb364652014258339103f4e460257a674bf19262c9f824dd17d86e", + "0x0a0e4a23e7565c93ebd635c41c01005c5bf44908500e9820600784a695ad7768", + "0x185833bfc67ae1d1e405a88dfe822e59dcaec373305b2e76c80db6a7091905d7", + "0x620f05d3b25d35da47076de4dceb31f95567ff863138ae7d1fe416ea0bc2ff41" ] } }, "0x24C694d193B19119bcDea9D40a3b0bfaFb281E6D": { "0x1852756d70656c206b506f696e743a20457468656e61205332066b7053415453": { - "amount": "205596732836116780", + "amount": "5035486532645526909", "proof": [ - "0x4bf5c095f95a6461e2f3eb39058850cd65b02d1014ee5a1a12f85d088b5f0e80", - "0xc239b9fd3aa0cf39df1880333a057f6ebfd29f85d15d1b9adf7fc2f072ffec91", - "0xf841623187465e7d387f63fe823bdf658c969e95fbfaff30008e0c7f18f38e4d", - "0xa0e9cea52035069ab2ed309706310a8da4a4262651b77fc8873182a03a65a1be", - "0x2129557061359b11c571b9a63f6363b144b6ae40058d9731d0e165463fc18438" + "0x191a3f5a1c7f9b1657f56cf44eb79a72b47ad4be40fae5ced80af9e38731e10c", + "0x72173d6e267f2a29d16a34509f44aac2ad022a7f60873b53300a93802c340804", + "0x4439e29397d45eb830afb7d52dfc37d8972adbe4eefd9df3c64126153422857d", + "0x185833bfc67ae1d1e405a88dfe822e59dcaec373305b2e76c80db6a7091905d7", + "0x620f05d3b25d35da47076de4dceb31f95567ff863138ae7d1fe416ea0bc2ff41" ] } }, @@ -87,11 +98,33 @@ "0x1852756d70656c206b506f696e743a20457468656e61205332066b7053415453": { "amount": "874588945039572133000", "proof": [ - "0x22bd0a3dd00ce6d39746f618e1314a076f69dc34b7f13b915a642b5600e25305", - "0xc06e767d40c0f02f172dd70f160cfe7f9a54281fc7553a967c18e6ad6ffa7fc1", - "0xb6c90adb569922bd45aac66a537d64fabe79a1dd423e5ed8b92f6840bb85f01b", - "0xa0e9cea52035069ab2ed309706310a8da4a4262651b77fc8873182a03a65a1be", - "0x2129557061359b11c571b9a63f6363b144b6ae40058d9731d0e165463fc18438" + "0x204bc5b06a6b2d4f2756538646d437d08bd90b5261d351bbdb3f1a7b8e4257c3", + "0x25adc46cf5c2f7012dc1c4e2f45ed46fe6b0937d4f45b69007541a847eac9dd4", + "0x4439e29397d45eb830afb7d52dfc37d8972adbe4eefd9df3c64126153422857d", + "0x185833bfc67ae1d1e405a88dfe822e59dcaec373305b2e76c80db6a7091905d7", + "0x620f05d3b25d35da47076de4dceb31f95567ff863138ae7d1fe416ea0bc2ff41" + ] + } + }, + "0xe2C3445a84de723Ef4425922165a58D22AD06e33": { + "0x1852756d70656c206b506f696e743a20457468656e61205332066b7053415453": { + "amount": "4157401330951234038", + "proof": [ + "0xf32553bd8ea432642fd95f93d04661d727c3495c97e1ea55841dda3ea97bf75d", + "0x61be1ce59f6e838eae374c35dc5a4d0d596bd8a909863cc6a052608df95bd026", + "0x68ab2a2acfc0717fe2f1a2d72d08932d87ba90aa7c673fc5f7f3d24a75cfa445" + ] + } + }, + "0xD6633c1382896079D3576eC43519d844a8C80B56": { + "0x1852756d70656c206b506f696e743a20457468656e61205332066b7053415453": { + "amount": "2322490968449677698", + "proof": [ + "0x7c1140f479d8f8e1295f0da50f5554de0c77b7b73783022f63b840e186a69c3d", + "0x7633b40f0b9d031a2504b9bd6e72e8a6d60f27109c35e8e3a1e5a9588b288124", + "0x1825942bcf756f17362686c29e669214db7df52b3c86e78654592b95c5b3a76e", + "0x617d803c581341b5720c7932932ca45ebfb90e87a122f801b0d5fe53b747db51", + "0x620f05d3b25d35da47076de4dceb31f95567ff863138ae7d1fe416ea0bc2ff41" ] } } @@ -101,21 +134,20 @@ "0x1852756d70656c206b506f696e743a20457468656e61205332066b7053415453": { "amount": "833020026897918484874", "proof": [ - "0x991fd8976022911aeb40e40bcb5754f9529f2080710f7ec1db8ace85c4f7b7f8", - "0x6f741517db6626510cd30ca65490b696d97e69c114ac78f9a11371f8639fc3d5", - "0xeb5e5c658b3904864029aa2d7702a319436d658e2094408832173c6d565c88d4", - "0x9c4c736ac69fbbc0f510cbee646cfcb0a5186004dbb3c577d7c3ab658ddcf209", - "0x2129557061359b11c571b9a63f6363b144b6ae40058d9731d0e165463fc18438" + "0xb605c6d24f4591b726ca75a2244f789388c19ffebedd76217fe0eda994f0a8a4", + "0x6357299d7699ba4e80f928ce033e518301b337cced573cc09f09339befc0c120", + "0x9b0c4a7e606c4fd8857fd20d901299bfc87aad79ceaaef4ec5961f5c943e92c1", + "0x68ab2a2acfc0717fe2f1a2d72d08932d87ba90aa7c673fc5f7f3d24a75cfa445" ] }, "0x1552756d70656c20506f696e743a205a69726375697408705a49524355495400": { "amount": "335440188667996950000", "proof": [ - "0xa11fb0c1a4d796bcb6fa408ad7fead1f27c139ee194686098410c137f2d5d224", - "0x6f741517db6626510cd30ca65490b696d97e69c114ac78f9a11371f8639fc3d5", - "0xeb5e5c658b3904864029aa2d7702a319436d658e2094408832173c6d565c88d4", - "0x9c4c736ac69fbbc0f510cbee646cfcb0a5186004dbb3c577d7c3ab658ddcf209", - "0x2129557061359b11c571b9a63f6363b144b6ae40058d9731d0e165463fc18438" + "0x8b788cab342842ae529d8efac9659e1af9367270c13caaf4c8b5ef4c67a51402", + "0x9ae95d5e291ec3487c512e2d0067797e0f1b6a1965fcea0e0b75065d8b869d14", + "0x1825942bcf756f17362686c29e669214db7df52b3c86e78654592b95c5b3a76e", + "0x617d803c581341b5720c7932932ca45ebfb90e87a122f801b0d5fe53b747db51", + "0x620f05d3b25d35da47076de4dceb31f95567ff863138ae7d1fe416ea0bc2ff41" ] } }, @@ -123,11 +155,11 @@ "0x1852756d70656c206b506f696e743a20457468656e61205332066b7053415453": { "amount": "152407798291890457882", "proof": [ - "0x6a69b863aea1e9a735f460a6fb449a28b7398f958c4792872d7764700936b79d", - "0xf88a43494a509c28f8321582f54b7964fc2232a7f109d49a44631cbcfa5d30a9", - "0x65c2bc0496edc30a605d1618f867da252e88358e98d08d80ad0d485df4439055", - "0x9c4c736ac69fbbc0f510cbee646cfcb0a5186004dbb3c577d7c3ab658ddcf209", - "0x2129557061359b11c571b9a63f6363b144b6ae40058d9731d0e165463fc18438" + "0x7b50ab37696a9b8976ea0f3028d4d126c49cf1b24c3721446bd284664c4c17be", + "0x7633b40f0b9d031a2504b9bd6e72e8a6d60f27109c35e8e3a1e5a9588b288124", + "0x1825942bcf756f17362686c29e669214db7df52b3c86e78654592b95c5b3a76e", + "0x617d803c581341b5720c7932932ca45ebfb90e87a122f801b0d5fe53b747db51", + "0x620f05d3b25d35da47076de4dceb31f95567ff863138ae7d1fe416ea0bc2ff41" ] } }, @@ -135,11 +167,11 @@ "0x1852756d70656c206b506f696e743a20457468656e61205332066b7053415453": { "amount": "131187337543613434191", "proof": [ - "0x217b3e35b22b6bd3732704009f72c0e75d295787739b31e22f4eceb2aadb3b37", - "0xc06e767d40c0f02f172dd70f160cfe7f9a54281fc7553a967c18e6ad6ffa7fc1", - "0xb6c90adb569922bd45aac66a537d64fabe79a1dd423e5ed8b92f6840bb85f01b", - "0xa0e9cea52035069ab2ed309706310a8da4a4262651b77fc8873182a03a65a1be", - "0x2129557061359b11c571b9a63f6363b144b6ae40058d9731d0e165463fc18438" + "0x2b472340f06e2903f4bad87569e59ad8c2748f37d874e860182a7b23b63bf187", + "0xeda910c5f504e63aafb87a8104f5af92636f2c57e1061ff3e9b4aa12a5544172", + "0x0a0e4a23e7565c93ebd635c41c01005c5bf44908500e9820600784a695ad7768", + "0x185833bfc67ae1d1e405a88dfe822e59dcaec373305b2e76c80db6a7091905d7", + "0x620f05d3b25d35da47076de4dceb31f95567ff863138ae7d1fe416ea0bc2ff41" ] } }, @@ -147,8 +179,10 @@ "0x1852756d70656c206b506f696e743a20457468656e61205332066b7053415453": { "amount": "73286503362495655536", "proof": [ - "0xd4d61b57e16feaf70406fff80fc7d6b6f8141a7d60ccd01bc4085808d809dd14", - "0x9b65a90d08a22d23d963d2a68a131ee4e4d5a61d9cb648b3644cb5b72bde48ba" + "0xc5a3de3c602ab30847fc470e18dc68519e5d2139992db65ec4dd75e0146df4c8", + "0xc6f15a7cbd986873c6b761e81c98ee8ac4afd1c9885b7d8e0ae4de752040ab12", + "0x9b0c4a7e606c4fd8857fd20d901299bfc87aad79ceaaef4ec5961f5c943e92c1", + "0x68ab2a2acfc0717fe2f1a2d72d08932d87ba90aa7c673fc5f7f3d24a75cfa445" ] } }, @@ -156,9 +190,10 @@ "0x1852756d70656c206b506f696e743a20457468656e61205332066b7053415453": { "amount": "4977606283426392328730", "proof": [ - "0xb0401a96d02a3441cb53ae8eb4f241b5b66ce510eb5c767e52c12e30ae576957", - "0xdc6743cb29d00ac8467f33ac244256f40e5d7fc8e8813cfc8d3c0ab87f1df4d2", - "0x9b65a90d08a22d23d963d2a68a131ee4e4d5a61d9cb648b3644cb5b72bde48ba" + "0xa11fb0c1a4d796bcb6fa408ad7fead1f27c139ee194686098410c137f2d5d224", + "0x6357299d7699ba4e80f928ce033e518301b337cced573cc09f09339befc0c120", + "0x9b0c4a7e606c4fd8857fd20d901299bfc87aad79ceaaef4ec5961f5c943e92c1", + "0x68ab2a2acfc0717fe2f1a2d72d08932d87ba90aa7c673fc5f7f3d24a75cfa445" ] } }, @@ -166,11 +201,11 @@ "0x1852756d70656c206b506f696e743a20457468656e61205332066b7053415453": { "amount": "2830357527081490335359", "proof": [ - "0x7c1140f479d8f8e1295f0da50f5554de0c77b7b73783022f63b840e186a69c3d", - "0xf88a43494a509c28f8321582f54b7964fc2232a7f109d49a44631cbcfa5d30a9", - "0x65c2bc0496edc30a605d1618f867da252e88358e98d08d80ad0d485df4439055", - "0x9c4c736ac69fbbc0f510cbee646cfcb0a5186004dbb3c577d7c3ab658ddcf209", - "0x2129557061359b11c571b9a63f6363b144b6ae40058d9731d0e165463fc18438" + "0x6258fb3ee01fe8edb76a1ee2cb317cd32b8464c63e31903826acd02863982f31", + "0x6f209cf7bc61e5a8fcb44d39ea95351ae3989caaa2178e74ce62330ea0151fe2", + "0x03c4c7f992659d2c405eb95248d21dfd7f66c7bdef49d9d33cb97b0b5d35c37a", + "0x617d803c581341b5720c7932932ca45ebfb90e87a122f801b0d5fe53b747db51", + "0x620f05d3b25d35da47076de4dceb31f95567ff863138ae7d1fe416ea0bc2ff41" ] } }, @@ -178,11 +213,11 @@ "0x1852756d70656c206b506f696e743a20457468656e61205332066b7053415453": { "amount": "522530241238727636619443", "proof": [ - "0x204bc5b06a6b2d4f2756538646d437d08bd90b5261d351bbdb3f1a7b8e4257c3", - "0x6eea1cb929cbbb3470f1ecd4c6bc7eeffe80233e2832c56b2c355a395e758a37", - "0xb6c90adb569922bd45aac66a537d64fabe79a1dd423e5ed8b92f6840bb85f01b", - "0xa0e9cea52035069ab2ed309706310a8da4a4262651b77fc8873182a03a65a1be", - "0x2129557061359b11c571b9a63f6363b144b6ae40058d9731d0e165463fc18438" + "0x05b5632fa9188d3d57e26410c16ba2974649803ace78e06da3f50ec9d64ebbb2", + "0x72173d6e267f2a29d16a34509f44aac2ad022a7f60873b53300a93802c340804", + "0x4439e29397d45eb830afb7d52dfc37d8972adbe4eefd9df3c64126153422857d", + "0x185833bfc67ae1d1e405a88dfe822e59dcaec373305b2e76c80db6a7091905d7", + "0x620f05d3b25d35da47076de4dceb31f95567ff863138ae7d1fe416ea0bc2ff41" ] } }, @@ -190,11 +225,11 @@ "0x1852756d70656c206b506f696e743a20457468656e61205332066b7053415453": { "amount": "262106044120029423561824", "proof": [ - "0x4bfe5e81e4d249db669aeb65109e2409cad5d9d0e4ebf9e58765b431d601b4b2", - "0xce23b4c55a319d5d0b0adcc04b8aa71e95f05acd666f1d8f4e181e7fff0a4fac", - "0xf841623187465e7d387f63fe823bdf658c969e95fbfaff30008e0c7f18f38e4d", - "0xa0e9cea52035069ab2ed309706310a8da4a4262651b77fc8873182a03a65a1be", - "0x2129557061359b11c571b9a63f6363b144b6ae40058d9731d0e165463fc18438" + "0x50aaf318ad53de9f666ad28cfe0153009fc3a94e2fa40f6ae674f9e6fd3e878c", + "0xfaca43636023a73bf06295aa693c262efe0bb3231357a68b8ad7eec7e901c8ef", + "0x03c4c7f992659d2c405eb95248d21dfd7f66c7bdef49d9d33cb97b0b5d35c37a", + "0x617d803c581341b5720c7932932ca45ebfb90e87a122f801b0d5fe53b747db51", + "0x620f05d3b25d35da47076de4dceb31f95567ff863138ae7d1fe416ea0bc2ff41" ] } }, @@ -202,11 +237,11 @@ "0x1852756d70656c206b506f696e743a20457468656e61205332066b7053415453": { "amount": "988835303595225079157382", "proof": [ - "0x8868fb0d626d9b7beb373860e043cef276e796a7e86e8070e5d3f5ac07e04d47", - "0xec7d2e07249c1b63f1cbafebe4b19b2a4aede14f630e574c65700ea8211055d9", - "0xeb5e5c658b3904864029aa2d7702a319436d658e2094408832173c6d565c88d4", - "0x9c4c736ac69fbbc0f510cbee646cfcb0a5186004dbb3c577d7c3ab658ddcf209", - "0x2129557061359b11c571b9a63f6363b144b6ae40058d9731d0e165463fc18438" + "0x991fd8976022911aeb40e40bcb5754f9529f2080710f7ec1db8ace85c4f7b7f8", + "0x9ae95d5e291ec3487c512e2d0067797e0f1b6a1965fcea0e0b75065d8b869d14", + "0x1825942bcf756f17362686c29e669214db7df52b3c86e78654592b95c5b3a76e", + "0x617d803c581341b5720c7932932ca45ebfb90e87a122f801b0d5fe53b747db51", + "0x620f05d3b25d35da47076de4dceb31f95567ff863138ae7d1fe416ea0bc2ff41" ] } }, @@ -214,11 +249,11 @@ "0x1852756d70656c206b506f696e743a20457468656e61205332066b7053415453": { "amount": "2396414216569414059964695", "proof": [ - "0x50aaf318ad53de9f666ad28cfe0153009fc3a94e2fa40f6ae674f9e6fd3e878c", - "0xd9d5035f478e73b0e33ae1677a34fb215dd9f25d858d17265608acd57f066e48", - "0x65c2bc0496edc30a605d1618f867da252e88358e98d08d80ad0d485df4439055", - "0x9c4c736ac69fbbc0f510cbee646cfcb0a5186004dbb3c577d7c3ab658ddcf209", - "0x2129557061359b11c571b9a63f6363b144b6ae40058d9731d0e165463fc18438" + "0x6a69b863aea1e9a735f460a6fb449a28b7398f958c4792872d7764700936b79d", + "0x6f209cf7bc61e5a8fcb44d39ea95351ae3989caaa2178e74ce62330ea0151fe2", + "0x03c4c7f992659d2c405eb95248d21dfd7f66c7bdef49d9d33cb97b0b5d35c37a", + "0x617d803c581341b5720c7932932ca45ebfb90e87a122f801b0d5fe53b747db51", + "0x620f05d3b25d35da47076de4dceb31f95567ff863138ae7d1fe416ea0bc2ff41" ] } } diff --git a/js-scripts/generateRedemptionRights/out/ptoken-snapshot-kpsats.json b/js-scripts/generateRedemptionRights/out/ptoken-snapshot-kpsats.json index 313f03c..a7d9c46 100644 --- a/js-scripts/generateRedemptionRights/out/ptoken-snapshot-kpsats.json +++ b/js-scripts/generateRedemptionRights/out/ptoken-snapshot-kpsats.json @@ -1,6 +1,6 @@ { "address": "0xdFa21ceC8A46386F5d36F4b07E18BcCcA59f425B", - "blockNumber": "21143365", + "blockNumber": "21149351", "balances": { "0x25E426b153e74Ab36b2685c3A464272De60888Ae": "832939015897918484874", "0xAF9e4E01525C4856E00Cb0F363AFc34E7decD6a7": "1209830694094345523934847", From ddebc267822fa8d339b17bcc12755d2b08e25586 Mon Sep 17 00:00:00 2001 From: Steven Valeri Date: Sat, 9 Nov 2024 06:22:21 -0500 Subject: [PATCH 16/16] feat: double check calculations --- contracts/script/PointTokenVault.s.sol | 2 +- contracts/test/SetRedemptionENA4Nov24.t.sol | 188 ++++++++++++++++-- foundry.toml | 4 + .../generateRedemptionRights/countpoints.js | 24 +++ 4 files changed, 195 insertions(+), 23 deletions(-) create mode 100644 js-scripts/generateRedemptionRights/countpoints.js diff --git a/contracts/script/PointTokenVault.s.sol b/contracts/script/PointTokenVault.s.sol index 9fc0e9e..8e7fa4f 100644 --- a/contracts/script/PointTokenVault.s.sol +++ b/contracts/script/PointTokenVault.s.sol @@ -132,7 +132,7 @@ contract PointTokenVaultScripts is BatchScript { // Update merkle root vm.startBroadcast(MAINNET_MERKLE_UPDATER); - vaultV0_1_0.updateRoot(0x8add61929f9038b9b001852126409672b6c4c12161be6caee4c4ce44fe59538c); + vaultV0_1_0.updateRoot(0xa1c76e2c6f7ac8300b288ff758b8a83c4a19e12780ca7ac5f61182f64ef8edf6); vm.stopBroadcast(); } diff --git a/contracts/test/SetRedemptionENA4Nov24.t.sol b/contracts/test/SetRedemptionENA4Nov24.t.sol index 0006871..8c0b285 100644 --- a/contracts/test/SetRedemptionENA4Nov24.t.sol +++ b/contracts/test/SetRedemptionENA4Nov24.t.sol @@ -7,11 +7,15 @@ import {ERC20} from "solmate/test/utils/mocks/MockERC20.sol"; import {PointTokenVault} from "../PointTokenVault.sol"; import {PointTokenVaultScripts} from "../script/PointTokenVault.s.sol"; +import {PToken} from "../PToken.sol"; contract SetRedemptionENA4Nov24Test is Test { PointTokenVault vaultV0_1_0 = PointTokenVault(payable(0x1EeEBa76f211C4Dce994b9c5A74BDF25DB649Fa1)); + PToken kpSats = PToken(0xdFa21ceC8A46386F5d36F4b07E18BcCcA59f425B); bytes32 pointsId = LibString.packTwo("Rumpel kPoint: Ethena S2", "kpSATS"); + mapping(address => bool) userAccountedFor; // pToken holder accounted for + function setUp() public { string memory MAINNET_RPC_URL = vm.envString("MAINNET_RPC_URL"); uint256 forkId = vm.createFork(MAINNET_RPC_URL, 21_112_610); // Block mined at Nov-04-2024 06:51:59 AM +UTC @@ -23,11 +27,11 @@ contract SetRedemptionENA4Nov24Test is Test { function test_RedemptionRights1() public { bytes32[] memory proof = new bytes32[](5); - proof[0] = 0x6258fb3ee01fe8edb76a1ee2cb317cd32b8464c63e31903826acd02863982f31; - proof[1] = 0xd9d5035f478e73b0e33ae1677a34fb215dd9f25d858d17265608acd57f066e48; - proof[2] = 0x65c2bc0496edc30a605d1618f867da252e88358e98d08d80ad0d485df4439055; - proof[3] = 0x9c4c736ac69fbbc0f510cbee646cfcb0a5186004dbb3c577d7c3ab658ddcf209; - proof[4] = 0x2129557061359b11c571b9a63f6363b144b6ae40058d9731d0e165463fc18438; + proof[0] = 0x4e0230e7a7546148f373efe52256490c04ea0019e199f2256a375e75cf2b6b96; + proof[1] = 0xfaca43636023a73bf06295aa693c262efe0bb3231357a68b8ad7eec7e901c8ef; + proof[2] = 0x03c4c7f992659d2c405eb95248d21dfd7f66c7bdef49d9d33cb97b0b5d35c37a; + proof[3] = 0x617d803c581341b5720c7932932ca45ebfb90e87a122f801b0d5fe53b747db51; + proof[4] = 0x620f05d3b25d35da47076de4dceb31f95567ff863138ae7d1fe416ea0bc2ff41; address USER = 0x25E426b153e74Ab36b2685c3A464272De60888Ae; uint256 AMOUNT = 26396311093240867247; @@ -54,11 +58,11 @@ contract SetRedemptionENA4Nov24Test is Test { function test_RedemptionRights1_ClaimTooMuch() public { bytes32[] memory proof = new bytes32[](5); - proof[0] = 0x6258fb3ee01fe8edb76a1ee2cb317cd32b8464c63e31903826acd02863982f31; - proof[1] = 0xd9d5035f478e73b0e33ae1677a34fb215dd9f25d858d17265608acd57f066e48; - proof[2] = 0x65c2bc0496edc30a605d1618f867da252e88358e98d08d80ad0d485df4439055; - proof[3] = 0x9c4c736ac69fbbc0f510cbee646cfcb0a5186004dbb3c577d7c3ab658ddcf209; - proof[4] = 0x2129557061359b11c571b9a63f6363b144b6ae40058d9731d0e165463fc18438; + proof[0] = 0x4e0230e7a7546148f373efe52256490c04ea0019e199f2256a375e75cf2b6b96; + proof[1] = 0xfaca43636023a73bf06295aa693c262efe0bb3231357a68b8ad7eec7e901c8ef; + proof[2] = 0x03c4c7f992659d2c405eb95248d21dfd7f66c7bdef49d9d33cb97b0b5d35c37a; + proof[3] = 0x617d803c581341b5720c7932932ca45ebfb90e87a122f801b0d5fe53b747db51; + proof[4] = 0x620f05d3b25d35da47076de4dceb31f95567ff863138ae7d1fe416ea0bc2ff41; address USER = 0x25E426b153e74Ab36b2685c3A464272De60888Ae; uint256 TOTAL_CLAIMABLE = 26396311093240867247; @@ -69,21 +73,161 @@ contract SetRedemptionENA4Nov24Test is Test { vaultV0_1_0.redeemRewards(PointTokenVault.Claim(pointsId, TOTAL_CLAIMABLE, CLAIM_AMOUNT, proof), USER); } - function test_NormalPTokenClaim() public { - bytes32[] memory proof = new bytes32[](5); - proof[0] = 0x6a69b863aea1e9a735f460a6fb449a28b7398f958c4792872d7764700936b79d; - proof[1] = 0xf88a43494a509c28f8321582f54b7964fc2232a7f109d49a44631cbcfa5d30a9; - proof[2] = 0x65c2bc0496edc30a605d1618f867da252e88358e98d08d80ad0d485df4439055; - proof[3] = 0x9c4c736ac69fbbc0f510cbee646cfcb0a5186004dbb3c577d7c3ab658ddcf209; - proof[4] = 0x2129557061359b11c571b9a63f6363b144b6ae40058d9731d0e165463fc18438; + struct RedemptionData { + uint256 pTokenBalance; + uint256 claimedPoints; + uint256 totalClaimablePoints; + uint256 unclaimedPoints; + uint256 totalRedeemableBalance; + uint256 currentRedeemableBalance; + } - address USER = 0x24C694d193B19119bcDea9D40a3b0bfaFb281E6D; - uint256 AMOUNT = 152407798291890457882; + struct RedemptionFiles { + string root; + string path; + string alphaDistribution; + string merged; + string balances; + } - vm.prank(USER); - OldVault(address(vaultV0_1_0)).claimPTokens(PointTokenVault.Claim(pointsId, AMOUNT, AMOUNT, proof), USER); + function test_RedemptionRightsCalculatedAmount() public { + uint256 rewardsPerPToken = 63381137368827226; + + uint256 expectedRedemptionRights; + uint256 redemptionRightAmount; + + RedemptionFiles memory rf; + rf.root = vm.projectRoot(); + rf.path = string.concat(rf.root, "/js-scripts/generateRedemptionRights/last-alpha-distribution.json"); + rf.alphaDistribution = vm.readFile(rf.path); + rf.path = string.concat(rf.root, "/js-scripts/generateRedemptionRights/out/merged-distribution.json"); + rf.merged = vm.readFile(rf.path); + rf.path = string.concat(rf.root, "/js-scripts/generateRedemptionRights/out/ptoken-snapshot-kpsats.json"); + rf.balances = vm.readFile(rf.path); + + string[] memory users = vm.parseJsonKeys(rf.alphaDistribution,string.concat(".pTokens")); + for(uint256 i=0; i < users.length; i++) { + RedemptionData memory rd; + address user = stringToAddress(users[i]); + userAccountedFor[user] = true; + + rd.pTokenBalance = kpSats.balanceOf(user); + rd.claimedPoints = vaultV0_1_0.claimedPTokens(user, pointsId); + rd.totalClaimablePoints = vm.parseJsonUint( + rf.alphaDistribution, + string.concat(".pTokens.", vm.toString(user), ".", vm.toString(pointsId), ".accumulatingPoints") + ); + + rd.unclaimedPoints = rd. totalClaimablePoints - rd.claimedPoints; + rd.totalRedeemableBalance = rd.pTokenBalance + rd.unclaimedPoints; + + // uni overrides + if(user == 0x24C694d193B19119bcDea9D40a3b0bfaFb281E6D){ + rd.totalRedeemableBalance += 6487631537430741114; + } + if(user == 0x44Cb2d713BDa3858001f038645fD05E23E5DE03D){ + rd.totalRedeemableBalance += 27597767454066598826095; + } + + expectedRedemptionRights = rd.totalRedeemableBalance * rewardsPerPToken / 2e18; + try vm.parseJsonUint( + rf.merged, + string.concat(".redemptionRights.", vm.toString(user), ".", vm.toString(pointsId), ".amount") + ) returns (uint256 amount) { + redemptionRightAmount = amount; + } + catch { + redemptionRightAmount = 0; + } + + assertLe(redemptionRightAmount, expectedRedemptionRights); + assertApproxEqAbs(redemptionRightAmount, expectedRedemptionRights, 1e10); + + expectedRedemptionRights = 0; + redemptionRightAmount = 0; + } + + // account for users with pToken balances, but no claimable tokens + string[] memory balanceUsers = vm.parseJsonKeys(rf.balances,string.concat(".balances")); + for(uint256 i=0; i < balanceUsers.length; i++) { + address user = stringToAddress(balanceUsers[i]); + if(!userAccountedFor[user]){ + RedemptionData memory rd; + userAccountedFor[user] = true; + + rd.pTokenBalance = kpSats.balanceOf(user); + rd.totalRedeemableBalance = rd.pTokenBalance; + + // uni overrides + if(user == 0x24C694d193B19119bcDea9D40a3b0bfaFb281E6D){ + rd.totalRedeemableBalance += 6487631537430741114; + } + if(user == 0x44Cb2d713BDa3858001f038645fD05E23E5DE03D){ + rd.totalRedeemableBalance += 27597767454066598826095; + } + + expectedRedemptionRights = rd.totalRedeemableBalance * rewardsPerPToken / 2e18; + + redemptionRightAmount; + try vm.parseJsonUint( + rf.merged, + string.concat(".redemptionRights.", vm.toString(user), ".", vm.toString(pointsId), ".amount") + ) returns (uint256 amount) { + redemptionRightAmount = amount; + } + catch { + redemptionRightAmount = 0; + } + + assertLe(redemptionRightAmount, expectedRedemptionRights); + assertApproxEqAbs(redemptionRightAmount, expectedRedemptionRights, 1e10); + + expectedRedemptionRights = 0; + redemptionRightAmount = 0; + } + } + } - assertEq(ERC20(address(vaultV0_1_0.pTokens(pointsId))).balanceOf(USER), AMOUNT); + function stringToAddress(string memory _address) internal returns (address) { + // Remove "0x" prefix if present + bytes memory _addressBytes = bytes(_address); + if (_addressBytes.length >= 2 && _addressBytes[0] == "0" && (_addressBytes[1] == "x" || _addressBytes[1] == "X")) { + string memory _cleanAddress = new string(_addressBytes.length - 2); + for(uint i = 0; i < _addressBytes.length - 2; i++) { + bytes(_cleanAddress)[i] = _addressBytes[i + 2]; + } + _address = _cleanAddress; + } + + // Check if the string length is correct (40 characters for address without 0x) + require(bytes(_address).length == 40, "Invalid address length"); + + // Convert string to bytes + bytes memory _hexBytes = bytes(_address); + uint160 _parsedAddress = 0; + + // Convert each character to its hex value + for(uint i = 0; i < 40; i++) { + bytes1 char = _hexBytes[i]; + uint8 digit; + + if (uint8(char) >= 48 && uint8(char) <= 57) { + // 0-9 + digit = uint8(char) - 48; + } else if (uint8(char) >= 65 && uint8(char) <= 70) { + // A-F + digit = uint8(char) - 55; + } else if (uint8(char) >= 97 && uint8(char) <= 102) { + // a-f + digit = uint8(char) - 87; + } else { + revert("Invalid character in address string"); + } + + _parsedAddress = _parsedAddress * 16 + digit; + } + + return address(_parsedAddress); } } diff --git a/foundry.toml b/foundry.toml index 6d69766..797fa61 100644 --- a/foundry.toml +++ b/foundry.toml @@ -10,6 +10,10 @@ ffi = true ast = true build_info = true extra_output = ["storageLayout"] +fs_permissions = [{ access = "read", path = "./js-scripts/generateRedemptionRights/last-alpha-distribution.json" }, +{ access = "read", path = "./js-scripts/generateRedemptionRights/out/merged-distribution.json" }, +{ access = "read", path = "./js-scripts/generateRedemptionRights/out/ptoken-snapshot-kpsats.json" }, +{ access = "read", path = "./out/PointTokenVault.sol/PointTokenVault.json" }] [rpc_endpoints] sepolia = "${SEPOLIA_RPC_URL}" diff --git a/js-scripts/generateRedemptionRights/countpoints.js b/js-scripts/generateRedemptionRights/countpoints.js new file mode 100644 index 0000000..772ba72 --- /dev/null +++ b/js-scripts/generateRedemptionRights/countpoints.js @@ -0,0 +1,24 @@ +import { readFileSync } from "fs"; + +const rewards = 132431200000000000000000 / 1e18; + +const data = JSON.parse( + readFileSync( + `${process.cwd()}/js-scripts/generateRedemptionRights/last-alpha-distribution.json` + ) +); + +const kpSatId = + "0x1852756d70656c206b506f696e743a20457468656e61205332066b7053415453"; + +const pTokens = data.pTokens; + +let total = 0; +for (const user in pTokens) { + console.log(pTokens[user][kpSatId]); + total += pTokens[user][kpSatId].accumulatingPoints; +} +console.log(total); +const totalPTokens = total / 1e18; +const rewardsPerPToken = rewards / totalPTokens; +console.log(rewardsPerPToken * 2);