Skip to content

Upgrade timelock misc - #12

Merged
tess3rac7 merged 7 commits into
mainfrom
upgrade-timelock-misc
Apr 1, 2022
Merged

tess3rac7 merged 7 commits into
mainfrom
upgrade-timelock-misc

Conversation

@tess3rac7

Copy link
Copy Markdown
Collaborator

No description provided.

_withdrawUnderlyingToVault(maxAmount, false);
updateBalance();
_deleverage(type(uint256).max);
_withdrawUnderlyingToVault(balanceOfPool, false);

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

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

sending max uint to withdrawUnderlyingToVault overflows when doing the slippage check.

return harvestLog.length;
}

/**

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

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

contract size issues.

Copy link
Copy Markdown
Owner

Choose a reason for hiding this comment

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

I think it would be preferable to keep the log slice function. It could be used by our front-end for an automated solution of our APY display problems. From example you call the function with (5), get [100, 90, 53535, 123, 88, 95] <-- an algorithm can analyze this and throw out the 3rd number, then make a new average.

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

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

There is already a function to get the size of the log, and any element in the log can be queried directly by index. I have some other ideas to reduce contract size in #11 but that leads to a lot of refactoring then.

*/
modifier doUpdateBalance {
_;
updateBalance();

Copy link
Copy Markdown
Owner

Choose a reason for hiding this comment

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

Modifier adds a lot of contract size doesn't it? Since it just pastes in the whole function. I think it is preferable to call the updateBalance() where needed to save contract size and keep some of these other functions.

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

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

Contract size with modifier is 24.438. Without modifier is 24.436. No difference really.

require(_newWftmToWantRoute[0] == WFTM, "bad route");
require(_newWftmToWantRoute[_newWftmToWantRoute.length - 1] == want, "bad route");
delete wftmToWantRoute;
wftmToWantRoute = _newWftmToWantRoute;

Copy link
Copy Markdown
Owner

Choose a reason for hiding this comment

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

Isn't re-assigning the variable also deleting the old one? Why the need to delete?

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

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

Probably. Just being a bit paranoid about it.

@0xulver

0xulver commented Mar 31, 2022

Copy link
Copy Markdown
Owner

I wonder if we should add another role like "keeper" and add this to the setTargetLTV function. This would allow us to add a harvester bot script to monitor leveraging profitability and to have automatic leveraging for yield optimization.

@tess3rac7

Copy link
Copy Markdown
Collaborator Author

I wonder if we should add another role like "keeper" and add this to the setTargetLTV function. This would allow us to add a harvester bot script to monitor leveraging profitability and to have automatic leveraging for yield optimization.

this is a good idea, I can make this change.

@tess3rac7
tess3rac7 merged commit e3062c6 into main Apr 1, 2022
@tess3rac7
tess3rac7 deleted the upgrade-timelock-misc branch April 1, 2022 18:47
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