Resilience, swarm redistribution, calculate the "pulse" on a hard-currency

A similar design to the ”symmetric” IOU version can also be used for the hard currency version, the ”pulses” keep track of ratios of how much each person gets, and could also aggregate pulses as well as provide an incentive for agents to process different segments of the ”branching schemes”, as employees within the swarm, similar to how Ethereum Alarm Clock employs people to invoke functions at certain points in time. That the swarm redistribution "pulse" can be done in segments is a way to manage GAS costs and potential transaction size limitations (with that, block size limitations on Ethereum are no problem. )

struct Taxes {
    uint amount;
    mapping(address => uint) ratio;
    uint sum;
    address[] tips; // How far has the branching scheme been processed?
    uint timestamp;
}

mapping(bytes32 => Taxes) taxRecord;

processSegment(bytes32 _taxID, uint _tip) {
    address root = taxRecord[_taxID].tips[_tip];
    computeSwarm(root);
}


The ratio of each person from any given transaction tax, is then used to claim that tax, and that process can be aggregated as well (many pulses in a single transaction. )

// Can be claimed after some period of time, say, 7 days, 
// so there is time to process it first
function claimTax(bytes32 _taxID) {
    require(taxRecord[_taxID].timestamp + 7 days < now);
    require(taxRecord[_taxID].ratio[msg.sender] != 0);
    uint amount = taxRecord[_taxID].amount * taxRecord[_taxID].ratio / taxRecord[_taxID].sum;
    rewardTax(msg.sender, amount);
    delete taxRecord[_taxID].ratio[msg.sender];
}

/* Create an object for dividend pathways */
struct DividendPathway {
        address from;
        uint amount;
        uint timeStamp;
}

/* This creates an array with all dividend pathways */
mapping(address => DividendPathway[]) public dividendPathways;


The transfer function with an ERC20 token on Ethereum, RES

function transfer(address _to, uint256 _value) {
/* if the sender doesnt have enough balance then stop */
if (balanceOf[msg.sender] < _value) throw;

/* Calculate tax */
uint256 taxCollected = _value * taxRate / 1000;

/* Create the dividend pathway */
dividendPathways[_to].push(dividendPathway({
from: msg.sender,
amount: _value,
timeStamp: now
}));

bytes32 taxID = sha3(msg.sender, _to, now)

/* File the tax, to be processed separate from this transaction */
taxRecord[taxID].amount = taxCollected;
taxRecord[taxID].tips.push(_to); // root of the swarm redistribution pulse
taxRecord[taxID].timestamp = now;

/* Transfer the amount minus the tax */
balanceOf[msg.sender] -= _value; // Subtract from the sender
balanceOf[_to] += _value - taxCollected;   
}
H2
H3
H4
3 columns
2 columns
1 column
Join the conversation now
Logo
Center