This repository contains the core smart contract code for Open Dollar, a GEB fork. GEB is the abbreviation of Gödel, Escher and Bach as well as the name of an Egyptian god.
When running forge
, you can specify the profile to use using the FOUNDRY_PROFILE environment variable. e.g. export FOUNDRY_PROFILE=test && forge test
. Alternatively, you can add FOUNDRY_PROFILE=test
to .env
and run source .env
.
OpenDollar governance follows the common pattern of:
- proposing a governance action
- queuing the governance action
- executing the governance action
We include a set of governance scripts in script/gov
which allow DAO members to propose, queue and execute different governance actions.
NOTE: It is important that you use the
governance
profile when running the different scripts otherwise the reading and writing of JSON files will not work.
JSONScript.s.sol
: provides functionality for building JSON objects for proposing governance actions, parsing the proposal id for queuing proposals and parsing JSON objects for execution of the proposals.
The current list of governance operations that can be proposed:
- Add Collateral: Adding a new collateral type to the system which can be borrowed against
- Update NFT Renderer: Sets the canonical NFT Renderer contract on Vault721
The input for the proposal is specific to the proposal and what that proposal requires.
The output is always a JSON file which includes at least the following proposalParams
:
{
"proposalId": uint256,
"targets": address[],
"values": uint256[]
"calldatas": bytes[],
"description": string,
"descriptionHash": bytes32
}
The JSON output may also include some extra params just for informative purposes.
Required env vars:
GOV_EXECUTOR_PK
: private key of the governance executorGOVERNANCE_ADDRESS
: address of OD GovernanceGLOBAL_SETTLEMENT_ADDRESS
: address of the global settlement contractADD_COLLATERAL_NEW_COLLATERAL_TYPE
: bytes32 value of the new collateral typeADD_COLLATERAL_NEW_COLLATERAL_ADDRESS
: address of the new collateral addressADD_COLLATERAL_MINIMUM_BID
: minimum bid for the collateral auctions (wad)ADD_COLLATERAL_MIN_DISCOUNT
: minimum discount for the collateral auctions (wad %)ADD_COLLATERAL_MAX_DISCOUNT
: maximum discount for the collateral auctions (wad %)ADD_COLLATERAL_PER_SECOND_DISCOUNT_UPDATE_RATE
: Per second rate at which the discount is updated (ray)
This script proposes adding a new collateral to the system (deploys new contracts via the collateral join and collateral auction house factories) and outputs a JSON output with the proposalParams
.
ProposeUpdateNFTRenderer.s.sol
Required env vars:
GOV_EXECUTOR_PK
: private key of the governance executorGOVERNANCE_ADDRESS
: address of OD GovernanceVAULT_721_ADDRESS
: address of the Vault721 contractORACLE_RELAYER_ADDRESS
: address of the oracle relayerTAX_COLLECTOR_ADDRESS
: address of the tax collectorCOLLATERAL_JOIN_FACTORY_ADDRESS
: address of the collateral join factory
This script proposes setting a new NFTRenderer contract on the Vault721 contract (deploys new NFTRenderer contract) and outputs a JSON output with the proposalParams
.
ProposeUpdatePidController.s.sol
Required env vars:
GOV_EXECUTOR_PK
: private key of the governance executorGOVERNANCE_ADDRESS
: address of OD GovernancePID_CONTROLLER_ADDRESS
: address of PID controllerSEED_PROPOSER
: new seed proposer addressNOISE_BARRIER
: new noise barrier valueINTEGRAL_PERIOD_SIZE
: new integral period size valueFEEDBACK_OUTPUT_UPPER_BOUND
: new feedback output upper bound valueFEEDBACK_OUTPUT_LOWER_BOUND
: new feedback output lower bound valuePER_SECOND_CUMULATIVE_LEAK
: new per second cumulative leak valueKP
: new kp valueKI
: new ki valuePRICE_DEVIATION_CUMULATIVE
: new deviation observation integral value
NOTE: see
IPIDController.sol
for more information about this.
This script proposes updating params on the PIDController contract and outputs a JSON output with the proposalParams
.
Required env vars:
GOVERNANCE_ADDRESS
: address of OD GovernanceJSON_FILE_PATH
: the path to the desired JSON proposal fileGOV_EXECUTOR_PK
: the private key of the queuer of the governance action
QueueProposal.s.sol
is used to queue a proposal given the path of the JSON file which you want, e.g. export JSON_FILE_PATH=gov-output/1-add-collateral-proposal.json
.
This script extracts the proposal id and queues the proposal via the OD governance contract. This script can be used arbitrarily for any proposal.
Required env vars:
GOVERNANCE_ADDRESS
: address of OD GovernanceJSON_FILE_PATH
: the path to the desired JSON proposal fileGOV_EXECUTOR_PK
: the private key of the executor of the governance action
ExecuteProposal.s.sol
is used to execute a proposal given the path of the JSON file you want, e.g. export JSON_FILE_PATH=gov-output/1-add-collateral-proposal.json
.
The script extracts the necessary execution params from the JSON-the same params used during the proposal and executes the proposal. This script can be used arbitrarily for any proposal.