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

Automatic MBR caculation for contract creation, box cost allocation, and any other fn related to manual MBR calculations. #377

Open
anupa-perera opened this issue Feb 11, 2025 · 2 comments

Comments

@anupa-perera
Copy link

anupa-perera commented Feb 11, 2025

Problem

MBR calculation is currently being handled manually by the contract creators. This is a big pain point; if it can be addressed, it will abstract away a major pain point for all the developers utilizing Algorand to deploy contracts.

Solution

Introducing a utility function within the Algokit to automatically calculate the MBR amount so it can be passed through as a parameter to facilitate the payment. Possibly by incorporating simulate to figure out what the MBR cost would be prior to the contract, box creation, etc.

Proposal

Pros and Cons

Dependencies

@SilentRhetoric
Copy link
Contributor

@neilcampbell Thinking about your recent experimentation around abstracting away covering fees for innerTxn calls (coverAppCallInnerTransactionFees), I wonder if this use case of needing to cover MBR could benefit from a similar abstraction provided by AlgorandClient.

Perhaps simulate could surface a deficit in the contract account and add in the requisite Pay txn to fund the account earlier in the atomic group?

@neilcampbell
Copy link
Contributor

neilcampbell commented Feb 12, 2025

@SilentRhetoric It's potentially do-able, however would require some experimentation.

I think there is also some potential here for an app to exploit such a feature.
For example if an app opted in to 1000 assets when it's called, that would trigger a 100 ALGO pay transaction to be attached to the group automatically. The app could then opt out of the assets it doesn't require and the balance is available to spend.

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

3 participants