simplify cpfacotry && fix proxy-dvm test
This commit is contained in:
@@ -21,13 +21,11 @@ contract CrowdPoolingFactory is InitializableOwnable {
|
||||
|
||||
address public immutable _CLONE_FACTORY_;
|
||||
address public immutable _CP_TEMPLATE_;
|
||||
address public immutable _UNOWNED_DVM_FACTORY_;
|
||||
address public immutable _FEE_RATE_MODEL_TEMPLATE_;
|
||||
address public immutable _DVM_FACTORY_;
|
||||
|
||||
address public immutable _DEFAULT_MAINTAINER_;
|
||||
address public immutable _DEFAULT_MT_FEE_RATE_MODEL_;
|
||||
address public immutable _DEFAULT_PERMISSION_MANAGER_;
|
||||
address public immutable _DEFAULT_GAS_PRICE_SOURCE_;
|
||||
|
||||
uint256 public _X_ = 50; //default
|
||||
uint256 public _Y_ = 0; //default
|
||||
@@ -70,21 +68,17 @@ contract CrowdPoolingFactory is InitializableOwnable {
|
||||
constructor(
|
||||
address cloneFactory,
|
||||
address cpTemplate,
|
||||
address unOwnedDvmFactory,
|
||||
address feeRateModelTemplate,
|
||||
address dvmFactory,
|
||||
address defaultMaintainer,
|
||||
address defaultMtFeeRateModel,
|
||||
address defaultPermissionManager,
|
||||
address defaultGasPriceSource
|
||||
address defaultPermissionManager
|
||||
) public {
|
||||
_CLONE_FACTORY_ = cloneFactory;
|
||||
_CP_TEMPLATE_ = cpTemplate;
|
||||
_UNOWNED_DVM_FACTORY_ = unOwnedDvmFactory;
|
||||
_FEE_RATE_MODEL_TEMPLATE_ = feeRateModelTemplate;
|
||||
_DVM_FACTORY_ = dvmFactory;
|
||||
_DEFAULT_MAINTAINER_ = defaultMaintainer;
|
||||
_DEFAULT_MT_FEE_RATE_MODEL_ = defaultMtFeeRateModel;
|
||||
_DEFAULT_PERMISSION_MANAGER_ = defaultPermissionManager;
|
||||
_DEFAULT_GAS_PRICE_SOURCE_ = defaultGasPriceSource;
|
||||
_X_ = 50;
|
||||
_Y_ = 30 days;
|
||||
}
|
||||
@@ -109,7 +103,7 @@ contract CrowdPoolingFactory is InitializableOwnable {
|
||||
addressList[3] = quoteToken;
|
||||
addressList[4] = _DEFAULT_PERMISSION_MANAGER_;
|
||||
addressList[5] = _DEFAULT_MT_FEE_RATE_MODEL_;
|
||||
addressList[6] = _UNOWNED_DVM_FACTORY_;
|
||||
addressList[6] = _DVM_FACTORY_;
|
||||
|
||||
ICP(cpAddress).init(
|
||||
addressList,
|
||||
|
||||
@@ -74,8 +74,8 @@ library DODOMath {
|
||||
// V0 = V1*(1+(sqrt-1)/2k)
|
||||
// sqrt = √(1+4kidelta/V1)
|
||||
// premium = 1+(sqrt-1)/2k
|
||||
uint256 sqrt = DecimalMath.multiMulWithDiv((4 * k).mul(i),delta,V1).add(DecimalMath.ONE2).sqrt();
|
||||
// uint256 sqrt = (4 * k).mul(i).mul(delta).div(V1).add(DecimalMath.ONE2).sqrt();
|
||||
// uint256 sqrt = DecimalMath.multiMulWithDiv((4 * k).mul(i),delta,V1).add(DecimalMath.ONE2).sqrt();
|
||||
uint256 sqrt = (4 * k).mul(i).mul(delta).div(V1).add(DecimalMath.ONE2).sqrt();
|
||||
uint256 premium = DecimalMath.divFloor(sqrt.sub(DecimalMath.ONE), k * 2).add(
|
||||
DecimalMath.ONE
|
||||
);
|
||||
@@ -129,8 +129,8 @@ library DODOMath {
|
||||
// Q2=Q1/(1+ideltaBQ1/Q0/Q0)
|
||||
// temp = ideltaBQ1/Q0/Q0
|
||||
// Q1-Q2 = Q1*(temp/(1+temp))
|
||||
uint256 temp = DecimalMath.multiMulWithDiv(i.mul(delta),V1,V0).div(V0);
|
||||
// uint256 temp = i.mul(delta).mul(V1).div(V0.mul(V0));
|
||||
// uint256 temp = DecimalMath.multiMulWithDiv(i.mul(delta),V1,V0).div(V0);
|
||||
uint256 temp = i.mul(delta).mul(V1).div(V0.mul(V0));
|
||||
return V1.mul(temp).div(temp.add(DecimalMath.ONE));
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user