Published
Edited
Aug 3, 2020
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
hash = "fd9d8c13ffeaf53ff56e9e4405bbd79ae1a70480"
Insert cell
last_week_hash = "323bfba930429967e119c0d3de0413d1aa33d40b"
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
balance = aliasMap(a => {
return pastPayout.get(a) + fastPayout.get(a) + slowPayout.get(a);
})
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
totalProportion = aliasMap((a) => totalCred.get(a) / sumTotalCred)
Insert cell
totalCred = aliasMap((a) => d3.sum(intervalCred.has(a) ? intervalCred.get(a).slice(0,last_week_idx+1) : 0))
Insert cell
Insert cell
transfers = {
const x = new Map()
for (const alias of aliases) {
x.set(alias, 0);
}
for (const {from, to, amount} of transferRecords) {
const fromBal = x.get(from) || 0;
const toBal = x.get(to) || 0;
x.set(from, fromBal - amount);
x.set(to, toBal + amount);
}
return x;
}

Insert cell
transferRecords=(await (await fetch(`https://raw.githubusercontent.com/sourcecred/makerdao-cred/${hash}/transfers.json`)).json())[1];
Insert cell
sumTotalCred = d3.sum(Array.from(totalCred.values()))
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
percentFormat = d3.format(".1%")
Insert cell
Insert cell
Insert cell

One platform to build and deploy the best data apps

Experiment and prototype by building visualizations in live JavaScript notebooks. Collaborate with your team and decide which concepts to build out.
Use Observable Framework to build data apps locally. Use data loaders to build in any language or library, including Python, SQL, and R.
Seamlessly deploy to Observable. Test before you ship, use automatic deploy-on-commit, and ensure your projects are always up-to-date.
Learn more