autowrap; sendAmounts() restored
This commit is contained in:
@@ -4,8 +4,10 @@ pragma solidity ^0.8.30;
|
||||
import {ABDKMath64x64} from "../lib/abdk-libraries-solidity/ABDKMath64x64.sol";
|
||||
import {IERC20} from "../lib/openzeppelin-contracts/contracts/token/ERC20/IERC20.sol";
|
||||
import {SafeERC20} from "../lib/openzeppelin-contracts/contracts/token/ERC20/utils/SafeERC20.sol";
|
||||
import {ReentrancyGuard} from "../lib/openzeppelin-contracts/contracts/utils/ReentrancyGuard.sol";
|
||||
import {ERC20Internal} from "./ERC20Internal.sol";
|
||||
import {IPartyPool} from "./IPartyPool.sol";
|
||||
import {IWETH9} from "./IWETH9.sol";
|
||||
import {LMSRStabilized} from "./LMSRStabilized.sol";
|
||||
import {PartyPoolBase} from "./PartyPoolBase.sol";
|
||||
|
||||
@@ -17,6 +19,7 @@ contract PartyPoolMintImpl is PartyPoolBase {
|
||||
using LMSRStabilized for LMSRStabilized.State;
|
||||
using SafeERC20 for IERC20;
|
||||
|
||||
constructor(IWETH9 wrapper_) PartyPoolBase(wrapper_) {}
|
||||
|
||||
//
|
||||
// Initialization Mint
|
||||
@@ -62,7 +65,7 @@ contract PartyPoolMintImpl is PartyPoolBase {
|
||||
// Regular Mint and Burn
|
||||
//
|
||||
|
||||
function mint(address payer, address receiver, uint256 lpTokenAmount, uint256 deadline) external nonReentrant
|
||||
function mint(address payer, address receiver, uint256 lpTokenAmount, uint256 deadline) external payable nonReentrant
|
||||
returns (uint256 lpMinted) {
|
||||
require(deadline == 0 || block.timestamp <= deadline, "mint: deadline exceeded");
|
||||
uint256 n = tokens.length;
|
||||
@@ -82,7 +85,7 @@ contract PartyPoolMintImpl is PartyPoolBase {
|
||||
// Transfer in all token amounts
|
||||
for (uint i = 0; i < n; ) {
|
||||
if (depositAmounts[i] > 0) {
|
||||
tokens[i].safeTransferFrom(payer, address(this), depositAmounts[i]);
|
||||
_receiveTokenFrom(payer, tokens[i], depositAmounts[i]);
|
||||
}
|
||||
unchecked { i++; }
|
||||
}
|
||||
@@ -124,6 +127,9 @@ contract PartyPoolMintImpl is PartyPoolBase {
|
||||
|
||||
_mint(receiver, actualLpToMint);
|
||||
emit IPartyPool.Mint(payer, receiver, depositAmounts, actualLpToMint);
|
||||
|
||||
_refund();
|
||||
|
||||
return actualLpToMint;
|
||||
}
|
||||
|
||||
@@ -151,7 +157,7 @@ contract PartyPoolMintImpl is PartyPoolBase {
|
||||
// Transfer underlying tokens out to receiver according to computed proportions
|
||||
for (uint i = 0; i < n; ) {
|
||||
if (withdrawAmounts[i] > 0) {
|
||||
tokens[i].safeTransfer(receiver, withdrawAmounts[i]);
|
||||
_sendTokenTo(tokens[i], receiver, withdrawAmounts[i]);
|
||||
}
|
||||
unchecked { i++; }
|
||||
}
|
||||
@@ -366,8 +372,8 @@ contract PartyPoolMintImpl is PartyPoolBase {
|
||||
uint256 totalTransfer = amountInUint + feeUintActual;
|
||||
require(totalTransfer > 0 && totalTransfer <= maxAmountIn, "swapMint: transfer exceeds max");
|
||||
|
||||
// Transfer tokens from payer (assume standard ERC20 without transfer fees)
|
||||
tokens[inputTokenIndex].safeTransferFrom(payer, address(this), totalTransfer);
|
||||
// Transfer tokens from payer (assume standard ERC20 without transfer fees) via helper
|
||||
_receiveTokenFrom(payer, tokens[inputTokenIndex], totalTransfer);
|
||||
|
||||
// Accrue protocol share (floor) from the fee on the input token
|
||||
uint256 protoShare = 0;
|
||||
@@ -514,8 +520,8 @@ contract PartyPoolMintImpl is PartyPoolBase {
|
||||
}
|
||||
}
|
||||
|
||||
// Transfer the payout to receiver
|
||||
tokens[inputTokenIndex].safeTransfer(receiver, amountOutUint);
|
||||
// Transfer the payout to receiver via centralized helper
|
||||
_sendTokenTo(tokens[inputTokenIndex], receiver, amountOutUint);
|
||||
|
||||
// Burn LP tokens from payer (authorization via allowance)
|
||||
if (msg.sender != payer) {
|
||||
|
||||
Reference in New Issue
Block a user