Geode Finance
Search…
⌃K

Implementing

There are 3 different states for being allowed to operate a Planet's Staking Pool:
  1. 1.
    Being an activeOperator
  2. 2.
    Being a previously activated Operator which has not expired yet.
  3. 3.
    Deactivated.
Before getting into the next steps, take a look at StakeUtils Library

Being an activeOperator

When a planet's Maintainer allows you to operate their Staking Pool, you will be the activeOperator until the Planet activates another Operator.
However, having another Operator activated doesn't deactivate you automatically!
It means you can continue operating the current validators you have created so far, but you are not allowed to take on new funds to create more validators. Simply, you can not call ClaimSurplus() for a given Planet when you are no longer the activeOperator.
Currently we are working on Avalanche Portal to improve Staking Pool - Node Operator interactions. With an incoming update, Portal will adopt the Open Market approach that is implemented in Ethereum.
Which means activeOperator approach will be abandoned soon.
Learn more about the incoming update:
Learn more here about Marketplace approach:

Important Notes!

  1. 1.
    With the implementation of pBank logic, it is required to ensure cross-chain verification. So, It is currently forbidden to operate during Telescope updates: 00:00 - 00:30 GMT
  2. 2.
    Funds always should be moved between Portal (on C-chain) to pBank (P-chain). Never leave any funds around while moving or keep them in a separate address as Telescope always watches.
    • However, with the mentioned incoming update, this will not be an issue as transactions will be limited with the help of EOA accounts.

Operating a Pool

The following operations are merely a suggestion on how to build your Infrastructure accordingly. You might follow any order as long as it respects the mentioned warnings.

1. Claim Surplus for a Planet

Claim the Surplus from a given Planet to create new Validators from your previously set pBank address.
Portal.claimSurplus(uint256 planetId);
To find out the Surplus of a Planet:
Portal.planetSurplus(uint256 planetId)
Best approach to claim surplus is to check the pool regularly and set a minimum amount to move. For example, check every 10 minutes for 100 Avax.

2. Paying Debt for a Planet

To be able to peg the price within the Withdrawal Pool you will need to pay the Debt of the Staking Pool by simply operating a buyback over the Withdrawal Pool and Burning the swapped gAVAX tokens.
Planet.payDebt(uint256 planetId, uint256 operatorId)
To find out the current Debt of a Planet:
Portal.planetDebt(uint256 planetId)
It is best to handle operations on the C-chain before moving funds to P-chain. However, sometimes you might need to move some funds to the C-chain to pay the debt.

3. Claim your Fee from a given Planet

Fee is distributed in terms of Plain Avax, however this process reverts if there are not enough surplus. So, it is best to pay the debt before claiming your fee.
Planet.claimFee(uint256 planetId, uint256 operatorId);
To find out the total Fees for a particular Staking Pool:
Portal.accumulatedFee(uint256 planetId, uint256 operatorId);

Deactivation...

A Planet's Maintainer can Deactivate an Operator.

Normally, we would expect a Planet to behave reasonably and let the Operator know beforehand, but that might not be the case and it cannot be enforced due to technical limitations.

No worries! Since there is a lock-time within the Avax Blockchain, you still have time to get some fees before returning the previously claimed Surplus.

Portal.deactivateOperator() function will give you 15 days and let you know with an event named OperatorDeactivated. Afterwards it is crucial for you to return the funds back to the Staking Pool in 15 days. This can easily be achieved by Portal.payDebt(). Because this function puts the extra amount back to Surplus after the debt is completely paid!