Skip to content

Commit

Permalink
fix(lint): auto-fix [ci]
Browse files Browse the repository at this point in the history
  • Loading branch information
mzywang committed May 22, 2024
1 parent 6af0ede commit dbe0058
Show file tree
Hide file tree
Showing 4 changed files with 24 additions and 22 deletions.
7 changes: 4 additions & 3 deletions .github/workflows/CI.yml
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,7 @@ jobs:
build-and-test:
needs: lint
name: build
name: build-and-test
runs-on: ubuntu-latest

steps:
Expand Down Expand Up @@ -86,7 +86,8 @@ jobs:
run: yarn build

- name: Build Docker
run: yarn docker:build
run: yarn build:docker

- name: Test
run: yarn test
# We need to run test in this mode because github CI is non-interactive
run: yarn test:no-tty
3 changes: 2 additions & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -6,11 +6,12 @@
"scripts": {
"lint": "eslint . --ext .ts --fix",
"build": "run-s codegen && graph build",
"docker:build": "docker build -t matchstick .",
"build:docker": "docker build -t matchstick .",
"buildonly": "graph build",
"deploy:alchemy": "graph deploy --node https://subgraphs.alchemy.com/api/subgraphs/deploy --ipfs https://ipfs.satsuma.xyz",
"codegen": "graph codegen --output-dir src/types/",
"test": "graph test -d",
"test:no-tty": "docker run -i --rm --mount type=bind,source=$INIT_CWD,target=/matchstick matchstick",
"create-local": "graph create ianlapham/uniswap-v3 --node http://127.0.0.1:8020",
"deploy-local": "graph deploy ianlapham/uniswap-v3 --debug --ipfs http://localhost:5001 --node http://127.0.0.1:8020",
"deploy": "graph deploy ianlapham/uniswap-v3-subgraph --ipfs https://api.thegraph.com/ipfs/ --node https://api.thegraph.com/deploy/ --debug",
Expand Down
2 changes: 1 addition & 1 deletion src/mappings/factory.ts
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ export function handlePoolCreated(event: PoolCreated): void {
export function handlePoolCreatedHelper(
event: PoolCreated,
factoryAddress: string = FACTORY_ADDRESS,
whitelistTokens: string[] = WHITELIST_TOKENS,
whitelistTokens: string[] = WHITELIST_TOKENS
): void {
// temp fix
if (event.params.pool == Address.fromHexString('0x8fe8d9bb8eeba3ed688069c3d6b556c9ca258248')) {
Expand Down
34 changes: 17 additions & 17 deletions tests/handlePoolCreated.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ import {
POOL_TICK_SPACING_03,
USDC_MAINNET_FIXTURE,
USDC_WETH_03_MAINNET_POOL,
WETH_MAINNET_FIXTURE,
WETH_MAINNET_FIXTURE
} from './constants'

describe('handlePoolCreated', () => {
Expand Down Expand Up @@ -44,7 +44,7 @@ describe('handlePoolCreated', () => {
['totalValueLockedETH', '0'],
['totalValueLockedUSD', '0'],
['totalValueLockedETHUntracked', '0'],
['totalValueLockedUSDUntracked', '0'],
['totalValueLockedUSDUntracked', '0']
])

assertObjectMatches('Bundle', '1', [['ethPriceUSD', '0']])
Expand All @@ -64,7 +64,7 @@ describe('handlePoolCreated', () => {
['totalValueLockedUSDUntracked', '0'],
['txCount', '0'],
['poolCount', '0'],
['whitelistPools', `[${USDC_WETH_03_MAINNET_POOL}]`],
['whitelistPools', `[${USDC_WETH_03_MAINNET_POOL}]`]
])

assertObjectMatches('Token', WETH_MAINNET_FIXTURE.address, [
Expand All @@ -82,7 +82,7 @@ describe('handlePoolCreated', () => {
['totalValueLockedUSDUntracked', '0'],
['txCount', '0'],
['poolCount', '0'],
['whitelistPools', `[${USDC_WETH_03_MAINNET_POOL}]`],
['whitelistPools', `[${USDC_WETH_03_MAINNET_POOL}]`]
])

assertObjectMatches('Pool', USDC_WETH_03_MAINNET_POOL, [
Expand All @@ -109,7 +109,7 @@ describe('handlePoolCreated', () => {
['untrackedVolumeUSD', '0'],
['collectedFeesToken0', '0'],
['collectedFeesToken1', '0'],
['collectedFeesUSD', '0'],
['collectedFeesUSD', '0']
])
})

Expand All @@ -125,7 +125,7 @@ describe('handlePoolCreated', () => {
const usdcAddress = Address.fromString(USDC_MAINNET_FIXTURE.address)
createMockedFunction(usdcAddress, 'symbol', 'symbol():(string)').reverts()
createMockedFunction(usdcAddress, 'symbol', 'symbol():(bytes32)').returns([
ethereum.Value.fromBytes(Bytes.fromUTF8('USDC')),
ethereum.Value.fromBytes(Bytes.fromUTF8('USDC'))
])
const symbol = fetchTokenSymbol(usdcAddress)
assert.stringEquals(symbol, 'USDC')
Expand All @@ -135,15 +135,15 @@ describe('handlePoolCreated', () => {
const usdcAddress = Address.fromString(USDC_MAINNET_FIXTURE.address)
createMockedFunction(usdcAddress, 'symbol', 'symbol():(string)').reverts()
createMockedFunction(usdcAddress, 'symbol', 'symbol():(bytes32)').returns([
ethereum.Value.fromBytes(Bytes.fromHexString(NULL_ETH_HEX_STRING)),
ethereum.Value.fromBytes(Bytes.fromHexString(NULL_ETH_HEX_STRING))
])
const staticDefinitions: Array<StaticTokenDefinition> = [
{
address: Address.fromString(USDC_MAINNET_FIXTURE.address),
symbol: 'USDC',
name: 'USD Coin',
decimals: BigInt.fromI32(6),
},
decimals: BigInt.fromI32(6)
}
]
const symbol = fetchTokenSymbol(usdcAddress, staticDefinitions)
assert.stringEquals(symbol, 'USDC')
Expand All @@ -170,7 +170,7 @@ describe('handlePoolCreated', () => {
const usdcAddress = Address.fromString(USDC_MAINNET_FIXTURE.address)
createMockedFunction(usdcAddress, 'name', 'name():(string)').reverts()
createMockedFunction(usdcAddress, 'name', 'name():(bytes32)').returns([
ethereum.Value.fromBytes(Bytes.fromUTF8('USD Coin')),
ethereum.Value.fromBytes(Bytes.fromUTF8('USD Coin'))
])
const name = fetchTokenName(usdcAddress)
assert.stringEquals(name, 'USD Coin')
Expand All @@ -180,15 +180,15 @@ describe('handlePoolCreated', () => {
const usdcAddress = Address.fromString(USDC_MAINNET_FIXTURE.address)
createMockedFunction(usdcAddress, 'name', 'name():(string)').reverts()
createMockedFunction(usdcAddress, 'name', 'name():(bytes32)').returns([
ethereum.Value.fromBytes(Bytes.fromHexString(NULL_ETH_HEX_STRING)),
ethereum.Value.fromBytes(Bytes.fromHexString(NULL_ETH_HEX_STRING))
])
const staticDefinitions: Array<StaticTokenDefinition> = [
{
address: Address.fromString(USDC_MAINNET_FIXTURE.address),
symbol: 'USDC',
name: 'USD Coin',
decimals: BigInt.fromI32(6),
},
decimals: BigInt.fromI32(6)
}
]
const name = fetchTokenName(usdcAddress, staticDefinitions)
assert.stringEquals(name, 'USD Coin')
Expand All @@ -207,7 +207,7 @@ describe('handlePoolCreated', () => {
test('success - fetch token total supply', () => {
const usdcAddress = Address.fromString(USDC_MAINNET_FIXTURE.address)
createMockedFunction(usdcAddress, 'totalSupply', 'totalSupply():(uint256)').returns([
ethereum.Value.fromUnsignedBigInt(BigInt.fromString('300')),
ethereum.Value.fromUnsignedBigInt(BigInt.fromString('300'))
])
const totalSupply = fetchTokenTotalSupply(usdcAddress)
assert.bigIntEquals(totalSupply, BigInt.fromString('300'))
Expand All @@ -225,7 +225,7 @@ describe('handlePoolCreated', () => {
test('success - fetch token decimals', () => {
const usdcAddress = Address.fromString(USDC_MAINNET_FIXTURE.address)
createMockedFunction(usdcAddress, 'decimals', 'decimals():(uint32)').returns([
ethereum.Value.fromUnsignedBigInt(BigInt.fromI32(6)),
ethereum.Value.fromUnsignedBigInt(BigInt.fromI32(6))
])
const decimals = fetchTokenDecimals(usdcAddress)
assert.assertTrue(decimals == BigInt.fromI32(6))
Expand All @@ -239,8 +239,8 @@ describe('handlePoolCreated', () => {
address: Address.fromString(USDC_MAINNET_FIXTURE.address),
symbol: 'USDC',
name: 'USD Coin',
decimals: BigInt.fromI32(6),
},
decimals: BigInt.fromI32(6)
}
]
const decimals = fetchTokenDecimals(usdcAddress, staticDefinitions)
assert.assertTrue(decimals == BigInt.fromI32(6))
Expand Down

0 comments on commit dbe0058

Please sign in to comment.