-
-
Notifications
You must be signed in to change notification settings - Fork 262
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feature(unlock-app): Airdrops blastoff (#15564)
* wip * more work * adding campaign * typescript * fixed typescript
- Loading branch information
Showing
9 changed files
with
392 additions
and
70 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,19 +1,26 @@ | ||
[ | ||
{ | ||
"id": "1", | ||
"title": "UP Token Swap", | ||
"name": "UP Token Swap", | ||
"description": "The Unlock DAO migration to Base is complete, and the UP token swap reward airdrop, totaling 1.061 million UP tokens, is now live for all eligible participants.", | ||
"tokenAmount": "1061000", | ||
"tokenSymbol": "UP", | ||
"recipientsFile": "https://example.com/airdrop1-recipients.json" | ||
"url": "https://unlock-protocol.com/blog/up-token-swap-reward-airdrop-now-live-" | ||
}, | ||
{ | ||
"id": "2", | ||
"title": "Airdrop #2", | ||
"description": "More to come", | ||
"contractAddress": "0x1234567890123456789012345678901234567890", | ||
"tokenAmount": "10000", | ||
"tokenSymbol": "UP", | ||
"recipientsFile": "https://example.com/airdrop2-recipients.json" | ||
"name": "Blastoff Airdrop", | ||
"description": "The Unlock Protocol Foundation is launching a next airdrop to Unlock Protocol community members, distributing over 7 million $UP tokens on Base to over 10,000 members of the community!", | ||
"contractAddress": "0x3b26D06Ea8252a73742d2125D1ACEb594ECEE5c6", | ||
"recipientsFile": "https://merkle-trees.unlock-protocol.com/0xe238effc14b43022c9ce132e22f0baa73cdd8696f4b435150a4c9341c83abfbf.json", | ||
"token": { | ||
"address": "0x3b26D06Ea8252a73742d2125D1ACEb594ECEE5c6", | ||
"symbol": "UP", | ||
"decimals": 18 | ||
}, | ||
"chainId": 8453 | ||
}, | ||
{ | ||
"id": "3", | ||
"name": "Trading Volume", | ||
"description": "More details to be announced soon!" | ||
} | ||
] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,21 +1,25 @@ | ||
import { ethers } from 'ethers' | ||
import { AirdropData } from '../../components/Campaigns' | ||
|
||
/** | ||
* Checks if an address is eligible for an airdrop and returns the token amount | ||
* This is a temporary implementation that randomly determines eligibility | ||
* To be replaced with actual implementation that checks against the recipients file | ||
*/ | ||
export const isEligible = async ( | ||
_address: string, | ||
_recipientsFile: string | ||
address: string, | ||
airdrop: AirdropData | ||
): Promise<number> => { | ||
// Temporary implementation: randomly determine eligibility | ||
// const random = Math.random() | ||
|
||
// // 40% chance of being eligible | ||
// if (random < 0.4) { | ||
// // Random amount between 100 and 1000 tokens | ||
// const amount = Math.floor(Math.random() * 900) + 100 | ||
// return amount | ||
// } | ||
|
||
return 1337 | ||
if (!airdrop.recipientsFile || !address) { | ||
return 0 | ||
} | ||
const request = await fetch(airdrop.recipientsFile) | ||
const recipients = await request.json() | ||
const recipient = recipients.values.find((recipient: any) => { | ||
return recipient.value[0] === address | ||
}) | ||
if (!recipient) { | ||
return 0 | ||
} | ||
return Number(ethers.formatUnits(recipient.value[1], airdrop.token.decimals)) | ||
} |
Oops, something went wrong.