Skip to content
This repository has been archived by the owner on Oct 26, 2022. It is now read-only.

feat: lock on first deposit #102

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open

feat: lock on first deposit #102

wants to merge 1 commit into from

Conversation

gasperbr
Copy link

@gasperbr gasperbr commented Jan 5, 2022

No description provided.

@@ -185,8 +185,6 @@ contract BentoBox is MasterContractManager, BoringBatchable {
IERC20 token = token_ == USE_ETHEREUM ? wethToken : token_;
Rebase memory total = totals[token];

// If a new token gets added, the tokenSupply call checks that this is a deployed contract. Needed for security.
require(total.elastic != 0 || token.totalSupply() > 0, "BentoBox: No tokens");
Copy link
Contributor

Choose a reason for hiding this comment

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

This check protects against adding shares for a token that is yet to be deployed (predictable address with CREATE2)

total.base = total.base.add(share.to128());
if (total.elastic == 0) {
// Upon the first deposit permanently lock the MINIMUM_SHARE_BALANCE amount of tokens
share = share.sub(MINIMUM_SHARE_BALANCE);
Copy link
Contributor

Choose a reason for hiding this comment

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

YieldBox has a different solution for this that doesn't burn any user tokens, but adds a virtual balance instead. Would love your review of this new method :)

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

Successfully merging this pull request may close these issues.

None yet

2 participants