Search…
⌃K
Links

Manage the Insurance parameter

As described in the DelegationsManager page, the Insurance, i.e. the amount of token that a Delegation must have staked in order to attach itself to the DelegationsManager can be managed in two different ways:
  1. 1.
    defining the insurance amount inside the DelegationsManager contract -> setting the _attachInsurance parameter when initializing the DelegationsManager.
  2. 2.
    retrieving the insurance amount from an external smart contract -> setting the _attachInsuranceRetriever parameter when initializing the DelegationsManager.
If you initialize an _attachInsuranceRetriever address, the _attachInsurance parameter is not taken into account even if populated.
The _attachInsuranceRetriever can only be defined when initializing the DelegationsManager and it can't be modified later.
If you initialize the _attachInsurance and not _attachInsuranceRetriever it can be modified later using the setAttachInsurance function:
function setAttachInsurance(uint256 value) external returns (uint256 oldValue);

How and why should you define insurance externally?

The _attachInsuranceRetriever smart contract must implement a get() view function that returns the insurance amount in the form of uint256.
Defining an _attachInsuranceRetriever allows you to save the insurance amount as a parameter in the State Manager of the Organization (at the Root or Governance layer) and have the get () method of the _attachInsuranceRetriever retrieve the value by reading it from the State Manager.
In this case, the value of the insurance parameter can be modified by:
  • a Root level Proposal that overwrites the value in the State Manager, if the insurance variable is saved in the State Manager at Root level.
  • a subDAO Proposal that overwrites the value in the State Manager, if the insurance variable is saved in the State Manager at Governance level and if there is a Proposal Model, surveyless or survey, to do so. The Proposal to change the value of a variable saved in the state manager can be found here.
Here, you can find an example of a _attachInsuranceRetriever smart contract that retrieves the insurance amount from the State Manager at the Governance layer.