diff --git a/packages/contracts/scripts/generate-typechain-osx-versions.ts b/packages/contracts/scripts/generate-typechain-osx-versions.ts index 45b9fd94..19cff219 100644 --- a/packages/contracts/scripts/generate-typechain-osx-versions.ts +++ b/packages/contracts/scripts/generate-typechain-osx-versions.ts @@ -26,5 +26,8 @@ for (let i = 0; i < OSX_VERSION_ALIASES.length; i++) { generateTypechain( `./artifacts/${OSX_VERSION_ALIASES[i]}`, `./typechain/${OSX_VERSION_ALIASES[i]}` - ); + ).catch(e => { + console.error(e); + process.exit(1); + }); } diff --git a/packages/contracts/src/MajorityVotingBase.sol b/packages/contracts/src/MajorityVotingBase.sol index 5a60a5f8..695ca7c0 100644 --- a/packages/contracts/src/MajorityVotingBase.sol +++ b/packages/contracts/src/MajorityVotingBase.sol @@ -218,6 +218,7 @@ abstract contract MajorityVotingBase is keccak256("UPDATE_VOTING_SETTINGS_PERMISSION"); /// @notice A mapping between proposal IDs and proposal information. + // solhint-disable-next-line named-parameters-mapping mapping(uint256 => Proposal) internal proposals; /// @notice The struct storing the voting settings. @@ -269,6 +270,7 @@ abstract contract MajorityVotingBase is /// @dev This method is required to support [ERC-1822](https://eips.ethereum.org/EIPS/eip-1822). /// @param _dao The IDAO interface of the associated DAO. /// @param _votingSettings The voting settings. + // solhint-disable-next-line func-name-mixedcase function __MajorityVotingBase_init( IDAO _dao, VotingSettings calldata _votingSettings diff --git a/packages/contracts/src/TokenVotingSetup.sol b/packages/contracts/src/TokenVotingSetup.sol index e5ed0fac..f3696d13 100644 --- a/packages/contracts/src/TokenVotingSetup.sol +++ b/packages/contracts/src/TokenVotingSetup.sol @@ -38,12 +38,15 @@ contract TokenVotingSetup is PluginSetup { bytes32 public constant EXECUTE_PERMISSION_ID = keccak256("EXECUTE_PERMISSION"); /// @notice The address of the `TokenVoting` base contract. + // solhint-disable-next-line immutable-vars-naming TokenVoting private immutable tokenVotingBase; /// @notice The address of the `GovernanceERC20` base contract. + // solhint-disable-next-line immutable-vars-naming address public immutable governanceERC20Base; /// @notice The address of the `GovernanceWrappedERC20` base contract. + // solhint-disable-next-line immutable-vars-naming address public immutable governanceWrappedERC20Base; /// @notice The token settings struct. diff --git a/packages/contracts/src/mocks/MajorityVotingMock.sol b/packages/contracts/src/mocks/MajorityVotingMock.sol index 7f0f2f9b..55bc8c58 100644 --- a/packages/contracts/src/mocks/MajorityVotingMock.sol +++ b/packages/contracts/src/mocks/MajorityVotingMock.sol @@ -25,6 +25,7 @@ contract MajorityVotingMock is MajorityVotingBase { return 0; } + /* solhint-disable no-empty-blocks */ function _vote( uint256 /* _proposalId */, VoteOption /* _voteOption */, diff --git a/packages/contracts/test/10_unit-testing/governance-erc20/11_governance-erc20.ts b/packages/contracts/test/10_unit-testing/governance-erc20/11_governance-erc20.ts index ce51d2cd..52c2593b 100644 --- a/packages/contracts/test/10_unit-testing/governance-erc20/11_governance-erc20.ts +++ b/packages/contracts/test/10_unit-testing/governance-erc20/11_governance-erc20.ts @@ -193,7 +193,7 @@ describe('GovernanceERC20', function () { const balanceSigner1 = await token.balanceOf(signers[1].address); const balanceSigner2 = await token.balanceOf(signers[2].address); - let tx1 = await token.connect(signers[0]).delegate(signers[1].address); + const tx1 = await token.connect(signers[0]).delegate(signers[1].address); await ethers.provider.send('evm_mine', []); // verify that current votes are correct @@ -203,7 +203,7 @@ describe('GovernanceERC20', function () { ); expect(await token.getVotes(signers[2].address)).to.eq(balanceSigner2); - let tx2 = await token.connect(signers[0]).delegate(signers[2].address); + await token.connect(signers[0]).delegate(signers[2].address); await ethers.provider.send('evm_mine', []); // verify that current votes are correct diff --git a/packages/contracts/test/10_unit-testing/governance-erc20/12_governance-wrapped-erc20.ts b/packages/contracts/test/10_unit-testing/governance-erc20/12_governance-wrapped-erc20.ts index c18080bb..4544b84e 100644 --- a/packages/contracts/test/10_unit-testing/governance-erc20/12_governance-wrapped-erc20.ts +++ b/packages/contracts/test/10_unit-testing/governance-erc20/12_governance-wrapped-erc20.ts @@ -258,7 +258,7 @@ describe('GovernanceWrappedERC20', function () { describe('delegate', async () => { beforeEach(async function () { // approve and deposit for all token holders - let promises = defaultBalances.map(balance => + const promises = defaultBalances.map(balance => erc20.approve(balance.account, balance.amount) ); @@ -312,7 +312,7 @@ describe('GovernanceWrappedERC20', function () { signers[2].address ); - let tx1 = await governanceToken + const tx1 = await governanceToken .connect(signers[0]) .delegate(signers[1].address); await ethers.provider.send('evm_mine', []); @@ -326,9 +326,7 @@ describe('GovernanceWrappedERC20', function () { balanceSigner2 ); - let tx2 = await governanceToken - .connect(signers[0]) - .delegate(signers[2].address); + await governanceToken.connect(signers[0]).delegate(signers[2].address); await ethers.provider.send('evm_mine', []); // verify that current votes are correct diff --git a/packages/contracts/test/10_unit-testing/token-voting/11_token-voting.ts b/packages/contracts/test/10_unit-testing/token-voting/11_token-voting.ts index fde2fa2a..dc43864a 100644 --- a/packages/contracts/test/10_unit-testing/token-voting/11_token-voting.ts +++ b/packages/contracts/test/10_unit-testing/token-voting/11_token-voting.ts @@ -121,7 +121,7 @@ describe('TokenVoting', function () { startDate = (await time.latest()) + 20; endDate = startDate + votingSettings.minDuration; - dao.grant( + await dao.grant( dao.address, voting.address, ethers.utils.id('EXECUTE_PERMISSION') @@ -139,7 +139,7 @@ describe('TokenVoting', function () { async function setTotalSupply(totalSupply: number) { await ethers.provider.send('evm_mine', []); - let block = await ethers.provider.getBlock('latest'); + const block = await ethers.provider.getBlock('latest'); const currentTotalSupply: BigNumber = await governanceErc20Mock.getPastTotalSupply(block.number - 1); @@ -228,7 +228,7 @@ describe('TokenVoting', function () { it('upgrades from v1.0.0', async () => { legacyContractFactory = new TokenVoting_V1_0_0__factory(signers[0]); - const {proxy, fromImplementation, toImplementation} = + const {fromImplementation, toImplementation} = await deployAndUpgradeFromToCheck( signers[0], signers[1], @@ -968,7 +968,7 @@ describe('TokenVoting', function () { await setBalances([{receiver: signers[0].address, amount: 10}]); - let tx = await voting.createProposal( + const tx = await voting.createProposal( dummyMetadata, dummyActions, allowFailureMap, @@ -1041,7 +1041,7 @@ describe('TokenVoting', function () { await setBalances([{receiver: signers[0].address, amount: 10}]); - let tx = await voting.createProposal( + const tx = await voting.createProposal( dummyMetadata, dummyActions, 0, @@ -1470,7 +1470,7 @@ describe('TokenVoting', function () { expect(await voting.canExecute(id)).to.equal(true); // `tryEarlyExecution` is turned on and the vote is decided - let tx = await voting + const tx = await voting .connect(signers[6]) .vote(id, VoteOption.Yes, true); { @@ -2004,7 +2004,7 @@ describe('TokenVoting', function () { governanceErc20Mock.address ); - let magnitude = BigNumber.from(10).pow(power); + const magnitude = BigNumber.from(10).pow(power); const oneToken = magnitude; const balances = [ diff --git a/packages/contracts/test/test-utils/dao.ts b/packages/contracts/test/test-utils/dao.ts index 9b4faf3a..fa2a5466 100644 --- a/packages/contracts/test/test-utils/dao.ts +++ b/packages/contracts/test/test-utils/dao.ts @@ -53,60 +53,9 @@ export async function deployNewDAO( signer: SignerWithAddress, metadata = dummyMetadata ): Promise { - return await createDaoProxy(signer, dummyMetadata); + return await createDaoProxy(signer, metadata); } -// export async function getActions() { -// const signers = await ethers.getSigners(); -// const ActionExecuteFactory = new ActionExecute__factory(signers[0]); -// let ActionExecute = await ActionExecuteFactory.deploy(); -// const iface = new ethers.utils.Interface(ActionExecute__factory.abi); - -// const num = 20; -// return { -// failAction: { -// to: ActionExecute.address, -// data: iface.encodeFunctionData('fail'), -// value: 0, -// }, -// succeedAction: { -// to: ActionExecute.address, -// data: iface.encodeFunctionData('setTest', [num]), -// value: 0, -// }, -// failActionMessage: ethers.utils -// .hexlify(ethers.utils.toUtf8Bytes('ActionExecute:Revert')) -// .substring(2), -// successActionResult: ethers.utils.hexZeroPad(ethers.utils.hexlify(num), 32), -// }; -// } - -// export function getERC721TransferAction( -// tokenAddress: string, -// from: string, -// to: string, -// tokenId: number, -// issafe: boolean = true -// ) { -// const iface = new ethers.utils.Interface(ERC721Mock__factory.abi); - -// const functionName = issafe -// ? 'safeTransferFrom(address, address, uint256)' -// : 'transferFrom(address, address, uint256)'; - -// const encodedData = iface.encodeFunctionData(functionName, [ -// from, -// to, -// tokenId, -// ]); - -// return { -// to: tokenAddress, -// value: 0, -// data: encodedData, -// }; -// } - export function getERC20TransferAction( tokenAddress: string, to: string, @@ -121,27 +70,3 @@ export function getERC20TransferAction( data: encodedData, }; } - -// export function getERC1155TransferAction( -// tokenAddress: string, -// from: string, -// to: string, -// tokenId: number, -// amount: number | BigNumber -// ) { -// const iface = new ethers.utils.Interface(ERC1155Mock__factory.abi); - -// const encodedData = iface.encodeFunctionData('safeTransferFrom', [ -// from, -// to, -// tokenId, -// amount, -// '0x', -// ]); - -// return { -// to: tokenAddress, -// value: 0, -// data: encodedData, -// }; -// } diff --git a/packages/contracts/test/test-utils/fixture.ts b/packages/contracts/test/test-utils/fixture.ts index 3fdab729..75f46608 100644 --- a/packages/contracts/test/test-utils/fixture.ts +++ b/packages/contracts/test/test-utils/fixture.ts @@ -1,6 +1,6 @@ import networks from '@aragon/osx-commons-configs'; import {getNetworkByNameOrAlias} from '@aragon/osx-commons-configs'; -import hre, {network, deployments} from 'hardhat'; +import {network, deployments} from 'hardhat'; export interface ForkOsxVersion { version: string; diff --git a/packages/contracts/test/test-utils/uups-upgradeable.ts b/packages/contracts/test/test-utils/uups-upgradeable.ts index fd952f12..ec18c311 100644 --- a/packages/contracts/test/test-utils/uups-upgradeable.ts +++ b/packages/contracts/test/test-utils/uups-upgradeable.ts @@ -101,7 +101,7 @@ export async function deployAndUpgradeFromToCheck( toImplementation: string; }> { // Deploy proxy and implementation - let proxy = await upgrades.deployProxy( + const proxy = await upgrades.deployProxy( from.connect(deployer), Object.values(initArgs), { diff --git a/packages/contracts/tsconfig.json b/packages/contracts/tsconfig.json index 4d61aedd..d52ee2fa 100644 --- a/packages/contracts/tsconfig.json +++ b/packages/contracts/tsconfig.json @@ -23,6 +23,7 @@ "deploy/**/*", "test/**/*", "utils/**/*", - "plugin-settings.ts" + "plugin-settings.ts", + "scripts/**/*.ts" ] }