-
Notifications
You must be signed in to change notification settings - Fork 212
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat!: use contractGovernor to govern Treasury using ParamManager
extract params to a separate file integrate contract governance into treasury swingset test for treasury governance closes #3189 closes #3473
- Loading branch information
1 parent
cc67024
commit 1eb2464
Showing
26 changed files
with
1,583 additions
and
615 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,84 @@ | ||
// @ts-check | ||
|
||
import { buildParamManager, ParamType } from '@agoric/governance'; | ||
|
||
export const POOL_FEE_KEY = 'PoolFee'; | ||
export const PROTOCOL_FEE_KEY = 'ProtocolFee'; | ||
|
||
export const CHARGING_PERIOD_KEY = 'ChargingPeriod'; | ||
export const RECORDING_PERIOD_KEY = 'RecordingPeriod'; | ||
|
||
export const INITIAL_MARGIN_KEY = 'InitialMargin'; | ||
export const LIQUIDATION_MARGIN_KEY = 'LiquidationMargin'; | ||
export const INTEREST_RATE_KEY = 'InterestRate'; | ||
export const LOAN_FEE_KEY = 'LoanFee'; | ||
|
||
export const governedParameterTerms = { | ||
loanParams: [POOL_FEE_KEY, PROTOCOL_FEE_KEY], | ||
poolParams: [ | ||
CHARGING_PERIOD_KEY, | ||
RECORDING_PERIOD_KEY, | ||
INITIAL_MARGIN_KEY, | ||
LIQUIDATION_MARGIN_KEY, | ||
INTEREST_RATE_KEY, | ||
LOAN_FEE_KEY, | ||
], | ||
}; | ||
|
||
/** @type {{ FEE: 'fee', POOL: 'pool' }} */ | ||
export const ParamKey = { | ||
FEE: 'fee', | ||
POOL: 'pool', | ||
}; | ||
|
||
export const makeFeeParamManager = loanParams => { | ||
/** @type {FeeParamManager} */ | ||
return buildParamManager([ | ||
{ | ||
name: POOL_FEE_KEY, | ||
value: loanParams.poolFee, | ||
type: ParamType.NAT, | ||
}, | ||
{ | ||
name: PROTOCOL_FEE_KEY, | ||
value: loanParams.protocolFee, | ||
type: ParamType.NAT, | ||
}, | ||
]); | ||
}; | ||
|
||
export const makePoolParamManager = (loanParams, rates) => { | ||
/** @type {PoolParamManager} */ | ||
return buildParamManager([ | ||
{ | ||
name: CHARGING_PERIOD_KEY, | ||
value: loanParams.chargingPeriod, | ||
type: ParamType.NAT, | ||
}, | ||
{ | ||
name: RECORDING_PERIOD_KEY, | ||
value: loanParams.recordingPeriod, | ||
type: ParamType.NAT, | ||
}, | ||
{ | ||
name: INITIAL_MARGIN_KEY, | ||
value: rates.initialMargin, | ||
type: ParamType.RATIO, | ||
}, | ||
{ | ||
name: LIQUIDATION_MARGIN_KEY, | ||
value: rates.liquidationMargin, | ||
type: ParamType.RATIO, | ||
}, | ||
{ | ||
name: INTEREST_RATE_KEY, | ||
value: rates.interestRate, | ||
type: ParamType.RATIO, | ||
}, | ||
{ | ||
name: LOAN_FEE_KEY, | ||
value: rates.loanFee, | ||
type: ParamType.RATIO, | ||
}, | ||
]); | ||
}; |
Oops, something went wrong.