DPP trade test

This commit is contained in:
mingda
2020-11-26 13:22:22 +08:00
parent 6d8bd3646a
commit 61479dbf04
6 changed files with 223 additions and 17 deletions

View File

@@ -213,18 +213,17 @@ library PMMPricing {
// ============ Helper functions ============
// todo 我不确定这个函数是不是能改state的状态
function adjustedTarget(PMMState memory state) internal pure {
if (state.R == RState.BELOW_ONE) {
state.Q0 = DODOMath._SolveQuadraticFunctionForTarget(
state.B,
state.Q,
state.B.sub(state.B0),
state.i,
state.K
);
} else if (state.R == RState.ABOVE_ONE) {
state.B0 = DODOMath._SolveQuadraticFunctionForTarget(
state.Q,
state.B,
state.Q.sub(state.Q0),
DecimalMath.reciprocalFloor(state.i),
state.K