Skip to content

Commit

Permalink
Merge pull request #35 from TrueBlocks/develop
Browse files Browse the repository at this point in the history
Develop
  • Loading branch information
tjayrush authored Jul 13, 2022
2 parents 37786e5 + 100a556 commit 256c9a0
Show file tree
Hide file tree
Showing 22 changed files with 475 additions and 19 deletions.
Empty file removed Ideas.md
Empty file.
2 changes: 2 additions & 0 deletions R/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
.RData
.Rhistory
34 changes: 34 additions & 0 deletions R/Ideas.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
Chart ideas
===============
- Histogram of Contrib Amount
- Scatter Contrib vs. Sybil score
- Unclaimed from Round 8
- Scatter plot of sybil score vs. time
- Time vs. amount per sender (a lot of sends in not a person)
- Heat maps are interesting
- Distribution is important
- Mean is appearantly important
- Category (by function) comparison for smart contracts

- latest data https://github.com/gitcoinco/gitcoin_cadcad_model/blob/main/data/2020-03-18/2021-03-18-round9-contributions.csv.xz

- From the Payout Contract there were:

- 1 Finalized calls
- 364 PayoutAdded calls
- 1 Transfer In
- 1 Funded calls
- 167 Transfer Outs
- 167 PayoutClaimed calls

- Function calls per contract

- Calculated estimate after each donation vs. actual

- Auditing

- Add up all donations from grant files and see if it adds to the total in the contract files

- Add the pre-round 4 contracts

- We did reconcilations of the PayoutAdded / PayoutClaimed and compared that against the smart contract. We could have called that a reconcilation and allow the user to download.
3 changes: 3 additions & 0 deletions R/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
## R

This is a collection of 'R' code for analyizing the data found in the [./data folder](../data/README.md).
22 changes: 22 additions & 0 deletions R/Untitled.Rmd
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
---
title: "TrueBlocks Exploration of GitCoin Data"
output: html_notebook
---

We used TrueBlocks to extract as much publically available information from
the GitCoin ecosystem as we could in an effort to explore just how open
open shared ledgers are. All data was aquired either from the GitCoin
public APIs or the from on-chain data.

This is a growing document. Please add to it via GitHub Pull Requests

```{r}
require(tidyverse)
l <- c(1,2,3)
plot(l)
```

---
This is some more shit
---

300 changes: 300 additions & 0 deletions R/Untitled.nb.html

Large diffs are not rendered by default.

2 changes: 2 additions & 0 deletions R/explore.R
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
require(tidyverse)

5 changes: 5 additions & 0 deletions R/ideas.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
Total number of addresses

Total number of uniq addresses

Distribution of the number of times an address appears
5 changes: 3 additions & 2 deletions gitcoin/exports/mainnet/neighbors/networks/README.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
### Network Graphs

