Skip to content

Commit

Permalink
deploy new implementationtion genericEulerStaker (#66)
Browse files Browse the repository at this point in the history
  • Loading branch information
GuillaumeNervoXS authored Mar 6, 2023
1 parent adcd1f3 commit d838502
Show file tree
Hide file tree
Showing 7 changed files with 249 additions and 1 deletion.

Large diffs are not rendered by default.

Large diffs are not rendered by default.

Large diffs are not rendered by default.

Large diffs are not rendered by default.

49 changes: 49 additions & 0 deletions broadcast/UpgradeGenericEulerStakerLender.sol/1/run-latest.json

Large diffs are not rendered by default.

Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
// SPDX-License-Identifier: GPL-3.0
pragma solidity ^0.8.17;

import "forge-std/Script.sol";
import "../../MainnetConstants.s.sol";
import { GenericEulerStaker } from "../../../../contracts/strategies/OptimizerAPR/genericLender/euler/GenericEulerStaker.sol";

contract DeployGenericEulerStakerImplementation is Script, MainnetConstants {
uint256 internal constant _BASE_TOKEN = 10**18;
uint256 internal constant _BASE_APR = 10**18;
uint64 internal constant _BPS = 10**4;

GenericEulerStaker public lenderEulerImplementation;

error ZeroAdress();

function run() external {
// vm.createSelectFork("mainnet");
uint256 deployerPrivateKey = vm.deriveKey(vm.envString("MNEMONIC_MAINNET"), 0);
vm.startBroadcast(deployerPrivateKey);

lenderEulerImplementation = new GenericEulerStaker();
console.log(
"Successfully deployed Euler implementation strategy at the address: ",
address(lenderEulerImplementation)
);

vm.stopBroadcast();
}
}
7 changes: 6 additions & 1 deletion test/foundry/optimizerAPR/OptimizerAPRStrategyTest.test.sol
Original file line number Diff line number Diff line change
Expand Up @@ -567,6 +567,11 @@ contract OptimizerAPRStrategyTest is BaseTest {
amounts[0] = bound(amounts[0], 1, maxTokenAmount);
amounts[1] = bound(amounts[1], 1, maxTokenAmount);
amounts[2] = bound(amounts[2], 1, maxTokenAmount);

vm.label(address(lender1), "Lender1");
vm.label(address(lender2), "Lender2");
vm.label(address(lender3), "Lender3");

// Because in this special case my best estimate won't be better than the greedy, because the distribution
// will be closer to te true optimum. This is just by chance for the greedy and the fuzzing is "searching for that chance"
uint256 sumAmounts = (amounts[0] + amounts[1] + amounts[2]);
Expand Down Expand Up @@ -602,7 +607,7 @@ contract OptimizerAPRStrategyTest is BaseTest {
// Because in this special case my best estimate won't be better than the greedy, because the distribution
// will be closer to te true optimum. This is just by chance for the greedy and the fuzzing is "searching for that chance"
if (
(amountOnLender3AfterPrepareReturn * _BPS) / sumAmounts > _BPS / 4 &&
(amountOnLender3AfterPrepareReturn * _BPS) / sumAmounts > _BPS / 5 &&
(amountOnLender3AfterPrepareReturn * _BPS) / sumAmounts < (_BPS * 44) / 100
) return;
}
Expand Down

0 comments on commit d838502

Please sign in to comment.