diff --git a/.github/workflows/ci_allowance.yml b/.github/workflows/ci_allowance.yml new file mode 100644 index 000000000..4f2a795c3 --- /dev/null +++ b/.github/workflows/ci_allowance.yml @@ -0,0 +1,43 @@ +name: safe-modules-allowance +on: + push: + paths: + - 'modules/allowances/**' + +jobs: + tests: + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v4 + - name: Install pnpm + uses: pnpm/action-setup@v3 + with: + version: 9 + - uses: actions/setup-node@v4 + with: + node-version: 20.x + cache: pnpm + - run: | + pnpm install + pnpm run --filter "@safe-global/safe-allowance-module" coverage + - uses: coverallsapp/github-action@master + with: + path-to-lcov: modules/allowances/coverage/lcov.info + github-token: ${{ secrets.GITHUB_TOKEN }} + lint: + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v4 + - name: Install pnpm + uses: pnpm/action-setup@v3 + with: + version: 9 + - uses: actions/setup-node@v4 + with: + node-version: 20.x + cache: pnpm + - run: | + pnpm install + pnpm run --filter "@safe-global/safe-allowance-module" lint + pnpm run --filter "@safe-global/safe-allowance-module" fmt:check + pnpm run --filter "@safe-global/safe-allowance-module" build diff --git a/modules/allowances/contracts/test/ISafe.sol b/modules/allowances/contracts/test/ISafe.sol index 627447b81..3df5a5126 100644 --- a/modules/allowances/contracts/test/ISafe.sol +++ b/modules/allowances/contracts/test/ISafe.sol @@ -1,7 +1,7 @@ // SPDX-License-Identifier: LGPL-3.0-only pragma solidity >=0.8.0 <0.9.0; -interface ISafe { +interface ISafeTest { function getThreshold() external view returns (uint256); function getChainId() external view returns (uint256); diff --git a/modules/allowances/package.json b/modules/allowances/package.json index d89821e55..e52ec1e98 100644 --- a/modules/allowances/package.json +++ b/modules/allowances/package.json @@ -17,10 +17,15 @@ "prepare": "pnpm run clean && npm run build", "lint": "pnpm run lint:sol && npm run lint:ts", "lint:sol": "solhint 'contracts/**/*.sol'", - "lint:ts": "eslint 'tasks/**/*.ts' 'test/**/*.ts' --max-warnings 0 --fix", - "fmt": "pnpm run fmt:sol && npm run fmt:ts", - "fmt:sol": "prettier 'contracts/**/*.sol' -w", - "fmt:ts": "prettier 'tasks/**/*.ts' 'test/**/*.ts' -w" + "lint:sol:fix": "solhint 'contracts/**/*.sol' --fix", + "lint:ts": "eslint 'tasks/**/*.ts' 'test/**/*.ts' --max-warnings 0", + "lint:ts:fix": "eslint 'tasks/**/*.ts' 'test/**/*.ts' --max-warnings 0 --fix", + "fmt": "pnpm run fmt:sol:write && npm run fmt:ts:write", + "fmt:check": "pnpm run fmt:sol:check && npm run fmt:ts:check", + "fmt:sol:check": "prettier 'contracts/**/*.sol' --check", + "fmt:ts:check": "prettier 'tasks/**/*.ts' 'test/**/*.ts' --check", + "fmt:sol:write": "prettier 'contracts/**/*.sol' --write", + "fmt:ts:write": "prettier 'tasks/**/*.ts' 'test/**/*.ts' --write" }, "author": "richard@gnosis.io", "license": "ISC", diff --git a/modules/allowances/test/test-helpers/execSafeTransaction.ts b/modules/allowances/test/test-helpers/execSafeTransaction.ts index 3cfa0930f..f27d7d697 100644 --- a/modules/allowances/test/test-helpers/execSafeTransaction.ts +++ b/modules/allowances/test/test-helpers/execSafeTransaction.ts @@ -1,9 +1,9 @@ import { SignerWithAddress } from '@nomicfoundation/hardhat-ethers/signers' import { TransactionRequest, ZeroAddress } from 'ethers' -import { ISafe } from '../../typechain-types' +import { ISafeTest } from '../../typechain-types' -export default async function execSafeTransaction(safe: ISafe, { to, data, value = 0 }: TransactionRequest, signer: SignerWithAddress) { +export default async function execSafeTransaction(safe: ISafeTest, { to, data, value = 0 }: TransactionRequest, signer: SignerWithAddress) { const address = await safe.getAddress() const chainId = await safe.getChainId() const nonce = await safe.nonce() diff --git a/modules/allowances/test/test-helpers/setup.ts b/modules/allowances/test/test-helpers/setup.ts index 280374d88..7e4096b44 100644 --- a/modules/allowances/test/test-helpers/setup.ts +++ b/modules/allowances/test/test-helpers/setup.ts @@ -1,7 +1,7 @@ import { SignerWithAddress } from '@nomicfoundation/hardhat-ethers/signers' import hre from 'hardhat' -import { AllowanceModule__factory, ISafe__factory, TestToken, TestToken__factory } from '../../typechain-types' +import { AllowanceModule__factory, ISafeTest__factory, TestToken, TestToken__factory } from '../../typechain-types' import deploySafeProxy from './deploySafeProxy' import deploySingletons from './deploySingletons' @@ -18,7 +18,7 @@ export default async function setup() { // both the safe and the allowance work by signature // connect the contracts to a signer that has funds // but isn't safe owner, or allowance spender - const safe = ISafe__factory.connect(safeAddress, relayer) + const safe = ISafeTest__factory.connect(safeAddress, relayer) const allowanceModule = AllowanceModule__factory.connect(allowanceModuleAddress, relayer) // fund the safe