linted code

This commit is contained in:
Richa-iitr 2022-04-04 02:01:04 +05:30
parent bc12131ccf
commit b859ad49e6
3 changed files with 72 additions and 52 deletions

View File

@ -239,8 +239,16 @@ contract AaveHelpers is Helper {
bytes32[] memory s, bytes32[] memory s,
uint256[] memory expiry uint256[] memory expiry
) internal { ) internal {
for(uint256 i = 0; i < tokens.length; i++) { for (uint256 i = 0; i < tokens.length; i++) {
aTokenContracts[i].permit(userAccount, address(this), uint(-1), expiry[i], v[i], r[i], s[i]); aTokenContracts[i].permit(
userAccount,
address(this),
uint256(-1),
expiry[i],
v[i],
r[i],
s[i]
);
} }
} }

View File

@ -111,12 +111,20 @@ contract AaveV3ImportPermitResolver is AaveHelpers {
* @param inputData The struct containing all the neccessary input data * @param inputData The struct containing all the neccessary input data
* @param permitData The struct containing signed permit data like v,r,s,expiry * @param permitData The struct containing signed permit data like v,r,s,expiry
*/ */
function importAave(address userAccount, ImportInputData memory inputData, signedPermits memory permitData) function importAave(
address userAccount,
ImportInputData memory inputData,
signedPermits memory permitData
)
external external
payable payable
returns (string memory _eventName, bytes memory _eventParam) returns (string memory _eventName, bytes memory _eventParam)
{ {
(_eventName, _eventParam) = _importAave(userAccount, inputData, permitData); (_eventName, _eventParam) = _importAave(
userAccount,
inputData,
permitData
);
} }
} }

View File

@ -31,83 +31,83 @@ const mnemonic = "test test test test test test test test test test test junk";
const erc20Abi = [ const erc20Abi = [
{ {
"constant": false, constant: false,
"inputs": [ inputs: [
{ {
"name": "_spender", name: "_spender",
"type": "address" type: "address"
}, },
{ {
"name": "_value", name: "_value",
"type": "uint256" type: "uint256"
} }
], ],
"name": "approve", name: "approve",
"outputs": [ outputs: [
{ {
"name": "", name: "",
"type": "bool" type: "bool"
} }
], ],
"payable": false, payable: false,
"stateMutability": "nonpayable", stateMutability: "nonpayable",
"type": "function" type: "function"
}, },
{ {
"constant": true, constant: true,
"inputs": [], inputs: [],
"name": "totalSupply", name: "totalSupply",
"outputs": [ outputs: [
{ {
"name": "", name: "",
"type": "uint256" type: "uint256"
} }
], ],
"payable": false, payable: false,
"stateMutability": "view", stateMutability: "view",
"type": "function" type: "function"
}, },
{ {
"constant": true, constant: true,
"inputs": [ inputs: [
{ {
"name": "_owner", name: "_owner",
"type": "address" type: "address"
} }
], ],
"name": "balanceOf", name: "balanceOf",
"outputs": [ outputs: [
{ {
"name": "balance", name: "balance",
"type": "uint256" type: "uint256"
} }
], ],
"payable": false, payable: false,
"stateMutability": "view", stateMutability: "view",
"type": "function" type: "function"
}, },
{ {
"constant": false, constant: false,
"inputs": [ inputs: [
{ {
"name": "_to", name: "_to",
"type": "address" type: "address"
}, },
{ {
"name": "_value", name: "_value",
"type": "uint256" type: "uint256"
} }
], ],
"name": "transfer", name: "transfer",
"outputs": [ outputs: [
{ {
"name": "", name: "",
"type": "bool" type: "bool"
} }
], ],
"payable": false, payable: false,
"stateMutability": "nonpayable", stateMutability: "nonpayable",
"type": "function" type: "function"
} }
]; ];
@ -304,7 +304,7 @@ describe("Import Aave", function () {
it("Should migrate Aave position", async () => { it("Should migrate Aave position", async () => {
const DOMAIN_SEPARATOR = await aDai.connect(wallet0).DOMAIN_SEPARATOR(); const DOMAIN_SEPARATOR = await aDai.connect(wallet0).DOMAIN_SEPARATOR();
const PERMIT_TYPEHASH = "0x6e71edae12b1b97f4d1f60370fef10105fa2faae0126114a169c64845d6126c9"; const PERMIT_TYPEHASH = "0x6e71edae12b1b97f4d1f60370fef10105fa2faae0126114a169c64845d6126c9";
let nonce = (await aDai.connect(wallet0).nonces(wallet.address)).toNumber(); let nonce = (await aDai.connect(wallet0).nonces(wallet.address)).toNumber();
//Approving max amount //Approving max amount
const amount = ethers.constants.MaxUint256; const amount = ethers.constants.MaxUint256;
@ -335,7 +335,11 @@ describe("Import Aave", function () {
{ {
connector: "AAVE-V3-IMPORT-PERMIT-X", connector: "AAVE-V3-IMPORT-PERMIT-X",
method: "importAave", method: "importAave",
args: [wallet.address, [[DAI], [USDC], false, [amountB.toFixed(0)]], [[ethers.utils.hexlify(v)], [ethers.utils.hexlify(r)], [ethers.utils.hexlify(s)], [expiry]]] args: [
wallet.address,
[[DAI], [USDC], false, [amountB.toFixed(0)]],
[[ethers.utils.hexlify(v)], [ethers.utils.hexlify(r)], [ethers.utils.hexlify(s)], [expiry]]
]
}, },
{ {
connector: "INSTAPOOL-C", connector: "INSTAPOOL-C",