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

Fix/liquidity mining #165

Merged
merged 48 commits into from
Jun 1, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
48 commits
Select commit Hold shift + click to select a range
c962f11
feat: start of LiquidityMiningFacet
Apr 3, 2022
32e1eaa
feat: diamond usage
Apr 4, 2022
1c4519f
refactor: views
Apr 4, 2022
9c70701
feat: liquidityMiningController
Apr 4, 2022
25bff33
chore: remove unused funcs, fill out refreshPool()
Apr 7, 2022
92861ba
fix: most state variables to diamond storage
Apr 7, 2022
3b61b46
fix: all state to appStorage
Apr 12, 2022
5bed032
fix: semantics
parv3213 Apr 13, 2022
0467f49
fix: change `me` type to IERC20
parv3213 Apr 15, 2022
a7db828
fix(LMF): require reason
parv3213 Apr 15, 2022
de43c7f
fix(LMF): add TODO for precision check
parv3213 Apr 15, 2022
3ce2d11
perf(LMF): clear calculation
parv3213 Apr 15, 2022
0a1875b
fix: all state to appStorage
Apr 12, 2022
b5c6225
fix: change `me` type to IERC20
parv3213 Apr 15, 2022
f7eedb2
perf: improvements
parv3213 Apr 18, 2022
30d9a2e
fix: replace `claimRewardExact` with modifed `claimReward`
parv3213 Apr 18, 2022
c8632e7
fix: proper function arrangement
parv3213 Apr 18, 2022
44dcba5
perf: precise imports
parv3213 Apr 19, 2022
aabae5b
perf: remove unnecessary constructor
parv3213 Apr 19, 2022
18e5d6b
feat: add few functions
parv3213 Apr 20, 2022
78a6749
feat: add setter and getter
parv3213 Apr 20, 2022
944bb8a
test(LiquidityMining): create and add few tests
parv3213 Apr 20, 2022
a129b83
chore: remove unnecessary TODOs
parv3213 Apr 21, 2022
b161842
test: unexpected result
parv3213 Apr 21, 2022
ca28113
fix(rentrency): add to local storage
zgorizzo69 Apr 21, 2022
1283517
fix(liquidity): add init
zgorizzo69 Apr 21, 2022
8228e4d
Revert "test: unexpected result"
parv3213 Apr 21, 2022
679793e
feat: remove non-essential index from merkle node
parv3213 Apr 22, 2022
efc68c5
test(LMF): add tests related to `initSeason`
parv3213 Apr 22, 2022
0a69908
feat: changes in initSeason
parv3213 May 5, 2022
bf0bc3d
fix: comment off `addToRewardsAllocation` due to improper implementation
parv3213 May 5, 2022
75cdd30
fix: did some renaming and add TODOs
parv3213 May 5, 2022
4618948
fix: did some renaming and add TODOs
parv3213 May 5, 2022
c5d2381
test(LMF): test `recoverERC20`
parv3213 May 5, 2022
989d3a5
feat: minor improvement
parv3213 May 5, 2022
6ee9680
test(LMF): incremental tests
parv3213 May 5, 2022
4134ff3
fix: improvements
parv3213 May 6, 2022
1df2859
test: add MerkleTree
parv3213 May 6, 2022
7af0f8a
feat: update `getPoolInfo` to return user specific details
parv3213 May 10, 2022
56c7fd2
test(LMF): complete `stake` tests
parv3213 May 10, 2022
41ae09a
test(LMF): complete `withdraw` tests
parv3213 May 10, 2022
5a92739
fix(diamond): reentrancy and tests fixed
zgorizzo69 May 13, 2022
0c64994
fix(liquidity mining): separate storage
zgorizzo69 May 17, 2022
0cd472e
fix(test): fix tests and remove todo
zgorizzo69 May 19, 2022
ee40626
fix(test): set correct state at end of test
zgorizzo69 May 20, 2022
c1c6ba3
fix(test): fixing todos
zgorizzo69 May 20, 2022
d2097fc
fix(migration): add test for migration swap triggered by burn
zgorizzo69 May 26, 2022
9391d06
fix(init): remove unecessary import
zgorizzo69 May 30, 2022
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
11 changes: 10 additions & 1 deletion contracts/DiamondInit.sol
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
pragma solidity 0.8.9;

import {IERC165} from "@openzeppelin/contracts/utils/introspection/IERC165.sol";
import {IERC20} from "@openzeppelin/contracts/token/ERC20/IERC20.sol";
import {IDiamondCut} from "./interfaces/IDiamondCut.sol";
import {IDiamondLoupe} from "./interfaces/IDiamondLoupe.sol";
import {IMigrationRegistry} from "./interfaces/IMigrationRegistry.sol";
Expand All @@ -10,11 +11,12 @@ import {AppStorage} from "./libs/LibAppStorage.sol";
import {LibDiamond} from "./libs/LibDiamond.sol";
import {LibCurve} from "./libs/LibCurve.sol";
import {ABDKMathQuad} from "./utils/ABDKMathQuad.sol";
import {ReentrancyGuard} from "./utils/ReentrancyGuard.sol";

/// @title Diamond Init
/// @author Carter Carlson (@cartercarlson), @zgorizzo69
/// @notice Contract to initialize state variables, similar to OZ's initialize()
contract DiamondInit {
contract DiamondInit is ReentrancyGuard {
using ABDKMathQuad for uint256;
struct Args {
uint256 mintFee;
Expand All @@ -24,6 +26,7 @@ contract DiamondInit {
uint256 interestFee;
uint256 yieldFee;
address diamond;
IERC20 me;
IVaultRegistry vaultRegistry;
IMigrationRegistry migrationRegistry;
address meTokenFactory;
Expand All @@ -39,6 +42,8 @@ contract DiamondInit {

function init(Args memory _args) external {
require(msg.sender == _owner, "!owner");
require(s.diamond == address(0), "Already initialized");
s.me = _args.me;
s.diamond = _args.diamond;
s.vaultRegistry = _args.vaultRegistry;
s.migrationRegistry = _args.migrationRegistry;
Expand All @@ -52,6 +57,7 @@ contract DiamondInit {

s.MAX_REFUND_RATIO = 1e6;
s.PRECISION = 1e18;
s.BASE = 1e54;
s.MAX_FEE = 5e16; // 5%

LibDiamond.DiamondStorage storage ds = LibDiamond.diamondStorage();
Expand All @@ -65,5 +71,8 @@ contract DiamondInit {
cs.one = (uint256(1)).fromUInt();
cs.maxWeight = uint256(LibCurve.MAX_WEIGHT).fromUInt();
cs.baseX = uint256(1 ether).fromUInt();

//adding reentrancy initial state
s.reentrancyStatus = NOT_ENTERED;
}
}
Loading