From a29a3240f832bce697ab9da7225ea23400a8a224 Mon Sep 17 00:00:00 2001 From: ghost Date: Sun, 18 Feb 2024 02:26:39 +0200 Subject: [PATCH] remove extra code by withdraw processed funds as profit immediately --- .env | 16 ++--------- README.md | 3 +- config/services.yaml | 4 --- src/Controller/CrontabController.php | 41 ---------------------------- 4 files changed, 3 insertions(+), 61 deletions(-) diff --git a/.env b/.env index 3d23a4f..6911f11 100644 --- a/.env +++ b/.env @@ -39,22 +39,10 @@ APP_KEVACOIN_PORT=9992 APP_KEVACOIN_USERNAME=EDIT_ME APP_KEVACOIN_PASSWORD=EDIT_ME -# Separated profit account (to withdraw profit funds collected) -APP_KEVACOIN_PROFIT_ACCOUNT=PROFIT - -# Address to receive KevaCoin donations +# KevaCoin Address to receive profit funds (remote or local) APP_KEVACOIN_PROFIT_ADDRESS=EDIT_ME -# KevaCoin address to withdraw instance profit (empty to disable) -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) +# Local pool account name (to generate tmp addresses for guest publications) APP_KEVACOIN_POOL_ACCOUNT=POOL # Share with other some mining pool to get free coins diff --git a/README.md b/README.md index 9d8e491..6592ab7 100644 --- a/README.md +++ b/README.md @@ -40,8 +40,7 @@ All messages related to their room `namespace`. * `cd webapp` * `composer update` * `php bin/console doctrine:schema:update --force` -* `* * * * * /usr/bin/wget -q --spider http://../crontab/pool > /dev/null 2>&1` - process pool -* `0 0 * * * /usr/bin/wget -q --spider http://../crontab/withdraw > /dev/null 2>&1` - withdraw profit +* `* * * * * /usr/bin/wget -q --spider http://../crontab/pool > /dev/null 2>&1` ## Update diff --git a/config/services.yaml b/config/services.yaml index f768d36..4ad4b24 100644 --- a/config/services.yaml +++ b/config/services.yaml @@ -16,11 +16,7 @@ parameters: app.kevacoin.username: '%env(APP_KEVACOIN_USERNAME)%' app.kevacoin.password: '%env(APP_KEVACOIN_PASSWORD)%' 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.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.readonly: '%env(APP_KEVACOIN_ROOM_NAMESPACES_READONLY)%' app.kevacoin.room.namespace.default: '%env(APP_KEVACOIN_ROOM_NAMESPACE_DEFAULT)%' diff --git a/src/Controller/CrontabController.php b/src/Controller/CrontabController.php index b62f31b..be9555f 100644 --- a/src/Controller/CrontabController.php +++ b/src/Controller/CrontabController.php @@ -150,45 +150,4 @@ class CrontabController extends AbstractController 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 - } } \ No newline at end of file