-
Notifications
You must be signed in to change notification settings - Fork 10
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
contracts: Add interfaces #80
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -24,25 +24,29 @@ interface IBorrowerOperations is ILiquityBase { | |
address _boldTokenAddress | ||
) external; | ||
|
||
function openTrove(uint _maxFee, uint256 _ETHAmount, uint _boldAmount, address _upperHint, address _lowerHint, uint256 _annualInterestRate) external; | ||
function openTrove(address _owner, uint256 _ownerIndex, uint _maxFee, uint256 _ETHAmount, uint _boldAmount, address _upperHint, address _lowerHint, uint256 _annualInterestRate, uint256 _spDeposit) external; | ||
|
||
function addColl(uint256 _ETHAmount) external; | ||
function addColl(uint256 _troveId, uint256 _ETHAmount) external; | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Does There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Yes, exactly. Technically it’s actually any ERC20 used as collateral, but in our case it will be WETH and some LSTs. |
||
|
||
function moveETHGainToTrove(address _user, uint256 _ETHAmount) external; | ||
function moveETHGainToTrove(uint256 _troveId, uint256 _ETHAmount) external; | ||
|
||
function withdrawColl(uint _amount) external; | ||
function withdrawColl(uint256 _troveId, uint _amount) external; | ||
|
||
function withdrawBold(uint _maxFee, uint _amount) external; | ||
function withdrawBold(uint256 _troveId, uint _maxFee, uint _amount) external; | ||
|
||
function repayBold(uint _amount) external; | ||
function repayBold(uint256 _troveId, uint _amount) external; | ||
|
||
function closeTrove() external; | ||
function closeTrove(uint256 _troveId) external; | ||
|
||
function adjustTrove(uint _maxFee, uint _collChange, bool _isCollIncrease, uint _debtChange, bool isDebtIncrease) external; | ||
function adjustTrove(uint256 _troveId, uint _maxFee, uint _collChange, bool _isCollIncrease, uint _debtChange, bool isDebtIncrease) external; | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Is There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Good point. I’ll remove it. |
||
|
||
function claimCollateral() external; | ||
function delegateInterest(uint256 _troveId, address _delegate) external; | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. How do you undelegate? Is the idea to reuse There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I was thinking of delegating to zero address (or to owner), but that’s an option too. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I thought of There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Upon further thought, there should probably be 2 different calls for interest rate delegation:
The first one would grant the arbitrary address " The second form is for batch delegation (duh) and requires
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Actually, we probably have to add hints to batch delegation too, as in:
Most of the time, hints won't be crucial as each batch will store "pointers" to both ends of its slice of the list for the purpose of quickly skipping over the entire batch, which can be used to find the correct insertion point on-chain. However, if a batch is empty, we don't know the correct position of constituents yet, so we need a hint. Alternatively, we could put placeholder nodes in the list for each batch manager (or just empty batches) where new Troves are to be inserted, but this could be abused (spamming the list full of useless empty batches that make traversing the list costly, e.g. when redeeming). For that reason, I prefer hints. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Yes, your reasoning above make a lot of sense to me. Feel free to add a commit with those new function signatures so they don’t get lost in this comments. |
||
|
||
function claimCollateral(uint256 _troveId) external; | ||
|
||
// TODO: addRepayWhitelistedAddress?(see github issue #64) | ||
|
||
function getCompositeDebt(uint _debt) external pure returns (uint); | ||
|
||
function adjustTroveInterestRate(uint _newAnnualInterestRate, address _upperHint, address _lowerHint) external; | ||
function adjustTroveInterestRate(uint256 _troveId, uint _newAnnualInterestRate, address _upperHint, address _lowerHint) external; | ||
} |
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -54,7 +54,7 @@ interface IStabilityPool is ILiquityBase { | |
*/ | ||
function provideToSP(uint _amount) external; | ||
|
||
|
||
/* withdrawFromSP(): | ||
* - Calculates depositor's ETH gain | ||
* - Calculates the compounded deposit | ||
|
@@ -81,6 +81,21 @@ interface IStabilityPool is ILiquityBase { | |
*/ | ||
function offset(uint _debt, uint _coll) external; | ||
|
||
/* setETHSellIntent(): | ||
* Opt-in swap facility liquidation gains | ||
*/ | ||
function setETHSellIntent(uint256 _ethAmount, uint256 _priceDiscount) external; | ||
|
||
/* buyETH(): | ||
* Swap ETH to Bold using opt-in swap facility liquidation gains, from one depositor | ||
*/ | ||
function buyETH(address _depositor, uint256 _ethAmount) external; | ||
|
||
/* buyETHBatch(): | ||
* Swap ETH to Bold using opt-in swap facility liquidation gains, from multiple depositors | ||
*/ | ||
function buyETHBatch(address[] calldata _depositors, uint256 _ethAmount) external; | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Haven't thought this through, but shouldn't There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Yes, my idea was the latter. I’m assuming you would order the array from most favorable to least. |
||
|
||
/* | ||
* Returns the total amount of ETH held by the pool, accounted in an internal variable instead of `balance`, | ||
* to exclude edge cases like ETH received from a self-destruct. | ||
|
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 know combined operations will be coming later, but there's one that's worth considering already: opening a Trove with a delegated interest rate.
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! Good idea.