Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
34 commits
Select commit Hold shift + click to select a range
51a519d
Add liquidity pool
viatrix Feb 10, 2025
c7b5adc
Merge branch 'main' into feat-liq-pool
viatrix Feb 10, 2025
bf3e07a
Fix lint
viatrix Feb 10, 2025
694cdad
Cleanup
viatrix Feb 10, 2025
d7dc429
Merge branch 'main' into feat-liq-pool
viatrix Feb 10, 2025
dbc52e6
Fix typo
viatrix Feb 10, 2025
36e5869
Fix typo
viatrix Feb 10, 2025
d8dfd58
Fix test
viatrix Feb 10, 2025
60f87b9
Refactor deployment
lastperson Feb 10, 2025
c4773c3
Merge branch 'feat-refactor-deploy' into feat-liq-pool
lastperson Feb 10, 2025
92fc368
Remove withdrawAll
viatrix Feb 10, 2025
7d23533
Add nonce and deadline to MPC signature
lastperson Feb 10, 2025
bba4e78
Merge branch 'feat-liq-pool' of github.com:sprintertech/sprinter-liqu…
lastperson Feb 10, 2025
f51cb56
Make deployable to testnets
lastperson Feb 10, 2025
b84190d
Borrow and repay collateral
viatrix Feb 11, 2025
90b2469
Try to repay before deposit
viatrix Feb 11, 2025
59ee595
Fix typo in _checkTokenLTV
viatrix Feb 11, 2025
e6e5b6e
Remove unnecessary condition
viatrix Feb 11, 2025
c1111db
Fix ltv calculation
viatrix Feb 11, 2025
aa34306
Add sign-borrow task
lastperson Feb 12, 2025
a8539a2
Add set default LTV task
lastperson Feb 12, 2025
9c2e789
Set default ltv in task to 20%
lastperson Feb 12, 2025
5299f9b
Fix default borrow task
lastperson Feb 12, 2025
f779e2a
Cleanup
viatrix Feb 12, 2025
6f1cd7e
Merge branch 'feat-liq-pool' of https://github.com/sprintertech/sprin…
viatrix Feb 12, 2025
0a73be2
Fix warnings
viatrix Feb 12, 2025
0767f2a
Add upgrade liquidity pool script
lastperson Feb 12, 2025
c93056c
Update withdrawProfit
viatrix Feb 12, 2025
b797935
Fix lint
viatrix Feb 12, 2025
4e62365
Cleanup, refactor, fix solhint, add tasks
lastperson Feb 13, 2025
083f3a5
Fix withdrawProfit, cleanup
viatrix Feb 13, 2025
4da1f38
Fix lint
viatrix Feb 13, 2025
69a5f21
Check that collateral is supported
viatrix Feb 13, 2025
838a9dc
Add set-routes tasks and deploy arbitrum sepolia commands
lastperson Feb 13, 2025
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
43 changes: 34 additions & 9 deletions .env.example
Original file line number Diff line number Diff line change
@@ -1,16 +1,41 @@
# Contracts admin.
ADMIN=
# Rebalance caller.
REBALANCE_CALLER=
# Address that can increase/decerease LP conversion rate.
ADJUSTER=
# Deposits to Liquidity Hub are only allowed till this limit is reached.
ASSETS_LIMIT=
# Liquidity mining tiers. Multiplier will be divided by 100. So 175 will result in 1.75x.
# There is no limit to the number of tiers, but has to be atleast one.
TIER_1_DAYS=90
TIER_1_MULTIPLIER=100
TIER_2_DAYS=180
TIER_2_MULTIPLIER=150
TIER_3_DAYS=360
TIER_3_MULTIPLIER=200
BASE_SEPOLIA_PRIVATE_KEY=
TIER_1_SECONDS=7776000
TIER_1_MULTIPLIER=30
TIER_2_SECONDS=15552000
TIER_2_MULTIPLIER=80
TIER_3_SECONDS=31104000
TIER_3_MULTIPLIER=170
# Rebalance caller.
REBALANCE_CALLER=
# Liquidity Pool parameters.
# Value 500 will result in health factor 5.
MIN_HEALTH_FACTOR=500
# Value 20 will result in LTV 20%.
DEFAULT_LTV=20
MPC_ADDRESS=
WITHDRAW_PROFIT=
# General deployment parameters.
DEPLOYER_PRIVATE_KEY=
VERIFY=false
BASE_SEPOLIA_RPC=
ETHEREUM_SEPOLIA_RPC=
ARBITRUM_SEPOLIA_RPC=
ETHERSCAN_BASE_SEPOLIA=
ETHERSCAN_ETHEREUM_SEPOLIA=
ETHERSCAN_ARBITRUM_SEPOLIA=
# Upgrade and configuration update parameters.
LIQUIDITY_POOL=
REBALANCER=
# Testing parameters.
FORK_PROVIDER=https://eth-mainnet.public.blastapi.io
USDC_OWNER_ADDRESS=0x7713974908Be4BEd47172370115e8b1219F4A5f0
RPL_OWNER_ADDRESS=0xdC7b28976d6eb13082a5Be7C66f9dCFE0115738f
UNI_OWNER_ADDRESS=0x46f34C24A7bA7a2Ac6DD76c3F09B32D41C144d08
PRIME_OWNER_ADDRESS=0x1D0065D367DA1919cD597d25F91a97B6039428C5
6 changes: 4 additions & 2 deletions .solhint.json
Original file line number Diff line number Diff line change
@@ -1,9 +1,11 @@
{
"extends": "solhint:recommended",
"rules": {
"max-line-length": ["off", 120],
"max-line-length": ["warn", 120],
"func-visibility": ["warn", {"ignoreConstructors": true}],
"func-name-mixedcase": ["off"],
"one-contract-per-file": ["off"]
"one-contract-per-file": ["off"],
"no-inline-assembly": ["off"],
"avoid-low-level-calls": ["off"]
}
}
3 changes: 2 additions & 1 deletion contracts/Deps.sol
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
// SPDX-License-Identifier: LGPL-3.0-only
pragma solidity 0.8.28;

