Skip to content

Commit 72f4ebb

Browse files
authored
Merge pull request #124 from nation3/113-rename-to-voting-escrow
Rename to voting escrow (#113)
2 parents 1fb0cfc + 2a5a80c commit 72f4ebb

File tree

300 files changed

+632
-632
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

300 files changed

+632
-632
lines changed

.github/CODEOWNERS

+1-1
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
* @nation3/developer-level-4 @nation3/developer-level-5
1+
* @nation3/developer-level-4

.github/pull_request_template.md

+1-1
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@
77
<!--- Please describe in detail how you tested your changes. -->
88

99
- [ ] Status checks pass
10-
- [ ] Works on Goerli
10+
- [ ] Works on Sepolia
1111
- [ ] Works on Mainnet
1212

1313
## Are There Admin Tasks?

.github/workflows/generate-datasets-weekly.yml

+8-8
Original file line numberDiff line numberDiff line change
@@ -36,17 +36,17 @@ jobs:
3636
- name: Build
3737
run: npm run build
3838

39-
# Generate Citizen Data CSV 🧮
40-
- run: npm run generate-csv
39+
# 1. Generate Citizen Data CSV 🧮
40+
- run: npm run generate-1-csv
4141

42-
# Generate Citizen Data JSON 🧮
43-
- run: npm run generate-json
42+
# 2. Generate Citizen Data JSON 🧮
43+
- run: npm run generate-2-json
4444

45-
# Generate Historical Citizen Data CSVs 🧮
46-
- run: npm run generate-power
45+
# 3. Generate Historical Citizen Data CSVs 🧮
46+
- run: npm run generate-3-voting-escrow
4747

48-
# Generate Citizen Count CSV 🧮
49-
- run: npm run generate-count
48+
# 4. Generate Citizen Count CSV 🧮
49+
- run: npm run generate-4-count
5050

5151
- name: Commit Changes
5252
run: |

data-sources/citizens/README.md

+10-10
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ https://etherscan.io/token/0x3337dac9f251d4e403d6030e18e3cfb6a2cb1333#inventory
66

77
- `citizens.csv`
88

9-
- Contains the NFT Passport ID, owner/signer Ethereum address and ENS name (if any) of each Nation3 Citizen. And the `voting_power` column is the Citizen's [`$veNATION`](https://wiki.nation3.org/token/#venation) balance.
9+
- Contains the NFT Passport ID, owner/signer Ethereum address and ENS name (if any) of each Nation3 Citizen. And the `voting_escrow` column is the Citizen's [`$veNATION`](https://wiki.nation3.org/token/#venation) balance.
1010

1111
- The `owner_address` is the Ethereum address used for linking a Citizen to activity in Dework/GitHub/Karma/Snapshot/SourceCred.
1212

@@ -16,7 +16,7 @@ https://etherscan.io/token/0x3337dac9f251d4e403d6030e18e3cfb6a2cb1333#inventory
1616

1717
- `citizen-<passportId>.csv`
1818

19-
- Contains a Citizen's voting power week by week.
19+
- Contains a Citizen's voting escrow week by week.
2020

2121
- `citizen-count-peer-week.csv`
2222

@@ -36,26 +36,26 @@ npm install
3636
npm run build
3737
```
3838

39-
### Generate Citizen Data CSV
39+
### 1. Generate Citizen Data CSV
4040

4141
```
42-
npm run generate-csv
42+
npm run generate-1-csv
4343
```
4444

45-
### Generate Citizen Data JSON
45+
### 2. Generate Citizen Data JSON
4646

4747
```
48-
npm run generate-json
48+
npm run generate-2-json
4949
```
5050

51-
### Generate Historical Citizen Data CSVs
51+
### 3. Generate Historical Citizen Data CSVs
5252

5353
```
54-
npm run generate-power
54+
npm run generate-3-voting-escrow
5555
```
5656

57-
### Generate Citizen Count CSV
57+
### 4. Generate Citizen Count CSV
5858

5959
```
60-
npm run generate-count
60+
npm run generate-4-count
6161
```

data-sources/citizens/generate-citizens-csv.ts data-sources/citizens/generate-1-citizens-csv.ts

+10-10
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,7 @@ async function loadCitizenData() {
3535
{ id: 'owner_address', title: 'owner_address' },
3636
{ id: 'signer_address', title: 'signer_address' },
3737
{ id: 'ens_name', title: 'ens_name' },
38-
{ id: 'voting_power', title: 'voting_power' },
38+
{ id: 'voting_escrow', title: 'voting_escrow' },
3939
],
4040
})
4141
let csvRows = []
@@ -62,20 +62,20 @@ async function loadCitizenData() {
6262
const ensName: string | null = await getEnsName(ownerAddress)
6363
console.info('ensName:', ensName)
6464

65-
const votingPowerWei: number = await getVotingPower(ownerAddress)
66-
console.info('votingPowerWei:', votingPowerWei)
67-
const votingPowerEther: string = ethers.formatUnits(votingPowerWei)
68-
console.info('votingPowerEther:', votingPowerEther)
69-
const votingPowerRounded: string = new Number(votingPowerEther).toFixed(2)
70-
console.info('votingPowerRounded:', votingPowerRounded)
65+
const votingEscrowWei: number = await getVotingEscrow(ownerAddress)
66+
console.info('votingEscrowWei:', votingEscrowWei)
67+
const votingEscrowEther: string = ethers.formatUnits(votingEscrowWei)
68+
console.info('votingEscrowEther:', votingEscrowEther)
69+
const votingEscrowRounded: string = new Number(votingEscrowEther).toFixed(2)
70+
console.info('votingEscrowRounded:', votingEscrowRounded)
7171

7272
// Export to CSV
7373
const csvRow = {
7474
passport_id: passportId,
7575
owner_address: ownerAddress.toLowerCase(),
7676
signer_address: signerAddress.toLowerCase(),
7777
ens_name: ensName,
78-
voting_power: votingPowerRounded
78+
voting_escrow: votingEscrowRounded
7979
}
8080
csvRows.push(csvRow)
8181
}
@@ -113,8 +113,8 @@ async function getEnsName(ethAddress: string): Promise<string | null> {
113113
return await ethersProvider.lookupAddress(ethAddress)
114114
}
115115

116-
async function getVotingPower(ethAddress: string): Promise<number> {
117-
console.info('getVotingPower')
116+
async function getVotingEscrow(ethAddress: string): Promise<number> {
117+
console.info('getVotingEscrow')
118118
return await votingEscrowContract.balanceOf(ethAddress)
119119
}
120120

data-sources/citizens/generate-citizens-json.ts data-sources/citizens/generate-2-citizens-json.ts

+2-2
Original file line numberDiff line numberDiff line change
@@ -27,15 +27,15 @@ async function convertToJSON() {
2727
const ownerAddress: string = row.owner_address
2828
const signerAddress: string = row.signer_address
2929
const ensName: string = row.ens_name
30-
const votingPower: number = Number(row.voting_power)
30+
const votingEscrow: number = Number(row.voting_escrow)
3131

3232
if (passportID >= 0) {
3333
const citizenObject = {
3434
passportId: passportID,
3535
ownerAddress: ownerAddress,
3636
signerAddress: signerAddress,
3737
ensName: ensName,
38-
votingPower: votingPower,
38+
votingEscrow: votingEscrow,
3939
}
4040

4141
citizenObjects[String(passportID)] = citizenObject

data-sources/citizens/generate-voting-power-datasets.ts data-sources/citizens/generate-3-voting-escrow-datasets.ts

+14-14
Original file line numberDiff line numberDiff line change
@@ -19,10 +19,10 @@ const votingEscrowContract = new ethers.Contract(
1919
ethersProvider
2020
)
2121

22-
loadVotingPowerData()
22+
loadVotingEscrowData()
2323

24-
async function loadVotingPowerData() {
25-
console.info('loadVotingPowerData')
24+
async function loadVotingEscrowData() {
25+
console.info('loadVotingEscrowData')
2626

2727
const citizensJson = require('../output/citizens.json')
2828
for (const passportId in citizensJson) {
@@ -39,7 +39,7 @@ async function loadVotingPowerData() {
3939
header: [
4040
{ id: 'week_end', title: 'week_end' },
4141
{ id: 'block', title: 'block' },
42-
{ id: 'voting_power', title: 'voting_power' }
42+
{ id: 'voting_escrow', title: 'voting_escrow' }
4343
]
4444
})
4545
const csvRows = []
@@ -57,19 +57,19 @@ async function loadVotingPowerData() {
5757
const blockByDate = await dater.getDate(weekEndDate)
5858
// console.debug('blockByDate:', blockByDate)
5959

60-
// Get Citizen's voting power at the current block
61-
const votingPowerWei: number = await getVotingPowerAtBlock(ethAddress, blockByDate.block)
62-
console.info('votingPowerWei:', votingPowerWei)
63-
const votingPowerEther: string = ethers.formatUnits(votingPowerWei)
64-
console.info('votingPowerEther:', votingPowerEther)
65-
const votingPowerRounded: string = new Number(votingPowerEther).toFixed(2)
66-
console.info('votingPowerRounded:', votingPowerRounded)
60+
// Get Citizen's voting escrow at the current block
61+
const votingEscrowWei: number = await getVotingEscrowAtBlock(ethAddress, blockByDate.block)
62+
console.info('votingEscrowWei:', votingEscrowWei)
63+
const votingEscrowEther: string = ethers.formatUnits(votingEscrowWei)
64+
console.info('votingEscrowEther:', votingEscrowEther)
65+
const votingEscrowRounded: string = new Number(votingEscrowEther).toFixed(2)
66+
console.info('votingEscrowRounded:', votingEscrowRounded)
6767

6868
// Export to CSV
6969
const csvRow = {
7070
week_end: weekEndDate.toISOString().substring(0, 10),
7171
block: blockByDate.block,
72-
voting_power: votingPowerRounded
72+
voting_escrow: votingEscrowRounded
7373
}
7474
csvRows.push(csvRow)
7575

@@ -81,7 +81,7 @@ async function loadVotingPowerData() {
8181
}
8282
}
8383

84-
async function getVotingPowerAtBlock(ethAddress: string, blockNumber: number): Promise<number> {
85-
console.info('getVotingPowerAtBlock')
84+
async function getVotingEscrowAtBlock(ethAddress: string, blockNumber: number): Promise<number> {
85+
console.info('getVotingEscrowAtBlock')
8686
return await votingEscrowContract.balanceOfAt(ethAddress, blockNumber)
8787
}

data-sources/citizens/generate-citizen-count-csv.ts data-sources/citizens/generate-4-citizen-count-csv.ts

+3-3
Original file line numberDiff line numberDiff line change
@@ -101,7 +101,7 @@ function getTotalExpiredPassports(weekEndDate: Date, maxPassportID: number): num
101101
for (let passportID = 0; passportID < maxPassportID; passportID++) {
102102
console.info(`weekEndDate: ${weekEndDateString}, passportID: ${passportID}`)
103103

104-
// Fetch voting power data from the citizen's data CSV
104+
// Fetch voting escrow data from the citizen's data CSV
105105
const citizenFilePath: string = `output/citizen-${passportID}.csv`
106106
console.info('Fetching citizen data:', citizenFilePath)
107107
const file: File = fs.readFileSync(citizenFilePath)
@@ -115,8 +115,8 @@ function getTotalExpiredPassports(weekEndDate: Date, maxPassportID: number): num
115115
// console.info('result:', result)
116116
result.data.forEach((row: any, i: number) => {
117117
if (row.week_end == weekEndDateString) {
118-
console.info(`row.week_end ${row.week_end}, row.voting_power: ${row.voting_power}`)
119-
if (row.voting_power < 1.5) {
118+
console.info(`row.week_end ${row.week_end}, row.voting_escrow: ${row.voting_escrow}`)
119+
if (row.voting_escrow < 1.5) {
120120
// https://etherscan.io/address/0x279c0b6bfcbba977eaf4ad1b2ffe3c208aa068ac#readContract#F9
121121
console.info('Passport ID expired:', passportID)
122122
totalExpiredPassports++

data-sources/citizens/output/citizen-0.csv

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
week_end,block,voting_power
1+
week_end,block,voting_escrow
22
2022-06-05,14905988,0.00
33
2022-06-12,14947132,0.00
44
2022-06-19,14987809,0.00

data-sources/citizens/output/citizen-1.csv

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
week_end,block,voting_power
1+
week_end,block,voting_escrow
22
2022-06-05,14905988,2.91
33
2022-06-12,14947132,2.89
44
2022-06-19,14987809,2.88

data-sources/citizens/output/citizen-10.csv

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
week_end,block,voting_power
1+
week_end,block,voting_escrow
22
2022-06-05,14905988,3.38
33
2022-06-12,14947132,3.37
44
2022-06-19,14987809,3.35

data-sources/citizens/output/citizen-100.csv

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
week_end,block,voting_power
1+
week_end,block,voting_escrow
22
2022-06-05,14905988,2.42
33
2022-06-12,14947132,2.40
44
2022-06-19,14987809,2.39

data-sources/citizens/output/citizen-101.csv

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
week_end,block,voting_power
1+
week_end,block,voting_escrow
22
2022-06-05,14905988,2.22
33
2022-06-12,14947132,2.21
44
2022-06-19,14987809,2.20

data-sources/citizens/output/citizen-102.csv

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
week_end,block,voting_power
1+
week_end,block,voting_escrow
22
2022-06-05,14905988,2.60
33
2022-06-12,14947132,2.59
44
2022-06-19,14987809,2.57

data-sources/citizens/output/citizen-103.csv

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
week_end,block,voting_power
1+
week_end,block,voting_escrow
22
2022-06-05,14905988,2.03
33
2022-06-12,14947132,2.02
44
2022-06-19,14987809,2.01

data-sources/citizens/output/citizen-104.csv

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
week_end,block,voting_power
1+
week_end,block,voting_escrow
22
2022-06-05,14905988,2.10
33
2022-06-12,14947132,2.09
44
2022-06-19,14987809,2.08

data-sources/citizens/output/citizen-105.csv

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
week_end,block,voting_power
1+
week_end,block,voting_escrow
22
2022-06-05,14905988,2.03
33
2022-06-12,14947132,2.02
44
2022-06-19,14987809,2.01

data-sources/citizens/output/citizen-106.csv

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
week_end,block,voting_power
1+
week_end,block,voting_escrow
22
2022-06-05,14905988,2.43
33
2022-06-12,14947132,2.42
44
2022-06-19,14987809,2.40

data-sources/citizens/output/citizen-107.csv

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
week_end,block,voting_power
1+
week_end,block,voting_escrow
22
2022-06-05,14905988,2.42
33
2022-06-12,14947132,2.40
44
2022-06-19,14987809,2.39

data-sources/citizens/output/citizen-108.csv

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
week_end,block,voting_power
1+
week_end,block,voting_escrow
22
2022-06-05,14905988,2.43
33
2022-06-12,14947132,2.42
44
2022-06-19,14987809,2.40

data-sources/citizens/output/citizen-109.csv

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
week_end,block,voting_power
1+
week_end,block,voting_escrow
22
2022-06-05,14905988,2.22
33
2022-06-12,14947132,2.21
44
2022-06-19,14987809,2.20

data-sources/citizens/output/citizen-11.csv

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
week_end,block,voting_power
1+
week_end,block,voting_escrow
22
2022-06-05,14905988,2.13
33
2022-06-12,14947132,2.12
44
2022-06-19,14987809,2.11

data-sources/citizens/output/citizen-110.csv

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
week_end,block,voting_power
1+
week_end,block,voting_escrow
22
2022-06-05,14905988,3.98
33
2022-06-12,14947132,3.96
44
2022-06-19,14987809,3.94

data-sources/citizens/output/citizen-111.csv

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
week_end,block,voting_power
1+
week_end,block,voting_escrow
22
2022-06-05,14905988,2.08
33
2022-06-12,14947132,2.07
44
2022-06-19,14987809,2.06

data-sources/citizens/output/citizen-112.csv

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
week_end,block,voting_power
1+
week_end,block,voting_escrow
22
2022-06-05,14905988,0.00
33
2022-06-12,14947132,0.00
44
2022-06-19,14987809,0.00

data-sources/citizens/output/citizen-113.csv

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
week_end,block,voting_power
1+
week_end,block,voting_escrow
22
2022-06-05,14905988,2.43
33
2022-06-12,14947132,2.42
44
2022-06-19,14987809,2.40

data-sources/citizens/output/citizen-114.csv

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
week_end,block,voting_power
1+
week_end,block,voting_escrow
22
2022-06-05,14905988,2.19
33
2022-06-12,14947132,2.18
44
2022-06-19,14987809,2.17

data-sources/citizens/output/citizen-115.csv

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
week_end,block,voting_power
1+
week_end,block,voting_escrow
22
2022-06-05,14905988,2.09
33
2022-06-12,14947132,2.08
44
2022-06-19,14987809,2.07

data-sources/citizens/output/citizen-116.csv

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
week_end,block,voting_power
1+
week_end,block,voting_escrow
22
2022-06-05,14905988,2.52
33
2022-06-12,14947132,2.50
44
2022-06-19,14987809,2.49

data-sources/citizens/output/citizen-117.csv

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
week_end,block,voting_power
1+
week_end,block,voting_escrow
22
2022-06-05,14905988,2.55
33
2022-06-12,14947132,2.53
44
2022-06-19,14987809,2.51

data-sources/citizens/output/citizen-118.csv

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
week_end,block,voting_power
1+
week_end,block,voting_escrow
22
2022-06-05,14905988,2.04
33
2022-06-12,14947132,2.03
44
2022-06-19,14987809,2.02

data-sources/citizens/output/citizen-119.csv

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
week_end,block,voting_power
1+
week_end,block,voting_escrow
22
2022-06-05,14905988,2.03
33
2022-06-12,14947132,2.02
44
2022-06-19,14987809,2.01

data-sources/citizens/output/citizen-12.csv

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
week_end,block,voting_power
1+
week_end,block,voting_escrow
22
2022-06-05,14905988,2.43
33
2022-06-12,14947132,2.42
44
2022-06-19,14987809,2.41

data-sources/citizens/output/citizen-120.csv

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
week_end,block,voting_power
1+
week_end,block,voting_escrow
22
2022-06-05,14905988,2.09
33
2022-06-12,14947132,2.08
44
2022-06-19,14987809,2.07

data-sources/citizens/output/citizen-121.csv

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
week_end,block,voting_power
1+
week_end,block,voting_escrow
22
2022-06-05,14905988,2.51
33
2022-06-12,14947132,2.50
44
2022-06-19,14987809,2.49

0 commit comments

Comments
 (0)