Add managed quote-push treasury workflows
This commit is contained in:
@@ -58,29 +58,13 @@ contract RunManagedMainnetAaveCwusdcUsdcQuotePushCycle is Script {
|
||||
console.log("gasHoldbackTargetRaw", gasHoldbackTargetRaw);
|
||||
|
||||
vm.startBroadcast(pk);
|
||||
AaveQuotePushFlashReceiver(receiver).flashQuotePush(usdc, amount, p);
|
||||
|
||||
uint256 harvested = 0;
|
||||
if (harvest) {
|
||||
uint256 receiverSweepableAfterFlash = manager.receiverSweepableQuote();
|
||||
if (receiverSweepableAfterFlash > 0) {
|
||||
harvested = manager.harvestReceiverSurplus();
|
||||
}
|
||||
console.log("receiverSweepableAfterFlash", receiverSweepableAfterFlash);
|
||||
}
|
||||
|
||||
uint256 available = manager.availableQuote();
|
||||
uint256 gasAmount = _min(available, gasHoldbackTargetRaw);
|
||||
uint256 recycleAmount = available - gasAmount;
|
||||
|
||||
if (gasAmount > 0 || recycleAmount > 0) {
|
||||
manager.distributeToConfiguredRecipients(gasAmount, recycleAmount);
|
||||
}
|
||||
(uint256 harvested, uint256 gasAmount, uint256 recycleAmount) =
|
||||
manager.runManagedCycle(usdc, amount, p, harvest, gasHoldbackTargetRaw);
|
||||
vm.stopBroadcast();
|
||||
|
||||
console.log("harvested", harvested);
|
||||
console.log("gasDistributionRaw", gasAmount);
|
||||
console.log("recycleDistributionRaw", recycleAmount);
|
||||
console.log("managedCycleHarvestedRaw", harvested);
|
||||
console.log("managedCycleGasDistributionRaw", gasAmount);
|
||||
console.log("managedCycleRecycleDistributionRaw", recycleAmount);
|
||||
console.log("managerQuoteAfter", manager.quoteBalance());
|
||||
console.log("managerAvailableAfter", manager.availableQuote());
|
||||
console.log("receiverSweepableAfter", manager.receiverSweepableQuote());
|
||||
@@ -136,8 +120,18 @@ contract RunManagedMainnetAaveCwusdcUsdcQuotePushCycle is Script {
|
||||
string memory pathHex = vm.envString("UNWIND_V3_PATH_HEX");
|
||||
bytes memory path = vm.parseBytes(pathHex);
|
||||
unwindData = abi.encode(dodoPool, intermediateToken, minIntermediateOut, path);
|
||||
} else if (unwindMode == 6) {
|
||||
address poolA = vm.envAddress("UNWIND_TWO_HOP_POOL_A");
|
||||
address poolB = vm.envAddress("UNWIND_TWO_HOP_POOL_B");
|
||||
address midToken = vm.envAddress("UNWIND_TWO_HOP_MID_TOKEN");
|
||||
uint256 minMidOut = vm.envOr("UNWIND_MIN_MID_OUT_RAW", uint256(1));
|
||||
address intermediateToken = vm.envAddress("UNWIND_INTERMEDIATE_TOKEN");
|
||||
uint256 minIntermediateOut = vm.envOr("UNWIND_MIN_INTERMEDIATE_OUT_RAW", uint256(1));
|
||||
string memory pathHex = vm.envString("UNWIND_V3_PATH_HEX");
|
||||
bytes memory path = vm.parseBytes(pathHex);
|
||||
unwindData = abi.encode(poolA, poolB, midToken, minMidOut, intermediateToken, minIntermediateOut, path);
|
||||
} else {
|
||||
revert("UNWIND_MODE must be 0, 1, 2, 4, or 5");
|
||||
revert("UNWIND_MODE must be 0, 1, 2, 4, 5, or 6");
|
||||
}
|
||||
|
||||
p = AaveQuotePushFlashReceiver.QuotePushParams({
|
||||
@@ -166,8 +160,4 @@ contract RunManagedMainnetAaveCwusdcUsdcQuotePushCycle is Script {
|
||||
console.log("minOutPmm", minOutPmm);
|
||||
console.log("minOutUnwind", minOutUnwind);
|
||||
}
|
||||
|
||||
function _min(uint256 a, uint256 b) internal pure returns (uint256) {
|
||||
return a < b ? a : b;
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user