Function: deployToSpark(uint256 deployAmt)
This function moves undeployed USDT owned by the vault into the SparkLend market during the Yield phase. The admin can deploy a specific amount or pass 0 to sweep the entire idle balance, after which the pool pulls the funds using the preset allowance.
Inputs
deployAmtControl: N/A.
Constraints: Must be
0or less than the outstanding deployable balance (totalSupply - usdtDeployed).Impact: Amount of USDT to deploy to SparkLend.
Branches and code coverage
Intended branches
Reverts if all shares are already accounted for in
usdtDeployed.Passing
deployAmt == 0sweeps the entire deployable amount into Spark.Reverts if providing an explicit amount larger than
deployable.
Negative behavior
Non-admin callers or calls outside the Yield phase revert.
Reentrancy is blocked by
nonReentrant.
Function call analysis
SPARK_LEND_USDT_POOL.supply(asset: address(USDT), amount: deployAmt, onBehalfOf: address(this), referralCode: SPARK_REFERRAL_CODE)What is controllable? The admin influences
deployAmt— asset, receiver, and referral code are fixed constants determined at deployment.If the return value is controllable, how is it used and how can it go wrong? N/A.
What happens if it reverts, reenters or does other unusual control flow? The pool could theoretically call back via ERC-20 hooks, but
ReentrancyGuardblocks reentry into vault functions.