Hello! My name is Arvidas and I'm Cryptonfly Ethereum developer.
I would like to show you some details on our contract implementations. Of course, your suggestions are welcome!
First of all, our Ethereum application will be 100% decentralized and NOT controlled by our team after start. After initial coin distribution, everyone can create a contract, put some coins and allow users to mine them with his app. To do this, you will have to code an inherited contract on CFBasePartnerContract, which looks like this:
contract CFBasePartnerContract {
function get_owner() returns (address);
function get_reward(uint64 balance, uint24 user_last_10min, int8 user_status, bool by_owner) returns (uint64);
}
This contract should have only two methods — return an owner of it and provide a function that will calculate a reward for user action. This function have 4 params:
* balance — amount of coins contract has (user reward can't be more than your application balance)
* user_last_10min — timestamp / 600 of last user action. We decided to use unsigned 24-bit integer to use less space on Eth blockchain.
* user_status — any number, your application can change status of any user. For example: -1 for banned, 0 — new/unregistered, 1 — verified, etc...
* by_owner — is reward paid by you centralized application or user claims bounty himself. You may ignore this param or allow your application to send coins only centralized way.
Here is an example of our application contract, a draft version of it:
contract DraftCryptonflyCheckinAppContract is CFBasePartnerContract {
address owner;
uint64 initial_amount = 10000000000000000;
uint64 step = 100000000000000;
function DraftCryptonflyCheckinAppContract() {
owner = msg.sender;
}
function get_owner() returns (address) {
return owner;
}
function get_reward(uint64 balance, uint24 user_last_10min, int8 user_status, bool by_owner) returns (uint64) {
if (user_status <= 0) return 0;
if (uint24(now / 600) - user_last_10min < 60 * 8) return 0;
if (balance > initial_amount) balance = initial_amount;
uint64 coinsDistributed = initial_amount - balance;
uint32 reward = 100000000;
for (uint8 i = 0; i < coinsDistributed / 100000000000000; i++) {
reward = reward * 99 / 100;
}
if (reward > balance) return 0;
return reward;
}
}
How it works? We initially reserve 10 000 000 coins, and pay first 100 000 checkins for 1 coin. After that we pay 0.99 for checkin, then 0.99^2 = 0.9801, etc... (Numbers are given as example, exact values will be announced later.)
We check user_status to be more than 0, that means only registered users of our mobile application will be allowed to claim reward. We will verify mobile phones and then put user status to 1.
One more condition: we allow only one checkin with our application in 8 hour period.
Others applications can code other conditions.
Next post will be about our main contract!