Skip to content

Commit

Permalink
chore: remove gate logic and unused imports
Browse files Browse the repository at this point in the history
  • Loading branch information
fxp3 committed Jul 13, 2024
1 parent 8f8cae5 commit 77df862
Show file tree
Hide file tree
Showing 68 changed files with 330 additions and 1,476 deletions.
108 changes: 2 additions & 106 deletions .vscode/snippets-sol.code-snippets
Original file line number Diff line number Diff line change
Expand Up @@ -35,13 +35,13 @@
"pragma solidity ^0.8.0;",
"",
"import {Deployed} from \"scripts/deploy/libs/Deployed.s.sol\";",
"import {Log, Help} from \"kresko-lib/utils/s/LibVm.s.sol\";",
"import {Log, Utils} from \"kresko-lib/utils/s/LibVm.s.sol\";",
"import {ShortAssert} from \"kresko-lib/utils/s/ShortAssert.t.sol\";",
"import {Tested} from \"kresko-lib/utils/s/Tested.t.sol\";",
"",
"contract TestSnip is Tested {",
" using Log for *;",
" using Help for *;",
" using Utils for *;",
" using Deployed for *;",
" using ShortAssert for *;",
"",
Expand All @@ -57,109 +57,5 @@
"}"
],
"description": "Base for a new forge test using workspace utils"
},
"kresko: forge test template with protocol deployment": {
"isFileTemplate": true,
"prefix": "kresko_forge_test_protocol_template",
"scope": "solidity",
"body": [
"// solhint-disable state-visibility, max-states-count, no-empty-blocks, no-console",
"// SPDX-License-Identifier: MIT",
"pragma solidity ^0.8.0;",
"",
"import {Deployed} from \"scripts/deploy/libs/Deployed.s.sol\";",
"import {Deploy} from \"scripts/deploy/Deploy.s.sol\";",
"import {Log, Help} from \"kresko-lib/utils/Libs.s.sol\";",
"import {ShortAssert} from \"kresko-lib/utils/ShortAssert.t.sol\";",
"import {IKrMulticall} from \"periphery/IKrMulticall.sol\";",
"import {Tested} from \"kresko-lib/utils/Tested.t.sol\";",
"",
"contract TestSnip is Tested, Deploy {",
" using Log for *;",
" using Help for *;",
" using Deployed for *;",
" using ShortAssert for *;",
"",
"",
" address krETH;",
" address admin;",
"",
" function setUp() public {",
" admin = Deploy.deployTest(\"MNEMONIC_DEVNET\", \"test-base\", 0).params.common.admin;",
" krETH = (\"krETH\").addr();",
" }",
"",
" function testTheThing() public {",
" prank(admin);",
"",
" weth.approve(krETH, type(uint256).max);",
"",
" admin.notEq(address(0), \"admin-address-0\");",
" admin.clg(\"admin-address\");",
" }",
"}"
],
"description": "Base for a new forge test using minimal protocol deployment"
},
"kresko: forge script template": {
"isFileTemplate": true,
"prefix": "kresko_script_template",
"scope": "solidity",
"body": [
"// solhint-disable state-visibility",
"// SPDX-License-Identifier: MIT",
"pragma solidity ^0.8.0;",
"",
"import {Scripted} from \"kresko-lib/utils/Scripted.s.sol\";",
"import {Help, Log} from \"kresko-lib/utils/Libs.s.sol\";",
"import {IDataV1} from \"periphery/interfaces/IDataV1.sol\";",
"import {Deployed} from \"scripts/deploy/libs/Deployed.s.sol\";",
"import {IDeploymentFactory} from \"factory/IDeploymentFactory.sol\";",
"import {IKreskoAssetAnchor} from \"kresko-asset/IKreskoAssetAnchor.sol\";",
"import {MockERC20} from \"mocks/MockERC20.sol\";",
"import {IKreskoAsset} from \"kresko-asset/IKreskoAsset.sol\";",
"import {IExtendedDiamondCutFacet} from \"diamond/interfaces/IDiamondCutFacet.sol\";",
"import {IKresko} from \"periphery/IKresko.sol\";",
"import {IKISS} from \"kiss/interfaces/IKISS.sol\";",
"import {IVault} from \"vault/interfaces/IVault.sol\";",
"import {IKrMulticall} from \"periphery/IKrMulticall.sol\";",
"",
"contract ScriptSnip is Scripted {",
" using Log for *;",
" using Help for *;",
" using Deployed for *;",
" IDeploymentFactory factory;",
" IKresko kresko;",
" IExtendedDiamondCutFacet diamond;",
" IKreskoAsset krETH;",
" IKreskoAssetAnchor akrETH;",
" IDataV1 datav1;",
" IVault vault;",
" IKISS kiss;",
" IKrMulticall multicall;",
" MockERC20 token;",
"",
" function init() private {",
" vm.createSelectFork(\"arbitrumSepolia\");",
"",
" useMnemonic(\"MNEMONIC_DEVNET\");",
"",
" kresko = IKresko(Deployed.addr(\"Kresko\"));",
"",
" multicall = IKrMulticall(Deployed.addr(\"Multicall\"));",
" diamond = IExtendedDiamondCutFacet(address(kresko));",
" vault = IVault(Deployed.addr(\"Vault\"));",
" datav1 = IDataV1(Deployed.addr(\"DataV1\"));",
" krETH = IKreskoAsset(Deployed.addr(\"krETH\"));",
" akrETH = IKreskoAssetAnchor(Deployed.addr(\"akrETH\"));",
" }",
"",
" function run() public {",
" init();",
" // do the thing",
" }",
"}"
],
"description": "Base for a new forge script using live protocol"
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,6 @@
"04_oracleDecimals": 8,
"05_sequencerGracePeriodTime": 3600,
"06_sequencerUptimeFeed": "0xFdB631F5EE196F0ed6FAa767959853A9F217697D",
"07_gatingManager": "0x0000000000000000000000000000000000000000",
"08_pythEndpoint": "0xff1a0f4744e8582DF1aE09D5611b887B6a12925C",
"09_marketStatusProvider": "0x0000000000000000000000000000000000000000"
},
Expand All @@ -29,6 +28,5 @@
"01_questForKreskNFT": "0x1C04925779805f2dF7BbD0433ABE92Ea74829bF6",
"02_V3SwapRouter02": "0x68b3465833fb72A70ecDF485E0e4C7bD8665Fc45",
"03_UniswapQuoterV2": "0x61fFE014bA17989E743c5F6cB21bF9697530B21e"
},
"06_gatingPhase": 0
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,6 @@
"04_oracleDecimals": 8,
"05_sequencerGracePeriodTime": 3600,
"06_sequencerUptimeFeed": "0x23ab08d87BBAe90e8BDe56F87ad6e53683E08279",
"07_gatingManager": "0x0000000000000000000000000000000000000000",
"08_pythEndpoint": "0x4374e5a8b9C22271E9EB878A2AA31DE97DF15DAF",
"09_marketStatusProvider": "0x0000000000000000000000000000000000000000"
},
Expand All @@ -29,6 +28,5 @@
"01_questForKreskNFT": "0x200945e331Af88e1D854Cb9D3503F257B33Fe19F",
"02_V3SwapRouter02": "0x021dAc9a7652A2C010AD4B4f412E2DEbBE76481a",
"03_UniswapQuoterV2": "0x2779a0CC1c3e0E44D2542EC3e79e3864Ae93Ef0B"
},
"06_gatingPhase": 1
}
}
4 changes: 1 addition & 3 deletions configs/foundry/deploy/arbitrum/params-arbitrum.json
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,6 @@
"04_oracleDecimals": 8,
"05_sequencerGracePeriodTime": 3600,
"06_sequencerUptimeFeed": "0xFdB631F5EE196F0ed6FAa767959853A9F217697D",
"07_gatingManager": "0x00000000685B935476005E6A7ed5E1Bf3C000B12",
"08_pythEndpoint": "0xff1a0f4744e8582DF1aE09D5611b887B6a12925C",
"09_marketStatusProvider": "0xf6188e085ebEB716a730F8ecd342513e72C8AD04"
},
Expand All @@ -29,6 +28,5 @@
"01_questForKreskNFT": "0x1C04925779805f2dF7BbD0433ABE92Ea74829bF6",
"02_V3SwapRouter02": "0x68b3465833fb72A70ecDF485E0e4C7bD8665Fc45",
"03_UniswapQuoterV2": "0x61fFE014bA17989E743c5F6cB21bF9697530B21e"
},
"06_gatingPhase": 4
}
}
8 changes: 3 additions & 5 deletions configs/foundry/deploy/localhost/params-localhost.json
Original file line number Diff line number Diff line change
Expand Up @@ -9,9 +9,8 @@
"04_oracleDecimals": 8,
"05_sequencerGracePeriodTime": 3600,
"06_sequencerUptimeFeed": "0x0000000000000000000000000000000000000000",
"07_gatingManager": "0x0000000000000000000000000000000000000000",
"08_pythEndpoint": "0x0000000000000000000000000000000000000000",
"09_marketStatusProvider": "0x0000000000000000000000000000000000000000"
"07_pythEndpoint": "0x0000000000000000000000000000000000000000",
"08_marketStatusProvider": "0x0000000000000000000000000000000000000000"
},
"03_scdp": {
"00_minCollateralRatio": 250e2,
Expand All @@ -29,6 +28,5 @@
"01_questForKreskNFT": "0xDF01B2D0cBd99DbeECd1fE3f7F42C8307A0c3B5a",
"02_V3SwapRouter02": "0x0000000000000000000000000000000000000000",
"03_UniswapQuoterV2": "0x0000000000000000000000000000000000000000"
},
"06_gatingPhase": 0
}
}
8 changes: 3 additions & 5 deletions configs/foundry/deploy/test/params-test-audit.json
Original file line number Diff line number Diff line change
Expand Up @@ -9,9 +9,8 @@
"04_oracleDecimals": 8,
"05_sequencerGracePeriodTime": 3600,
"06_sequencerUptimeFeed": "0x0000000000000000000000000000000000000000",
"07_gatingManager": "0x0000000000000000000000000000000000000000",
"08_pythEndpoint": "0x0000000000000000000000000000000000000000",
"09_marketStatusProvider": "0x0000000000000000000000000000000000000000"
"07_pythEndpoint": "0x0000000000000000000000000000000000000000",
"08_marketStatusProvider": "0x0000000000000000000000000000000000000000"
},
"03_scdp": {
"00_minCollateralRatio": 250e2,
Expand All @@ -29,6 +28,5 @@
"01_questForKreskNFT": "0x0000000000000000000000000000000000000000",
"02_V3SwapRouter02": "0x0000000000000000000000000000000000000000",
"03_UniswapQuoterV2": "0x0000000000000000000000000000000000000000"
},
"06_gatingPhase": 0
}
}
8 changes: 3 additions & 5 deletions configs/foundry/deploy/test/params-test-base.json
Original file line number Diff line number Diff line change
Expand Up @@ -9,9 +9,8 @@
"04_oracleDecimals": 8,
"05_sequencerGracePeriodTime": 3600,
"06_sequencerUptimeFeed": "0x0000000000000000000000000000000000000000",
"07_gatingManager": "0x0000000000000000000000000000000000000000",
"08_pythEndpoint": "0x0000000000000000000000000000000000000000",
"09_marketStatusProvider": "0x0000000000000000000000000000000000000000"
"07_pythEndpoint": "0x0000000000000000000000000000000000000000",
"08_marketStatusProvider": "0x0000000000000000000000000000000000000000"
},
"03_scdp": {
"00_minCollateralRatio": 250e2,
Expand All @@ -29,6 +28,5 @@
"01_questForKreskNFT": "0x0000000000000000000000000000000000000000",
"02_V3SwapRouter02": "0x0000000000000000000000000000000000000000",
"03_UniswapQuoterV2": "0x0000000000000000000000000000000000000000"
},
"06_gatingPhase": 0
}
}
8 changes: 3 additions & 5 deletions configs/foundry/deploy/test/params-test-clean.json
Original file line number Diff line number Diff line change
Expand Up @@ -9,9 +9,8 @@
"04_oracleDecimals": 8,
"05_sequencerGracePeriodTime": 3600,
"06_sequencerUptimeFeed": "0x0000000000000000000000000000000000000000",
"07_gatingManager": "0x0000000000000000000000000000000000000000",
"08_pythEndpoint": "0x0000000000000000000000000000000000000000",
"09_marketStatusProvider": "0x0000000000000000000000000000000000000000"
"07_pythEndpoint": "0x0000000000000000000000000000000000000000",
"08_marketStatusProvider": "0x0000000000000000000000000000000000000000"
},
"03_scdp": {
"00_minCollateralRatio": 250e2,
Expand All @@ -29,6 +28,5 @@
"01_questForKreskNFT": "0x0000000000000000000000000000000000000000",
"02_V3SwapRouter02": "0x0000000000000000000000000000000000000000",
"03_UniswapQuoterV2": "0x0000000000000000000000000000000000000000"
},
"06_gatingPhase": 0
}
}
16 changes: 6 additions & 10 deletions configs/hardhat/deploy/arbitrumSepolia.ts
Original file line number Diff line number Diff line change
Expand Up @@ -238,18 +238,14 @@ const gnosisSafeDeployments: GnosisSafeDeployment[] = [
SignMessageLib,
SimulateTxAccessor,
]
const commonInitAgs = (
gatingManager: string,
): Omit<CommonInitArgsStruct, 'feeRecipient' | 'admin' | 'council' | 'treasury'> => ({
const commonInitArgs = {
oracleDecimals: 8,
gatingManager,
maxPriceDeviationPct: 0.1e4,
sequencerGracePeriodTime: 3600,
sequencerUptimeFeed: '0x23ab08d87BBAe90e8BDe56F87ad6e53683E08279',
pythEp: '0x4374e5a8b9C22271E9EB878A2AA31DE97DF15DAF',
marketStatusProvider: '0xf6188e085ebEB716a730F8ecd342513e72C8AD04',
})

}
export const minterInitArgs: MinterInitArgsStruct = {
minCollateralRatio: 1.5e4,
liquidationThreshold: 1.4e4,
Expand All @@ -263,28 +259,28 @@ export const scdpInitArgs: SCDPInitArgsStruct = {
}
export const testnetConfigs: NetworkConfig = {
all: {
commonInitAgs: commonInitAgs(zeroAddress),
commonInitArgs,
minterInitArgs,
scdpInitArgs,
assets: [assets.DAI, assets.KISS, assets.WETH, assets.krBTC, assets.krETH],
gnosisSafeDeployments,
},
hardhat: {
commonInitAgs: commonInitAgs(zeroAddress),
commonInitArgs,
minterInitArgs,
scdpInitArgs,
assets: [assets.KISS, assets.krETH],
gnosisSafeDeployments,
},
localhost: {
commonInitAgs: commonInitAgs(zeroAddress),
commonInitArgs,
minterInitArgs,
scdpInitArgs,
assets: [assets.DAI, assets.KISS, assets.krBTC, assets.krETH],
gnosisSafeDeployments,
},
arbitrumGoerli: {
commonInitAgs: commonInitAgs(zeroAddress),
commonInitArgs,
minterInitArgs,
scdpInitArgs,
assets: [assets.DAI, assets.KISS, assets.krBTC, assets.krETH],
Expand Down
8 changes: 2 additions & 6 deletions configs/hardhat/deploy/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -48,13 +48,10 @@ export const getMinterInitializer = async (hre: HardhatRuntimeEnvironment): Prom
args: testnetConfigs[hre.network.name].minterInitArgs,
}
}
export const getCommonInitializer = async (
hre: HardhatRuntimeEnvironment,
gatingManager: string,
): Promise<CommonInitializer> => {
export const getCommonInitializer = async (hre: HardhatRuntimeEnvironment): Promise<CommonInitializer> => {
const { treasury, admin, multisig } = await getDeploymentUsers(hre)

const config = testnetConfigs[hre.network.name].commonInitAgs
const config = testnetConfigs[hre.network.name].commonInitArgs

return {
name: 'CommonConfigFacet',
Expand All @@ -63,7 +60,6 @@ export const getCommonInitializer = async (
admin,
treasury,
council: multisig,
gatingManager,
pythEp: hre.network.live ? config.pythEp : (await hre.deployments.get('MockPyth')).address,
sequencerUptimeFeed: hre.network.live
? config.sequencerUptimeFeed
Expand Down
2 changes: 1 addition & 1 deletion lib/kresko-lib
Submodule kresko-lib updated 1 files
+22 −0 src/utils/Libs.sol
1 change: 0 additions & 1 deletion src/contracts/core/common/Auth.sol
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@ pragma solidity 0.8.23;
import {EnumerableSet} from "@oz/utils/structs/EnumerableSet.sol";
import {Strings} from "libs/Strings.sol";
import {Meta} from "libs/Meta.sol";
import {ds} from "diamond/DState.sol";

import {Errors} from "common/Errors.sol";
import {Role} from "common/Constants.sol";
Expand Down
3 changes: 0 additions & 3 deletions src/contracts/core/common/Errors.sol
Original file line number Diff line number Diff line change
Expand Up @@ -130,9 +130,6 @@ library Errors {
error NO_COLLATERALS_DEPOSITED(address who);
error ONLY_WHITELISTED();
error BLACKLISTED();
error MISSING_PHASE_3_NFT();
error MISSING_PHASE_2_NFT();
error MISSING_PHASE_1_NFT();
error CANNOT_RE_ENTER();
error PYTH_ID_ZERO(string ticker);
error ARRAY_LENGTH_MISMATCH(string ticker, uint256 arr1, uint256 arr2);
Expand Down
11 changes: 1 addition & 10 deletions src/contracts/core/common/Modifiers.sol
Original file line number Diff line number Diff line change
Expand Up @@ -6,10 +6,9 @@ import {Errors} from "common/Errors.sol";
import {Auth} from "common/Auth.sol";
import {Role, Constants, Enums} from "common/Constants.sol";
import {Asset} from "common/Types.sol";
import {cs, gm, CommonState} from "common/State.sol";
import {cs, CommonState} from "common/State.sol";
import {WadRay} from "libs/WadRay.sol";
import {scdp} from "scdp/SState.sol";
import {IPyth} from "kresko-lib/vendor/Pyth.sol";
import {handlePythUpdate} from "common/funcs/Utils.sol";

library LibModifiers {
Expand Down Expand Up @@ -250,14 +249,6 @@ contract Modifiers {
cs().entered = Constants.NOT_ENTERED;
}

/// @notice Reverts if the caller does not have the required NFT's for the gated phase
modifier gate(address _account) {
if (address(gm().manager) != address(0)) {
gm().manager.check(_account);
}
_;
}

modifier usePyth(bytes[] calldata _updateData) {
handlePythUpdate(_updateData);
_;
Expand Down
1 change: 0 additions & 1 deletion src/contracts/core/common/Types.sol
Original file line number Diff line number Diff line change
Expand Up @@ -168,7 +168,6 @@ struct CommonInitArgs {
uint8 oracleDecimals;
uint32 sequencerGracePeriodTime;
address sequencerUptimeFeed;
address gatingManager;
address pythEp;
address marketStatusProvider;
}
Loading

0 comments on commit 77df862

Please sign in to comment.