Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Sherlock fix https://github.com/sherlock-audit/2023-03-Y2K-judging/issues/418 #133

Merged
merged 3 commits into from
May 10, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
113 changes: 19 additions & 94 deletions configJSON.json
Original file line number Diff line number Diff line change
Expand Up @@ -4,113 +4,38 @@
"variables":{
"newMarkets": true,
"amountOfNewMarkets": 1,
"marketsIds": [15],
"marketsIds": [2],
"newEpochs": true,
"amountOfNewEpochs": 7,
"epochsIds": [6, 7, 8, 13, 14, 12, 15],
"amountOfNewFarms": 7,
"amountOfNewEpochs": 1,
"epochsIds": [2],
"amountOfNewFarms": 1,
"newFarms": true,
"farmsIds" : [6, 7, 8, 13, 14, 12, 15]
"farmsIds" : [2]
},

"markets":[
{
"marketId": 15,
"name":"y2kMIM_950*",
"strikePrice": 950000000000000000,
"token": "0xFEa7a6a0B346362BF88A9e4A88416B77a57D6c2A",
"oracle": "0x87121F6c9A9F6E90E59591E4Cf4804873f54A95b"
"marketId": 2,
"name":"y2kUSDC_999*",
"strikePrice": 999000000000000000,
"token": "0xFF970A61A04b1cA14834A43f5dE4533eBDDB5CC8",
"oracle": "0x50834F3163758fcC1Df9973b6e91f0F0F0434aD3"
}
],

"epochs":[
{
"marketId": 6,
"epochBegin":1673395200,
"epochEnd":1673827200,
"epochFee":50
},
{
"marketId": 7,
"epochBegin":1673395200,
"epochEnd":1673827200,
"marketId": 2,
"epochBegin":1683279838,
"epochEnd":1683366238,
"epochFee":50
},
{
"marketId": 8,
"epochBegin":1673395200,
"epochEnd":1673827200,
"epochFee":50
},
{
"marketId": 13,
"epochBegin":1673395200,
"epochEnd":1673827200,
"epochFee":50
},
{
"marketId": 14,
"epochBegin":1673395200,
"epochEnd":1673827200,
"epochFee":50

},
{
"marketId": 12,
"epochBegin":1673827200,
"epochEnd":1676246400,
"epochFee":50
},
{
"marketId": 15,
"epochBegin":1673827200,
"epochEnd":1676246400,
"epochFee":50
}
}
],

"farms":[
{
"marketId": 6,
"epochEnd":1673827200,
"farmRewardsHEDGE": "6006000000000000000000",
"farmRewardsRISK" : "667000000000000000000"
},
{
"marketId": 7,
"epochEnd":1673827200,
"farmRewardsHEDGE": "6006000000000000000000",
"farmRewardsRISK" : "667000000000000000000"
},
{
"marketId": 8,
"epochEnd":1673827200,
"farmRewardsHEDGE": "6006000000000000000000",
"farmRewardsRISK" : "667000000000000000000"
},
{
"marketId": 13,
"epochEnd":1673827200,
"farmRewardsHEDGE": "6006000000000000000000",
"farmRewardsRISK" : "667000000000000000000"
},
{
"marketId": 14,
"epochEnd":1673827200,
"farmRewardsHEDGE": "6006000000000000000000",
"farmRewardsRISK" : "667000000000000000000"
},
{
"marketId": 12,
"epochEnd":1676246400,
"farmRewardsHEDGE": "15014000000000000000000",
"farmRewardsRISK" : "1168000000000000000000"
},
{
"marketId": 15,
"epochEnd":1676246400,
"farmRewardsHEDGE": "15014000000000000000000",
"farmRewardsRISK" : "1168000000000000000000"
}
"marketId": 2,
"epochEnd":1683366238,
"farmRewardsHEDGE": "106000000000000000000",
"farmRewardsRISK" : "57000000000000000000"
}
]
}
6 changes: 3 additions & 3 deletions configTestEnv.json
Original file line number Diff line number Diff line change
Expand Up @@ -28,9 +28,9 @@
"tokenUSDT": "0xFd086bC7CD5C481DCC9C85ebE478A1C0b69FCbb9",
"oracleUSDT": "0x3f3f5dF88dC9F13eac63DF89EC16ef6e7E25DdE7",

