failed attempt to save even more gas in balanced pair by interpolating from a lookup table
This commit is contained in:
@@ -1,6 +1,7 @@
|
||||
// SPDX-License-Identifier: UNLICENSED
|
||||
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 {NativeWrapper} from "../src/NativeWrapper.sol";
|
||||
import {PartyPlanner} from "../src/PartyPlanner.sol";
|
||||
@@ -66,23 +67,31 @@ library Deploy {
|
||||
NativeWrapper wrapper,
|
||||
bool _stable
|
||||
) internal returns (PartyPool) {
|
||||
return _stable && tokens_.length == 2 ?
|
||||
new PartyPoolBalancedPair(
|
||||
owner_,
|
||||
name_,
|
||||
symbol_,
|
||||
tokens_,
|
||||
bases_,
|
||||
_kappa,
|
||||
_swapFeePpm,
|
||||
_flashFeePpm,
|
||||
PROTOCOL_FEE_PPM,
|
||||
PROTOCOL_FEE_RECEIVER,
|
||||
wrapper,
|
||||
new PartyPoolSwapImpl(wrapper),
|
||||
new PartyPoolMintImpl(wrapper)
|
||||
) :
|
||||
new PartyPool(
|
||||
if(_stable && tokens_.length == 2) {
|
||||
PartyPoolBalancedPair pool = new PartyPoolBalancedPair(
|
||||
owner_,
|
||||
name_,
|
||||
symbol_,
|
||||
tokens_,
|
||||
bases_,
|
||||
_kappa,
|
||||
_swapFeePpm,
|
||||
_flashFeePpm,
|
||||
PROTOCOL_FEE_PPM,
|
||||
PROTOCOL_FEE_RECEIVER,
|
||||
wrapper,
|
||||
new PartyPoolSwapImpl(wrapper),
|
||||
new PartyPoolMintImpl(wrapper)
|
||||
);
|
||||
pool.precompute(
|
||||
ABDKMath64x64.divu(25,10_000), // ±25 bps
|
||||
ABDKMath64x64.divu(10, 100), // taking up to 10% of the pool
|
||||
20, // num Δ samples
|
||||
20 // num α samples
|
||||
);
|
||||
return pool;
|
||||
}
|
||||
return new PartyPool(
|
||||
owner_,
|
||||
name_,
|
||||
symbol_,
|
||||
|
||||
Reference in New Issue
Block a user