Compare commits
2 Commits
52c923baee
...
316da25f5b
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
316da25f5b | ||
|
|
12fc43f999 |
@@ -1,14 +1,19 @@
|
|||||||
// SPDX-License-Identifier: UNLICENSED
|
// SPDX-License-Identifier: UNLICENSED
|
||||||
pragma solidity ^0.8.30;
|
pragma solidity ^0.8.30;
|
||||||
|
|
||||||
import "../test/Deploy.sol";
|
|
||||||
import "../src/IPartyPool.sol";
|
|
||||||
import "../src/PartyPlanner.sol";
|
|
||||||
import "../src/PartyPool.sol";
|
|
||||||
import "../test/MockERC20.sol";
|
|
||||||
import "@abdk/ABDKMath64x64.sol";
|
|
||||||
import "forge-std/Script.sol";
|
|
||||||
import "forge-std/console2.sol";
|
import "forge-std/console2.sol";
|
||||||
|
import {ABDKMath64x64} from "../lib/abdk-libraries-solidity/ABDKMath64x64.sol";
|
||||||
|
import {CommonBase} from "../lib/forge-std/src/Base.sol";
|
||||||
|
import {Script} from "../lib/forge-std/src/Script.sol";
|
||||||
|
import {StdChains} from "../lib/forge-std/src/StdChains.sol";
|
||||||
|
import {StdCheatsSafe} from "../lib/forge-std/src/StdCheats.sol";
|
||||||
|
import {StdUtils} from "../lib/forge-std/src/StdUtils.sol";
|
||||||
|
import {IERC20} from "../lib/openzeppelin-contracts/contracts/token/ERC20/IERC20.sol";
|
||||||
|
import {IERC20Metadata} from "../lib/openzeppelin-contracts/contracts/token/ERC20/extensions/IERC20Metadata.sol";
|
||||||
|
import {PartyPlanner} from "../src/PartyPlanner.sol";
|
||||||
|
import {PartyPoolViewer} from "../src/PartyPoolViewer.sol";
|
||||||
|
import {Deploy} from "../test/Deploy.sol";
|
||||||
|
import {MockERC20} from "../test/MockERC20.sol";
|
||||||
|
|
||||||
contract DeployMock is Script {
|
contract DeployMock is Script {
|
||||||
|
|
||||||
@@ -49,9 +54,9 @@ contract DeployMock is Script {
|
|||||||
mintAll(msg.sender, 10_000);
|
mintAll(msg.sender, 10_000);
|
||||||
// prepare initial deposits (10_000 units of each token, scaled by _bases)
|
// prepare initial deposits (10_000 units of each token, scaled by _bases)
|
||||||
uint256[] memory initialDeposits = new uint256[](3);
|
uint256[] memory initialDeposits = new uint256[](3);
|
||||||
initialDeposits[0] = _bases[0] * 10_000;
|
initialDeposits[0] = 10_000 * 10 ** IERC20Metadata(address(tokens[0])).decimals();
|
||||||
initialDeposits[1] = _bases[1] * 10_000;
|
initialDeposits[1] = 10_000 * 10 ** IERC20Metadata(address(tokens[1])).decimals();
|
||||||
initialDeposits[2] = _bases[2] * 10_000;
|
initialDeposits[2] = 10_000 * 10 ** IERC20Metadata(address(tokens[2])).decimals();
|
||||||
// approve factory to move initial deposits
|
// approve factory to move initial deposits
|
||||||
for (uint i = 0; i < tokens.length; i++) {
|
for (uint i = 0; i < tokens.length; i++) {
|
||||||
IERC20(tokens[i]).approve(address(planner), initialDeposits[i]);
|
IERC20(tokens[i]).approve(address(planner), initialDeposits[i]);
|
||||||
@@ -94,9 +99,9 @@ contract DeployMock is Script {
|
|||||||
mintAll(msg.sender, 10_000);
|
mintAll(msg.sender, 10_000);
|
||||||
// prepare initial deposits (10_000 units of each token, scaled by _bases)
|
// prepare initial deposits (10_000 units of each token, scaled by _bases)
|
||||||
initialDeposits = new uint256[](3);
|
initialDeposits = new uint256[](3);
|
||||||
initialDeposits[0] = _bases[0] * 10_000;
|
initialDeposits[0] = 10_000 * 10 ** IERC20Metadata(address(tokens[0])).decimals();
|
||||||
initialDeposits[1] = _bases[1] * 10_000;
|
initialDeposits[1] = 10_000 * 10 ** IERC20Metadata(address(tokens[1])).decimals();
|
||||||
initialDeposits[2] = _bases[2] * 10_000;
|
initialDeposits[2] = 10_000 * 10 ** IERC20Metadata(address(tokens[2])).decimals();
|
||||||
// approve factory to move initial deposits
|
// approve factory to move initial deposits
|
||||||
for (uint i = 0; i < tokens.length; i++) {
|
for (uint i = 0; i < tokens.length; i++) {
|
||||||
IERC20(tokens[i]).approve(address(planner), initialDeposits[i]);
|
IERC20(tokens[i]).approve(address(planner), initialDeposits[i]);
|
||||||
@@ -106,7 +111,7 @@ contract DeployMock is Script {
|
|||||||
planner.newPool(
|
planner.newPool(
|
||||||
'Stablecoin Pool',
|
'Stablecoin Pool',
|
||||||
'STAP',
|
'STAP',
|
||||||
tokens,
|
IERC20[](tokens),
|
||||||
_bases,
|
_bases,
|
||||||
ABDKMath64x64.divu(1, 10),
|
ABDKMath64x64.divu(1, 10),
|
||||||
ABDKMath64x64.divu(1,10000),
|
ABDKMath64x64.divu(1,10000),
|
||||||
@@ -137,8 +142,8 @@ contract DeployMock is Script {
|
|||||||
mintAll(msg.sender, 10_000);
|
mintAll(msg.sender, 10_000);
|
||||||
// prepare initial deposits (10_000 units of each token, scaled by _bases)
|
// prepare initial deposits (10_000 units of each token, scaled by _bases)
|
||||||
initialDeposits = new uint256[](2);
|
initialDeposits = new uint256[](2);
|
||||||
initialDeposits[0] = _bases[0] * 10_000;
|
initialDeposits[0] = 10_000 * 10 ** IERC20Metadata(address(tokens[0])).decimals();
|
||||||
initialDeposits[1] = _bases[1] * 10_000;
|
initialDeposits[1] = 10_000 * 10 ** IERC20Metadata(address(tokens[1])).decimals();
|
||||||
// approve factory to move initial deposits
|
// approve factory to move initial deposits
|
||||||
for (uint i = 0; i < tokens.length; i++) {
|
for (uint i = 0; i < tokens.length; i++) {
|
||||||
IERC20(tokens[i]).approve(address(planner), initialDeposits[i]);
|
IERC20(tokens[i]).approve(address(planner), initialDeposits[i]);
|
||||||
@@ -148,7 +153,7 @@ contract DeployMock is Script {
|
|||||||
planner.newPool(
|
planner.newPool(
|
||||||
'Stable Pair',
|
'Stable Pair',
|
||||||
'SPAIR',
|
'SPAIR',
|
||||||
tokens,
|
IERC20[](tokens),
|
||||||
_bases,
|
_bases,
|
||||||
ABDKMath64x64.divu(8,10), // kappa = 0.8
|
ABDKMath64x64.divu(8,10), // kappa = 0.8
|
||||||
_feePpm,
|
_feePpm,
|
||||||
|
|||||||
@@ -1,10 +1,11 @@
|
|||||||
// SPDX-License-Identifier: UNLICENSED
|
// SPDX-License-Identifier: UNLICENSED
|
||||||
pragma solidity ^0.8.30;
|
pragma solidity ^0.8.30;
|
||||||
|
|
||||||
|
import {IERC20} from "../lib/openzeppelin-contracts/contracts/token/ERC20/IERC20.sol";
|
||||||
|
|
||||||
import "./IPartyPool.sol";
|
import "./IPartyPool.sol";
|
||||||
import "./PartyPoolMintImpl.sol";
|
import "./PartyPoolMintImpl.sol";
|
||||||
import "./PartyPoolSwapImpl.sol";
|
import "./PartyPoolSwapImpl.sol";
|
||||||
import "@openzeppelin/contracts/token/ERC20/IERC20.sol";
|
|
||||||
|
|
||||||
/// @title IPartyPlanner
|
/// @title IPartyPlanner
|
||||||
/// @notice Interface for factory contract for creating and tracking PartyPool instances
|
/// @notice Interface for factory contract for creating and tracking PartyPool instances
|
||||||
|
|||||||
@@ -26,6 +26,8 @@ interface IPartyPool is IERC20Metadata, IOwnable {
|
|||||||
|
|
||||||
// Events
|
// Events
|
||||||
|
|
||||||
|
event Killed();
|
||||||
|
|
||||||
event Mint(address payer, address indexed receiver, uint256[] amounts, uint256 lpMinted);
|
event Mint(address payer, address indexed receiver, uint256[] amounts, uint256 lpMinted);
|
||||||
|
|
||||||
event Burn(address payer, address indexed receiver, uint256[] amounts, uint256 lpBurned);
|
event Burn(address payer, address indexed receiver, uint256[] amounts, uint256 lpBurned);
|
||||||
|
|||||||
@@ -162,6 +162,7 @@ contract PartyPool is PartyPoolBase, OwnableExternal, ERC20External, IPartyPool
|
|||||||
/// mint functionality, leaving only burns (withdrawals) working.
|
/// mint functionality, leaving only burns (withdrawals) working.
|
||||||
function kill() external onlyOwner {
|
function kill() external onlyOwner {
|
||||||
_killed = true;
|
_killed = true;
|
||||||
|
emit Killed();
|
||||||
}
|
}
|
||||||
|
|
||||||
/* ----------------------
|
/* ----------------------
|
||||||
@@ -457,7 +458,7 @@ contract PartyPool is PartyPoolBase, OwnableExternal, ERC20External, IPartyPool
|
|||||||
}
|
}
|
||||||
|
|
||||||
_sendTokenTo(token, address(receiver), amount, false);
|
_sendTokenTo(token, address(receiver), amount, false);
|
||||||
require(receiver.onFlashLoan(address(receiver), address(token), amount, fee, data) == FLASH_CALLBACK_SUCCESS);
|
require(receiver.onFlashLoan(msg.sender, address(token), amount, fee, data) == FLASH_CALLBACK_SUCCESS);
|
||||||
_receiveTokenFrom(address(receiver), token, amount + fee);
|
_receiveTokenFrom(address(receiver), token, amount + fee);
|
||||||
|
|
||||||
// Update cached balance for the borrowed token
|
// Update cached balance for the borrowed token
|
||||||
|
|||||||
Reference in New Issue
Block a user