This forum is a read-only archive. Posting, replying and signing in are disabled.

Opt In Stateful Smart Contract

AnishRane

If the account opts into a stateful smart contract then is it referenced at index 1 of Txn.accounts array?

so to write to its local state i`ll need to write to App.localPut(Int(1),Bytes(“key”),Int(1)) ?

AnishRane

what if it is not opt in call , i want to write to local state of a account that has opted in stateful smart contract?

in that case i need to pass that account through transaction call?

fabrice

App.localPut(Int(0), ...) write in the local storage of the sender of the application call transaction (i.e., the account making the smart contract call).
It does not need to be an optin call, it can be any call, as long as the sender opted in in the past (or it is an optin call).

If you want to write to the local storage of another account than the sender’s one, use foreign accounts.

See Overview - Algorand Developer Portal