Skip to content

Commit

Permalink
style: formatting
Browse files Browse the repository at this point in the history
  • Loading branch information
heueristik committed Oct 23, 2023
1 parent f61f238 commit 3932311
Show file tree
Hide file tree
Showing 16 changed files with 80 additions and 65 deletions.
8 changes: 8 additions & 0 deletions .vscode/extensions.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
{
"recommendations": [
"esbenp.prettier-vscode",
"NomicFoundation.hardhat-solidity",
"KnisterPeter.vscode-commitizen",
"tintinweb.solidity-visual-auditor"
]
}
7 changes: 7 additions & 0 deletions .vscode/settings.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
{
"editor.defaultFormatter": "esbenp.prettier-vscode",
"editor.formatOnSave": true,
"prettier.documentSelectors": ["**/*.sol"],
"solidity.formatter": "prettier",
"editor.tabSize": 4
}
4 changes: 2 additions & 2 deletions contracts/.solcover.js
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
module.exports = {
istanbulReporter: ['html', 'lcov'],
providerOptions: {
privateKey: process.env.PRIVATE_KEY,
privateKey: process.env.PRIVATE_KEY
},
skipFiles: ['test'],
skipFiles: ['test']
};
62 changes: 31 additions & 31 deletions contracts/hardhat.config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ const apiUrls: {[index: string]: string} = {
polygon: 'https://polygon-mainnet.infura.io/v3/',
polygonMumbai: 'https://polygon-mumbai.infura.io/v3/',
base: 'https://mainnet.base.org',
baseGoerli: 'https://goerli.base.org',
baseGoerli: 'https://goerli.base.org'
};

export const networks: {[index: string]: NetworkUserConfig} = {
Expand All @@ -37,39 +37,39 @@ export const networks: {[index: string]: NetworkUserConfig} = {
forking: {
url: `${
apiUrls[process.env.NETWORK_NAME ? process.env.NETWORK_NAME : 'mainnet']
}${process.env.INFURA_API_KEY}`,
},
}${process.env.INFURA_API_KEY}`
}
},
mainnet: {
chainId: 1,
url: `${apiUrls.mainnet}${process.env.INFURA_API_KEY}`,
url: `${apiUrls.mainnet}${process.env.INFURA_API_KEY}`
},
goerli: {
chainId: 5,
url: `${apiUrls.goerli}${process.env.INFURA_API_KEY}`,
url: `${apiUrls.goerli}${process.env.INFURA_API_KEY}`
},
sepolia: {
chainId: 11155111,
url: `${apiUrls.sepolia}${process.env.INFURA_API_KEY}`,
url: `${apiUrls.sepolia}${process.env.INFURA_API_KEY}`
},
polygon: {
chainId: 137,
url: `${apiUrls.polygon}${process.env.INFURA_API_KEY}`,
url: `${apiUrls.polygon}${process.env.INFURA_API_KEY}`
},
polygonMumbai: {
chainId: 80001,
url: `${apiUrls.polygonMumbai}${process.env.INFURA_API_KEY}`,
url: `${apiUrls.polygonMumbai}${process.env.INFURA_API_KEY}`
},
base: {
chainId: 8453,
url: `${apiUrls.base}`,
gasPrice: ethers.utils.parseUnits('0.001', 'gwei').toNumber(),
gasPrice: ethers.utils.parseUnits('0.001', 'gwei').toNumber()
},
baseGoerli: {
chainId: 84531,
url: `${apiUrls.baseGoerli}`,
gasPrice: ethers.utils.parseUnits('0.0000001', 'gwei').toNumber(),
},
gasPrice: ethers.utils.parseUnits('0.0000001', 'gwei').toNumber()
}
};

// Uses hardhats private key if none is set. DON'T USE THIS ACCOUNT FOR DEPLOYMENTS
Expand All @@ -81,7 +81,7 @@ for (const network in networks) {
// special treatement for hardhat
if (network.startsWith('hardhat')) {
networks[network].accounts = {
mnemonic: 'test test test test test test test test test test test junk',
mnemonic: 'test test test test test test test test test test test junk'
};
continue;
}
Expand All @@ -103,34 +103,34 @@ const config: HardhatUserConfig = {
polygon: process.env.POLYGONSCAN_API_KEY || '',
polygonMumbai: process.env.POLYGONSCAN_API_KEY || '',
base: process.env.BASESCAN_API_KEY || '',
baseGoerli: process.env.BASESCAN_API_KEY || '',
baseGoerli: process.env.BASESCAN_API_KEY || ''
},
customChains: [
{
network: 'sepolia',
chainId: 11155111,
urls: {
apiURL: 'https://api-sepolia.etherscan.io/api',
browserURL: 'https://sepolia.etherscan.io',
},
browserURL: 'https://sepolia.etherscan.io'
}
},
{
network: 'base',
chainId: 8453,
urls: {
apiURL: 'https://api.basescan.org/api',
browserURL: 'https://basescan.org',
},
browserURL: 'https://basescan.org'
}
},
{
network: 'baseGoerli',
chainId: 84531,
urls: {
apiURL: 'https://api-goerli.basescan.org/api',
browserURL: 'https://goerli.basescan.org',
},
},
],
browserURL: 'https://goerli.basescan.org'
}
}
]
},

namedAccounts: {
Expand All @@ -145,23 +145,23 @@ const config: HardhatUserConfig = {
harold: 7,
ivan: 8,
judy: 9,
mallory: 10,
mallory: 10
},

gasReporter: {
currency: 'USD',
enabled: process.env.REPORT_GAS === 'true' ? true : false,
excludeContracts: [],
src: './contracts',
coinmarketcap: process.env.COINMARKETCAP_API_KEY,
coinmarketcap: process.env.COINMARKETCAP_API_KEY
},
networks,
paths: {
artifacts: './artifacts',
cache: './cache',
sources: './src',
tests: './test',
deploy: './deploy',
deploy: './deploy'
},

solidity: {
Expand All @@ -170,28 +170,28 @@ const config: HardhatUserConfig = {
metadata: {
// Not including the metadata hash
// https://github.com/paulrberg/hardhat-template/issues/31
bytecodeHash: 'none',
bytecodeHash: 'none'
},
// Disable the optimizer when debugging
// https://hardhat.org/hardhat-network/#solidity-optimizer-support
optimizer: {
enabled: true,
runs: 800,
},
},
runs: 800
}
}
},
typechain: {
outDir: 'typechain',
target: 'ethers-v5',
target: 'ethers-v5'
},
docgen: {
outputDir: 'docs/developer-portal/reference-guide',
theme: 'markdown',
pages: 'files',
templates: 'docs/templates',
collapseNewlines: true,
exclude: ['test'],
},
exclude: ['test']
}
};

export default config;
8 changes: 4 additions & 4 deletions contracts/test/plugin/majority-voting/majority-voting.ts
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ import {
IMajorityVoting__factory,
DAO__factory,
MajorityVotingMock__factory,
IProtocolVersion__factory,
IProtocolVersion__factory
} from '../../../typechain';
import {deployUUPSProxy} from '../../../utils/helpers';
import {getInterfaceId} from '../../../utils/interfaces';
Expand All @@ -24,7 +24,7 @@ export const MAJORITY_VOTING_BASE_INTERFACE = new ethers.utils.Interface([
'function totalVotingPower(uint256)',
'function getProposal(uint256)',
'function updateVotingSettings(tuple(uint8,uint32,uint32,uint64,uint256))',
'function createProposal(bytes,tuple(address,uint256,bytes)[],uint256,uint64,uint64,uint8,bool)',
'function createProposal(bytes,tuple(address,uint256,bytes)[],uint256,uint64,uint64,uint8,bool)'
]);

describe('MajorityVotingMock', function () {
Expand All @@ -40,7 +40,7 @@ describe('MajorityVotingMock', function () {

dao = await deployUUPSProxy<DAO>(new DAO__factory(signers[0]), {
initializerName: 'initialize',
args: [[], ownerAddress, ethers.constants.AddressZero, 'examplURI'],
args: [[], ownerAddress, ethers.constants.AddressZero, 'examplURI']
});
});

Expand All @@ -50,7 +50,7 @@ describe('MajorityVotingMock', function () {
supportThreshold: pctToRatio(50),
minParticipation: pctToRatio(20),
minDuration: ONE_HOUR,
minProposerVotingPower: 0,
minProposerVotingPower: 0
};

const MajorityVotingBase = new MajorityVotingMock__factory(signers[0]);
Expand Down
4 changes: 2 additions & 2 deletions contracts/test/plugin/majority-voting/voting-helpers.ts
Original file line number Diff line number Diff line change
Expand Up @@ -7,13 +7,13 @@ export enum VoteOption {
None,
Abstain,
Yes,
No,
No
}

export enum VotingMode {
Standard,
EarlyExecution,
VoteReplacement,
VoteReplacement
}

export type VotingSettings = {
Expand Down
8 changes: 4 additions & 4 deletions contracts/test/token/erc20/governance-wrapped-erc20.ts
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ import {
IGovernanceWrappedERC20__factory,
IERC20Upgradeable__factory,
IERC20PermitUpgradeable__factory,
IVotesUpgradeable__factory,
IVotesUpgradeable__factory
} from '../../../typechain';
import {getInterfaceId} from '../../../utils/interfaces';
import {SignerWithAddress} from '@nomiclabs/hardhat-ethers/signers';
Expand Down Expand Up @@ -53,7 +53,7 @@ describe('GovernanceWrappedERC20', function () {
defaultBalances = [
{account: signers[0].address, amount: 123},
{account: signers[1].address, amount: 456},
{account: signers[2].address, amount: 789},
{account: signers[2].address, amount: 789}
];

from = signers[0];
Expand All @@ -73,7 +73,7 @@ describe('GovernanceWrappedERC20', function () {
defaultGovernanceWrappedERC20InitData = [
erc20.address,
governanceWrappedERC20Name,
governanceWrappedERC20Symbol,
governanceWrappedERC20Symbol
];

governanceToken = await GovernanceWrappedERC20.deploy(
Expand Down Expand Up @@ -151,7 +151,7 @@ describe('GovernanceWrappedERC20', function () {
const iface = new ethers.utils.Interface([
'function name()',
'function symbol()',
'function decimals()',
'function decimals()'
]);
expect(await governanceToken.supportsInterface(getInterfaceId(iface))).to
.be.true;
Expand Down
12 changes: 6 additions & 6 deletions contracts/test/utils/addresslist.ts
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ describe('AddresslistMock', function () {
await addresslist.addAddresses([
signers[0].address,
signers[1].address,
signers[2].address,
signers[2].address
]);
expect(await addresslist.addresslistLength()).to.equal(3);

Expand All @@ -40,7 +40,7 @@ describe('AddresslistMock', function () {

await addresslist.removeAddresses([
signers[1].address,
signers[2].address,
signers[2].address
]);
expect(await addresslist.addresslistLength()).to.equal(0);
});
Expand All @@ -53,7 +53,7 @@ describe('AddresslistMock', function () {

const tx2 = await addresslist.addAddresses([
signers[1].address,
signers[2].address,
signers[2].address
]);
await ethers.provider.send('evm_mine', []);

Expand All @@ -74,7 +74,7 @@ describe('AddresslistMock', function () {
const tx1 = await addresslist.addAddresses([
signers[0].address,
signers[1].address,
signers[2].address,
signers[2].address
]);
await ethers.provider.send('evm_mine', []);

Expand All @@ -83,14 +83,14 @@ describe('AddresslistMock', function () {

const tx3 = await addresslist.removeAddresses([
signers[1].address,
signers[2].address,
signers[2].address
]);
await ethers.provider.send('evm_mine', []);

const [rc1, rc2, rc3] = await Promise.all([
tx1.wait(),
tx2.wait(),
tx3.wait(),
tx3.wait()
]);

expect(rc1.blockNumber).to.be.lt(rc2.blockNumber);
Expand Down
8 changes: 4 additions & 4 deletions contracts/test/utils/version-comparison-lib.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import {
VersionComparisonLibTest,
VersionComparisonLibTest__factory,
VersionComparisonLibTest__factory
} from '../../typechain';
import {expect} from 'chai';
import {ethers} from 'hardhat';
Expand Down Expand Up @@ -121,7 +121,7 @@ async function eqChecks(
func([0, 1, 0], [0, 1, 0]),
func([0, 0, 1], [0, 0, 1]),
//
func([0, 0, 0], [0, 0, 0]),
func([0, 0, 0], [0, 0, 0])
]);

// Check that all results match the expected value
Expand Down Expand Up @@ -155,7 +155,7 @@ async function ltChecks(
//
func([1, 0, 0], [2, 0, 0]),
func([0, 1, 0], [0, 2, 0]),
func([0, 0, 1], [0, 0, 2]),
func([0, 0, 1], [0, 0, 2])
]);

// Check that all results match the expected value
Expand Down Expand Up @@ -187,7 +187,7 @@ async function gtChecks(
//
func([2, 0, 0], [1, 0, 0]),
func([0, 2, 0], [0, 1, 0]),
func([0, 0, 2], [0, 0, 1]),
func([0, 0, 2], [0, 0, 1])
]);

// Check that all results match the expected value
Expand Down
4 changes: 2 additions & 2 deletions contracts/utils/etherscan.ts
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ export const verifyContract = async (
// Write a temporal file to host complex parameters for hardhat-etherscan https://github.com/nomiclabs/hardhat/tree/master/packages/hardhat-etherscan#complex-arguments
const {fd, path, cleanup} = await file({
prefix: 'verify-params-',
postfix: '.js',
postfix: '.js'
});
fs.writeSync(
fd,
Expand All @@ -27,7 +27,7 @@ export const verifyContract = async (

const params = {
address: address,
constructorArgs: path,
constructorArgs: path
};
await runTaskWithRetry('verify', params, times, msDelay, cleanup);
} catch (error) {
Expand Down
Loading

0 comments on commit 3932311

Please sign in to comment.