Skip to content

Commit

Permalink
chore:(drop_me_after_review): add mock data for test
Browse files Browse the repository at this point in the history
  • Loading branch information
jurajpiar committed Feb 13, 2025
1 parent 7b24cb1 commit 65c8a16
Show file tree
Hide file tree
Showing 2 changed files with 80 additions and 5 deletions.
70 changes: 69 additions & 1 deletion .github/.scripts/boost.ts
Original file line number Diff line number Diff line change
@@ -1 +1,69 @@
;(() => {})()
import { promises as fs } from 'fs'
import path from 'path'
;(async () => {
try {
// Define paths
const rootDir = process.cwd() // Assumes the script is run from the project root
const dataDir = path.join(rootDir, 'nft_boost_data')
const latestFilePath = path.join(dataDir, 'latest')
const jsonFileName = '0xDEADDEADDEADDEADDEADDEADDEADDEADDEADDEAD_666666.json'
const jsonFilePath = path.join(dataDir, jsonFileName)

// 1. Create folder nft_boost_data if it doesn't exist
try {
await fs.access(dataDir)
// Folder exists
} catch {
// Folder does not exist; create it
await fs.mkdir(dataDir)
console.log(`Directory created: ${dataDir}`)
}

// 2. Create file 'latest' in the nft_boost_data folder if it doesn't exist
try {
await fs.access(latestFilePath)
// File exists
} catch {
// File does not exist; create an empty file
await fs.writeFile(latestFilePath, '', 'utf8')
console.log(`File created: ${latestFilePath}`)
}

// 3. Create JSON file if it doesn't exist with the specified template
try {
await fs.access(jsonFilePath)
// File exists
} catch {
// File does not exist; create it with template content
const jsonData = {
nftContractAddress: '0xDEADDEADDEADDEADDEADDEADDEADDEADDEADDEAD_666666',
boostPercentage: 0,
calculationBlock: 0,
holders: {
// Example structure:
// "0xHolderAddress1": {
// estimatedRBTCRewards: 0,
// estimatedRIFRewards: 0,
// boostedRBTCRewards: 0,
// boostedRIFRewards: 0,
// tokenId: "0xTokenId"
// },
// "0xHolderAddress2": {
// estimatedRBTCRewards: 0,
// estimatedRIFRewards: 0,
// boostedRBTCRewards: 0,
// boostedRIFRewards: 0
// }
},
}
await fs.writeFile(jsonFilePath, JSON.stringify(jsonData, null, 2), 'utf8')
console.log(`JSON file created: ${jsonFilePath}`)
}

// 4. Make the latest file contain the JSON file name
await fs.writeFile(latestFilePath, jsonFileName, 'utf8')
console.log(`Latest file updated with content: ${jsonFileName}`)
} catch (error) {
console.error('Error:', error)
}
})()
15 changes: 11 additions & 4 deletions .github/workflows/booster.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,8 @@ on:
nft:
description: 'The address of the NFT contract'
required: true
# TODO: remove after testing/review:
pull_request:

jobs:
boost:
Expand Down Expand Up @@ -39,10 +41,15 @@ jobs:
BOOSTER_RPC_URL: ${{ secrets.BOOSTER_RPC_URL }}
BOOSTER_CHAIN_ID: ${{ secrets.BOOSTER_CHAIN_ID }}
run: |
npx tsx ./github/.scripts/boost.ts \
--campaignId ${{ github.event.inputs.campaignId }} \
--amount ${{ github.event.inputs.amount }} \
--nft ${{ github.event.inputs.nft }}
# npx tsx ./github/.scripts/boost.ts \
# --campaignId ${{ github.event.inputs.campaignId }} \
# --amount ${{ github.event.inputs.amount }} \
# --nft ${{ github.event.inputs.nft }}
# TODO: remove after testing/review:
npx tsx .github/.scripts/boost.ts \
--campaignId "Vanguard_campaign_01" \
--amount 20 \
--nft "0xDEADDEADDEADDEADDEADDEADDEADDEADDEADDEAD_666666"
- name: Commit and push changes
run: |
Expand Down

0 comments on commit 65c8a16

Please sign in to comment.