Using the `neighbors` files in the folder above this one, this Python script (thanks in large part to nollied#6773) genates network graphs, images of the same, and adjacency lists.
Using the `neighbors` files in the folder above this one, this Python script (thanks in large part to nollied#6773)
genates network graphs, images of the same, and adjacency lists.

This data is very much a work in progress.

Expand All @@ -16,7 +17,7 @@ This data is alpha status and may be (and probably is) incomplete.
```
python -m venv env
source env/bin/activate
pip install -r requirements.txt
pip install -r requirements.fil
python neighbor_networks.py <address>
```

Expand Down
15 changes: 15 additions & 0 deletions gitcoin/exports/mainnet/neighbors/networks/requirements.fil
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
colorhash==1.0.4
cycler==0.11.0
fonttools==4.33.3
kiwisolver==1.4.2
matplotlib==3.5.2
networkx==2.8
numpy==1.22.3
packaging==21.3
pandas==1.4.2
Pillow==9.1.0
pyparsing==3.0.8
python-dateutil==2.8.2
pytz==2022.1
scipy==1.8.0
six==1.16.0
4 changes: 4 additions & 0 deletions gitcoin/ui/src/App.css
Original file line number Diff line number Diff line change
Expand Up @@ -79,6 +79,10 @@ header a.install-tb {
white-space: nowrap;
}

.main-rows .column-suspicious {
font-size: xx-large;
}

.with-sidebar {
text-align: left;
}
Expand Down
12 changes: 11 additions & 1 deletion gitcoin/ui/src/ColumnCells.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -63,14 +63,16 @@ export const NameCell = ({ grantData }) => {
"/" +
grantData.name.replace(/[^a-z0-9 -]/g, '').replace(/\s+/g, '-').replace(/-+/g, '-');

if (!slug)
if (!slug) {
return (
<div>
{name} <ZipLink grantData={grantData} />
<br />
{explorerLink}
</div>
);
}

return (
<div>
<div>
Expand Down Expand Up @@ -124,6 +126,14 @@ export const NeighborsHeader = () => (
/>
)

//--------------------------------------------------
export const SuspiciousHeader = () => (
<ColumnTitle
title='Suspicious'
tooltip='Does this address look suspicious?'
/>
)

//--------------------------------------------------
const dateDisplay = (block) => {
if (block === '0')
Expand Down
13 changes: 10 additions & 3 deletions gitcoin/ui/src/ColumnDefs.jsx
Original file line number Diff line number Diff line change
@@ -1,7 +1,10 @@
import { DownloadIcon } from './Utils';
import { DateHeader, DateCell, NameHeader, NameCell, BalanceHeader, AppearanceHeader, TransactionHeader, EventLogsHeader, NeighborsHeader } from "./ColumnCells"
import { DateHeader, DateCell, NameHeader, NameCell, BalanceHeader, AppearanceHeader, TransactionHeader, EventLogsHeader, NeighborsHeader, SuspiciousHeader } from "./ColumnCells"
import { getChainData } from './GlobalState';

// To mocked predicate to tell if an address is suspicious
const mockedIsSuspicious = (index) => (index + 1) % 5 === 0;

export const columns = [
{
title: <DateHeader />,
Expand All @@ -27,8 +30,12 @@ export const columns = [
sorter: {
compare: (a, b) => a.address - b.address,
},
render: function (u, grantData) {
return <NameCell grantData={grantData} />
render: function (u, grantData, index) {
const overrideName = mockedIsSuspicious(index)
? "Name has been changed to protect the innocent"
: false;

return <NameCell grantData={grantData} overrideName={overrideName} />
},
},
{
Expand Down
2 changes: 1 addition & 1 deletion gitcoin/ui/src/last-update.js
Original file line number Diff line number Diff line change
@@ -1 +1 @@
export const lastUpdate = "Last updated at block: 14721137 2022-05-06 03:21:01 UTC";
export const lastUpdate = "Last updated at block: 15008207 2022-06-22 15:08:13 UTC";
5 changes: 3 additions & 2 deletions giveth/exports/mainnet/neighbors/networks/README.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
### Network Graphs

Using the `neighbors` files in the folder above this one, this Python script (thanks in large part to nollied#6773) genates network graphs, images of the same, and adjacency lists.
Using the `neighbors` files in the folder above this one, this Python script (thanks in large part to nollied#6773)
genates network graphs, images of the same, and adjacency lists.

This data is very much a work in progress.

Expand All @@ -16,7 +17,7 @@ This data is alpha status and may be (and probably is) incomplete.
```
python -m venv env
source env/bin/activate
pip install -r requirements.txt
pip install -r requirements.fil
python neighbor_networks.py <address>
```

Expand Down
15 changes: 15 additions & 0 deletions giveth/exports/mainnet/neighbors/networks/requirements.fil
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
colorhash==1.0.4
cycler==0.11.0
fonttools==4.33.3
kiwisolver==1.4.2
matplotlib==3.5.2
networkx==2.8
numpy==1.22.3
packaging==21.3
pandas==1.4.2
Pillow==9.1.0
pyparsing==3.0.8
python-dateutil==2.8.2
pytz==2022.1
scipy==1.8.0
six==1.16.0
4 changes: 4 additions & 0 deletions giveth/ui/src/App.css
Original file line number Diff line number Diff line change
Expand Up @@ -79,6 +79,10 @@ header a.install-tb {
white-space: nowrap;
}

.main-rows .column-suspicious {
font-size: xx-large;
}

.with-sidebar {
text-align: left;
}
Expand Down
17 changes: 14 additions & 3 deletions giveth/ui/src/ColumnCells.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ export const NameHeader = () => (
tooltip='The name and address of the grant or core contract.'
/>
)
export const NameCell = ({ grantData }) => {
export const NameCell = ({ grantData, overrideName }) => {
const [copied, setCopied] = useState(false);
const { localExplorer } = useGlobalState();

Expand Down Expand Up @@ -63,14 +63,17 @@ export const NameCell = ({ grantData }) => {
"/" +
grantData.name.replace(/[^a-z0-9 -]/g, '').replace(/\s+/g, '-').replace(/-+/g, '-');

if (!slug)
if (!slug || overrideName) {
const nameToShow = overrideName || name;
return (
<div>
{name} <ZipLink grantData={grantData} />
{nameToShow} <ZipLink grantData={grantData} />
<br />
{explorerLink}
</div>
);
}

return (
<div>
<div>
Expand Down Expand Up @@ -124,6 +127,14 @@ export const NeighborsHeader = () => (
/>
)

//--------------------------------------------------
export const SuspiciousHeader = () => (
<ColumnTitle
title='Suspicious'
tooltip='Does this address look suspicious?'
/>
)

//--------------------------------------------------
const dateDisplay = (block) => {
if (block === '0')
Expand Down
24 changes: 21 additions & 3 deletions giveth/ui/src/ColumnDefs.jsx
Original file line number Diff line number Diff line change
@@ -1,7 +1,10 @@
import { DownloadIcon } from './Utils';
import { DateHeader, DateCell, NameHeader, NameCell, BalanceHeader, AppearanceHeader, TransactionHeader, EventLogsHeader, NeighborsHeader } from "./ColumnCells"
import { DateHeader, DateCell, NameHeader, NameCell, BalanceHeader, AppearanceHeader, TransactionHeader, EventLogsHeader, NeighborsHeader, SuspiciousHeader } from "./ColumnCells"
import { getChainData } from './GlobalState';

// To mocked predicate to tell if an address is suspicious
const mockedIsSuspicious = (index) => (index + 1) % 5 === 0;

export const columns = [
{
title: <DateHeader />,
Expand All @@ -27,8 +30,12 @@ export const columns = [
sorter: {
compare: (a, b) => a.address - b.address,
},
render: function (u, grantData) {
return <NameCell grantData={grantData} />
render: function (u, grantData, index) {
const overrideName = mockedIsSuspicious(index)
? "Name has been changed to protect the innocent"
: false;

return <NameCell grantData={grantData} overrideName={overrideName} />
},
},
{
Expand Down Expand Up @@ -140,4 +147,15 @@ export const columns = [
);
},
},
{
title: <SuspiciousHeader />,
width: '2%',
render(text, record, index) {
const icon = mockedIsSuspicious(index)
? <span>😡</span>
: null;

return <div className='column-suspicious'>{icon}</div>
}
},
];
2 changes: 1 addition & 1 deletion giveth/ui/src/last-update.js
Original file line number Diff line number Diff line change
@@ -1 +1 @@
export const lastUpdate = "Last updated at block: 14721137 2022-05-06 03:21:01 UTC";
export const lastUpdate = "Last updated at block: 15008207 2022-06-22 15:08:13 UTC";
4 changes: 2 additions & 2 deletions index.html
Original file line number Diff line number Diff line change
Expand Up @@ -51,12 +51,12 @@ <h2>
</h2>
<ol>
<li>
<a href="/gitcoin">
<a href="https://gitcoin.tokenomics.io">
GitCoin Grants Data Pouch
</a>
</li>
<li>
<a href="/giveth">
<a href="https://giveth.tokenomics.io">
Giveth Data Pouch
</a>
</li>
Expand Down
4 changes: 3 additions & 1 deletion update-all.sh
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
#!/usr/bin/env bash

# ./update-one.sh wallets "gnosis --chain mainnet" txt
PATH=$PATH:/home/jrush/Development/trueblocks-core/bin/
cd /home/jrush/Development/tokenomics.io/

./update-one.sh giveth "gnosis --chain mainnet" csv
./update-one.sh gitcoin "mainnet" csv
chifra when latest --no_header | cut -f1,3 | tr '\t' ' ' | sed 's/^/export const lastUpdate = \"Last updated at block: /' | sed 's/$/\";/' >giveth/ui/src/last-update.js
Expand Down

0 comments on commit 256c9a0

Please sign in to comment.