-
-
Notifications
You must be signed in to change notification settings - Fork 246
Closed
Labels
bugSomething isn't workingSomething isn't working
Description
As title.
After some investigation, the cause is from the forceExchange() in canExchange.php. The forceExchange uses
$transfers = app(CommonService::class)->multiBrings([
(new Bring())
->setStatus(Transfer::STATUS_EXCHANGE)
->setDeposit($deposit)
->setWithdraw($withdraw)
->setFrom($from)
->setTo($to)
]);
and in Bring.php
public function toArray(): array
{
return [
'status' => $this->getStatus(),
'deposit_id' => $this->getDeposit()->getKey(),
'withdraw_id' => $this->getWithdraw()->getKey(),
'from_type' => $this->getFrom()->getMorphClass(),
'from_id' => $this->getFrom()->getKey(),
'to_type' => $this->getTo()->getMorphClass(),
'to_id' => $this->getTo()->getKey(),
// THE CAUSE IS HERE
'fee' => abs($this->getWithdraw()->amount) - abs($this->getDeposit()->amount),
'uuid' => $this->getUuid(),
];
}
The transfer's deposit and withdraw are from different wallet (or currency) with rate. So the minus result here usually not correct.
Metadata
Metadata
Assignees
Labels
bugSomething isn't workingSomething isn't working