Skip to content

Commit

Permalink
add log output for amount of total pandora in pods contract
Browse files Browse the repository at this point in the history
  • Loading branch information
caldereth committed Feb 22, 2024
1 parent 1ab4a19 commit 8c74a94
Showing 1 changed file with 36 additions and 13 deletions.
49 changes: 36 additions & 13 deletions scripts/pandora-holder-snapshot.ts
Original file line number Diff line number Diff line change
Expand Up @@ -242,20 +242,10 @@ function calculateAirdropDistribution(
return airdropDistribution
}

async function peapodsSnapshot(endBlock: number) {
// Configuration.
const startBlock = 19167200
const pandoraPodMainnetAddress = "0xf109BA50e6697F2579d5B073f347520373C2ADb3"

// Connect to the deployed mainnet Pandora Pod contract using a MockERC20 interface.
const pandoraPodFactory = await ethers.getContractFactory("MockERC20")
const pandoraPodContract = await pandoraPodFactory.attach(
pandoraPodMainnetAddress,
)

async function peapodsSnapshot(contract, startBlock: number, endBlock: number) {
// First load the events.
const events = await loadOrGenerateEventsFile(
pandoraPodContract,
contract,
startBlock,
endBlock,
false,
Expand Down Expand Up @@ -323,8 +313,41 @@ async function main() {
console.log("Saved unfiltered balances to file", balancesFilename)

if (includePeapods) {
// Configuration.
const podStartBlock = 19167200
const pandoraPodMainnetAddress =
"0xf109BA50e6697F2579d5B073f347520373C2ADb3"

// Connect to the deployed mainnet Pandora Pod contract using a MockERC20 interface.
const pandoraPodFactory = await ethers.getContractFactory("MockERC20")
const pandoraPodContract = await pandoraPodFactory.attach(
pandoraPodMainnetAddress,
)

// Take Pandora peapods snapshot
const pandoraPeapodsBalances = await peapodsSnapshot(endBlock)
const pandoraPeapodsBalances = await peapodsSnapshot(
pandoraPodContract,
podStartBlock,
endBlock,
)

// Check that the sum of all balances is equal to the PANDORA balance in the contract
const sum = Object.values(pandoraPeapodsBalances).reduce(
(acc, value) => acc + value,
0n,
)
const contractBalance = await pandoraContract.balanceOf(
pandoraPodMainnetAddress,
{
blockTag: endBlock,
},
)

console.log("Sum of all pPDRA balances:", ethers.formatEther(sum))
console.log(
"PANDORA balance of pPDRA contract:",
ethers.formatEther(contractBalance),
)

// Merge the two balance sets.
for (const [address, balance] of Object.entries(pandoraPeapodsBalances)) {
Expand Down

0 comments on commit 8c74a94

Please sign in to comment.