-
Notifications
You must be signed in to change notification settings - Fork 8
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* made generate run on a fork of mainnet or sepolia. should no longer require a private key to generate a proposal * linted * added an open proposal generation script * linted * removed loading of private key from generator scripts * removed generated test file * Format output json --------- Co-authored-by: Patrick Gallagher <[email protected]>
- Loading branch information
1 parent
e31c215
commit 22d75d0
Showing
17 changed files
with
150 additions
and
160 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,38 +1 @@ | ||
{ | ||
"chainid": "31337", | ||
"description": "add NEWADD as a collateral type", | ||
"network": "anvil", | ||
"newCollateralAddress": "0xa513E6E4b8f2a923D98304ec87F64353C4D5C853", | ||
"newCollateralType": "NEWADD", | ||
"proposalType": "AddCollateral", | ||
"ProtocolToken_Address": "", | ||
"ODGovernor_Address": "", | ||
"SAFEEngine_Address": "", | ||
"OracleRelayer_Address": "", | ||
"LiquidationEngine_Address": "", | ||
"TaxCollector_Address": "", | ||
"GlobalSettlement_Address": "", | ||
"SAFEEngineCollateralParams": { | ||
"collateralDebtCeiling": "500000000000000000000000000000000000000000000000", | ||
"collateralDebtFloor": "100000000000000000000000000000000000000000000000" | ||
}, | ||
"TaxCollectorCollateralParams": { | ||
"stabilityFee": "1000000000000000000000000000" | ||
}, | ||
"LiquidationEngineCollateralParams": { | ||
"newCAHChild": "0xd468bF477c0c99095D508c3B0A60f39348d91ac0", | ||
"liquidationPenalty": "1000000000000000000", | ||
"liquidationQuantity": "1000000000000000000000000000000000000000000000" | ||
}, | ||
"OracleRelayerCollateralParams": { | ||
"delayedOracle": "0xa783CDc72e34a174CCa57a6d9a74904d0Bec05A9", | ||
"safetyCRatio": "1000000000000000000000000000", | ||
"liquidationCRatio": "1000000000000000000000000000" | ||
}, | ||
"CollateralAuctionHouseParams": { | ||
"maximumDiscount": "1", | ||
"minimumBid": "2", | ||
"minimumDiscount": "3", | ||
"perSecondDiscountUpdateRate": "999998607628240538157433861" | ||
} | ||
} | ||
{"chainid":"31337","description":"add NEWADDed as a collateral type","network":"anvil","newCollateralAddress":"0xa513E6E4b8f2a923D98304ec87F64353C4D5C853","newCollateralType":"NEWADD","proposalType":"AddCollateral","ProtocolToken_Address":"0xc6e7DF5E7b4f2A278906862b61205850344D4e7d","ODGovernor_Address":"0xa85233C63b9Ee964Add6F2cffe00Fd84eb32338f","SAFEEngine_Address":"0x67d269191c92Caf3cD7723F116c85e6E9bf55933","OracleRelayer_Address":"0xE6E340D132b5f46d1e472DebcD681B2aBc16e57E","LiquidationEngine_Address":"0xa82fF9aFd8f496c3d6ac40E2a0F282E47488CFc9","TaxCollector_Address":"0x95401dc811bb5740090279Ba06cfA8fcF6113778","GlobalSettlement_Address":"0x5f3f1dBD7B74C6B46e8c44f98792A1dAf8d69154","SAFEEngineCollateralParams":{"collateralDebtCeiling":"500000000000000000000000000000000000000000000000","collateralDebtFloor":"100000000000000000000000000000000000000000000000"},"TaxCollectorCollateralParams":{"stabilityFee":"1000000000000000000000000000"},"LiquidationEngineCollateralParams":{"liquidationPenalty":"1000000000000000000","liquidationQuantity":"1000000000000000000000000000000000000000000000","newCAHChild":"0xf9b42E09Fd787d6864D6b2Cd8E1350fc93E6683D"},"OracleRelayerCollateralParams":{"delayedOracle":"0xa783CDc72e34a174CCa57a6d9a74904d0Bec05A9","safetyCRatio":"1000000000000000000000000000","liquidationCRatio":"1000000000000000000000000000"},"CollateralAuctionHouseParams":{"maximumDiscount":"1","minimumBid":"2","minimumDiscount":"3","perSecondDiscountUpdateRate":"999998607628240538157433861"}} |
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 |
---|---|---|
@@ -1,38 +1,38 @@ | ||
{ | ||
"chainid": "42161", | ||
"description": "add NEWADD as a collateral type", | ||
"network": "mainnet", | ||
"newCollateralAddress": "0xa513E6E4b8f2a923D98304ec87F64353C4D5C853", | ||
"newCollateralType": "NEWADD", | ||
"proposalType": "AddCollateral", | ||
"ProtocolToken_Address": "", | ||
"ODGovernor_Address": "", | ||
"SAFEEngine_Address": "", | ||
"OracleRelayer_Address": "", | ||
"LiquidationEngine_Address": "", | ||
"TaxCollector_Address": "", | ||
"GlobalSettlement_Address": "", | ||
"SAFEEngineCollateralParams": { | ||
"collateralDebtCeiling": "500000000000000000000000000000000000000000000000", | ||
"collateralDebtFloor": "100000000000000000000000000000000000000000000000" | ||
}, | ||
"TaxCollectorCollateralParams": { | ||
"stabilityFee": "1000000000000000000000000000" | ||
}, | ||
"LiquidationEngineCollateralParams": { | ||
"newCAHChild": "0x293b702362918e990Dd5f48a80fB139FeAd64263", | ||
"liquidationPenalty": "1000000000000000000", | ||
"liquidationQuantity": "1000000000000000000000000000000000000000000000" | ||
}, | ||
"OracleRelayerCollateralParams": { | ||
"delayedOracle": "0xa783CDc72e34a174CCa57a6d9a74904d0Bec05A9", | ||
"safetyCRatio": "1000000000000000000000000000", | ||
"liquidationCRatio": "1000000000000000000000000000" | ||
}, | ||
"CollateralAuctionHouseParams": { | ||
"maximumDiscount": "1", | ||
"minimumBid": "2", | ||
"minimumDiscount": "3", | ||
"perSecondDiscountUpdateRate": "999998607628240538157433861" | ||
} | ||
} | ||
"chainid": "42161", | ||
"description": "add NEWADD as a collateral type", | ||
"network": "mainnet", | ||
"newCollateralAddress": "0xa513E6E4b8f2a923D98304ec87F64353C4D5C853", | ||
"newCollateralType": "NEWADD", | ||
"proposalType": "AddCollateral", | ||
"ProtocolToken_Address": "", | ||
"ODGovernor_Address": "", | ||
"SAFEEngine_Address": "", | ||
"OracleRelayer_Address": "", | ||
"LiquidationEngine_Address": "", | ||
"TaxCollector_Address": "", | ||
"GlobalSettlement_Address": "", | ||
"SAFEEngineCollateralParams": { | ||
"collateralDebtCeiling": "500000000000000000000000000000000000000000000000", | ||
"collateralDebtFloor": "100000000000000000000000000000000000000000000000" | ||
}, | ||
"TaxCollectorCollateralParams": { | ||
"stabilityFee": "1000000000000000000000000000" | ||
}, | ||
"LiquidationEngineCollateralParams": { | ||
"newCAHChild": "0x293b702362918e990Dd5f48a80fB139FeAd64263", | ||
"liquidationPenalty": "1000000000000000000", | ||
"liquidationQuantity": "1000000000000000000000000000000000000000000000" | ||
}, | ||
"OracleRelayerCollateralParams": { | ||
"delayedOracle": "0xa783CDc72e34a174CCa57a6d9a74904d0Bec05A9", | ||
"safetyCRatio": "1000000000000000000000000000", | ||
"liquidationCRatio": "1000000000000000000000000000" | ||
}, | ||
"CollateralAuctionHouseParams": { | ||
"maximumDiscount": "1", | ||
"minimumBid": "2", | ||
"minimumDiscount": "3", | ||
"perSecondDiscountUpdateRate": "999998607628240538157433861" | ||
} | ||
} |
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,22 @@ | ||
{ | ||
"chainid": 42161, | ||
"description": "Random calldatas", | ||
"network": "mainnet", | ||
"proposalType": "TargetsAndCalldata", | ||
"ODGovernor_Address": "0xf704735CE81165261156b41D33AB18a08803B86F", | ||
"objectArray": [ | ||
{ | ||
"target": "0xbbB4f37c787C6ecb0b6b5Fb3F73221aA22fabA70", | ||
"calldata": "0xC295763Eed507d4A0f8B77241c03dd3354781a15" | ||
}, | ||
{ | ||
"target": "0xbbB4f37c787C6ecb0b6b5Fb3F73221aA22fabA70", | ||
"calldata": "0xC295763Eed507d4A0f8B77241c03dd3354781a15" | ||
}, | ||
{ | ||
"target": "0xbbB4f37c787C6ecb0b6b5Fb3F73221aA22fabA70", | ||
"calldata": "0xC295763Eed507d4A0f8B77241c03dd3354781a15" | ||
} | ||
], | ||
"arrayLength": "3" | ||
} |
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 |
---|---|---|
@@ -1,10 +1,10 @@ | ||
{ | ||
"chainid": 42161, | ||
"description": "update timelock controller delay", | ||
"network": "mainnet", | ||
"TimelockController_Address": "", | ||
"ProtocolToken_Address": "", | ||
"ODGovernor_Address": "", | ||
"proposalType": "UpdateDelay", | ||
"newDelay": 86400 | ||
} | ||
"chainid": 42161, | ||
"description": "update timelock controller delay", | ||
"network": "mainnet", | ||
"TimelockController_Address": "", | ||
"ProtocolToken_Address": "", | ||
"ODGovernor_Address": "", | ||
"proposalType": "UpdateDelay", | ||
"newDelay": 86400 | ||
} |
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 |
---|---|---|
@@ -1,38 +1 @@ | ||
{ | ||
"chainid": "421614", | ||
"network": "sepolia", | ||
"newCollateralAddress": "", | ||
"newCollateralType": "", | ||
"proposalType": "AddCollateral", | ||
"description": "", | ||
"ProtocolToken_Address": "", | ||
"ODGovernor_Address": "", | ||
"SAFEEngine_Address": "", | ||
"OracleRelayer_Address": "", | ||
"LiquidationEngine_Address": "", | ||
"TaxCollector_Address": "", | ||
"GlobalSettlement_Address": "", | ||
"SAFEEngineCollateralParams": { | ||
"collateralDebtCeiling": "", | ||
"collateralDebtFloor": "" | ||
}, | ||
"TaxCollectorCollateralParams": { | ||
"stabilityFee": "" | ||
}, | ||
"LiquidationEngineCollateralParams": { | ||
"newCAHChild": "", | ||
"liquidationPenalty": "", | ||
"liquidationQuantity": "" | ||
}, | ||
"OracleRelayerCollateralParams": { | ||
"delayedOracle": "", | ||
"safetyCRatio": "", | ||
"liquidationCRatio": "" | ||
}, | ||
"CollateralAuctionHouseParams": { | ||
"maximumDiscount": "", | ||
"minimumBid": "", | ||
"minimumDiscount": "", | ||
"perSecondDiscountUpdateRate": "" | ||
} | ||
} | ||
{"chainid":"421614","network":"sepolia","newCollateralAddress":"0x1ebFA3a5074f74C1dE3d1bfd1e981ab89475Ef14","newCollateralType":"NEWEY","proposalType":"AddCollateral","description":"it's a new collateratl!","ProtocolToken_Address":"","ODGovernor_Address":"","SAFEEngine_Address":"","OracleRelayer_Address":"","LiquidationEngine_Address":"","TaxCollector_Address":"","GlobalSettlement_Address":"","SAFEEngineCollateralParams":{"collateralDebtCeiling":"1","collateralDebtFloor":"2"},"TaxCollectorCollateralParams":{"stabilityFee":"3"},"LiquidationEngineCollateralParams":{"newCAHChild":"0x1ebFA3a5074f74C1dE3d1bfd1e981ab89475Ef14","liquidationPenalty":"4","liquidationQuantity":"5"},"OracleRelayerCollateralParams":{"delayedOracle":"0x1ebFA3a5074f74C1dE3d1bfd1e981ab89475Ef14","safetyCRatio":"6","liquidationCRatio":"7"},"CollateralAuctionHouseParams":{"maximumDiscount":"8","minimumBid":"9","minimumDiscount":"10","perSecondDiscountUpdateRate":"11"}} |
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
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
62 changes: 62 additions & 0 deletions
62
script/gov/Generate/GenerateTargetsAndCalldataProposal.s.sol
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,62 @@ | ||
// SPDX-License-Identifier: GPL-3.0 | ||
pragma solidity 0.8.20; | ||
|
||
import {JSONScript} from '@script/gov/helpers/JSONScript.s.sol'; | ||
import {ODGovernor} from '@contracts/gov/ODGovernor.sol'; | ||
import {TimelockController} from '@openzeppelin/governance/TimelockController.sol'; | ||
import {Generator} from '@script/gov/Generator.s.sol'; | ||
import {Strings} from '@openzeppelin/utils/Strings.sol'; | ||
import 'forge-std/StdJson.sol'; | ||
|
||
contract GenerateTargetsAndCalldataProposal is Generator, JSONScript { | ||
using stdJson for string; | ||
|
||
address public _odGovernor; | ||
string public _description; | ||
address[] public targets; | ||
bytes[] public calldatas; | ||
|
||
function _loadBaseData(string memory json) internal override { | ||
_description = json.readString(string(abi.encodePacked('.description'))); | ||
_odGovernor = json.readAddress(string(abi.encodePacked('.ODGovernor_Address:'))); | ||
uint256 len = json.readUint(string(abi.encodePacked('.arrayLength'))); | ||
for (uint256 i; i < len; i++) { | ||
string memory index = Strings.toString(i); | ||
address target = json.readAddress(string(abi.encodePacked('.objectArray[', index, '].target'))); | ||
bytes memory callData = json.readBytes(string(abi.encodePacked('.objectArray[', index, '].calldata'))); | ||
targets.push(target); | ||
calldatas.push(callData); | ||
} | ||
} | ||
|
||
function _generateProposal() internal override { | ||
ODGovernor gov = ODGovernor(payable(_odGovernor)); | ||
|
||
uint256[] memory values = new uint256[](targets.length); | ||
for (uint256 i; i < targets.length; i++) { | ||
values[i] = 0; | ||
} | ||
|
||
bytes32 descriptionHash = keccak256(bytes(_description)); | ||
|
||
uint256 proposalId = gov.hashProposal(targets, values, calldatas, descriptionHash); | ||
|
||
// Propose the action to add the collateral type | ||
|
||
string memory stringProposalId = vm.toString(proposalId / 10 ** 69); | ||
|
||
{ | ||
string memory objectKey = 'TARGETS-CALLDATA'; | ||
// Build the JSON output | ||
string memory jsonOutput = | ||
_buildProposalParamsJSON(proposalId, objectKey, targets, values, calldatas, _description, descriptionHash); | ||
vm.writeJson( | ||
jsonOutput, string.concat('./gov-output/', _network, '/', stringProposalId, '-targetsAndCalldata.json') | ||
); | ||
} | ||
} | ||
|
||
function _serializeCurrentJson(string memory _objectKey) internal override returns (string memory _serializedInput) { | ||
_serializedInput = vm.serializeJson(_objectKey, json); | ||
} | ||
} |
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
Oops, something went wrong.