Skip to content

Commit

Permalink
Merge remote-tracking branch 'origin/main' into nicka/claim-lido-with…
Browse files Browse the repository at this point in the history
…drawals
  • Loading branch information
naddison36 committed Dec 10, 2024
2 parents a9ee74c + 0148a94 commit 0ded6c2
Show file tree
Hide file tree
Showing 4 changed files with 24 additions and 15 deletions.
2 changes: 1 addition & 1 deletion foundry.toml
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ verbosity = 3
sender = "0x0165C55EF814dEFdd658532A48Bd17B2c8356322"
tx_origin = "0x0165C55EF814dEFdd658532A48Bd17B2c8356322"
auto_detect_remappings = false
gas_reports = ["OEthARM", "Proxy"]
gas_reports = ["OethARM", "Proxy"]
fs_permissions = [{ access = "read-write", path = "./build" }]
extra_output_files = ["metadata"]
ignored_warnings_from = ["src/contracts/Proxy.sol"]
Expand Down
7 changes: 5 additions & 2 deletions src/js/tasks/lido.js
Original file line number Diff line number Diff line change
Expand Up @@ -32,14 +32,17 @@ async function setZapper() {
await logTxDetails(tx, "setZap");
}

const lidoWithdrawStatus = async ({ id }) => {
const lidoWithdrawStatus = async ({ block, id }) => {
const blockTag = await getBlock(block);
const lidoWithdrawalQueueAddress = await parseAddress("LIDO_WITHDRAWAL");
const stEthWithdrawQueue = await hre.ethers.getContractAt(
"IStETHWithdrawal",
lidoWithdrawalQueueAddress
);

const status = await stEthWithdrawQueue.getWithdrawalStatus([id]);
const status = await stEthWithdrawQueue.getWithdrawalStatus([id], {
blockTag,
});

console.log(
`Withdrawal request ${id} for ${formatUnits(
Expand Down
6 changes: 6 additions & 0 deletions src/js/tasks/tasks.js
Original file line number Diff line number Diff line change
Expand Up @@ -730,6 +730,12 @@ task("claimLidoWithdraws").setAction(async (_, __, runSuper) => {

subtask("lidoWithdrawStatus", "Get the status of a Lido withdrawal request")
.addParam("id", "Request identifier", undefined, types.string)
.addOptionalParam(
"block",
"Block number. (default: latest)",
undefined,
types.int
)
.setAction(lidoWithdrawStatus);
task("lidoWithdrawStatus").setAction(async (_, __, runSuper) => {
return runSuper();
Expand Down
24 changes: 12 additions & 12 deletions test/smoke/LidoARMSmokeTest.t.sol
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,7 @@ contract Fork_LidoARM_Smoke_Test is AbstractSmokeTest {
assertEq(address(lidoARM.weth()), Mainnet.WETH, "WETH");
assertEq(lidoARM.liquidityAsset(), Mainnet.WETH, "liquidity asset");
assertEq(lidoARM.claimDelay(), 10 minutes, "claim delay");
assertEq(lidoARM.crossPrice(), 0.9998e36, "cross price");
assertEq(lidoARM.crossPrice(), 0.99985e36, "cross price");

assertEq(capManager.accountCapEnabled(), false, "account cap enabled");
assertEq(capManager.operator(), Mainnet.ARM_RELAYER, "Operator");
Expand All @@ -62,29 +62,29 @@ contract Fork_LidoARM_Smoke_Test is AbstractSmokeTest {
function test_swap_exact_steth_for_weth() external {
// trader sells stETH and buys WETH, the ARM buys stETH as a
// 4 bps discount
_swapExactTokensForTokens(steth, weth, 9996e32, 100 ether);
_swapExactTokensForTokens(steth, weth, 0.9996e36, 100 ether);
// 10 bps discount
_swapExactTokensForTokens(steth, weth, 9990e32, 1e15);
_swapExactTokensForTokens(steth, weth, 0.999e36, 1e15);
// 20 bps discount
_swapExactTokensForTokens(steth, weth, 9980e32, 1 ether);
_swapExactTokensForTokens(steth, weth, 0.998e36, 1 ether);
}

function test_swap_exact_weth_for_steth() external {
// trader buys stETH and sells WETH, the ARM sells stETH at a
// 1 bps discount
_swapExactTokensForTokens(weth, steth, 9999e32, 10 ether);
// 2 bps discount
_swapExactTokensForTokens(weth, steth, 9998e32, 100 ether);
_swapExactTokensForTokens(weth, steth, 0.9999e36, 10 ether);
// 1.5 bps discount
_swapExactTokensForTokens(weth, steth, 0.99985e36, 100 ether);
}

function test_swapTokensForExactTokens() external {
// trader sells stETH and buys WETH, the ARM buys stETH at a
// 4 bps discount
_swapTokensForExactTokens(steth, weth, 9996e32, 10 ether);
_swapTokensForExactTokens(steth, weth, 0.9996e36, 10 ether);
// 10 bps discount
_swapTokensForExactTokens(steth, weth, 9990e32, 100 ether);
_swapTokensForExactTokens(steth, weth, 0.999e36, 100 ether);
// 50 bps discount
_swapTokensForExactTokens(steth, weth, 9950e32, 10 ether);
_swapTokensForExactTokens(steth, weth, 0.995e36, 10 ether);
}

function _swapExactTokensForTokens(IERC20 inToken, IERC20 outToken, uint256 price, uint256 amountIn) internal {
Expand All @@ -108,7 +108,7 @@ contract Fork_LidoARM_Smoke_Test is AbstractSmokeTest {
expectedOut = amountIn * price / 1e36;

vm.prank(Mainnet.ARM_RELAYER);
uint256 sellPrice = price < 9996e32 ? 9998e32 : price + 2e32;
uint256 sellPrice = price < 0.99965e36 ? 0.99985e36 : price + 2e32;
lidoARM.setPrices(price, sellPrice);
}
// Approve the ARM to transfer the input token of the swap.
Expand Down Expand Up @@ -145,7 +145,7 @@ contract Fork_LidoARM_Smoke_Test is AbstractSmokeTest {
expectedIn = amountOut * 1e36 / price + 3;

vm.prank(Mainnet.ARM_RELAYER);
uint256 sellPrice = price < 9996e32 ? 9998e32 : price + 2e32;
uint256 sellPrice = price < 0.99965e36 ? 0.99985e36 : price + 2e32;
lidoARM.setPrices(price, sellPrice);
}
// Approve the ARM to transfer the input token of the swap.
Expand Down

0 comments on commit 0ded6c2

Please sign in to comment.