Skip to content

Commit

Permalink
lint
Browse files Browse the repository at this point in the history
  • Loading branch information
maceip committed Mar 8, 2024
1 parent dbfc815 commit 7b828ef
Show file tree
Hide file tree
Showing 12 changed files with 55 additions and 80 deletions.
12 changes: 6 additions & 6 deletions deploy/001_deploy_simple_erc20.ts
Original file line number Diff line number Diff line change
@@ -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,
Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -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",
Expand Down
10 changes: 3 additions & 7 deletions scripts/directTransfer.ts
Original file line number Diff line number Diff line change
@@ -1,30 +1,26 @@
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);
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);
}
Expand Down
15 changes: 3 additions & 12 deletions scripts/getBalance.ts
Original file line number Diff line number Diff line change
@@ -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);
Expand All @@ -27,23 +27,20 @@ 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');

const benefactor = await ethers.getSigner(deployer);
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);
Expand All @@ -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);
Expand All @@ -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()
Expand Down
11 changes: 5 additions & 6 deletions scripts/offramp.ts
Original file line number Diff line number Diff line change
@@ -1,14 +1,14 @@
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);
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');
Expand All @@ -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()
Expand Down
18 changes: 8 additions & 10 deletions scripts/onramp.ts
Original file line number Diff line number Diff line change
@@ -1,14 +1,14 @@
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);
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');
Expand All @@ -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()
Expand Down
6 changes: 3 additions & 3 deletions scripts/seed.ts
Original file line number Diff line number Diff line change
@@ -1,12 +1,12 @@
import { getUnnamedAccounts, ethers } from 'hardhat';
import {getUnnamedAccounts, ethers} from 'hardhat';

const messages = ['Hello', '你好', 'سلام', 'здравствуйте', 'Habari', 'Bonjour', 'नमस्ते'];

async function waitFor<T>(p: Promise<{ wait: () => Promise<T> }>): Promise<T> {
async function waitFor<T>(p: Promise<{wait: () => Promise<T>}>): Promise<T> {
const tx = await p;
try {
await ethers.provider.send('evm_mine', []); // speed up on local network
} catch (e) { }
} catch (e) {}
return tx.wait();
}

Expand Down
16 changes: 5 additions & 11 deletions scripts/setMessage.ts
Original file line number Diff line number Diff line change
@@ -1,27 +1,21 @@
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);
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
Expand Down
7 changes: 3 additions & 4 deletions scripts/transferERC20.ts
Original file line number Diff line number Diff line change
@@ -1,14 +1,14 @@
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);
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);

Expand All @@ -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'));
}
Expand Down
6 changes: 3 additions & 3 deletions scripts/withdrawDeposit.ts
Original file line number Diff line number Diff line change
@@ -1,14 +1,14 @@
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);
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);

Expand Down
4 changes: 1 addition & 3 deletions src/Interfaces/IERC2612.sol
Original file line number Diff line number Diff line change
Expand Up @@ -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 {}
28 changes: 14 additions & 14 deletions utils/network.ts
Original file line number Diff line number Diff line change
@@ -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()];
Expand Down Expand Up @@ -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 {
Expand Down Expand Up @@ -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,
},
},
Expand Down

0 comments on commit 7b828ef

Please sign in to comment.