import { TransparentUpgradeableProxy } from '@openzeppelin/contracts/proxy/transparent/TransparentUpgradeableProxy.sol';
/* solhint-disable no-unused-import */
import {TransparentUpgradeableProxy} from "@openzeppelin/contracts/proxy/transparent/TransparentUpgradeableProxy.sol";
18 changes: 9 additions & 9 deletions contracts/LiquidityHub.sol
Original file line number Diff line number Diff line change
Expand Up @@ -10,11 +10,11 @@ import {
Math
} from "@openzeppelin/contracts-upgradeable/token/ERC20/extensions/ERC4626Upgradeable.sol";
import {IERC20Permit} from "@openzeppelin/contracts/token/ERC20/extensions/IERC20Permit.sol";
import {AccessControlUpgradeable} from '@openzeppelin/contracts-upgradeable/access/AccessControlUpgradeable.sol';
import {ERC7201Helper} from './utils/ERC7201Helper.sol';
import {IManagedToken} from './interfaces/IManagedToken.sol';
import {ILiquidityPool} from './interfaces/ILiquidityPool.sol';
import {ILiquidityHub} from './interfaces/ILiquidityHub.sol';
import {AccessControlUpgradeable} from "@openzeppelin/contracts-upgradeable/access/AccessControlUpgradeable.sol";
import {ERC7201Helper} from "./utils/ERC7201Helper.sol";
import {IManagedToken} from "./interfaces/IManagedToken.sol";
import {ILiquidityPool} from "./interfaces/ILiquidityPool.sol";
import {ILiquidityHub} from "./interfaces/ILiquidityHub.sol";

contract LiquidityHub is ILiquidityHub, ERC4626Upgradeable, AccessControlUpgradeable {
using Math for uint256;
Expand All @@ -37,12 +37,12 @@ contract LiquidityHub is ILiquidityHub, ERC4626Upgradeable, AccessControlUpgrade
uint256 assetsLimit;
}

bytes32 private constant StorageLocation = 0xb877bfaae1674461dd1960c90f24075e3de3265a91f6906fe128ab8da6ba1700;
bytes32 private constant STORAGE_LOCATION = 0xb877bfaae1674461dd1960c90f24075e3de3265a91f6906fe128ab8da6ba1700;

constructor(address shares, address liquidityPool) {
ERC7201Helper.validateStorageLocation(
StorageLocation,
'sprinter.storage.LiquidityHub'
STORAGE_LOCATION,
"sprinter.storage.LiquidityHub"
);
if (shares == address(0)) revert ZeroAddress();
if (liquidityPool == address(0)) revert ZeroAddress();
Expand Down Expand Up @@ -251,7 +251,7 @@ contract LiquidityHub is ILiquidityHub, ERC4626Upgradeable, AccessControlUpgrade

function _getStorage() private pure returns (LiquidityHubStorage storage $) {
assembly {
$.slot := StorageLocation
$.slot := STORAGE_LOCATION
}
}
}
1 change: 0 additions & 1 deletion contracts/LiquidityMining.sol
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@ pragma solidity 0.8.28;
import {ERC20, IERC20} from "@openzeppelin/contracts/token/ERC20/ERC20.sol";
import {SafeERC20} from "@openzeppelin/contracts/token/ERC20/utils/SafeERC20.sol";
import {IERC20Permit} from "@openzeppelin/contracts/token/ERC20/extensions/IERC20Permit.sol";
import {Math} from "@openzeppelin/contracts/utils/math/Math.sol";
import {Ownable} from "@openzeppelin/contracts/access/Ownable.sol";

contract LiquidityMining is ERC20, Ownable {
Expand Down
Loading