All - Activity - gidon - Algorand

April Targeted DeFi Rewards Distribution Update - Algofi

To confirm, is this increasing the DeFi Rewards pool for the past governance period (as opposed to the current governance period)?

Indexer Fetcher Implementation

I see, thanks for the explanation. What is the purpose of the sleeping for 5 seconds on line 194? Is it a timeout to see if the indexer recovers from an error from failing to fetch the next block?

I am trying to read the implementation of the indexer but I am not familiar with the Go language. In this link, once caught up, how does the indexer know that a new block has been added? Line 136 comment is // wait for algod to notify of a …

Dealing with max size of stateful contract

When I first designed my application, I didn’t realize there was a maximum size of 700 for a stateful contract. One solution is to split up the contract into multiple and read the others’ states when needed. Are there any patterns or best practices I should be aware of when dividing the application?

API to disassemble TEAL program

@fabrice What would be the minimum code needed to do this? This is what I have at the moment and I am getting the following error: message: "failed to decode object: msgpack decode error [pos 1]: only encoded map or array can be decoded into a struct" My code is as follows: const app = await Algo…

In the issue, it talks about bytecode. However, I thought /v2/applications/{application-id} returns base64 encoded. Anyway, I tried using the dry run hack and it doesn’t seem to work.

I used the algod API /v2/applications/{application-id} to get the approval program base64 encoded. How would I disassemble it? I have tried using a simple base64 decoder but that doesn’t seem to work.

When to use UpdateApplication

As far as my understanding goes, transactions of type UpdateApplication is primarily for changing the actual TEAL of a smart contract. However, I have also seen UpdateApplication used for adding a new global state value this link.

Transaction Group Slots

The guidelines state: “Transaction groups must be designed with ‘slots’ such that each transaction will know what position it is in. A transaction’s logic can check ( txn GroupIndex == K && global GroupSize == M) and then also check specific other transactions by their index through gtxn N field”

Prevent Opt In Transactions from Draining Contract Account Algos

The lease window is max 1000 rounds so I cannot just set it to a round say 50 years from now. I presume the solution is to also require the asset opt in to be before the last valid round. Is there an alternative to this?

Thanks @cusma for the example. I think leases would be better though as it guarantees that you will only ever opt in once. Although practically it is probably the same unless someone can predict a stateless contract in advance and manage to submit many transactions in the small time frame.

Thanks @fabrice, I didn’t know about leases. Just to confirm my understanding:

I have written a stateless TEAL contract which can opt into a particular asset. However, what stops someone from continually opting into the same asset such that the contract account had to pay the transaction fee every time?

Setting the Debugger Context (JSON)

I used the --dryrun-dump option to generate a context debug file. I would now like to modify it and create my own so it is easier to set certain environments; however, a number of the JSON objects are unfamiliar and I am not sure what they are used for. Is there documentation for these objects?

Interpreting "goal app read" response

When I run the goal app read command, I get back a list of state variables, each containing fields such as tt, ui, and tb. Is there anywhere that lists what each of these mean?

Bond Implementation

Is there somewhere I can read more about the model the node is using in order to distribute rewards?

Thank you for your suggestions. I don’t quite understand the second solution. My understanding is that you are referring to a ‘Contract Account - Stateless Smart Contract’. Would every bond have its own Contract Account and how would you store any parameters in a stateless contract?

I am looking to create a smart contract for bond payments. The idea is that a bond holder will get an asset representing the bond, receive periodic coupon payments, and then at maturity can exchange the bond for the principal. I am unsure whether to use a non-fungible or fungible asset to represent it.