-
Notifications
You must be signed in to change notification settings - Fork 110
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
feat: allow setting liquidity cap for ZRC20 #1205
Conversation
!!!WARNING!!! Be very careful about using Only suppress a single rule (or a specific set of rules) within a section of code, while continuing to scan for other problems. To do this, you can list the rule(s) to be suppressed within the #nosec annotation, e.g: /* #nosec G401 */ or //#nosec G201 G202 G203 Pay extra attention to the way |
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.
LGTM
if txOrigin == "" { | ||
txOrigin = msg.Sender | ||
} | ||
if len(logs) > 0 { |
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.
Does len(logs) == 0
mean something wrong (e.g., we always expect some logs)? Just curious about what pre-assumption we had in our mind.
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.
It prevents doing unnecessary call to fetch system contracts since there would be no logs to iterate
} | ||
|
||
// update the liquidity cap | ||
coin.LiquidityCap = msg.LiquidityCap |
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.
My understanding is that when currentTotalSupply already > msg.LiquidityCap
, the ZRC20 will be capped immediately, correct?
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.
currentSupply + amount > liquidityCap
is the condition checked, therefore setting a liquidity cap below current supply would immediately blocks the deposits
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.
looks good. no blocking comment
Description
Allow setting a liquidity cap for a
ZRC20
. The value is stored in theForeignCoin
object. If the liquidity cap is reached (total minted on ZetaChain + inbound amount > liquidity cap) the cctx is automatically reverted to limit the liquidity on ZetaChain.The value can be set from admin group 2 through the
MsgUpdateZRC20LiquidityCap
message.Add smoke tests for the change
Other changes:
HandleEvmDeposit
testsZRC20DepositAndCallContract
testsCloses: #1187
Type of change
How Has This Been Tested?
Please describe the tests that you ran to verify your changes. Include instructions and any relevant details so others can reproduce.
Checklist: