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

Cleanup 0 value allowance objects in the KOIN and VHP contracts #112

Merged
merged 4 commits into from
Mar 12, 2025

Conversation

mvandeberg
Copy link
Member

Brief description

Cleanup 0 value allowance objects so they are not returned in get_allowances.

Checklist

  • I have built this pull request locally
  • I have ran the unit tests locally
  • I have manually tested this pull request
  • I have reviewed my pull request
  • I have added any relevant tests

Demonstration

@mvandeberg mvandeberg requested a review from sgerbino February 11, 2025 21:24
if (allowance.value >= amount) {

if (allowance.value == amount)
this.allowances.remove(key);
Copy link
Contributor

Choose a reason for hiding this comment

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

allowance accepted, then return true here.

@@ -296,6 +300,9 @@ export class Vhp {
key.set(account, 0);
key.set(caller, 25);
const allowance = this.allowances.get(key)!;

if (allowance.value == amount)
this.allowances.remove(key);
Copy link
Contributor

Choose a reason for hiding this comment

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

allowance accepted, then return true here.

@sgerbino sgerbino merged commit aef57bd into master Mar 12, 2025
6 checks passed
@sgerbino sgerbino deleted the cleanup-allowance-objects branch March 12, 2025 15:13
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