eos42 / Chintai-issues

A github to collect issues for the Chintai dApp
https://jungle.chintai.io
3 stars 4 forks source link

Interest rates not rounding correcting in smart contract to match orders for fulfillment #1

Closed PhillipHamnett closed 6 years ago

PhillipHamnett commented 6 years ago

Steps to reproduce:

Submit lease order with 1.8% interest rate: "from": "useraccount1", "to": "chintaitest1", "quantity": "3.3759 EOS", "memo": "lease | 187.5503 EOS | 0.0180 | 14 | 0.5000 | s66uc6nr9" In leases table, the order shows up with the unrounded interest rate:

},{
  "id": 73,
  "user": "useraccount1",
  "quantity": 1875503,
  "quantity_left": 1875503,
  "interest": "0.01799997120772401",
  "cpu_bw_ratio": "0.50000000000000000",
  "duration": 1209600,
  "order_creation_time": "1535132894000000",
  "airdrop_tokens": []
}

Now submit a stake order for 1.8% interest rate:

"from": "useraccount1", "to": "chintaitest1", "quantity": "185.0000 EOS", "memo": "stake | 185 EOS | 0.0180 | 14 | ucycuphkw5" The order shows up in the table as not equal, so the contract does not match the orders to fulfill them:

{ "id": 74, "user": "useraccount1", "quantity": 1850000, "quantity_left": 1850000, "interest": "0.01800000000000000", "cpu_bw_ratio": "0.00000000000000000", "duration": 1209600, "order_creation_time": "1535134393500000", "airdrop_tokens": [] } In the UI where the orders table is rounded to 2 decimals, we now observe a stake and lease order at the same rate but as unmatched/unfulfilled: screen shot 2018-08-24 at 2 14 08 pm

Open orders display: screen shot 2018-08-24 at 2 14 12 pm