Published
Edited
Jul 6, 2020
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
hash = "2a209c81d07c77280f7dcb332a7dd2d1e2a8ca8c"
Insert cell
last_week_hash = "2a209c81d07c77280f7dcb332a7dd2d1e2a8ca8c"
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

Purpose-built for displays of data

Observable is your go-to platform for exploring data and creating expressive data visualizations. Use reactive JavaScript notebooks for prototyping and a collaborative canvas for visual data exploration and dashboard creation.
Learn more