From 7b828ef459d8a924131a304981ccda23edfdef40 Mon Sep 17 00:00:00 2001 From: maceip Date: Thu, 7 Mar 2024 20:55:37 -0400 Subject: [PATCH] lint --- deploy/001_deploy_simple_erc20.ts | 12 ++++++------ package.json | 2 +- scripts/directTransfer.ts | 10 +++------- scripts/getBalance.ts | 15 +++------------ scripts/offramp.ts | 11 +++++------ scripts/onramp.ts | 18 ++++++++---------- scripts/seed.ts | 6 +++--- scripts/setMessage.ts | 16 +++++----------- scripts/transferERC20.ts | 7 +++---- scripts/withdrawDeposit.ts | 6 +++--- src/Interfaces/IERC2612.sol | 4 +--- utils/network.ts | 28 ++++++++++++++-------------- 12 files changed, 55 insertions(+), 80 deletions(-) diff --git a/deploy/001_deploy_simple_erc20.ts b/deploy/001_deploy_simple_erc20.ts index ce5d3ed..417e611 100644 --- a/deploy/001_deploy_simple_erc20.ts +++ b/deploy/001_deploy_simple_erc20.ts @@ -1,12 +1,12 @@ -import { HardhatRuntimeEnvironment } from 'hardhat/types'; -import { DeployFunction } from 'hardhat-deploy/types'; -import { parseEther } from 'ethers'; +import {HardhatRuntimeEnvironment} from 'hardhat/types'; +import {DeployFunction} from 'hardhat-deploy/types'; +import {parseEther} from 'ethers'; const func: DeployFunction = async function (hre: HardhatRuntimeEnvironment) { - const { deployments, getNamedAccounts } = hre; - const { deploy } = deployments; + const {deployments, getNamedAccounts} = hre; + const {deploy} = deployments; - const { deployer, simpleERC20Beneficiary, simpleOffchainVerifier } = await getNamedAccounts(); + const {deployer, simpleERC20Beneficiary, simpleOffchainVerifier} = await getNamedAccounts(); await deploy('SimpleERC20', { from: deployer, diff --git a/package.json b/package.json index b2bc1c7..f3af54b 100644 --- a/package.json +++ b/package.json @@ -37,7 +37,7 @@ "format:fix": "prettier --write \"**/*.{ts,js,sol}\"", "compile": "hardhat compile", "void:deploy": "hardhat deploy --report-gas", - "test": "cross-env HARDHAT_DEPLOY_FIXTURE=true HARDHAT_COMPILE=true mocha --bail --recursive test", + "test": "cross-env HARDHAT_DEPLOY_FIXTURE=true HARDHAT_COMPILE=true mocha --bail --recursive test --exit", "gas": "cross-env REPORT_GAS=true hardhat test", "coverage": "cross-env HARDHAT_DEPLOY_FIXTURE=true hardhat coverage", "dev:node": "cross-env MINING_INTERVAL=\"3000,5000\" hardhat node --hostname 0.0.0.0", diff --git a/scripts/directTransfer.ts b/scripts/directTransfer.ts index 36ed318..e87bf5a 100644 --- a/scripts/directTransfer.ts +++ b/scripts/directTransfer.ts @@ -1,6 +1,6 @@ -import { deployments, getNamedAccounts, getUnnamedAccounts, ethers } from 'hardhat'; +import {deployments, getNamedAccounts, getUnnamedAccounts, ethers} from 'hardhat'; -const { execute } = deployments; +const {execute} = deployments; // example script const args = process.argv.slice(2); @@ -8,23 +8,19 @@ const account = args[0]; const message = args[1]; async function main() { - const { owner, simpleOffchainVerifier, offRamper, onRamper } = await getNamedAccounts(); + const {owner, simpleOffchainVerifier, offRamper, onRamper} = await getNamedAccounts(); const simpleOffchainVerifierSigner = await ethers.getSigner(simpleOffchainVerifier); const bob = await ethers.getSigner(offRamper); const alice = await ethers.getSigner(onRamper); - console.log('simpleOffchainVerifier: ', simpleOffchainVerifier); console.log('bob.address: ', bob.address); console.log('DeRampVault.address: ', DeRampVault.address); - const erc20Deployment = await deployments.get('SimpleERC20'); const erc20ABI = await ethers.getContractFactory('SimpleERC20'); const deRampABI = await ethers.getContractFactory('DeRampVault'); - - const DeRampHandle = await deRampABI.connect(simpleOffchainVerifierSigner).attach(DeRampVault.address); const tx = await DeRampHandle.transferFrom(DeRampVault.address, alice.address, 100); } diff --git a/scripts/getBalance.ts b/scripts/getBalance.ts index 382b713..d7c4706 100644 --- a/scripts/getBalance.ts +++ b/scripts/getBalance.ts @@ -1,6 +1,6 @@ -import { deployments, getNamedAccounts, getUnnamedAccounts, ethers } from 'hardhat'; +import {deployments, getNamedAccounts, getUnnamedAccounts, ethers} from 'hardhat'; -const { execute } = deployments; +const {execute} = deployments; // example script const args = process.argv.slice(2); @@ -27,7 +27,7 @@ async function main() { console.log('deramp balance: ', supp2); */ - const { deployer, simpleOffchainVerifier, offRamper, onRamper } = await getNamedAccounts(); + const {deployer, simpleOffchainVerifier, offRamper, onRamper} = await getNamedAccounts(); const SimpleERC20Factory = await deployments.get('SimpleERC20'); const DeRampVault = await deployments.get('DeRampVault'); @@ -35,15 +35,12 @@ async function main() { const bobby = await ethers.getSigner(offRamper); const alice = await ethers.getSigner(onRamper); - const MyContract2 = await ethers.getContractFactory('SimpleERC20'); const DeRampVaultABI = await ethers.getContractFactory('DeRampVault'); - const USDCHandle = await MyContract2.connect(benefactor).attach(SimpleERC20Factory.address); const ReUSDCHandle = await DeRampVaultABI.connect(benefactor).attach(DeRampVault.address); - const supp2 = await USDCHandle.balanceOf(benefactor.address); const supp3 = await USDCHandle.balanceOf(bobby.address); const supp4 = await USDCHandle.balanceOf(alice.address); @@ -54,10 +51,6 @@ async function main() { const supp8 = await ReUSDCHandle.balanceOf(alice.address); const supp9 = await ReUSDCHandle.balanceOf(DeRampVault.address); - - - - console.log('---USDC BALANCES----'); console.log('usdc owner: ', benefactor.address, supp2); @@ -70,8 +63,6 @@ async function main() { console.log('offRamper balance: ', bobby.address, supp7); console.log('onRamper balance: ', alice.address, supp8); console.log('DeRampVault balance: ', DeRampVault.address, supp9); - - } main() diff --git a/scripts/offramp.ts b/scripts/offramp.ts index 477d721..045ed74 100644 --- a/scripts/offramp.ts +++ b/scripts/offramp.ts @@ -1,6 +1,6 @@ -import { deployments, getNamedAccounts, getUnnamedAccounts, ethers } from 'hardhat'; +import {deployments, getNamedAccounts, getUnnamedAccounts, ethers} from 'hardhat'; -const { execute } = deployments; +const {execute} = deployments; // example script const args = process.argv.slice(2); @@ -8,7 +8,7 @@ const account = args[0]; const message = args[1]; async function main() { - const { owner, simpleERC20Beneficiary, offRamper } = await getNamedAccounts(); + const {owner, simpleERC20Beneficiary, offRamper} = await getNamedAccounts(); const DeRampVault = await deployments.get('DeRampVault'); const erc = await deployments.get('SimpleERC20'); const erc20imp = await ethers.getContractFactory('SimpleERC20'); @@ -17,13 +17,12 @@ async function main() { const bob = await ethers.getSigner(offRamper); const erc20Handle = await erc20imp.connect(bob).attach(erc.address); const see = await erc20Handle.approve(DeRampVault.address, ethers.parseEther('1000000000')); - console.log("using erc20: ", erc.address); + console.log('using erc20: ', erc.address); const MyContract2 = await ethers.getContractFactory('DeRampVault'); const DeRampHandle = await MyContract2.connect(bob).attach(DeRampVault.address); //const supp2 = await DeRampHandle.deposit(ethers.parseEther(".05"), bob.address); - const supp2 = await DeRampHandle.offramp("revolut", "mac@revolut.com", 100, bob.address); - + const supp2 = await DeRampHandle.offramp('revolut', 'mac@revolut.com', 100, bob.address); } main() diff --git a/scripts/onramp.ts b/scripts/onramp.ts index 9582f99..79ab513 100644 --- a/scripts/onramp.ts +++ b/scripts/onramp.ts @@ -1,6 +1,6 @@ -import { deployments, getNamedAccounts, getUnnamedAccounts, ethers } from 'hardhat'; +import {deployments, getNamedAccounts, getUnnamedAccounts, ethers} from 'hardhat'; -const { execute } = deployments; +const {execute} = deployments; // example script const args = process.argv.slice(2); @@ -8,7 +8,7 @@ const account = args[0]; const message = args[1]; async function main() { - const { owner, simpleERC20Beneficiary, onRamper, offRamper, simpleOffchainVerifier } = await getNamedAccounts(); + const {owner, simpleERC20Beneficiary, onRamper, offRamper, simpleOffchainVerifier} = await getNamedAccounts(); const DeRampVault = await deployments.get('DeRampVault'); const erc = await deployments.get('SimpleERC20'); const erc20imp = await ethers.getContractFactory('SimpleERC20'); @@ -18,22 +18,20 @@ async function main() { const alice = await ethers.getSigner(onRamper); //const provider = new ethers.JsonRpcProvider("http://127.0.0.1:8545"); //const backendWallet = new ethers.Wallet("0xac0974bec39a17e36ba4a6b4d238ff944bacb478cbed5efcae784d7bf4f2ff80", provider); - const backend = await ethers.getSigner(simpleOffchainVerifier); + const backend = await ethers.getSigner(simpleOffchainVerifier); - console.log("offramper addy: ", bob.address); - console.log("onramper addy: ", alice.address); - - console.log("backend addy: ", backend); + console.log('offramper addy: ', bob.address); + console.log('onramper addy: ', alice.address); + console.log('backend addy: ', backend); const erc20Handle = await erc20imp.connect(bob).attach(erc.address); const see = await erc20Handle.approve(DeRampVault.address, ethers.parseEther('1000000000')); - console.log("using erc20: ", erc.address); + console.log('using erc20: ', erc.address); const MyContract2 = await ethers.getContractFactory('DeRampVault'); const DeRampHandle = await MyContract2.connect(backend).attach(DeRampVault.address); //const supp2 = await DeRampHandle.deposit(ethers.parseEther(".05"), bob.address); const supp2 = await DeRampHandle.onramp(10, bob.address, alice.address); - } main() diff --git a/scripts/seed.ts b/scripts/seed.ts index e4336c2..5ed683e 100644 --- a/scripts/seed.ts +++ b/scripts/seed.ts @@ -1,12 +1,12 @@ -import { getUnnamedAccounts, ethers } from 'hardhat'; +import {getUnnamedAccounts, ethers} from 'hardhat'; const messages = ['Hello', '你好', 'سلام', 'здравствуйте', 'Habari', 'Bonjour', 'नमस्ते']; -async function waitFor(p: Promise<{ wait: () => Promise }>): Promise { +async function waitFor(p: Promise<{wait: () => Promise}>): Promise { const tx = await p; try { await ethers.provider.send('evm_mine', []); // speed up on local network - } catch (e) { } + } catch (e) {} return tx.wait(); } diff --git a/scripts/setMessage.ts b/scripts/setMessage.ts index b975b14..0a6f033 100644 --- a/scripts/setMessage.ts +++ b/scripts/setMessage.ts @@ -1,5 +1,5 @@ -import { deployments, getNamedAccounts, getUnnamedAccounts } from 'hardhat'; -const { execute } = deployments; +import {deployments, getNamedAccounts, getUnnamedAccounts} from 'hardhat'; +const {execute} = deployments; // example script const args = process.argv.slice(2); @@ -7,21 +7,15 @@ const account = args[0]; const message = args[1]; async function main() { - const { owner, simpleERC20Beneficiary } = await getNamedAccounts(); + const {owner, simpleERC20Beneficiary} = await getNamedAccounts(); const accountAddress = isNaN(parseInt(account)) ? account : (await getUnnamedAccounts())[parseInt(account)]; const DeRampVault = await deployments.get('DeRampVault'); - await execute( - 'SimpleERC20', - { from: simpleERC20Beneficiary, log: true }, - 'approve', - DeRampVault.address, - 10000000 - ); + await execute('SimpleERC20', {from: simpleERC20Beneficiary, log: true}, 'approve', DeRampVault.address, 10000000); await execute( 'DeRampVault', - { from: simpleERC20Beneficiary, log: true }, + {from: simpleERC20Beneficiary, log: true}, 'deposit', 10000000, simpleERC20Beneficiary diff --git a/scripts/transferERC20.ts b/scripts/transferERC20.ts index b4cef48..c1cf986 100644 --- a/scripts/transferERC20.ts +++ b/scripts/transferERC20.ts @@ -1,6 +1,6 @@ -import { deployments, getNamedAccounts, getUnnamedAccounts, ethers } from 'hardhat'; +import {deployments, getNamedAccounts, getUnnamedAccounts, ethers} from 'hardhat'; -const { execute } = deployments; +const {execute} = deployments; // example script const args = process.argv.slice(2); @@ -8,7 +8,7 @@ const account = args[0]; const message = args[1]; async function main() { - const { deployer, simpleOffchainVerifier, offRamper } = await getNamedAccounts(); + const {deployer, simpleOffchainVerifier, offRamper} = await getNamedAccounts(); const benefactor = await ethers.getSigner(deployer); const bob = await ethers.getSigner(offRamper); @@ -19,7 +19,6 @@ async function main() { const erc20ABI = await ethers.getContractFactory('SimpleERC20'); - const DeRampHandle = await erc20ABI.connect(benefactor).attach(erc20Deployment.address); const tx = await DeRampHandle.transfer(bob.address, ethers.parseEther('10000')); } diff --git a/scripts/withdrawDeposit.ts b/scripts/withdrawDeposit.ts index 2bc8ef4..b8884b2 100644 --- a/scripts/withdrawDeposit.ts +++ b/scripts/withdrawDeposit.ts @@ -1,6 +1,6 @@ -import { deployments, getNamedAccounts, getUnnamedAccounts, ethers } from 'hardhat'; +import {deployments, getNamedAccounts, getUnnamedAccounts, ethers} from 'hardhat'; -const { execute } = deployments; +const {execute} = deployments; // example script const args = process.argv.slice(2); @@ -8,7 +8,7 @@ const account = args[0]; const message = args[1]; async function main() { - const { owner, simpleERC20Beneficiary, offRamper, simpleOffchainVerifier } = await getNamedAccounts(); + const {owner, simpleERC20Beneficiary, offRamper, simpleOffchainVerifier} = await getNamedAccounts(); const benefactor = await ethers.getSigner(simpleOffchainVerifier); const bob = await ethers.getSigner(offRamper); diff --git a/src/Interfaces/IERC2612.sol b/src/Interfaces/IERC2612.sol index e862c97..92e185c 100644 --- a/src/Interfaces/IERC2612.sol +++ b/src/Interfaces/IERC2612.sol @@ -6,6 +6,4 @@ import "@openzeppelin/contracts/token/ERC20/IERC20.sol"; import "./IERC2612Standalone.sol"; // solhint-disable-next-line no-empty-blocks -interface IERC2612 is IERC2612Standalone, IERC20 { - -} +interface IERC2612 is IERC2612Standalone, IERC20 {} diff --git a/utils/network.ts b/utils/network.ts index 088d446..8501800 100644 --- a/utils/network.ts +++ b/utils/network.ts @@ -1,5 +1,5 @@ import 'dotenv/config'; -import { HDAccountsUserConfig, HttpNetworkUserConfig, NetworksUserConfig } from 'hardhat/types'; +import {HDAccountsUserConfig, HttpNetworkUserConfig, NetworksUserConfig} from 'hardhat/types'; export function node_url(networkName: string): string { if (networkName) { const uri = process.env['ETH_NODE_URI_' + networkName.toUpperCase()]; @@ -42,8 +42,8 @@ export function getMnemonic(networkName?: string): string { return mnemonic; } -export function accounts(networkName?: string): { mnemonic: string } { - return { mnemonic: getMnemonic(networkName) }; +export function accounts(networkName?: string): {mnemonic: string} { + return {mnemonic: getMnemonic(networkName)}; } export function addForkConfiguration(networks: NetworksUserConfig): NetworksUserConfig { @@ -77,20 +77,20 @@ export function addForkConfiguration(networks: NetworksUserConfig): NetworksUser accounts: hardhatAccounts, forking: forkURL ? { - url: forkURL, - blockNumber: process.env.HARDHAT_FORK_NUMBER - ? parseInt(process.env.HARDHAT_FORK_NUMBER) - : undefined, - } + url: forkURL, + blockNumber: process.env.HARDHAT_FORK_NUMBER + ? parseInt(process.env.HARDHAT_FORK_NUMBER) + : undefined, + } : undefined, mining: process.env.MINING_INTERVAL ? { - auto: false, - interval: process.env.MINING_INTERVAL.split(',').map((v) => parseInt(v)) as [ - number, - number - ], - } + auto: false, + interval: process.env.MINING_INTERVAL.split(',').map((v) => parseInt(v)) as [ + number, + number + ], + } : undefined, }, },