algorand / algorand/go-algorand

Contract-to-Contract View Function (TBD)

Open
#4,416 1 comment 0 reactions 0 assignees View on GitHub
Team Scytale
Dominant language
Go
Stars
1.4k
Forks
537
Avg merge
1d 7h
Merged PRs (30d)
18

Description

## Problem

On-chain applications store information in their global state. Every application has access to read every other application's global state. However, an application A does not know how to decode application B's global state, unless the developer has explicitly read application B to understand the encoding and wrote the corresponding decoding into application A.

App B can offer an ABI method to read values from its global state. App A can call this method to get the values it needs from App B, and this way App A does not worry about App B's encodings. However, this requires paying a transaction fee, unlike reading the global state directly.

An easy example where this would be useful: I want to know an AMM's exchange rate (or multiple AMM's rates) before calling it. Currently, AMM devs expend significant effort explaining their specific encodings so that others can read their state on-chain without calling them.

## Solution

TBD.

Ideally, App A could get values from App B's global state (or local state, analogously, as long as it has access to the related accounts as well) without paying a full transaction fee, and without needing to decode the state itself.

Note that for an off-chain view function, the "simulate" endpoint can be used that is being developed in #3953 without paying a transaction fee.

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.