-
Notifications
You must be signed in to change notification settings - Fork 42
Conversation
@liamzebedee does this also touch #129? Looks like you're deploying non-stub versions of Uniswap 😃 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Eine kleine Frage
const child_process = require('child_process') | ||
|
||
async function deployUniswap() { | ||
if(uniswap.getDeployments().Factory != "") { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Is this enough to test for a deployment on mainnet, or just testnet? If so, we need to make sure we have a repeatable build, right?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Originally for testnet - this was just intended to work with unit tests (since Truffle redeploys for every test). Will get back to you on how suitable it is for mainnet.
Haha was that not the intention? In which case, it would be closing #129 too. 🌳 |
…to onchain-liquidation
@liamzebedee where are we on a non-draft PR? This is on my list for tomorrow. @prestwich can you give this another look? I'm going to double check on your requestor reward question |
@mhluongo last touches/cleanups, give it one hour. ⏳ |
- new ganache-cli has more detailed error msg's?
Ready for design review. Couple things still before we can undraft the PR:
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
A couple JS changes, but the big issue is removing the unrelated stuff from the PR that's making review difficult- eg around funding proofs, pulling in the token contract, etc. Has enough of that stuff been merged to master for a clean-up rebase? If not, is there another branch that's a better base for this PR?
|
||
static getDeadline() { | ||
const DEADLINE_FROM_NOW = 300 // TX expires in 300 seconds (5 minutes) | ||
const deadline = Math.ceil(Date.now() / 1000) + DEADLINE_FROM_NOW |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is a little obtuse- it looks like you're converting Date.now()
to seconds to get a future deadline in seconds, but considering the proliferation of date, time, and math libs and approaches in JS I'd leave a comment about what deadline
means
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Mmmm true. Will doc it returns a seconds-since-epoch timestamp
|
||
export class AssertBalanceHelpers { | ||
constructor(tbtc) { | ||
this.tbtcInstance = tbtc |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The difference in constructor param name vs instance var name.. irks
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I also don't personally think using the suffix instance
anywhere is useful unless you're distinguishing it from a constructor, factory, or collection, though maybe in this case tbtcInstance
is a lazy pseudo "type", reminding me sadly of Hungarian notation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Definitely Hungarian. Renaming constructor param sounds good.
/** | ||
|
||
|
||
Some notes on the cryptoeconomics of Uniswap and TBTC, time arbitrage between chains |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Oh my, I hope we have a better place for some of this- low discoverability
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think it'd be better to contribute to the Uniswap docs in that case. Had to read the Uniswap frontend JS to even get to this understanding... 😮
a. Uniswap 100% of ETH | ||
b. Uniswap 50% ETH and 50% falling price auction | ||
|
||
I think it's worth documenting the additional complexity stemming from automatic liquidation. 3a won't necessarily buy up enough TBTC to burn, depending on the pool size, but the arbitrage incentives are going to keep the price stable to its price-oracle reported value (with a little delta). |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
3a won't necessarily buy up enough TBTC to burn, depending on the pool size
The plan was to only Uniswap if we can buy up enough TBTC
to burn, otherwise to go 100% for the falling-price auction. Thoughts?
|
||
|
||
tbtcExchange = await IUniswapExchange.at(tbtcExchangeAddr) | ||
/* eslint-enable no-unused-vars */ |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Why uh.. why?
If you just need the side-effect can't you await
as a statement?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It's to create the contract from the interface ABI. IUniswapExchange is the interface contract. :)
I'll circle back to this when it's a little tidier- don't want to stick you with a bunch of irrelevant comments |
@gakonst you might find this interesting |
What's the status of this PR? |
Languishing while we finish up https://github.com/keep-network/tbtc-dapp @gakonst - would love review |
@gakonst warning, this one's a bit of a nakamofo. Design (esp tests) needs to be reduced down a bit more. |
It looks like we have some rebase work to be done here. Can we do that before anyone jumps into review? |
Ping, please let me know when I should review this PR (@pdyraga mentions above that it should first be rebased) |
@mhluongo Also interested if this is affected by the recent oracle discussions - should we review/merge or do we need something completely else? |
This should not be impacted by the new oracle design. Let's rebase and clean up so @gakonst can review @liamzebedee |
Yep going to give this a cleanup on the plane today and we can push forward |
Closing this PR - the rest of work has been split into #265, which so far is a much simpler implementation with hindsight applied 😉 |
This issue breaks away work from #160 into something more deliverable: - introduces a script to deploy external systems, based on discussions in #270. Uniswap is deployed from a newly-created package at https://github.com/keep-network/uniswap - updates README with respect to this - includes Uniswap Solidity interfaces - separates unit and integration testing into two suites, new circleci flows for this - includes an E2E test with our TBTCToken of a Uniswap trade
Closes #105, closes #129
This deploys a private Uniswap Factory/Exchange as part of a Truffle migration, as well as implementing onchain liquidation.
It also refactors some liquidation code, introducing
startLiquidation
. There is also some changes to the liquidation logic, which are discussed in #105attemptToLiquidateOnchain
attemptToLiquidateOnchain
with uniswap exchangestartSignerFraudLiquidation
startSignerAbortLiquidation
attemptToLiquidateOnchain
startLiquidation
--
Implementor: @liamzebedee
Feature buddy: @mhluongo