Skip to content
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

chore: add comments on things that seem redundant or incorrect #32

Draft
wants to merge 1 commit into
base: main
Choose a base branch
from

Conversation

igorline
Copy link
Contributor

No description provided.

@igorline igorline requested a review from Baraa42 May 31, 2022 16:44
@@ -23,6 +23,7 @@ contract HackMoneyVault is Multicall, Ownable, BaseVault {
// Amount locked for scheduled withdrawals last week;
uint128 public lastQueuedWithdrawAmount;
// % of funds to be used for weekly option purchase
// TODO: Do we need this?
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We dont need it, unless we introduce a limit on number of amount of options sold and have this to be upgradable. Idea is to start the system slowly and lift limitation with time

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Right, but does not vault cap solve this?

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes you are right, since we have one strategy per vault

@@ -35,14 +35,17 @@ contract HackMoneyStrategy is HackMoneyStrategyBase, IHackMoneyStrategy {
uint maxDeltaGap; // 5% ?
uint minVol; // 80%
uint maxVol; // 130%
// TODO: Do we need this?
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

we dont use maxVol, we can get rid of it

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

we also dont really use size, we can refactor the code

uint size; // 15
// TODO: This we don't use as of now. Maybe we should consider. TBC
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We dont use it too, Im still reviewing my finance courses might have an input on that later

uint maxVolVariance; // 10%
uint gwavPeriod;
}

HackMoneyStrategyDetail public strategyDetail;
uint public activeExpiry;
uint public currentBoardId;
// TODO: Should we move this into strategy details
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

yes good point

@@ -328,6 +333,7 @@ contract HackMoneyStrategy is HackMoneyStrategyBase, IHackMoneyStrategy {
// update active strikes
_addActiveStrike(strike.id, result.positionId);

// TODO: Remove this check as well?
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think this is redundant if we specify the minExpectedPremium inside the openPosition, the OptionMarket does _checkCostInBounds

@@ -339,6 +345,7 @@ contract HackMoneyStrategy is HackMoneyStrategyBase, IHackMoneyStrategy {
/**
* @dev use premium in strategy to reduce position size if collateral ratio is out of range
*/
// TODO: Remove this
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is there any cases where we would want to reduce position? In the current definition of strategy Id say no, but would it be an "emergency" case where we would want to get out?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

What is this "emergency" case? We might want to stop most of the actions and let users withdraw assets

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

yes that's something to think about later, maybe worth checking what's the security measures of Ribbon

@@ -439,6 +446,7 @@ contract HackMoneyStrategy is HackMoneyStrategyBase, IHackMoneyStrategy {
* @param collateralToLock collateral available to lock.
* @return size how many options we can sell.
*/
// TODO: Never used. Remove?
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

this one was used for _getRequiredCollateral in case we trade different type of options. For the current strategy not useful we can drop

@@ -84,6 +85,7 @@ contract HackMoneyVault is Multicall, Ownable, BaseVault {
// uint exchangeValue
) = strategy.doTrade(size);
// update the remaining locked amount
// TODO: This might be fucked up as capitalUsed now returns total sum with premiums exchanged. I still need to have amount we have been able to get from exchange as I need to display this in the UI
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes need correction, return one more variable

@@ -128,6 +131,7 @@ contract HackMoneyVault is Multicall, Ownable, BaseVault {

strategy.setBoard(boardId);

// FIXME: Do we have tests for this?
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Not really, once we have the script with the fork we can test the whole work flow for one week

@@ -138,6 +142,7 @@ contract HackMoneyVault is Multicall, Ownable, BaseVault {
lastQueuedWithdrawAmount = uint128(queuedWithdrawAmount);
emit RoundStarted(vaultState.round, uint104(lockedBalance));

// TODO: should we use lockedAmount?
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

they are the same at this moment, i dont see the difference?

@@ -151,6 +156,7 @@ contract HackMoneyVault is Multicall, Ownable, BaseVault {
}

// helper to set strategy size
// TODO: Do we need this?
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

do you need it for the UI? Could also need it for trading to know how much we still can trade

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We can get it from subgraph easily

@@ -459,6 +467,7 @@ contract HackMoneyStrategy is HackMoneyStrategyBase, IHackMoneyStrategy {
* @dev verify if the strike is valid for the strategy
* @return isValid true if vol is withint [minVol, maxVol] and delta is within targetDelta +- maxDeltaGap
*/
// TODO: Remove as never used or use in the code
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

OK

@@ -481,6 +490,7 @@ contract HackMoneyStrategy is HackMoneyStrategyBase, IHackMoneyStrategy {
/**
* @dev check if the vol variance for the given strike is within certain range
*/
// TODO: Remove as never used
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

OK

@@ -505,6 +515,7 @@ contract HackMoneyStrategy is HackMoneyStrategyBase, IHackMoneyStrategy {
secondsToExpiry <= strategyDetail.maxTimeToExpiry);
}

// TODO: Think how to handle dynamic fees of synthetix not to sell cheap.. https://blog.synthetix.io/dynamic-exchange-fees-explained/
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I dont think this is an issue, we use Synthetix to exchange premiums. Premiums are small portion of the notional and fees on exchanging premiums is a small portion of premiums, a max of 0.3% rare difference on premiums will not hurt in my opinion. Besides we are trading eth/usd which is not subject to high volatility compared to other markets. However Ill check, maybe we set a max fee to accept say 0.25%?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Maybe we can have max slippage specified in the contract

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Synthetix have 0 slippage, see https://docs.synthetix.io/litepaper/#system-architecture (cmd+F 'slippage'), only trading fees are paid.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yep, but that's what I refer. We can have slippage that would be reflecting fees that we have paid

Copy link
Collaborator

@Baraa42 Baraa42 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Commented on your notes, let me know when you open tickets

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants