Skip to content

Commit

Permalink
Merge pull request #83 from buttonwood-protocol/updating-prettier-config
Browse files Browse the repository at this point in the history
Updating prettier config
  • Loading branch information
SocksNFlops authored Mar 25, 2024
2 parents a4a0092 + 1ec4d8c commit 329a49c
Show file tree
Hide file tree
Showing 55 changed files with 2,964 additions and 2,879 deletions.
5 changes: 4 additions & 1 deletion .github/workflows/test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ jobs:
strategy:
matrix:
node-version: [16.20.2]
os: [macOS-latest, windows-latest, ubuntu-latest]
os: [ubuntu-latest]

steps:
- name: Setup Repo
Expand All @@ -37,6 +37,9 @@ jobs:
- name: Lint
run: yarn lint

- name: Format-Check
run: yarn format-check

- name: Compile
run: yarn compile

Expand Down
2 changes: 1 addition & 1 deletion .prettierrc
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
{
"semi": false,
"semi": true,
"trailingComma": "all",
"singleQuote": true,
"bracketSpacing": true,
Expand Down
24 changes: 12 additions & 12 deletions hardhat.config.ts
Original file line number Diff line number Diff line change
@@ -1,15 +1,15 @@
import './test/utils/loadDotEnv'
import { HardhatUserConfig } from 'hardhat/config'
import { Wallet } from 'ethers'
import '@nomiclabs/hardhat-ethers'
import '@nomiclabs/hardhat-waffle'
import '@openzeppelin/hardhat-upgrades'
import '@nomiclabs/hardhat-etherscan'
import 'solidity-coverage'
import 'hardhat-gas-reporter'
import './tasks'
import './test/utils/loadDotEnv';
import { HardhatUserConfig } from 'hardhat/config';
import { Wallet } from 'ethers';
import '@nomiclabs/hardhat-ethers';
import '@nomiclabs/hardhat-waffle';
import '@openzeppelin/hardhat-upgrades';
import '@nomiclabs/hardhat-etherscan';
import 'solidity-coverage';
import 'hardhat-gas-reporter';
import './tasks';

const DEFAULT_MNEMONIC = Wallet.createRandom().mnemonic.phrase
const DEFAULT_MNEMONIC = Wallet.createRandom().mnemonic.phrase;

export default {
etherscan: {
Expand Down Expand Up @@ -144,4 +144,4 @@ export default {
excludeContracts: ['mocks/'],
coinmarketcap: process.env.COINMARKETCAP_API_KEY,
},
} as HardhatUserConfig
} as HardhatUserConfig;
3 changes: 2 additions & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,8 @@
"test": "yarn hardhat test",
"profile": "REPORT_GAS=true yarn hardhat test test/unit/*.ts",
"coverage": "yarn hardhat coverage --testfiles 'test/unit/*.ts'",
"format": "yarn prettier --config .prettierrc --write '**/*.ts' 'contracts/**/*.sol'",
"format": "yarn prettier --config .prettierrc --write \"**/*.ts\" \"contracts/**/*.sol\"",
"format-check": "yarn prettier --config .prettierrc --check \"**/*.ts\" \"contracts/**/*.sol\"",
"lint": "yarn solhint 'contracts/**/*.sol'"
},
"pre-commit": [
Expand Down
10 changes: 5 additions & 5 deletions tasks/accounts.ts
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
import { Signer } from '@ethersproject/abstract-signer'
import { task } from 'hardhat/config'
import { Signer } from '@ethersproject/abstract-signer';
import { task } from 'hardhat/config';

task('accounts', 'Prints the list of accounts', async (_taskArgs, hre) => {
const accounts: Signer[] = await hre.ethers.getSigners()
const accounts: Signer[] = await hre.ethers.getSigners();

for (const account of accounts) {
console.log(await account.getAddress())
console.log(await account.getAddress());
}
})
});
14 changes: 7 additions & 7 deletions tasks/clean.ts
Original file line number Diff line number Diff line change
@@ -1,13 +1,13 @@
import fsExtra from 'fs-extra'
import { TASK_CLEAN } from 'hardhat/builtin-tasks/task-names'
import { task } from 'hardhat/config'
import fsExtra from 'fs-extra';
import { TASK_CLEAN } from 'hardhat/builtin-tasks/task-names';
import { task } from 'hardhat/config';

task(
TASK_CLEAN,
'Overrides the standard clean task',
async function (_taskArgs, _hre, runSuper) {
await fsExtra.remove('./coverage')
await fsExtra.remove('./coverage.json')
await runSuper()
await fsExtra.remove('./coverage');
await fsExtra.remove('./coverage.json');
await runSuper();
},
)
);
33 changes: 18 additions & 15 deletions tasks/deployers/ButtonTokenWamplRouter.ts
Original file line number Diff line number Diff line change
@@ -1,39 +1,42 @@
import { task, types } from 'hardhat/config'
import { TaskArguments } from 'hardhat/types'
import { task, types } from 'hardhat/config';
import { TaskArguments } from 'hardhat/types';

task('deploy:ButtonTokenWamplRouter')
.addParam('wampl', 'the address of wampl', undefined, types.string, false)
.setAction(async function (_args: TaskArguments, hre) {
const { wampl } = _args
console.log('Signer', await (await hre.ethers.getSigners())[0].getAddress())
const { wampl } = _args;
console.log(
'Signer',
await (await hre.ethers.getSigners())[0].getAddress(),
);
const ButtonTokenWamplRouter = await hre.ethers.getContractFactory(
'ButtonTokenWamplRouter',
)
const buttonTokenWamplRouter = await ButtonTokenWamplRouter.deploy(wampl)
await buttonTokenWamplRouter.deployed()
const buttonTokenWamplRouterAddress = buttonTokenWamplRouter.address
);
const buttonTokenWamplRouter = await ButtonTokenWamplRouter.deploy(wampl);
await buttonTokenWamplRouter.deployed();
const buttonTokenWamplRouterAddress = buttonTokenWamplRouter.address;
console.log(
`ButtonTokenWamplRouter deployed to ${buttonTokenWamplRouterAddress}`,
)
);

try {
await hre.run('verify:ButtonTokenWamplRouter', {
address: buttonTokenWamplRouterAddress,
wampl,
})
});
} catch (e) {
console.log('Unable to verify on etherscan', e)
console.log('Unable to verify on etherscan', e);
}
})
});

task('verify:ButtonTokenWamplRouter', 'Verifies on etherscan')
.addParam('address', 'the contract address', undefined, types.string, false)
.addParam('wampl', 'the address of wampl', undefined, types.string, false)
.setAction(async function (args: TaskArguments, hre) {
const { address, wampl } = args
const { address, wampl } = args;

await hre.run('verify:verify', {
address,
constructorArguments: [wampl],
})
})
});
});
33 changes: 18 additions & 15 deletions tasks/deployers/ButtonTokenWethRouter.ts
Original file line number Diff line number Diff line change
@@ -1,39 +1,42 @@
import { task, types } from 'hardhat/config'
import { TaskArguments } from 'hardhat/types'
import { task, types } from 'hardhat/config';
import { TaskArguments } from 'hardhat/types';

task('deploy:ButtonTokenWethRouter')
.addParam('weth', 'the address of weth', undefined, types.string, false)
.setAction(async function (_args: TaskArguments, hre) {
const { weth } = _args
console.log('Signer', await (await hre.ethers.getSigners())[0].getAddress())
const { weth } = _args;
console.log(
'Signer',
await (await hre.ethers.getSigners())[0].getAddress(),
);
const ButtonTokenWethRouter = await hre.ethers.getContractFactory(
'ButtonTokenWethRouter',
)
const buttonTokenWethRouter = await ButtonTokenWethRouter.deploy(weth)
await buttonTokenWethRouter.deployed()
const buttonTokenWethRouterAddress = buttonTokenWethRouter.address
);
const buttonTokenWethRouter = await ButtonTokenWethRouter.deploy(weth);
await buttonTokenWethRouter.deployed();
const buttonTokenWethRouterAddress = buttonTokenWethRouter.address;
console.log(
`ButtonTokenWethRouter deployed to ${buttonTokenWethRouterAddress}`,
)
);

try {
await hre.run('verify:ButtonTokenWethRouter', {
address: buttonTokenWethRouterAddress,
weth,
})
});
} catch (e) {
console.log('Unable to verify on etherscan', e)
console.log('Unable to verify on etherscan', e);
}
})
});

task('verify:ButtonTokenWethRouter', 'Verifies on etherscan')
.addParam('address', 'the contract address', undefined, types.string, false)
.addParam('weth', 'the address of weth', undefined, types.string, false)
.setAction(async function (args: TaskArguments, hre) {
const { address, weth } = args
const { address, weth } = args;

await hre.run('verify:verify', {
address,
constructorArguments: [weth],
})
})
});
});
65 changes: 34 additions & 31 deletions tasks/deployers/ankrETHOracle.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import { task, types } from 'hardhat/config'
import { HardhatRuntimeEnvironment, TaskArguments } from 'hardhat/types'
import { task, types } from 'hardhat/config';
import { HardhatRuntimeEnvironment, TaskArguments } from 'hardhat/types';

// ToDo: Change these
const prefilledArgs: Record<string, TaskArguments> = {
Expand All @@ -9,22 +9,22 @@ const prefilledArgs: Record<string, TaskArguments> = {
goerli: {
ankreth: '0x63dC5749fa134fF3B752813388a7215460a8aB01',
},
}
};

task('deploy:AnkrETHOracle:prefilled', 'Verifies on etherscan').setAction(
async function (args: TaskArguments, hre) {
console.log('chainId:', hre.network.config.chainId)
console.log('Network:', hre.network.name)
const prefilled = prefilledArgs[hre.network.name]
console.log('chainId:', hre.network.config.chainId);
console.log('Network:', hre.network.name);
const prefilled = prefilledArgs[hre.network.name];
if (!prefilled) {
throw new Error('Network not supported')
throw new Error('Network not supported');
}

const { ankreth } = prefilled
console.log('ankrETH Address:', ankreth)
await hre.run('deploy:AnkrETHOracle', { ankreth })
const { ankreth } = prefilled;
console.log('ankrETH Address:', ankreth);
await hre.run('deploy:AnkrETHOracle', { ankreth });
},
)
);

