mirror of
				https://github.com/Instadapp/dsa-connectors.git
				synced 2024-07-29 22:37:00 +00:00 
			
		
		
		
	Merge pull request #252 from Instadapp/Connector-updates
Euler new updates
This commit is contained in:
		
						commit
						d3f6361025
					
				|  | @ -52,8 +52,8 @@ contract Events { | |||
| 	); | ||||
| 
 | ||||
| 	event LogETransfer( | ||||
| 		uint256 subAccount1, | ||||
| 		uint256 subAccount2, | ||||
| 		uint256 subAccountFrom, | ||||
| 		uint256 subAccountTo, | ||||
| 		address token, | ||||
| 		uint256 amount, | ||||
| 		uint256 getId, | ||||
|  | @ -61,31 +61,20 @@ contract Events { | |||
| 	); | ||||
| 
 | ||||
| 	event LogDTransfer( | ||||
| 		uint256 subAccount1, | ||||
| 		uint256 subAccount2, | ||||
| 		address token, | ||||
| 		uint256 amount, | ||||
| 		uint256 getId, | ||||
| 		uint256 setId | ||||
| 	); | ||||
| 
 | ||||
| 	event LogApproveDebt( | ||||
| 		uint256 subAccountId, | ||||
| 		address debtReceiver, | ||||
| 		address token, | ||||
| 		uint256 amount, | ||||
| 		uint256 getId, | ||||
| 		uint256 setId | ||||
| 	); | ||||
| 
 | ||||
| 	event LogSwap( | ||||
| 		uint256 subAccountFrom, | ||||
| 		uint256 subAccountTo, | ||||
| 		address buyAddr, | ||||
| 		address sellAddr, | ||||
| 		uint256 sellAmt, | ||||
| 		uint256 unitAmt, | ||||
| 		bytes callData | ||||
| 		address token, | ||||
| 		uint256 amount, | ||||
| 		uint256 getId, | ||||
| 		uint256 setId | ||||
| 	); | ||||
| 
 | ||||
| 	event LogApproveSpenderDebt( | ||||
| 		uint256 subAccountId, | ||||
| 		address debtSender, | ||||
| 		address token, | ||||
| 		uint256 amount, | ||||
| 		uint256 setId | ||||
| 	); | ||||
| 
 | ||||
| 	event LogEnterMarket(uint256 subAccountId, address[] newMarkets); | ||||
|  |  | |||
|  | @ -10,43 +10,11 @@ contract Helpers is Basic, Events { | |||
| 		0x27182842E098f60e3D576794A5bFFb0777E025d3; | ||||
| 	IEulerMarkets internal constant markets = | ||||
| 		IEulerMarkets(0x3520d5a913427E6F0D6A83E07ccD4A4da316e4d3); | ||||
| 	IEulerSwap internal constant swapExec = | ||||
| 		IEulerSwap(0x7123C8cBBD76c5C7fCC9f7150f23179bec0bA341); | ||||
| 
 | ||||
| 	struct swapHelper { | ||||
| 		address _sellAddr; | ||||
| 		address _buyAddr; | ||||
| 		uint256 _buyDec; | ||||
| 		uint256 _sellDec; | ||||
| 		uint256 _sellAmt18; | ||||
| 		uint256 _slippageAmt; | ||||
| 	} | ||||
| 
 | ||||
| 	struct swapParams { | ||||
| 		uint256 subAccountFrom; | ||||
| 		uint256 subAccountTo; | ||||
| 		address buyAddr; | ||||
| 		address sellAddr; | ||||
| 		uint256 sellAmt; | ||||
| 		uint256 unitAmt; | ||||
| 		bytes callData; | ||||
| 	} | ||||
| 
 | ||||
| 	/** | ||||
| 	 * @dev Get Enetered markets for a user | ||||
| 	 */ | ||||
| 	function getEnteredMarkets() | ||||
| 		internal | ||||
| 		view | ||||
| 		returns (address[] memory enteredMarkets) | ||||
| 	{ | ||||
| 		enteredMarkets = markets.getEnteredMarkets(address(this)); | ||||
| 	} | ||||
| 
 | ||||
| 	/** | ||||
| 	 * @dev Get sub account address | ||||
| 	 * @param primary address of user | ||||
| 	 * @param subAccountId subAccount ID | ||||
| 	 * @param subAccountId sub-account id | ||||
| 	 */ | ||||
| 	function getSubAccount(address primary, uint256 subAccountId) | ||||
| 		public | ||||
|  | @ -57,12 +25,26 @@ contract Helpers is Basic, Events { | |||
| 		return address(uint160(primary) ^ uint160(subAccountId)); | ||||
| 	} | ||||
| 
 | ||||
| 	/** | ||||
| 	 * @dev Get Enetered markets for a user | ||||
| 	 * @param subAccountId sub-account id | ||||
| 	 */ | ||||
| 	function getEnteredMarkets(uint256 subAccountId) | ||||
| 		internal | ||||
| 		view | ||||
| 		returns (address[] memory enteredMarkets) | ||||
| 	{ | ||||
| 		address _subAccountAddress = getSubAccount(address(this), subAccountId); | ||||
| 		enteredMarkets = markets.getEnteredMarkets(_subAccountAddress); | ||||
| 	} | ||||
| 
 | ||||
| 	/** | ||||
| 	 * @dev Check if the market is entered | ||||
| 	 * @param subAccountId sub-account id | ||||
| 	 * @param token token address | ||||
| 	 */ | ||||
| 	function checkIfEnteredMarket(address token) public view returns (bool) { | ||||
| 		address[] memory enteredMarkets = getEnteredMarkets(); | ||||
| 	function checkIfEnteredMarket(uint256 subAccountId, address token) public view returns (bool) { | ||||
| 		address[] memory enteredMarkets = getEnteredMarkets(subAccountId); | ||||
| 		uint256 length = enteredMarkets.length; | ||||
| 
 | ||||
| 		for (uint256 i = 0; i < length; i++) { | ||||
|  |  | |||
|  | @ -36,6 +36,8 @@ interface IEulerEToken { | |||
| 
 | ||||
| 	function balanceOf(address account) external view returns (uint256); | ||||
| 
 | ||||
| 	function balanceOfUnderlying(address account) external view returns (uint); | ||||
| 
 | ||||
| 	function transferFrom(address from, address to, uint amount) external returns (bool); | ||||
| 
 | ||||
| 	function approve(address spender, uint256 amount) external returns (bool); | ||||
|  | @ -63,17 +65,3 @@ interface IEulerDToken { | |||
| 		uint256 amount | ||||
| 	) external returns (bool); | ||||
| } | ||||
| 
 | ||||
| struct Swap1InchParams { | ||||
| 		uint256 subAccountIdIn; | ||||
| 		uint256 subAccountIdOut; | ||||
| 		address underlyingIn; | ||||
| 		address underlyingOut; | ||||
| 		uint256 amount; | ||||
| 		uint256 amountOutMinimum; | ||||
| 		bytes payload; | ||||
| } | ||||
| 
 | ||||
| interface IEulerSwap { | ||||
| 	function swap1Inch(Swap1InchParams memory) external; | ||||
| } | ||||
|  |  | |||
|  | @ -95,7 +95,9 @@ abstract contract Euler is Helpers { | |||
| 
 | ||||
| 		TokenInterface tokenContract = TokenInterface(_token); | ||||
| 		IEulerEToken eToken = IEulerEToken(markets.underlyingToEToken(_token)); | ||||
| 		_amt = _amt == uint256(-1) ?  eToken.balanceOf(address(this)) : _amt; | ||||
| 
 | ||||
| 		address _subAccount = getSubAccount(address(this), subAccount); | ||||
| 		_amt = _amt == uint256(-1) ?  eToken.balanceOfUnderlying(_subAccount) : _amt; | ||||
| 		uint256 initialBal = tokenContract.balanceOf(address(this)); | ||||
| 
 | ||||
| 		eToken.withdraw(subAccount, _amt); | ||||
|  | @ -178,7 +180,8 @@ abstract contract Euler is Helpers { | |||
| 			markets.underlyingToDToken(_token) | ||||
| 		); | ||||
| 
 | ||||
| 		_amt = _amt == uint256(-1) ? borrowedDToken.balanceOf(address(this)) : _amt; | ||||
| 		address _subAccount = getSubAccount(address(this), subAccount); | ||||
| 		_amt = _amt == uint256(-1) ? borrowedDToken.balanceOf(_subAccount) : _amt; | ||||
| 		if (isEth) { | ||||
| 			convertEthToWeth(isEth, TokenInterface(_token), _amt); | ||||
| 		} | ||||
|  | @ -256,9 +259,15 @@ abstract contract Euler is Helpers { | |||
| 		IEulerDToken dToken = IEulerDToken(markets.underlyingToDToken(_token)); | ||||
| 		IEulerEToken eToken = IEulerEToken(markets.underlyingToEToken(_token)); | ||||
| 
 | ||||
| 		_amt = _amt == type(uint256).max | ||||
| 			? dToken.balanceOf(address(this)) | ||||
| 			: _amt; | ||||
| 		address _subAccount = getSubAccount(address(this), subAccount); | ||||
| 
 | ||||
| 		if(_amt == uint256(-1)) { | ||||
| 
 | ||||
| 			uint256 _eTokenBalance = eToken.balanceOfUnderlying(_subAccount); | ||||
| 			uint256 _dTokenBalance = dToken.balanceOf(_subAccount); | ||||
| 
 | ||||
| 			_amt = _eTokenBalance <= _dTokenBalance ? _eTokenBalance : _dTokenBalance; | ||||
| 		} | ||||
| 
 | ||||
| 		if (isEth) convertEthToWeth(isEth, TokenInterface(_token), _amt); | ||||
| 
 | ||||
|  | @ -299,15 +308,15 @@ abstract contract Euler is Helpers { | |||
| 
 | ||||
| 		IEulerEToken eToken = IEulerEToken(markets.underlyingToEToken(_token)); | ||||
| 
 | ||||
| 		address _subAccountFromAddr = getSubAccount(address(this), subAccountFrom); | ||||
| 		address _subAccountToAddr = getSubAccount(address(this), subAccountTo); | ||||
| 
 | ||||
| 		_amt = _amt == uint256(-1) | ||||
| 			? eToken.balanceOf(address(this)) | ||||
| 			? eToken.balanceOf(_subAccountFromAddr) | ||||
| 			: _amt; | ||||
| 
 | ||||
| 		if (isEth) convertEthToWeth(isEth, TokenInterface(_token), _amt); | ||||
| 
 | ||||
| 		address _subAccountFromAddr = getSubAccount(address(this), subAccountFrom); | ||||
| 		address _subAccountToAddr = getSubAccount(address(this), subAccountTo); | ||||
| 
 | ||||
| 		eToken.transferFrom(_subAccountFromAddr, _subAccountToAddr, _amt); | ||||
| 
 | ||||
| 		setUint(setId, _amt); | ||||
|  | @ -352,14 +361,15 @@ abstract contract Euler is Helpers { | |||
| 
 | ||||
| 		IEulerDToken dToken = IEulerDToken(markets.underlyingToDToken(_token)); | ||||
| 
 | ||||
| 		address _subAccountFromAddr = getSubAccount(address(this), subAccountFrom); | ||||
| 		address _subAccountToAddr = getSubAccount(address(this), subAccountTo); | ||||
| 
 | ||||
| 		_amt = _amt == uint256(-1) | ||||
| 			? dToken.balanceOf(address(this)) | ||||
| 			? dToken.balanceOf(_subAccountFromAddr) | ||||
| 			: _amt; | ||||
| 
 | ||||
| 		if (isEth) convertEthToWeth(isEth, TokenInterface(_token), _amt); | ||||
| 
 | ||||
| 		address _subAccountFromAddr = getSubAccount(address(this), subAccountFrom); | ||||
| 		address _subAccountToAddr = getSubAccount(address(this), subAccountTo); | ||||
| 		dToken.transferFrom(_subAccountFromAddr, _subAccountToAddr, _amt); | ||||
| 
 | ||||
| 		setUint(setId, _amt); | ||||
|  | @ -376,105 +386,37 @@ abstract contract Euler is Helpers { | |||
| 	} | ||||
| 
 | ||||
| 	/** | ||||
| 	 * @dev Approve debt. | ||||
| 	 * @notice Approves receiver to take debt. | ||||
| 	 * @param subAccountId Subaccount number | ||||
| 	 * @param debtReceiver Address of receiver | ||||
| 	 * @param token The address of the token to mint.(For ETH: 0xEeeeeEeeeEeEeeEeEeEeeEEEeeeeEeeeeeeeEEeE) | ||||
| 	 * @param amt The amount of the token to mint. | ||||
| 	 * @param getId ID to retrieve amt. | ||||
| 	 * @dev Approve Spender's debt. | ||||
| 	 * @notice Approve sender to send debt. | ||||
| 	 * @param subAccountId Subaccount id of receiver | ||||
| 	 * @param debtSender Address of sender | ||||
| 	 * @param token The address of the token.(For ETH: 0xEeeeeEeeeEeEeeEeEeEeeEEEeeeeEeeeeeeeEEeE) | ||||
| 	 * @param amt The amount of the token. | ||||
| 	 * @param setId ID stores the amount of tokens deposited. | ||||
| 	 */ | ||||
| 	function approveDebt( | ||||
| 	function approveSpenderDebt( | ||||
| 		uint256 subAccountId, | ||||
| 		address debtReceiver, | ||||
| 		address debtSender, | ||||
| 		address token, | ||||
| 		uint256 amt, | ||||
| 		uint256 getId, | ||||
| 		uint256 setId | ||||
| 	) | ||||
| 		external | ||||
| 		payable | ||||
| 		returns (string memory _eventName, bytes memory _eventParam) | ||||
| 	{ | ||||
| 		uint256 _amt = getUint(getId, amt); | ||||
| 
 | ||||
| 		bool isEth = token == ethAddr; | ||||
| 		address _token = isEth ? wethAddr : token; | ||||
| 
 | ||||
| 		IEulerDToken dToken = IEulerDToken(markets.underlyingToDToken(_token)); | ||||
| 
 | ||||
| 		dToken.approveDebt(subAccountId, debtReceiver, _amt); | ||||
| 		dToken.approveDebt(subAccountId, debtSender, amt); | ||||
| 
 | ||||
| 		setUint(setId, _amt); | ||||
| 		setUint(setId, amt); | ||||
| 
 | ||||
| 		_eventName = "LogApproveDebt(uint256,address,address,uint256)"; | ||||
| 		_eventParam = abi.encode(subAccountId, debtReceiver, token, _amt); | ||||
| 	} | ||||
| 
 | ||||
| 	/** | ||||
| 	 * @dev Swap. | ||||
| 	 * @notice Executes swap. | ||||
| 	 * @param params swapParams struct | ||||
| 	 */ | ||||
| 	function swap(swapParams memory params) | ||||
| 		external | ||||
| 		payable | ||||
| 		returns (string memory _eventName, bytes memory _eventParam) | ||||
| 	{ | ||||
| 		swapHelper memory helperParams; | ||||
| 
 | ||||
| 		helperParams._sellAddr = params.sellAddr == ethAddr | ||||
| 			? wethAddr | ||||
| 			: params.sellAddr; | ||||
| 		helperParams._buyAddr = params.sellAddr == ethAddr | ||||
| 			? wethAddr | ||||
| 			: params.buyAddr; | ||||
| 
 | ||||
| 		TokenInterface sellToken = TokenInterface(helperParams._sellAddr); | ||||
| 		TokenInterface buyToken = TokenInterface(helperParams._buyAddr); | ||||
| 
 | ||||
| 		approve(sellToken, address(swapExec), params.sellAmt); | ||||
| 
 | ||||
| 		(helperParams._buyDec, helperParams._sellDec) = getTokensDec( | ||||
| 			buyToken, | ||||
| 			sellToken | ||||
| 		); | ||||
| 		helperParams._sellAmt18 = convertTo18( | ||||
| 			helperParams._sellDec, | ||||
| 			params.sellAmt | ||||
| 		); | ||||
| 		helperParams._slippageAmt = convert18ToDec( | ||||
| 			helperParams._buyDec, | ||||
| 			wmul(params.unitAmt, helperParams._sellAmt18) | ||||
| 		); | ||||
| 
 | ||||
| 		Swap1InchParams memory oneInchParams = Swap1InchParams({ | ||||
| 				subAccountIdIn: params.subAccountFrom, | ||||
| 				subAccountIdOut: params.subAccountTo, | ||||
| 				underlyingIn: helperParams._sellAddr, | ||||
| 				underlyingOut: helperParams._buyAddr, | ||||
| 				amount: params.sellAmt, | ||||
| 				amountOutMinimum: helperParams._slippageAmt, | ||||
| 				payload: params.callData | ||||
| 			}); | ||||
| 
 | ||||
| 		swapExec.swap1Inch(oneInchParams); | ||||
| 
 | ||||
| 		if (!checkIfEnteredMarket(helperParams._buyAddr)) { | ||||
| 			markets.enterMarket(params.subAccountTo, helperParams._buyAddr); | ||||
| 		} | ||||
| 
 | ||||
| 		_eventName = "LogSwap(uint256,uint256,address,address,uint256,uint256,bytes)"; | ||||
| 		_eventParam = abi.encode( | ||||
| 			params.subAccountFrom, | ||||
| 			params.subAccountTo, | ||||
| 			params.buyAddr, | ||||
| 			params.sellAddr, | ||||
| 			params.sellAmt, | ||||
| 			params.unitAmt, | ||||
| 			params.callData | ||||
| 		); | ||||
| 		_eventName = "LogApproveSpenderDebt(uint256,address,address,uint256,uint256)"; | ||||
| 		_eventParam = abi.encode(subAccountId, debtSender, token, amt, setId); | ||||
| 	} | ||||
| 
 | ||||
| 	/** | ||||
|  |  | |||
|  | @ -34,6 +34,13 @@ export const tokens = { | |||
|     name: "Wrapped Ether", | ||||
|     address: "0xC02aaA39b223FE8D0A0e5C4F27eAD9083C756Cc2", | ||||
|     decimals: 18 | ||||
|   }, | ||||
|   ens: { | ||||
|     type: "token", | ||||
|     symbol: "ENS", | ||||
|     name: "Etherem Name Services", | ||||
|     address: "0xC18360217D8F7Ab5e7c516566761Ea12Ce7F9D72", | ||||
|     decimals: 18 | ||||
|   } | ||||
| }; | ||||
| 
 | ||||
|  |  | |||
|  | @ -12,6 +12,24 @@ import { tokens } from "../../../scripts/tests/mainnet/tokens"; | |||
| const { ethers } = hre; | ||||
| import type { Signer, Contract } from "ethers"; | ||||
| 
 | ||||
| const USDC = '0xA0b86991c6218b36c1d19D4a2e9Eb0cE3606eB48' | ||||
| const ACC_USDC = '0xe78388b4ce79068e89bf8aa7f218ef6b9ab0e9d0' | ||||
| const Usdc = parseUnits('5000', 6) | ||||
| 
 | ||||
| const DAI = '0x6b175474e89094c44da98b954eedeac495271d0f' | ||||
| const ACC_DAI = '0xcd6Eb888e76450eF584E8B51bB73c76ffBa21FF2' | ||||
| const Dai = parseUnits('5000', 18) | ||||
| 
 | ||||
| const WETH = '0xC02aaA39b223FE8D0A0e5C4F27eAD9083C756Cc2' | ||||
| const ACC_WETH = '0x05547D4e1A2191B91510Ea7fA8555a2788C70030' | ||||
| const Weth = parseUnits('50', 18) | ||||
| 
 | ||||
| const token_usdc = new ethers.Contract( | ||||
|   USDC, | ||||
|   IERC20__factory.abi, | ||||
|   ethers.provider, | ||||
| ) | ||||
| 
 | ||||
| describe("Euler", function () { | ||||
|   const connectorName = "EULER-TEST-A"; | ||||
|   let connector: any; | ||||
|  | @ -21,18 +39,6 @@ describe("Euler", function () { | |||
|   let instaConnectorsV2: Contract; | ||||
|   let masterSigner: Signer; | ||||
| 
 | ||||
|   const USDC = '0xA0b86991c6218b36c1d19D4a2e9Eb0cE3606eB48' | ||||
|   const ACC_USDC = '0xe78388b4ce79068e89bf8aa7f218ef6b9ab0e9d0' | ||||
|   const Usdc = parseUnits('5000', 6) | ||||
| 
 | ||||
|   const DAI = '0x6b175474e89094c44da98b954eedeac495271d0f' | ||||
|   const ACC_DAI = '0xcd6Eb888e76450eF584E8B51bB73c76ffBa21FF2' | ||||
|   const Dai = parseUnits('5000', 18) | ||||
| 
 | ||||
|   const WETH = '0xC02aaA39b223FE8D0A0e5C4F27eAD9083C756Cc2' | ||||
|   const ACC_WETH = '0x05547D4e1A2191B91510Ea7fA8555a2788C70030' | ||||
|   const Weth = parseUnits('50', 18) | ||||
| 
 | ||||
|   before(async () => { | ||||
|     await hre.network.provider.request({ | ||||
|       method: "hardhat_reset", | ||||
|  | @ -84,11 +90,6 @@ describe("Euler", function () { | |||
|     }); | ||||
| 
 | ||||
|     it("Deposit USDC into DSA wallet", async function () { | ||||
|       const token_usdc = new ethers.Contract( | ||||
|           USDC, | ||||
|           IERC20__factory.abi, | ||||
|           ethers.provider, | ||||
|       ) | ||||
| 
 | ||||
|       await hre.network.provider.request({ | ||||
|           method: 'hardhat_impersonateAccount', | ||||
|  | @ -171,7 +172,7 @@ describe("Euler", function () { | |||
|           { | ||||
|             connector: connectorName, | ||||
|             method: "deposit", | ||||
|             args: ["0", tokens.usdc.address, "10000000", "true", "0", "0"], | ||||
|             args: ["0", tokens.usdc.address, "10000000", "true", "0", "0"], // 10 USDC
 | ||||
|           }, | ||||
|         ]; | ||||
| 
 | ||||
|  | @ -187,7 +188,7 @@ describe("Euler", function () { | |||
|         { | ||||
|           connector: connectorName, | ||||
|           method: "deposit", | ||||
|           args: ["1", tokens.usdc.address, "10000000", "true", "0", "0"], | ||||
|           args: ["1", tokens.usdc.address, "10000000", "true", "0", "0"], // 10 USDC
 | ||||
|         }, | ||||
|       ]; | ||||
| 
 | ||||
|  | @ -205,7 +206,7 @@ describe("Euler", function () { | |||
|           { | ||||
|             connector: connectorName, | ||||
|             method: "borrow", | ||||
|             args: ["0", tokens.dai.address, "1000000000000000000", "0", "0"], | ||||
|             args: ["0", tokens.dai.address, "1000000000000000000", "0", "0"], // 1 DAI
 | ||||
|           }, | ||||
|         ]; | ||||
| 
 | ||||
|  | @ -223,7 +224,7 @@ describe("Euler", function () { | |||
|         { | ||||
|           connector: connectorName, | ||||
|           method: "repay", | ||||
|           args: ["0", tokens.dai.address, "500000000000000000", "0", "0"], | ||||
|           args: ["0", tokens.dai.address, "500000000000000000", "0", "0"], // 0.5 DAI
 | ||||
|         }, | ||||
|       ]; | ||||
| 
 | ||||
|  | @ -242,7 +243,7 @@ describe("Euler", function () { | |||
|         { | ||||
|           connector: connectorName, | ||||
|           method: "withdraw", | ||||
|           args: ["0", tokens.usdc.address, "2000000", "0", "0"], | ||||
|           args: ["0", tokens.usdc.address, "2000000", "0", "0"], // 2 USDC
 | ||||
|         }, | ||||
|       ]; | ||||
| 
 | ||||
|  | @ -251,6 +252,9 @@ describe("Euler", function () { | |||
|           .cast(...encodeSpells(spells), wallet1.getAddress()); | ||||
| 
 | ||||
|       await tx.wait(); | ||||
|       expect(await token_usdc.connect(masterSigner).balanceOf(dsaWallet0.address)).to.be.gte( | ||||
|         parseUnits('2', 6) | ||||
|       ); | ||||
|     }) | ||||
| 
 | ||||
|     it("Should borrow ENS into DSA wallet sub-account 1", async function () { | ||||
|  | @ -408,8 +412,8 @@ describe("Euler", function () { | |||
|       const spell = [ | ||||
|         { | ||||
|           connector: connectorName, | ||||
|           method: "approveDebt", | ||||
|           args: ["0", "0x9F60699cE23f1Ab86Ec3e095b477Ff79d4f409AD", tokens.dai.address, "10000000", "0", "0"], | ||||
|           method: "approveSpenderDebt", | ||||
|           args: ["0", "0x85c2ac24a8BD9Ff6E2Ef6cf76C198E36550f41D7", tokens.dai.address, "10000000", "0"], | ||||
|         }, | ||||
|       ]; | ||||
| 
 | ||||
|  | @ -458,7 +462,7 @@ describe("Euler", function () { | |||
|         { | ||||
|           connector: connectorName, | ||||
|           method: "deposit", | ||||
|           args: ["3", tokens.weth.address, "1000000000000000000", "true", "0", "0"], | ||||
|           args: ["3", tokens.dai.address, "1000000000000000000", "true", "0", "0"], | ||||
|         }, | ||||
|       ]; | ||||
| 
 | ||||
|  | @ -488,7 +492,39 @@ describe("Euler", function () { | |||
|         { | ||||
|           connector: connectorName, | ||||
|           method: "burn", | ||||
|           args: ["3", tokens.weth.address, "10000000", "0", "0"], | ||||
|           args: ["3", tokens.weth.address, "115792089237316195423570985008687907853269984665640564039457584007913129639935", "0", "0"], | ||||
|         }, | ||||
|       ]; | ||||
| 
 | ||||
|       const txn = await dsaWallet0 | ||||
|           .connect(wallet0) | ||||
|           .cast(...encodeSpells(spell), wallet1.getAddress()); | ||||
| 
 | ||||
|       await txn.wait(); | ||||
|     }) | ||||
| 
 | ||||
|     it("Should deposit in sub account 4", async function () { | ||||
| 
 | ||||
|       const spells = [ | ||||
|         { | ||||
|           connector: connectorName, | ||||
|           method: "deposit", | ||||
|           args: ["4", tokens.weth.address, "1000000000000000000", "true", "0", "0"], | ||||
|         }, | ||||
|       ]; | ||||
| 
 | ||||
|       const tx = await dsaWallet0 | ||||
|           .connect(wallet0) | ||||
|           .cast(...encodeSpells(spells), wallet1.getAddress()); | ||||
| 
 | ||||
|       await tx.wait(); | ||||
|     }) | ||||
|     it("Should withdraw from sub account 4", async function () { | ||||
|       const spell = [ | ||||
|         { | ||||
|           connector: connectorName, | ||||
|           method: "withdraw", | ||||
|           args: ["4", tokens.weth.address, "115792089237316195423570985008687907853269984665640564039457584007913129639935", "0", "0"], | ||||
|         }, | ||||
|       ]; | ||||
| 
 | ||||
|  |  | |||
		Loading…
	
		Reference in New Issue
	
	Block a user
	 Shriya Tyagi
						Shriya Tyagi