Skip to content

Commit

Permalink
✅ init test_depositCollateral_wrapUSDE
Browse files Browse the repository at this point in the history
  • Loading branch information
cmontecoding committed Oct 9, 2024
1 parent d3ad16e commit c03ef99
Show file tree
Hide file tree
Showing 3 changed files with 33 additions and 2 deletions.
2 changes: 2 additions & 0 deletions script/utils/parameters/ArbitrumParameters.sol
Original file line number Diff line number Diff line change
Expand Up @@ -23,5 +23,7 @@ contract ArbitrumParameters {

address public constant TBTC = 0x6c84a8f1c29108F47a79964b5Fe888D4f4D0dE40;

address public constant USDE = 0x5d3a1Ff2b6BAb83b63cd9AD0787074081a52ef34;

uint128 public constant SUSDC_SPOT_MARKET_ID = 1;
}
24 changes: 24 additions & 0 deletions test/Collateral.t.sol
Original file line number Diff line number Diff line change
Expand Up @@ -172,6 +172,30 @@ contract DepositCollateral is CollateralTest {
// assertWithinTolerance(expectedMargin, availableMargin, 2);
}

function test_depositCollateral_wrapUSDE() public {
uint256 decimalsFactor = 10 ** (18 - USDe.decimals());

deal(address(USDe), ACTOR, SMALLER_AMOUNT);

vm.startPrank(ACTOR);

USDe.approve(address(engine), type(uint256).max);

engine.modifyCollateralWrap({
_accountId: accountId,
_amount: int256(SMALLER_AMOUNT),
_tolerance: SMALLER_AMOUNT,
_collateral: USDe,
_synthMarketId: 5
});

vm.stopPrank();

// uint256 availableMargin = uint256(perpsMarketProxy.getAvailableMargin(accountId));
// uint256 expectedMargin = SMALLEST_AMOUNT * decimalsFactor;
// assertWithinTolerance(expectedMargin, availableMargin, 2);
}

/// @notice This test is expected to fail because sUSD is not a supported collateral
function test_depositCollateral_wrapfail_sUSD() public {
deal(address(sUSD), ACTOR, SMALLER_AMOUNT);
Expand Down
9 changes: 7 additions & 2 deletions test/utils/Bootstrap.sol
Original file line number Diff line number Diff line change
Expand Up @@ -56,6 +56,7 @@ contract Bootstrap is Test, Constants, Conditions, SynthetixV3Errors, TestHelper
IERC20 public WETH;
IERC20 public USDT;
IERC20 public tBTC;
IERC20 public USDe;
address public zap;
address public usdc;
address public weth;
Expand All @@ -79,7 +80,8 @@ contract Bootstrap is Test, Constants, Conditions, SynthetixV3Errors, TestHelper
address _usdcAddress,
address _wethAddress,
address _usdtAddress,
address _tBTCAddress
address _tBTCAddress,
address _usdeAddress
) = bootstrap.init();

engine = Engine(_engineAddress);
Expand All @@ -91,6 +93,7 @@ contract Bootstrap is Test, Constants, Conditions, SynthetixV3Errors, TestHelper
WETH = IERC20(_wethAddress);
USDT = IERC20(_usdtAddress);
tBTC = IERC20(_tBTCAddress);
USDe = IERC20(_usdeAddress);
synthMinter = new SynthMinter(_sUSDAddress, _spotMarketProxyAddress);
pDAO = _pDAOAddress;
zap = _zapAddress;
Expand Down Expand Up @@ -124,6 +127,7 @@ contract BootstrapArbitrum is Setup, ArbitrumParameters {
address,
address,
address,
address,
address
)
{
Expand Down Expand Up @@ -158,7 +162,8 @@ contract BootstrapArbitrum is Setup, ArbitrumParameters {
USDC,
WETH,
USDT,
TBTC
TBTC,
USDE
);
}
}

0 comments on commit c03ef99

Please sign in to comment.