ERC1155 allows Geode to keep track of multiple Staking Pools. gAVAX is just the artificial name of these sets of tokens.
Balances
gAVAX acts as a Database for the amount of staked Avax that is represented by multiple Maintainers.
Balances for the depositors of a single type of gAVAX, are tracked with a predetermined ID. IDs are the main separators of the different types of gAVAX, thus different maintainers.
Balances can be directly changed by Interfaces that are implemented and approved by the given ID's maintainer.
Pricing
The balance of users, that is stored in _balances parameter of the gAVAX contract, doesn’t change while the amount of underlying Avax changes, expectedly increasing over time thanks to Staking Rewards.
Every different ID of gAVAX has a different _pricePerShare value.
// shows the underlying Avax for 1 staked Avax for given Representative
Basically, a variable that represents the equivalent of 1 x-gAVAX in terms of underlying Avax.
_pricePerShare is used while minting new tokens through Portal and updated by an Oracle contract with the data coming from the Avalanche P-Chain, collected by Telescope.
function setPricePerShare(uint256 pricePerShare_, uint256 _id)
external
virtual
{
require(hasRole(ORACLE, _msgSender()), "gAVAX: must have ORACLE to set");
...
}
_pricePerShare parameter is one of the key components for the support of DeFi.
Interfaces
ERC1155 Interfaces are one of the most important concepts introduced by Geode.fi.
ERC-1155 tokens are not compatible within the DeFi ecosystem, thus they need to be mutated for public usage.
Every gAVAX token has a different use-case, depending on the represented Protocol, therefore it doesn’t come with a preset implementation.
Interfaces are external contracts used to manage the underlying asset(data) for different purposes, allowing Protocols to use the stored data with infinite flexibility!
There can be multiple Interfaces for one gAvax ID.
/**
* Mapping from Representative IDs to interface addresses