task('deploy:AnkrETHOracle')
.addParam(
Expand All @@ -35,42 +35,45 @@ task('deploy:AnkrETHOracle')
false,
)
.setAction(async function (args: TaskArguments, hre) {
const { ankreth } = args
console.log('Signer', await (await hre.ethers.getSigners())[0].getAddress())
const AnkrETHOracle = await hre.ethers.getContractFactory('AnkrETHOracle')
const ankrETHOracle = await AnkrETHOracle.deploy(ankreth)
await ankrETHOracle.deployed()
console.log(`AnkrETHOracle deployed to ${ankrETHOracle.address}`)
const { ankreth } = args;
console.log(
'Signer',
await (await hre.ethers.getSigners())[0].getAddress(),
);
const AnkrETHOracle = await hre.ethers.getContractFactory('AnkrETHOracle');
const ankrETHOracle = await AnkrETHOracle.deploy(ankreth);
await ankrETHOracle.deployed();
console.log(`AnkrETHOracle deployed to ${ankrETHOracle.address}`);

try {
await hre.run('verify:verify', {
address: ankrETHOracle.address,
constructorArguments: [ankreth],
})
});
} catch (e) {
console.log('Unable to verify on etherscan', e)
console.log('Unable to verify on etherscan', e);
}
})
});

task('verify:AnkrETHOracle:prefilled', 'Verifies on etherscan')
.addParam('address', 'the contract address', undefined, types.string, false)
.setAction(async function (args: TaskArguments, hre) {
console.log('chainId:', hre.network.config.chainId)
console.log('Network:', hre.network.name)
console.log('chainId:', hre.network.config.chainId);
console.log('Network:', hre.network.name);

const prefilled = prefilledArgs[hre.network.name]
const prefilled = prefilledArgs[hre.network.name];
if (!prefilled) {
throw new Error('Network not supported')
throw new Error('Network not supported');
}
const { ankreth } = prefilled
const { ankreth } = prefilled;

const { address } = args
const { address } = args;

await hre.run('verify:verify', {
address,
constructorArguments: [ankreth],
})
})
});
});

task('verify:AnkrETHOracle', 'Verifies on etherscan')
.addParam('address', 'the contract address', undefined, types.string, false)
Expand All @@ -82,10 +85,10 @@ task('verify:AnkrETHOracle', 'Verifies on etherscan')
false,
)
.setAction(async function (args: TaskArguments, hre) {
const { address, ankreth } = args
const { address, ankreth } = args;

await hre.run('verify:verify', {
address,
constructorArguments: [ankreth],
})
})
});
});
28 changes: 14 additions & 14 deletions tasks/deployers/api3Oracle.ts
Original file line number Diff line number Diff line change
@@ -1,37 +1,37 @@
import { task, types } from 'hardhat/config'
import { TaskArguments } from 'hardhat/types'
import { task, types } from 'hardhat/config';
import { TaskArguments } from 'hardhat/types';

task('deploy:API3Oracle')
.addParam('dapiproxy', 'the address of the underlying DapiProxy contract')
.addParam('stalenessthresholdsecs', 'the number of seconds before refresh')
.setAction(async function (args: TaskArguments, hre) {
const { dapiproxy, stalenessthresholdsecs } = args
const API3Oracle = await hre.ethers.getContractFactory('API3Oracle')
const oracle = await API3Oracle.deploy(dapiproxy, stalenessthresholdsecs)
await oracle.deployed()
const oracleAddress = oracle.address
console.log(`Oracle deployed to ${oracleAddress}`)
const { dapiproxy, stalenessthresholdsecs } = args;
const API3Oracle = await hre.ethers.getContractFactory('API3Oracle');
const oracle = await API3Oracle.deploy(dapiproxy, stalenessthresholdsecs);
await oracle.deployed();
const oracleAddress = oracle.address;
console.log(`Oracle deployed to ${oracleAddress}`);

try {
await hre.run('verify:API3Oracle', {
address: oracleAddress,
dapiproxy,
stalenessthresholdsecs,
})
});
} catch (e) {
console.log('Unable to verify on etherscan', e)
console.log('Unable to verify on etherscan', e);
}
})
});

task('verify:API3Oracle')
.addParam('address', 'the contract address', undefined, types.string, false)
.addParam('dapiproxy', 'the address of the underlying DapiProxy contract')
.addParam('stalenessthresholdsecs', 'the number of seconds before refresh')
.setAction(async function (args: TaskArguments, hre) {
const { address, dapiproxy, stalenessthresholdsecs } = args
const { address, dapiproxy, stalenessthresholdsecs } = args;

await hre.run('verify:verify', {
address,
constructorArguments: [dapiproxy, stalenessthresholdsecs],
})
})
});
});
Loading

0 comments on commit 329a49c

Please sign in to comment.