"vaultFactory": "0xB30Fd345FCd25104424C86D2d28eCaBB09c6bf1e",
"controller": "0x656488c0E45EEC4f1a5A46b4541f81fBA1873f11",
"rewardsFactory": "0x182bE471706d34405753214c8fC11Ec843a3B8BE",
"vaultFactory": "0xa39A84d1a3a0cedA92cdb7eBD9E3b6216fabAcE7",
"controller": "0x1ae6ca8892d7F0DaCBd3f282eaabDFbDbee3DE43",
"rewardsFactory": "0x22351212C4066d65F7B02f6f75Bc3347Ab17b870",
"keeperDepeg": "0x4208cd74b0dE2880d7B69700B749c2962381bD80",
"keeperEndEpoch": "0xcDf0Bda38eb465EC17Eda5B25830197075F4cabc"
}]
Expand Down
40 changes: 40 additions & 0 deletions configTestEnvV2.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@
{"configAddresses":
[{
"y2k": "0x5D59e5837F7e5d0F710178Eda34d9eCF069B36D2",
"treasury": "0xaC0D2cF77a8F8869069fc45821483701A264933B",
"admin": "0xaC0D2cF77a8F8869069fc45821483701A264933B",
"policy": "0xaC0D2cF77a8F8869069fc45821483701A264933B",

"weth": "0x6BE37a65E46048B1D12C0E08d9722402A5247Ff1",
"arbitrum_sequencer": "0xFdB631F5EE196F0ed6FAa767959853A9F217697D",
"gelatoOpsV2": "0xB3f5503f93d5Ef84b06993a1975B9D21B962892F",
"gelatoTaskTreasury": "0xB2f34fd4C16e656163dADFeEaE4Ae0c1F13b140A",

"tokenFrax": "0x17FC002b466eEc40DaE837Fc4bE5c67993ddBd6F",
"oracleFrax": "0x0809E3d38d1B4214958faf06D8b1B1a2b73f2ab8",

"tokenMIM": "0xFEa7a6a0B346362BF88A9e4A88416B77a57D6c2A",
"oracleMIM": "0x87121F6c9A9F6E90E59591E4Cf4804873f54A95b",

"tokenFEI": "0x4A717522566C7A09FD2774cceDC5A8c43C5F9FD2",
"oracleFEI": "0x7c4720086E6feb755dab542c46DE4f728E88304d",

"tokenUSDC": "0xFF970A61A04b1cA14834A43f5dE4533eBDDB5CC8",
"oracleUSDC": "0x50834F3163758fcC1Df9973b6e91f0F0F0434aD3",

"tokenDAI": "0xDA10009cBd5D07dd0CeCc66161FC93D7c9000da1",
"oracleDAI": "0xc5C8E77B397E531B8EC06BFb0048328B30E9eCfB",

"tokenUSDT": "0xFd086bC7CD5C481DCC9C85ebE478A1C0b69FCbb9",
"oracleUSDT": "0x3f3f5dF88dC9F13eac63DF89EC16ef6e7E25DdE7",

"vaultFactory": "0xa39A84d1a3a0cedA92cdb7eBD9E3b6216fabAcE7",
"controller": "0x1ae6ca8892d7F0DaCBd3f282eaabDFbDbee3DE43",
"rewardsFactory": "0x22351212C4066d65F7B02f6f75Bc3347Ab17b870",
"keeperDepeg": "0x4208cd74b0dE2880d7B69700B749c2962381bD80",
"keeperEndEpoch": "0xcDf0Bda38eb465EC17Eda5B25830197075F4cabc",
"carouselFactoryV2": "0xFd3DB836C652F80402398A9AdE2d3F3C5EEB22B1",
"controllerV2": "0xb4B8FDD25AC2dad1B681891BB8563a7Fe187da42"
}]
}

