Conversation
This change introduces a TBTC surplus mechanism which allows to reuse tokens from multiple early closed auctions in new auctions. It also handles the case when subsidized auction early closes as well and when the surplus is big enough to liquidate a deposit without performing an auction.
|
Ready for review. Will undraft once #39 lands on |
# Conflicts: # contracts/RiskManagerV1.sol # test/RiskManagerV1.test.js
|
After giving it more thought, I think this mechanism - although logically sound - is risky, a little too complex (read: expensive), and we could simplify it. My two concerns are:
I would consider changing this mechanism so that it keeps bookkeeping the surplus but instead of reducing the auction value, it would go straight to purchasing signer bonds if the surplus value allows for it. For example:
Please give it some thought, there is a chance some gremlins are hidden in this approach. |
The mechanism previously proposed has two flaws. First, it is hard to implement and requires a lot of additional bookkeeping in the contract given that multiple auctions can be open at the same time and all of them can generate a surplus. Secondly, it might happen that the auction gets opened for 0.0001 TBTC because the rest was filled by the surplus. In this scenario, the auction value is much lower than the minimum tBTC lot size and the auction length set by the governance could make not sense.
You're right. I had the same feelings while implementing that approach. Please see 259f7e8. I made some change towards a simpler approach. |
# Conflicts: # test/RiskManagerV1.test.js
Upon early close, auction's transferred amount should be fetched by the Auctioneer itself and returned to the calling code. This is a better place to do so instead of forcing the caller to call `amountTransferred` in the right moment, before early closing the auction.
Transferred amount is relevant only in the moment of auction's early close. There is no need to expose a dedicated view method. If so, we can simplify the code and return the transferred amount directly from `earlyClose` method.
This reverts commit ba3de98
|
@pdyraga, all comments addressed! |
|
|
||
| it("should consume a reasonable amount of gas", async () => { | ||
| await expect(parseInt(tx.gasLimit)).to.be.lessThan(480000) | ||
| await expect(parseInt(tx.gasLimit)).to.be.lessThan(485000) |
There was a problem hiding this comment.
Not in this PR but we quickly need to figure out why such high gas limit is needed. Estimations in earlier PRs about purchasing signer bonds were saying about ~250k.
There was a problem hiding this comment.
Yep, I will try to figure out this separately.
# Conflicts: # contracts/RiskManagerV1.sol
Depends on: #39
tBTC from early closed auctions should be reused if possible. This pull request provides such functionality by introducing a tBTC surplus mechanism in the
RiskManagerV1contract. Once an auction is early closed, its transferred amount is added to the surplus pool. When a new auction is created, the underlying deposit lot size is checked against the current value of the tBTC surplus pool. In case the surplus is big enough to cover the entire deposit lot size, the deposit is liquidated directly, without performing an auction.