Skip to content
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
4 changes: 4 additions & 0 deletions contracts/interfaces/cpmm/ICPMMGammaPool.sol
Original file line number Diff line number Diff line change
Expand Up @@ -28,4 +28,8 @@ interface ICPMMGammaPool {
/// @dev set maximum total APY charged by GammaPool to borrowers
/// @param _maxTotalAPY - new maximum total APY charged to GammaPool borrowers
function setMaxTotalAPY(uint256 _maxTotalAPY) external;

/// @dev get maximum total APY charged by GammaPool to borrowers
/// @return _maxTotalAPY - maximum total APY charged to GammaPool borrowers
function getMaxTotalAPY() external view returns(uint256);
}
7 changes: 3 additions & 4 deletions contracts/pools/CPMMGammaPool.sol
Original file line number Diff line number Diff line change
Expand Up @@ -78,9 +78,8 @@ contract CPMMGammaPool is GammaPool, GammaPoolExternal, ICPMMGammaPool {
abi.decode(callStrategy(rebalanceStrategy, abi.encodeCall(ICPMMRebalanceStrategy._setMaxTotalAPY, _maxTotalAPY)), ());
}

/// @dev See {IGammaPoolExternal-liquidateExternally}
function liquidateExternally(uint256 tokenId, uint128[] calldata amounts, uint256 lpTokens, address to, bytes calldata data)
external override virtual returns(uint256 loanLiquidity, uint256[] memory refund) {
return (0, new uint256[](0));
/// @dev See {ICPMMGammaPool-getMaxTotalAPY}
function getMaxTotalAPY() external virtual override view returns(uint256) {
return s.getUint256(uint256(keccak256("MAX_TOTAL_APY")));
}
}
14 changes: 7 additions & 7 deletions contracts/pools/VaultGammaPool.sol
Original file line number Diff line number Diff line change
Expand Up @@ -24,13 +24,14 @@ contract VaultGammaPool is CPMMGammaPool, IVaultGammaPool {
}

/// @dev See {IVaultGammaPool-getReservedBalances}
function getReservedBalances() external virtual override view returns(uint256 reservedBorrowedInvariant, uint256 reservedLPTokens) {
reservedBorrowedInvariant = s.getUint256(uint256(IVaultGammaPool.StorageIndexes.RESERVED_BORROWED_INVARIANT));
reservedLPTokens = s.getUint256(uint256(IVaultGammaPool.StorageIndexes.RESERVED_LP_TOKENS));
function getReservedBalances() external virtual override view returns(uint256, uint256) {
return(s.getUint256(uint256(IVaultGammaPool.StorageIndexes.RESERVED_BORROWED_INVARIANT)),
s.getUint256(uint256(IVaultGammaPool.StorageIndexes.RESERVED_LP_TOKENS)));
}

/// @dev See {IGammaPool-liquidateWithLP}
function liquidateWithLP(uint256 tokenId) external virtual override returns(uint256 loanLiquidity, uint256[] memory refund) {
/// @dev See {IGammaPoolExternal-liquidateExternally}
function liquidateExternally(uint256 tokenId, uint128[] calldata amounts, uint256 lpTokens, address to, bytes calldata data)
external override virtual returns(uint256 loanLiquidity, uint256[] memory refund) {
return (0, new uint256[](0));
}

Expand All @@ -41,9 +42,8 @@ contract VaultGammaPool is CPMMGammaPool, IVaultGammaPool {

/// @dev See {GammaPoolERC4626-maxAssets}
function maxAssets(uint256 assets) internal view virtual override returns(uint256) {
uint256 reservedLpTokenBalance = s.getUint256(uint256(IVaultGammaPool.StorageIndexes.RESERVED_LP_TOKENS));
uint256 lpTokenBalance = s.LP_TOKEN_BALANCE; // CFMM LP tokens in GammaPool that have not been borrowed
lpTokenBalance = lpTokenBalance - GSMath.min(reservedLpTokenBalance, lpTokenBalance);
lpTokenBalance = lpTokenBalance - GSMath.min(s.getUint256(uint256(IVaultGammaPool.StorageIndexes.RESERVED_LP_TOKENS)), lpTokenBalance);
if(assets < lpTokenBalance){ // limit assets available to withdraw to what has not been borrowed
return assets;
}
Expand Down
4 changes: 2 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@gammaswap/v1-implementations",
"version": "1.2.12",
"version": "1.2.13",
"description": "Pool and strategies implementation contracts for GammaSwap V1 protocol",
"homepage": "https://gammaswap.com",
"scripts": {
Expand Down Expand Up @@ -71,7 +71,7 @@
"typescript": "^4.7.4"
},
"dependencies": {
"@gammaswap/v1-core": "^1.2.12",
"@gammaswap/v1-core": "^1.2.13",
"@openzeppelin/contracts": "^4.7.0"
}
}
8 changes: 4 additions & 4 deletions yarn.lock
Original file line number Diff line number Diff line change
Expand Up @@ -449,10 +449,10 @@
"@ethersproject/properties" "^5.7.0"
"@ethersproject/strings" "^5.7.0"

"@gammaswap/v1-core@^1.2.12":
version "1.2.12"
resolved "https://npm.pkg.github.com/download/@gammaswap/v1-core/1.2.12/414f66123c7bc2f1b231c06e559f5d509d8abf49#414f66123c7bc2f1b231c06e559f5d509d8abf49"
integrity sha512-ti59W/jM5/VxLcEj9IP3Qhz6NirNMEqt7HIJNme1QAfD2SThPE+KF1pzfLwNlRYJnyZ2iP3Ye0cItwS2bYEsgQ==
"@gammaswap/v1-core@^1.2.13":
version "1.2.13"
resolved "https://npm.pkg.github.com/download/@gammaswap/v1-core/1.2.13/26f6719af9d6665640ade967b896fc2e3c0ec232#26f6719af9d6665640ade967b896fc2e3c0ec232"
integrity sha512-MqbWW584MMVmm6+iMToyxn7wp5F1dpwFohMp531qokrRHJ8qyC0Kj6l2v2klxsWvFHVe9qi9Vm3HeUFg7YuwoA==
dependencies:
"@openzeppelin/contracts" "^4.7.0"

Expand Down
Loading