Skip to content

Commit

Permalink
lint: fix warnings and typescript linting errors
Browse files Browse the repository at this point in the history
  • Loading branch information
jordaniza committed Feb 29, 2024
1 parent 96bb242 commit 38c73bb
Show file tree
Hide file tree
Showing 11 changed files with 27 additions and 94 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -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);
});
}
2 changes: 2 additions & 0 deletions packages/contracts/src/MajorityVotingBase.sol
Original file line number Diff line number Diff line change
Expand Up @@ -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.
Expand Down Expand Up @@ -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
Expand Down
3 changes: 3 additions & 0 deletions packages/contracts/src/TokenVotingSetup.sol
Original file line number Diff line number Diff line change
Expand Up @@ -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.
Expand Down
1 change: 1 addition & 0 deletions packages/contracts/src/mocks/MajorityVotingMock.sol
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@ contract MajorityVotingMock is MajorityVotingBase {
return 0;
}

/* solhint-disable no-empty-blocks */
function _vote(
uint256 /* _proposalId */,
VoteOption /* _voteOption */,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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)
);

Expand Down Expand Up @@ -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', []);
Expand All @@ -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
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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')
Expand All @@ -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);
Expand Down Expand Up @@ -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],
Expand Down Expand Up @@ -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,
Expand Down Expand Up @@ -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,
Expand Down Expand Up @@ -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);
{
Expand Down Expand Up @@ -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 = [
Expand Down
77 changes: 1 addition & 76 deletions packages/contracts/test/test-utils/dao.ts
Original file line number Diff line number Diff line change
Expand Up @@ -53,60 +53,9 @@ export async function deployNewDAO(
signer: SignerWithAddress,
metadata = dummyMetadata
): Promise<DAO> {
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,
Expand All @@ -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,
// };
// }
2 changes: 1 addition & 1 deletion packages/contracts/test/test-utils/fixture.ts
Original file line number Diff line number Diff line change
@@ -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;
Expand Down
2 changes: 1 addition & 1 deletion packages/contracts/test/test-utils/uups-upgradeable.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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),
{
Expand Down
3 changes: 2 additions & 1 deletion packages/contracts/tsconfig.json
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@
"deploy/**/*",
"test/**/*",
"utils/**/*",
"plugin-settings.ts"
"plugin-settings.ts",
"scripts/**/*.ts"
]
}

0 comments on commit 38c73bb

Please sign in to comment.