Earnings results seem to happen here:
https://github.com/tpruvot/yiimp/blob/yiimp/web/yaamp/modules/site/results/user_earning_results.phpfunction WriteBoxHeader($title)
{
echo ""
;
echo "$title
";
echo ""
;
}
$algo = user()->getState('yaamp-algo');
$user = getuserparam(getparam('address'));
if(!$user || $user->is_locked) return;
$count = getparam('count');
$count = $count? $count: 50;
WriteBoxHeader("Last $count Earnings: $user->username");
$earnings = getdbolist('db_earnings', "userid=$user->id order by create_time desc limit :count", array(':count'=>$count));
echo "";
echo "";
echo "";
echo " | ";
echo "Name | ";
echo "Amount | ";
echo "Percent | ";
echo "mBTC | ";
echo "Time | ";
echo "Status | ";
echo "
";
echo "";
$showrental = (bool) YAAMP_RENTAL;
foreach($earnings as $earning)
{
$coin = getdbo('db_coins', $earning->coinid);
$block = getdbo('db_blocks', $earning->blockid);
if (!$block) {
debuglog("missing block id {$earning->blockid}!");
continue;
}
$d = datetoa2($earning->create_time);
if(!$coin)
{
if (!$showrental)
continue;
$reward = bitcoinvaluetoa($earning->amount);
$value = altcoinvaluetoa($earning->amount*1000);
$percent = $block? mbitcoinvaluetoa($earning->amount*100/$block->amount): '';
$algo = $block? $block->algo: '';
echo "";
echo " | ";
echo "Rental ($algo) | ";
echo "$reward BTC | ";
echo "{$percent}% | ";
echo "$value | ";
echo "$d ago | ";
echo "Cleared | ";
echo "
";
continue;
}
$reward = altcoinvaluetoa($earning->amount);
$percent = mbitcoinvaluetoa($earning->amount*100/$block->amount);
$value = altcoinvaluetoa($earning->amount*$earning->price*1000);
echo "";
echo "$coin->image'> | ";
echo "$coin->name ($coin->algo) | ";
echo "$reward $coin->symbol_show | ";
echo "{$percent}% | ";
echo "$value | ";
echo "$d ago | ";
echo ""; if($earning->status == 0) echo "Immature ($block->confirmations)"; else if($earning->status == 1) echo 'Exchange'; else if($earning->status == 2) echo 'Cleared'; echo " | ";
echo "
";
}
echo "
";
echo "
"; Earnings population seems to happen here:
https://github.com/tpruvot/yiimp/blob/yiimp/web/yaamp/core/backend/blocks.phpfunction BackendBlockNew($coin, $db_block)
{
// debuglog("NEW BLOCK $coin->name $db_block->height");
$reward = $db_block->amount;
if(!$reward || $db_block->algo == 'PoS' || $db_block->algo == 'MN') return;
$sqlCond = "valid = 1";
if(!YAAMP_ALLOW_EXCHANGE) // only one coin mined
$sqlCond .= " AND coinid = ".intval($coin->id);
$total_hash_power = dboscalar("SELECT SUM(difficulty) FROM shares WHERE $sqlCond AND algo=:algo", array(':algo'=>$coin->algo));
if(!$total_hash_power) return;
$list = dbolist("SELECT userid, SUM(difficulty) AS total FROM shares WHERE $sqlCond AND algo=:algo GROUP BY userid",
array(':algo'=>$coin->algo));
foreach($list as $item)
{
$hash_power = $item['total'];
if(!$hash_power) continue;
$user = getdbo('db_accounts', $item['userid']);
if(!$user) continue;
$amount = $reward * $hash_power / $total_hash_power;
if(!$user->no_fees) $amount = take_yaamp_fee($amount, $coin->algo);
$earning = new db_earnings;
$earning->userid = $user->id;
$earning->coinid = $coin->id;
$earning->blockid = $db_block->id;
$earning->create_time = $db_block->time;
$earning->amount = $amount;
$earning->price = $coin->price;
if($db_block->category == 'generate')
{
$earning->mature_time = time();
$earning->status = 1;
}
else // immature
$earning->status = 0;
if (!$earning->save())
debuglog(__FUNCTION__.": Unable to insert earning!");
$user->last_login = time();
$user->save();
}
$delay = time() - 5*60;
$sqlCond = "time < $delay";
if(!YAAMP_ALLOW_EXCHANGE) // only one coin mined
$sqlCond .= " AND coinid = ".intval($coin->id);
dborun("DELETE FROM shares WHERE algo=:algo AND $sqlCond",
array(':algo'=>$coin->algo));
}
So the fee should be deducted from the amount in the earnings column.
I think you should see 100% mining share, and 98% earning share.
It's beginning to look like some of the issues stem from the shares table, and perhaps the blocks table (since 80 * .98 != 74.97), both of which I think are populated from the stratum processes.
When Turguy has finished adding decred to the system, I hope he looks at some of this sht with high priority.