add routev2 predata helper

This commit is contained in:
owen05
2020-12-22 13:18:23 +08:00
parent e9dc5c9be9
commit 2b3ffc31e8
14 changed files with 392 additions and 124 deletions

View File

@@ -208,6 +208,29 @@ contract DVMTrader is DVMVault {
PMMPricing.adjustedTarget(state);
}
function getPMMStateForCall()
external
view
returns (
uint256 i,
uint256 K,
uint256 B,
uint256 Q,
uint256 B0,
uint256 Q0,
uint8 R
)
{
PMMPricing.PMMState memory state = getPMMState();
i = state.i;
K = state.K;
B = state.B;
Q = state.Q;
B0 = state.B0;
Q0 = state.Q0;
R = uint8(state.R);
}
function getMidPrice() public view returns (uint256 midPrice) {
return PMMPricing.getMidPrice(getPMMState());
}