mirror of
https://github.com/kevachat/geminiapp.git
synced 2025-03-10 04:21:02 +00:00
add pool account and profit address support
This commit is contained in:
parent
fb506cbfd7
commit
6e4ec40f9f
@ -10,7 +10,7 @@
|
||||
},
|
||||
"require": {
|
||||
"yggverse/titan-ii": "^1.0",
|
||||
"kevachat/kevacoin": "^1.7",
|
||||
"kevachat/kevacoin": "dev-main",
|
||||
"clitor-is-protocol/kevacoin": "^1.0",
|
||||
"yggverse/cache": "^0.4"
|
||||
}
|
||||
|
@ -8,6 +8,10 @@
|
||||
"port":9992,
|
||||
"username":"",
|
||||
"password":""
|
||||
},
|
||||
"profit":
|
||||
{
|
||||
"address":""
|
||||
}
|
||||
},
|
||||
"gemini":
|
||||
@ -75,6 +79,7 @@
|
||||
},
|
||||
"pool":
|
||||
{
|
||||
"account":"pool",
|
||||
"timeout":3600,
|
||||
"confirmations":1
|
||||
},
|
||||
|
@ -329,8 +329,8 @@ class Room
|
||||
|
||||
public function post(string $namespace, ?string $mention, int $session, string $message, ?string &$address = null): null|int|string
|
||||
{
|
||||
// Validate funds available yet
|
||||
if (1 > $this->_kevacoin->getBalance())
|
||||
// Validate funds available
|
||||
if ($this->_kevacoin->getBalance($this->_config->kevachat->post->pool->account, $this->_config->kevachat->post->pool->confirmations))
|
||||
{
|
||||
return null;
|
||||
}
|
||||
@ -404,7 +404,9 @@ class Room
|
||||
':sent' => 0,
|
||||
':expired' => 0,
|
||||
':cost' => $this->_config->kevachat->post->cost->kva,
|
||||
':address' => $address = $this->_kevacoin->getNewAddress(),
|
||||
':address' => $address = $this->_kevacoin->getNewAddress(
|
||||
$this->_config->kevachat->post->pool->account
|
||||
),
|
||||
':namespace' => $namespace,
|
||||
':key' => sprintf('%s@anon', $time),
|
||||
':value' => $message
|
||||
|
@ -143,11 +143,11 @@ foreach ($database->query('SELECT * FROM `pool` WHERE `sent` = 0 AND `expired` =
|
||||
if ($kevacoin->getReceivedByAddress($pool->address, $config->kevachat->post->pool->confirmations) >= $pool->cost)
|
||||
{
|
||||
// Check physical wallet balance
|
||||
if ($kevacoin->getBalance() <= $pool->cost)
|
||||
if ($kevacoin->getBalance($config->kevachat->post->pool->account, $config->kevachat->post->pool->confirmations) < $pool->cost)
|
||||
{
|
||||
exit(
|
||||
sprintf(
|
||||
_('[%s] [error] Insufficient wallet funds!'),
|
||||
_('[%s] [error] Insufficient pool funds!'),
|
||||
date('c')
|
||||
) . PHP_EOL
|
||||
);
|
||||
@ -170,6 +170,16 @@ foreach ($database->query('SELECT * FROM `pool` WHERE `sent` = 0 AND `expired` =
|
||||
// Send to blockchain
|
||||
if ($txid = $kevacoin->kevaPut($pool->namespace, $pool->key, $pool->value))
|
||||
{
|
||||
// Send this amount to profit address if provided
|
||||
if ($config->kevacoin->profit->address)
|
||||
{
|
||||
$kevacoin->sendFrom(
|
||||
$pool->address,
|
||||
$config->kevacoin->profit->address,
|
||||
$pool->cost
|
||||
);
|
||||
}
|
||||
|
||||
// Update status
|
||||
$database->query(
|
||||
sprintf(
|
||||
|
Loading…
x
Reference in New Issue
Block a user