mirror of
https://github.com/kevachat/webapp.git
synced 2025-01-22 12:34:25 +00:00
remove extra code by withdraw processed funds as profit immediately
This commit is contained in:
parent
5d5843cce5
commit
a29a3240f8
16
.env
16
.env
@ -39,22 +39,10 @@ APP_KEVACOIN_PORT=9992
|
|||||||
APP_KEVACOIN_USERNAME=EDIT_ME
|
APP_KEVACOIN_USERNAME=EDIT_ME
|
||||||
APP_KEVACOIN_PASSWORD=EDIT_ME
|
APP_KEVACOIN_PASSWORD=EDIT_ME
|
||||||
|
|
||||||
# Separated profit account (to withdraw profit funds collected)
|
# KevaCoin Address to receive profit funds (remote or local)
|
||||||
APP_KEVACOIN_PROFIT_ACCOUNT=PROFIT
|
|
||||||
|
|
||||||
# Address to receive KevaCoin donations
|
|
||||||
APP_KEVACOIN_PROFIT_ADDRESS=EDIT_ME
|
APP_KEVACOIN_PROFIT_ADDRESS=EDIT_ME
|
||||||
|
|
||||||
# KevaCoin address to withdraw instance profit (empty to disable)
|
# Local pool account name (to generate tmp addresses for guest publications)
|
||||||
APP_KEVACOIN_PROFIT_WITHDRAW_ADDRESS=
|
|
||||||
|
|
||||||
# Keep at least n KVA on balance (for app transactions)
|
|
||||||
APP_KEVACOIN_PROFIT_WITHDRAW_BALANCE_MIN_KVA=1
|
|
||||||
|
|
||||||
# Withdraw funds starting from (do not keep amount greater this value)
|
|
||||||
APP_KEVACOIN_PROFIT_WITHDRAW_BALANCE_MAX_KVA=10
|
|
||||||
|
|
||||||
# Separated pool account (to generate tmp addresses e.g. guest publications)
|
|
||||||
APP_KEVACOIN_POOL_ACCOUNT=POOL
|
APP_KEVACOIN_POOL_ACCOUNT=POOL
|
||||||
|
|
||||||
# Share with other some mining pool to get free coins
|
# Share with other some mining pool to get free coins
|
||||||
|
@ -40,8 +40,7 @@ All messages related to their room `namespace`.
|
|||||||
* `cd webapp`
|
* `cd webapp`
|
||||||
* `composer update`
|
* `composer update`
|
||||||
* `php bin/console doctrine:schema:update --force`
|
* `php bin/console doctrine:schema:update --force`
|
||||||
* `* * * * * /usr/bin/wget -q --spider http://../crontab/pool > /dev/null 2>&1` - process pool
|
* `* * * * * /usr/bin/wget -q --spider http://../crontab/pool > /dev/null 2>&1`
|
||||||
* `0 0 * * * /usr/bin/wget -q --spider http://../crontab/withdraw > /dev/null 2>&1` - withdraw profit
|
|
||||||
|
|
||||||
## Update
|
## Update
|
||||||
|
|
||||||
|
@ -16,11 +16,7 @@ parameters:
|
|||||||
app.kevacoin.username: '%env(APP_KEVACOIN_USERNAME)%'
|
app.kevacoin.username: '%env(APP_KEVACOIN_USERNAME)%'
|
||||||
app.kevacoin.password: '%env(APP_KEVACOIN_PASSWORD)%'
|
app.kevacoin.password: '%env(APP_KEVACOIN_PASSWORD)%'
|
||||||
app.kevacoin.pool.account: '%env(APP_KEVACOIN_POOL_ACCOUNT)%'
|
app.kevacoin.pool.account: '%env(APP_KEVACOIN_POOL_ACCOUNT)%'
|
||||||
app.kevacoin.profit.account: '%env(APP_KEVACOIN_PROFIT_ACCOUNT)%'
|
|
||||||
app.kevacoin.profit.address: '%env(APP_KEVACOIN_PROFIT_ADDRESS)%'
|
app.kevacoin.profit.address: '%env(APP_KEVACOIN_PROFIT_ADDRESS)%'
|
||||||
app.kevacoin.profit.withdraw.address: '%env(APP_KEVACOIN_PROFIT_WITHDRAW_ADDRESS)%'
|
|
||||||
app.kevacoin.profit.withdraw.balance.min.kva: '%env(APP_KEVACOIN_PROFIT_WITHDRAW_BALANCE_MIN_KVA)%'
|
|
||||||
app.kevacoin.profit.withdraw.balance.max.kva: '%env(APP_KEVACOIN_PROFIT_WITHDRAW_BALANCE_MAX_KVA)%'
|
|
||||||
app.kevacoin.room.namespaces.pinned: '%env(APP_KEVACOIN_ROOM_NAMESPACES_PINNED)%'
|
app.kevacoin.room.namespaces.pinned: '%env(APP_KEVACOIN_ROOM_NAMESPACES_PINNED)%'
|
||||||
app.kevacoin.room.namespaces.readonly: '%env(APP_KEVACOIN_ROOM_NAMESPACES_READONLY)%'
|
app.kevacoin.room.namespaces.readonly: '%env(APP_KEVACOIN_ROOM_NAMESPACES_READONLY)%'
|
||||||
app.kevacoin.room.namespace.default: '%env(APP_KEVACOIN_ROOM_NAMESPACE_DEFAULT)%'
|
app.kevacoin.room.namespace.default: '%env(APP_KEVACOIN_ROOM_NAMESPACE_DEFAULT)%'
|
||||||
|
@ -150,45 +150,4 @@ class CrontabController extends AbstractController
|
|||||||
|
|
||||||
return new Response(); // @TODO
|
return new Response(); // @TODO
|
||||||
}
|
}
|
||||||
|
|
||||||
#[Route(
|
|
||||||
'/crontab/withdraw',
|
|
||||||
name: 'crontab_withdraw',
|
|
||||||
methods:
|
|
||||||
[
|
|
||||||
'GET'
|
|
||||||
]
|
|
||||||
)]
|
|
||||||
public function withdraw(): Response
|
|
||||||
{
|
|
||||||
// Connect kevacoin
|
|
||||||
$client = new \Kevachat\Kevacoin\Client(
|
|
||||||
$this->getParameter('app.kevacoin.protocol'),
|
|
||||||
$this->getParameter('app.kevacoin.host'),
|
|
||||||
$this->getParameter('app.kevacoin.port'),
|
|
||||||
$this->getParameter('app.kevacoin.username'),
|
|
||||||
$this->getParameter('app.kevacoin.password')
|
|
||||||
);
|
|
||||||
|
|
||||||
// Withdraw profit
|
|
||||||
if ($this->getParameter('app.kevacoin.profit.withdraw.address'))
|
|
||||||
{
|
|
||||||
if ($balance = $client->getBalance($this->getParameter('app.kevacoin.profit.account')))
|
|
||||||
{
|
|
||||||
if ($balance - $this->getParameter('app.kevacoin.profit.withdraw.balance.min.kva') >= $this->getParameter('app.kevacoin.profit.withdraw.balance.max.kva'))
|
|
||||||
{
|
|
||||||
$client->sendFrom(
|
|
||||||
$this->getParameter('app.kevacoin.profit.account'),
|
|
||||||
$this->getParameter('app.kevacoin.profit.withdraw.address'),
|
|
||||||
round(
|
|
||||||
$balance - $this->getParameter('app.kevacoin.profit.withdraw.balance.min.kva'),
|
|
||||||
8
|
|
||||||
)
|
|
||||||
);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
return new Response(); // @TODO
|
|
||||||
}
|
|
||||||
}
|
}
|
Loading…
x
Reference in New Issue
Block a user