Skip to content

Commit

Permalink
refactor: use share token directly
Browse files Browse the repository at this point in the history
  • Loading branch information
nlecoufl committed Aug 6, 2024
1 parent 6ceba6a commit 90b92dc
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 7 deletions.
2 changes: 1 addition & 1 deletion scripts/WithdrawPayloadScript.s.sol
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ contract WithdrawPayloadScript is Script {
ROUTER_ADDRESS = routerAddress;
ERC4626Strategy stUSDStrat = ERC4626Strategy(strategyAddress);

stUSDStrat.approve(ROUTER_ADDRESS, stUSDStrat.convertToShares(inputTokenAmount) + 1);
stUSDStrat.approve(ROUTER_ADDRESS, inputTokenAmount);

(bool success, ) = ROUTER_ADDRESS.call(data);
require(success, "Withdraw - mixer() call failed");
Expand Down
12 changes: 6 additions & 6 deletions utils/Withdraw.sh
Original file line number Diff line number Diff line change
Expand Up @@ -57,14 +57,14 @@ case $env in
;;
esac

# Execute the cast call and store the full result
FULL_RESULT=$(cast call $strategyAddress "maxWithdraw(address)(uint256)" $userAddress --rpc-url fork)
# # Execute the cast call and store the full result
# FULL_RESULT=$(cast call $strategyAddress "maxRedeem(address)(uint256)" $userAddress --rpc-url fork)

# Extract only the numeric part before the space
WITHDRAW_AMOUNT=$(echo $FULL_RESULT | awk '{print $1}')
# # Extract only the numeric part before the space
# WITHDRAW_AMOUNT=$(echo $FULL_RESULT | awk '{print $1}')

# Construct the URL
url="${base_url}/v1/integrators/payload/withdraw?chainId=$chainId&outputTokenAddress=$outputTokenAddress&inputTokenAmount=$WITHDRAW_AMOUNT&strategyAddress=$strategyAddress&userAddress=$userAddress&slippage=$slippage&ipAddress=none"
url="${base_url}/v1/integrators/payload/withdraw?chainId=$chainId&outputTokenAddress=$outputTokenAddress&inputTokenAmount=$inputTokenAmount&strategyAddress=$strategyAddress&userAddress=$userAddress&slippage=$slippage&ipAddress=none"

echo $url

Expand All @@ -88,4 +88,4 @@ forge script scripts/WithdrawPayloadScript.s.sol \
--evm-version shanghai \
--broadcast \
-vvvv \
--sig "run(bytes,address,uint256,address,address)" "$data" "$outputTokenAddress" "$WITHDRAW_AMOUNT" "$strategyAddress" "$routerAddress"
--sig "run(bytes,address,uint256,address,address)" "$data" "$outputTokenAddress" "$inputTokenAmount" "$strategyAddress" "$routerAddress"

0 comments on commit 90b92dc

Please sign in to comment.