Geode Document Hub
Search
⌃K

G-Derivatives

G-Derivatives are Databases of Balances and Prices with extra Scalability (interfaces).

a special ERC1155 contract

Balances

Acts as a Database for the amount of staked Ether that is represented by multiple Maintainers.
Balances for the depositors are tracked with a predetermined ID. IDs are the main separators of the different types of gETH, thus different maintainers.
mapping(uint256 => mapping(address => uint256)) private _balances;
Balances can be directly changed by Interfaces.
Anyone can disable the access of the interfaces by simply using the avoidInterfaces function!

Pricing

The balance of users, doesn’t change while the amount of the underlying tokens increase over time thanks to Staking Rewards.
Every different ID of gETH has a different _pricePerShare value.
mapping(uint256 => uint256) private _pricePerShare;

_pricePerShare

Basically, a variable that represents the equivalent of 1 gETH, in terms of underlying Ether.
_pricePerShare is used by Geode on minting / burning operations, and can be used by other contracts with peace of mind.
It's value is updated by an Oracle.
The _pricePerShare parameter is one of the key components that supports DeFi.

Interfaces

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 Derivative 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 assets for different purposes. Unlocking infinite flexibility!
There can be multiple Interfaces for one gETH ID.
However, Portal doesn't currently allow that.
mapping(uint256 => mapping(address => bool)) private _interfaces;
Transactions that are conducted with Interfaces can bypass the ERC1155 requirements, while other non-compatible contracts cannot receive them.
function _doSafeTransferAcceptanceCheck(...) private {
if (to.isContract() && !isInterface(operator, id))
{
...
}

Learn more about other cool gETH functionalities:

See our case studies about some interfaces here: