-
Notifications
You must be signed in to change notification settings - Fork 3
Program Outline
Proposal for the smart contract to take the following form:
It consists of a single main function which executes whenever the mining facility inputs the electricity costs of the last billing cycle. The function takes as input the electricity costs of the last billing cycle. The function calculates the amount of Ether mined during that last cycle (i.e. the amount mined since the function last ran), and uses the input electricity costs to calculate how much Ether to send to the donation wallet (beneficiary), and sends that quantity of coin to the said wallet. The function then notes down the current date and time in a global variable so that the next time the mining facility inputs the electricity costs and runs the function, it knows when it last ran and consequently from which time period of mining to draw coin from to send to the donation wallet (beneficiary).
Outline
time_of_last_payment
- global variable in which the date and time of the last time the mining rewards were split is stored
Split_Mining_Rewards(input: electricity_costs)
:
- calculate the amount of coin mined since
time_of_last_payment
- use
electricity_costs
to calculate the amount of coin to transfer - transfer the just calculate amount of coin to the receiving wallet
- set
time_of_last_payment
to the current date and time
the function which runs every time the mining facility declares its electricity costs
The function takes the electricity costs as input, uses that to calculate how much coin to send, and sends that amount of coin to the receiving wallet.