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

build: deposit limit #17

Open
wants to merge 3 commits into
base: master
Choose a base branch
from
Open

build: deposit limit #17

wants to merge 3 commits into from

Conversation

Schlagonia
Copy link
Collaborator

No description provided.

Copy link

@omnifient omnifient left a comment

Choose a reason for hiding this comment

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

looks good, minor questions/comments

@@ -120,10 +134,12 @@ contract L1YearnEscrow is L1Escrow {
function _receiveTokens(
uint256 amount
) internal virtual override whenNotPaused {
VaultStorage storage $ = _getVaultStorage();
require($.deposited + amount <= $.depositLimit, "deposit limit");

Choose a reason for hiding this comment

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

I personally like to use string error codes when using requires (e.g. "DEPOSIT_LIMIT") - or custom errors with reverts.

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

not sure i follow.

Are you saying just change the revert string to "DEPOSIT_LIMIT" instead of "deposit limit" ?

Choose a reason for hiding this comment

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

yeah, but it's minor

I find it easier to integrate with frontends etc

* @param _minimumBuffer The new minimum buffer to enforce.
*/
function updateMinimumBuffer(
uint256 _minimumBuffer
) external virtual onlyRole(DEFAULT_ADMIN_ROLE) {
VaultStorage storage $ = _getVaultStorage();
$.minimumBuffer = _minimumBuffer;
require(_minimumBuffer <= type(uint128).max, "max size");

Choose a reason for hiding this comment

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

why not change the parameter's type to uint128?

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

I tend to prefer keeping the external types the generic versions to make integrations and interfaces easier.

But can change it to 128 to make is clearer

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

);
mockEscrow = deployMockL1Escrow();

vm.expectRevert();

Choose a reason for hiding this comment

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

some comments would be helpful :)

// reverts because caller does is not allowed to change the deposit limit

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

@@ -154,7 +154,92 @@ contract EscrowTest is Setup {
assertEq(vault.balanceOf(address(mockEscrow)), 0);
}

function test_bridgeAsset_maxDepositLimit(uint256 _amount) public {
function test_bridgeAsset_escrowDepositLimit(uint256 _amount) public {
_amount = bound(_amount, minFuzzAmount, maxFuzzAmount);

Choose a reason for hiding this comment

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

can _amount be 0?

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

yes, will add a section to show that

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

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.

3 participants