PartyInfo.working(); DeployMock/Sep LP token amount fix

This commit is contained in:
tim
2025-11-10 16:31:43 -04:00
parent a08a928f7f
commit 89f4307ca0
4 changed files with 19 additions and 3 deletions

View File

@@ -249,3 +249,5 @@ By coupling LMSR with the proportional parameterization $b(\mathbf{q})=\kappa S(
## References
Hanson, R. (2002) [_Logarithmic Market Scoring Rules for Modular Combinatorial Information Aggregation_](https://mason.gmu.edu/~rhanson/mktscore.pdf)
Othman, Pennock, Reeves, Sandholm (2013) [_A Practical Liquidity-Sensitive Automated Market Maker_](https://www.cs.cmu.edu/~sandholm/liquidity-sensitive%20automated%20market%20maker.teac.pdf)
Xu, Paruch, Cousaert, Feng (2023) [SoK: Decentralized Exchanges (DEX) with Automated Market Maker (AMM) Protocols](https://arxiv.org/pdf/2103.12732)

View File

@@ -75,7 +75,7 @@ contract DeployMock is Script {
msg.sender, // payer: this script
DEV_ACCOUNT_7, // receiver of initial LP
initialDeposits,
10000,
10_000 * 10*18,
0
);
@@ -119,7 +119,7 @@ contract DeployMock is Script {
msg.sender, // payer: this script
DEV_ACCOUNT_7, // receiver of initial LP
initialDeposits,
10000,
10_000 * 10*18,
0
);
@@ -159,7 +159,7 @@ contract DeployMock is Script {
msg.sender, // payer: this script
DEV_ACCOUNT_7, // receiver of initial LP
initialDeposits,
10000,
10_000 * 10*18,
0
);

View File

@@ -4,6 +4,10 @@ pragma solidity ^0.8.30;
import {IPartyPool} from "./IPartyPool.sol";
interface IPartyInfo {
/// @notice returns true iff the pool is not killed and has been initialized with liquidity.
function working(IPartyPool pool) external view returns (bool);
/// @notice Marginal price of `base` denominated in `quote` as Q64.64.
/// @dev Returns the LMSR marginal price p_quote / p_base in ABDK 64.64 fixed-point format.
/// Useful for off-chain quoting; raw 64.64 value is returned (no scaling to token units).

View File

@@ -22,6 +22,16 @@ contract PartyInfo is PartyPoolHelpers, IPartyInfo {
MINT_IMPL = mintImpl;
}
function working(IPartyPool pool) external view returns (bool) {
if (pool.killed())
return false;
LMSRStabilized.State memory s = pool.LMSR();
uint256 sum = 0;
for( uint i=0; i<s.qInternal.length; i++ )
sum += s.qInternal[i];
return sum > 0;
}
//
// Current marginal prices
//