Skip to content

Commit

Permalink
Merge pull request #206 from nation3/skip-parcel
Browse files Browse the repository at this point in the history
Skip parcel (#205)
  • Loading branch information
aahna-ashina authored Oct 15, 2023
2 parents 7c09eb7 + 539bca5 commit dcbf117
Show file tree
Hide file tree
Showing 6 changed files with 5 additions and 54 deletions.
4 changes: 1 addition & 3 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,8 +1,6 @@
node_modules/
site/
output/*
output/*
!output/grainIntegration/
output/
cache/

.env
Expand Down
47 changes: 4 additions & 43 deletions generate-csv.js
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,6 @@ const path = require('path')
const csvParser = require('csv-parser')
const csvWriter = require('csv-writer')
const currencyDetails = require('./config/currencyDetails.json')
const nationAddress = currencyDetails.integrationCurrency.tokenAddress

// 0.50% of the weekly $NATION budget set in config/grain.json
const FLOOR = 0.01;
Expand All @@ -27,10 +26,7 @@ function generateCSV() {

files.forEach(function(file, index) {
const filePath = path.join('output/grainIntegration/', file)
if (filePath.endsWith('.csv')
&& !filePath.endsWith('_disperse.csv')
&& !filePath.endsWith('_gnosis.csv')
&& !filePath.endsWith('_parcel.csv')) {
if (filePath.endsWith('.csv')) {
// Read the rows of data from the CSV file
let csvRows = []
fs.createReadStream(filePath)
Expand All @@ -45,20 +41,12 @@ function generateCSV() {

csvRows = pruneRows(csvRows);

// Generate CSV for Disperse.app
filePathDisperse = filePath.replace('.csv', '_disperse.csv')
console.log('filePathDisperse', filePathDisperse)
writeToDisperseCSV(filePathDisperse, csvRows);

// Generate CSV for Gnosis Safe
filePathGnosis = filePath.replace('.csv', '_gnosis.csv')
const fileNameGnosis = file.replace('.csv', '_gnosis.csv')
console.log('fileNameGnosis:', fileNameGnosis)
const filePathGnosis = path.join('grain-distributions/', fileNameGnosis)
console.log('filePathGnosis', filePathGnosis)
writeToGnosisCSV(filePathGnosis, csvRows)

// Generate CSV for Parcel
filePathParcel = filePath.replace('.csv', '_parcel.csv')
console.log('filePathParcel', filePathParcel)
writeToParcelCSV(filePathParcel, csvRows)
})
}
})
Expand Down Expand Up @@ -101,17 +89,6 @@ function convertAmountFormat(csvRows) {
})
}

function writeToDisperseCSV(filePathDisperse, csvRows) {
console.log('writeToDisperseCSV')

const writer = csvWriter.createObjectCsvWriter({
path: filePathDisperse,
header: ['receiver', 'amount']
})

writer.writeRecords(csvRows)
}

function writeToGnosisCSV(filePathGnosis, csvRows) {
console.log('writeToGnosisCSV')

Expand All @@ -128,19 +105,3 @@ function writeToGnosisCSV(filePathGnosis, csvRows) {

writer.writeRecords(csvRows)
}

function writeToParcelCSV(filePathParcel, csvRows) {
console.log('writeToParcelCSV')

const writer = csvWriter.createObjectCsvWriter({
path: filePathParcel,
header: [
{id: 'name', title: 'Name(Optional)'},
{id: 'receiver', title: 'Address/ENS'},
{id: 'amount', title: 'Amount'},
{id: 'token_address', title: 'Token Address/Token Symbol'}
]
})

writer.writeRecords(csvRows)
}

This file was deleted.

This file was deleted.

This file was deleted.

0 comments on commit dcbf117

Please sign in to comment.