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

banks_crowd_sale_v3: Leverage short-circuit evaluation #8

Open
jubnzv opened this issue Sep 25, 2024 · 0 comments
Open

banks_crowd_sale_v3: Leverage short-circuit evaluation #8

jubnzv opened this issue Sep 25, 2024 · 0 comments

Comments

@jubnzv
Copy link

jubnzv commented Sep 25, 2024

We could optimize the payBank function leveraging the short-circuit evaluation supported by TVM.

  1. This condition:
if (refundTon > ton("0.005") && !is_ref) {

Could be rewritten as:

if (!is_ref && (refundTon > ton("0.005"))) {
  1. And this one:
if ((myBalance() - self.MinTonForStorage) > ton("0.1") && !is_ref) {

as:

if (!is_ref && ((myBalance() - self.MinTonForStorage) > ton("0.1"))) {

The resulting fift code might leverage the order of operations. See: nowarp/misti#144 for more details.

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

No branches or pull requests

1 participant