Swarm Redistribution - ELI5
Swarm Redistribution uses dividend pathways
contract SwarmRedistribution is RES {
struct dividendPathway {
address from;
uint amount;
uint timeStamp;
}
mapping(address => dividendPathway[]) public dividendPathways;
Each transfer()
of RES creates a dividend pathway
/* Send RES tokens */
function transfer(address _to, uint256 _value) {
/* Create the dividend pathway */
dividendPathways[_to].push(dividendPathway({
from: msg.sender,
amount: _value,
timeStamp: now
}));
uint256 taxCollected = _value * taxRate / 1000;
Sends the collected tax to swarmRedistribution(_to, taxCollected)
, computes a swarmTree
with all nodes connected to _to
via dividend pathways, all nodes connected to those nodes, and so on, using iterateThroughSwarm()
, then gives a share of the tax to every human in that swarm tree.
Then decays the dividend pathways,
bool human = isHuman[node];
if(human) balanceOf[swarmTree[i].node] += share;
if(dividendPathways[parent][index].amount - _taxCollected > 0) {
dividendPathways[parent][index].amount -= _taxCollected;
}
else removeDividendPathway(parent, index);
I'm trying to understand this, looks very interesting and promising.
I found the very end of your article here (https://medium.com/@resilience_me/try-out-proto-taxemes-c0d27f3ae36a#.l0n8yjvmy ) to be ELI5 for the taxeme concept. There, you explained it so it can be easily understood. Thanks for all your work on this!