-
Notifications
You must be signed in to change notification settings - Fork 26
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
subsequent calls of chai.dai() display that tokens lacking #12
Comments
The same is applicable for the transaction: https://etherscan.io/tx/0x3cf2c78ebcec110092422a7b2333f5ba962a0959d27a3edd0057e616e5219054 So, with these two transactions the balance leaks for |
@akolotov Unfortunately, it's not possible to go in and out of the DSR without incurring a rounding error. This is because DAI balances and
where The
The specific step where the down-rounding occurs is when we compute Therefore, you should not assume that after joining and exiting that you will have no fewer tokens than when you started. Let me know if you have any other questions. |
thanks @livnev for explanation! In general, this approach is OK since it is assumed that DSR>0 and But having DSR=0 exposes its weakness. At the moment, it was decided to set DSR to zero the way to calculate |
Also, I would like to clarify one more moment.
So, the loss actually depends on parameter Please, correct me, if I am wrong. |
@k1rill-fedoseev apologies, what I said about the error being bounded at 1 wei of DAI was false. I should have said that it is bounded at 1 wei of |
Well, as I said, I'm not sure that it's a good idea to assume that if you lock tokens in CHAI, and then withdraw them, that you will end up with no fewer tokens than what you started with.
To be clear, are you proposing here to pull less DAI than requested? As I mentioned above, that is another possible way of doing things, but then risks leaving DAI dust in the user's account (which could similarly create accounting problems). |
We are observing a strange situation with drawing tokens from the chai contract.
Here is the transaction: https://etherscan.io/tx/0xafde98025b80382855871045b81570dba5b833cfeb3c411d99617dee4d3ea627
The logs of the transactions represents that
100010000000000000000
Dai was minted to0x4aa42145aa6ebf72e164c9bbc74fbd3788045016
, so I would expect that the Dai balance invested in Chai will differ on this value.But if you check the value returned by
chai.dai()
before this transaction and after it you will check that the difference is more than100.01
Dai.Firstly, let's get the value for the block
9780635
:returns
Next, - for the block
9780637
:returns
The difference between
0x88b0be7d408ff70d3f7
and0x8859ffceee92c9fd3f6
is100010000000000000001
(0x56beae51fd2d10001
) rather than100010000000000000000
as expected.The issue here is that with DSR=0 we would expect that the Dai balance invested to Chai is not reduced. We are building logic of our contracts relying on this statement and see that our transactions are being failed since it is not true: https://etherscan.io/tx/0x236ea5de2c8957c9706f78f2f0347feb9b5b2757a59c285bfcda9ff008aeb178.
The text was updated successfully, but these errors were encountered: