add try-catch in dodoV2RouteHelper

This commit is contained in:
Attens1423
2023-08-24 22:51:55 +08:00
parent 5b293b91fb
commit 97bd322857
3 changed files with 35 additions and 23 deletions

View File

@@ -94,17 +94,23 @@ contract DODOV2CuttingRouteHelper is InitializableOwnable {
curRes.quoteToken = token0; curRes.quoteToken = token0;
} }
( try IDODOV2(cur).getPMMStateForCall() returns (uint256 _i, uint256 _K, uint256 _B, uint256 _Q, uint256 _B0, uint256 _Q0, uint256 _R){
curRes.i, curRes.i = _i;
curRes.K, curRes.K = _K;
curRes.B, curRes.B = _B;
curRes.Q, curRes.Q = _Q;
curRes.B0, curRes.B0 = _B0;
curRes.Q0, curRes.Q0 = _Q0;
curRes.R curRes.R = _R;
) = IDODOV2(cur).getPMMStateForCall(); } catch {
continue;
(curRes.lpFeeRate, curRes.mtFeeRate) = IDODOV2(cur).getUserFeeRate(userAddr); }
try IDODOV2(cur).getUserFeeRate(userAddr) returns (uint256 lpFeeRate, uint256 mtFeeRate) {
(curRes.lpFeeRate, curRes.mtFeeRate) = (lpFeeRate, mtFeeRate);
} catch {
(curRes.lpFeeRate, curRes.mtFeeRate) = (0, 1e18);
}
curRes.curPair = cur; curRes.curPair = cur;
res[i] = curRes; res[i] = curRes;
} }

View File

@@ -73,17 +73,23 @@ contract DODOV2RouteHelper {
curRes.quoteToken = token0; curRes.quoteToken = token0;
} }
( try IDODOV2(cur).getPMMStateForCall() returns (uint256 _i, uint256 _K, uint256 _B, uint256 _Q, uint256 _B0, uint256 _Q0, uint256 _R){
curRes.i, curRes.i = _i;
curRes.K, curRes.K = _K;
curRes.B, curRes.B = _B;
curRes.Q, curRes.Q = _Q;
curRes.B0, curRes.B0 = _B0;
curRes.Q0, curRes.Q0 = _Q0;
curRes.R curRes.R = _R;
) = IDODOV2(cur).getPMMStateForCall(); } catch {
continue;
(curRes.lpFeeRate, curRes.mtFeeRate) = IDODOV2(cur).getUserFeeRate(userAddr); }
try IDODOV2(cur).getUserFeeRate(userAddr) returns (uint256 lpFeeRate, uint256 mtFeeRate) {
(curRes.lpFeeRate, curRes.mtFeeRate) = (lpFeeRate, mtFeeRate);
} catch {
(curRes.lpFeeRate, curRes.mtFeeRate) = (0, 1e18);
}
curRes.curPair = cur; curRes.curPair = cur;
res[i] = curRes; res[i] = curRes;
} }

View File

@@ -185,7 +185,6 @@ module.exports = async (deployer, network, accounts) => {
logger.log("Init DefaultMtFeeRateAddress Tx:", tx.tx); logger.log("Init DefaultMtFeeRateAddress Tx:", tx.tx);
} }
// todo: 这个需不需要验证
if (UserQuotaAddress == "") { if (UserQuotaAddress == "") {
await deployer.deploy(UserQuota); await deployer.deploy(UserQuota);
UserQuotaAddress = UserQuota.address; UserQuotaAddress = UserQuota.address;
@@ -554,6 +553,7 @@ module.exports = async (deployer, network, accounts) => {
logger.log("Init DODOMineV3Proxy Tx:", tx.tx); logger.log("Init DODOMineV3Proxy Tx:", tx.tx);
} }
// need deploy dodoRouteProxy in dodo-route-contract repo
/* /*
if (DODORouteProxyAddress == "") { if (DODORouteProxyAddress == "") {
await deployer.deploy( await deployer.deploy(