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

Asset Reference - Check if Contract Account is Opted into Asset #31

Open
mangoplane opened this issue Jun 8, 2023 · 0 comments
Open

Comments

@mangoplane
Copy link

Hi,

How do I check whether a contract is opted in, but has 0 of the asset? Right now I can just check to see if the balance is 0, and then proceed to close out. It will work. But it won't have the precision and error handling by checking for this condition before trying to do it.

// check we have opted in the asset, and its balance is 0.
byte[] appAddress = CurrentApplicationAddress;
AccountReference contract = appAddress.ToAccountReference();
ulong assetBalance = contract.AssetBalance(assetReference);

Kind regards.

@mangoplane mangoplane changed the title Asset Reference Asset Reference - Check if Contract Account is Opted into Asset Jun 8, 2023
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