Skip to content

Invariant check in token swap program #70

Open
@anoushk1234

Description

@anoushk1234

Why are we comparing invariant here with pool_a.amount * pool_a.amount

if invariant > ctx.accounts.pool_account_a.amount * ctx.accounts.pool_account_a.amount {
return err!(TutorialError::InvariantViolated);
}

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

      Development

      No branches or pull requests

        Participants

        @anoushk1234

        Issue actions

          Invariant check in token swap program · Issue #70 · solana-developers/program-examples