4 changes: 2 additions & 2 deletions script/DeployConfigured.s.sol
Original file line number Diff line number Diff line change
Expand Up @@ -5,15 +5,15 @@ import "./Helper.sol";

/// @author MiguelBits

//forge script ConfigScript --rpc-url $ARBITRUM_RPC_URL --private-key $PRIVATE_KEY --broadcast --etherscan-api-key $arbiscanApiKey --verify --skip-simulation --gas-estimate-multiplier 200 --slow -vv
//forge script ConfigScript --rpc-url $ARBITRUM_RPC_URL --private-key $PRIVATE_KEY --broadcast --verify --skip-simulation --slow -vv

// forge verify-contract --chain-id 42161 --num-of-optimizations 1000000 --watch --constructor-args $(cast abi-encode "constructor(address,address,address,address,uint256)" 0xaC0D2cF77a8F8869069fc45821483701A264933B 0xaC0D2cF77a8F8869069fc45821483701A264933B 0x65c936f008BC34fE819bce9Fa5afD9dc2d49977f 0x447deddf312ad609e2f85fd23130acd6ba48e8b7 1668384000) --compiler-version v0.8.15+commit.e14f2714 0x69b614f03554c7e0da34645c65852cc55400d0f9 src/rewards/StakingRewards.sol:StakingRewards $arbiscanApiKey
contract ConfigScript is Script, HelperConfig {
using stdJson for string;

function run() public {

ConfigAddresses memory addresses = getConfigAddresses(false);
ConfigAddresses memory addresses = getConfigAddresses(true);
console2.log("Address admin", addresses.admin);
console2.log("Address arbitrum_sequencer", addresses.arbitrum_sequencer);
console2.log("Address oracleDAI", addresses.oracleDAI);
Expand Down
11 changes: 7 additions & 4 deletions script/DeployScript.s.sol
Original file line number Diff line number Diff line change
Expand Up @@ -4,11 +4,11 @@ pragma solidity ^0.8.13;
import "./Helper.sol";

/// @author MiguelBits
//forge script DeployScript --rpc-url $ARBITRUM_RPC_URL --private-key $PRIVATE_KEY --broadcast --skip-simulation --gas-estimate-multiplier 200 --slow -vv
//forge script DeployScript --rpc-url $ARBITRUM_RPC_URL --private-key $PRIVATE_KEY --broadcast --skip-simulation --slow --verify -vv
contract DeployScript is Script, HelperConfig {

function setupY2K() public{
ConfigAddresses memory addresses = getConfigAddresses(false); //true if test env
ConfigAddresses memory addresses = getConfigAddresses(true); //true if test env
contractToAddresses(addresses);
setVariables();
}
Expand Down Expand Up @@ -45,6 +45,9 @@ contract DeployScript is Script, HelperConfig {
ConfigMarket memory markets = getConfigMarket(i);
//TODO verify
require(markets.marketId == marketId, "marketId of markets and loop are not the same");

console.log("marketId", marketId);
console.log("vaultFactory", address(vaultFactory));

vaultFactory.createNewMarket(
1,
Expand Down Expand Up @@ -104,8 +107,8 @@ contract DeployScript is Script, HelperConfig {
StakingRewards(_rRisk).notifyRewardAmount(stringToUint(_rewardsAmountRISK));

//unpause
StakingRewards(_rHedge).unpause();
StakingRewards(_rRisk).unpause();
// StakingRewards(_rHedge).unpause();
// StakingRewards(_rRisk).unpause();
}

}
3 changes: 2 additions & 1 deletion script/Helper.sol
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,8 @@ import "forge-std/StdJson.sol";
import "../src/legacy_v1/VaultFactory.sol";
import "../src/legacy_v1/Controller.sol";
//TODO change this after deploy y2k token
import "../src/legacy_v1/rewards/PausableRewardsFactory.sol";
// import "../src/legacy_v1/rewards/PausableRewardsFactory.sol";
import "../src/legacy_v1/rewards/RewardsFactory.sol";
import "../src/tokens/Y2K.sol";
import "@openzeppelin/contracts/utils/Strings.sol";
import "./keepers/KeeperDepeg.sol";
Expand Down
Loading