Question about ASAs and Smart Contract restrictions

Hypothetical scenario:

Account A opts into USDC and then opts into a smart contract.

Account A is then rekeyed to the smart contract.

I want Account A to act as a pool of USDC inside of the smart contract.

I want to restrict the USDC sent to this account dynamically. Specifically, every time the pool gets to a balance of 1,000 USDC (or any arbitrary amount), the pool is emptied (all of the USDC is sent to some other account) and the smart contract restricts the “sending of USDC” to the pool until the smart contract logic decides to open it back up again.

Constraint: I want to restrict the USDC received by the pool without the need for grouped transactions with the smart contract.

Initial idea:

  • Every time I want to close the USDC pool, I do the following:
    • opt-out of USDC through an inner transaction
    • when I want to open the pool again, opt into USDC through an inner transaction

Any ideas as to how to solve this problem more elegantly?

Yes, currently the only way to prevent any account (whether controlled by a smart contract or not) to receive any asset is to opt out of the asset.

2 Likes