-
Notifications
You must be signed in to change notification settings - Fork 484
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
13 changed files
with
498 additions
and
16 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,22 @@ | ||
FROM --platform=linux/x86_64 ubuntu:22.04 | ||
|
||
ARG DEBIAN_FRONTEND=noninteractive | ||
|
||
ENV ARGS="" | ||
|
||
RUN apt update \ | ||
&& apt install -y sudo curl postgresql postgresql-contrib | ||
|
||
RUN curl -fsSL https://deb.nodesource.com/setup_18.x | sudo -E bash - \ | ||
&& sudo apt-get install -y nodejs | ||
|
||
RUN curl -OL https://github.com/LimeChain/matchstick/releases/download/0.6.0/binary-linux-22 \ | ||
&& chmod a+x binary-linux-22 | ||
|
||
RUN mkdir matchstick | ||
WORKDIR /matchstick | ||
|
||
# Commenting out for now as it seems there's no need to copy when using bind mount | ||
# COPY ./ . | ||
|
||
CMD ../binary-linux-22 ${ARGS} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Binary file not shown.
Binary file not shown.
Binary file not shown.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,22 @@ | ||
FROM --platform=linux/x86_64 ubuntu:22.04 | ||
|
||
ARG DEBIAN_FRONTEND=noninteractive | ||
|
||
ENV ARGS="" | ||
|
||
RUN apt update \ | ||
&& apt install -y sudo curl postgresql postgresql-contrib | ||
|
||
RUN curl -fsSL https://deb.nodesource.com/setup_18.x | sudo -E bash - \ | ||
&& sudo apt-get install -y nodejs | ||
|
||
RUN curl -OL https://github.com/LimeChain/matchstick/releases/download/0.6.0/binary-linux-22 \ | ||
&& chmod a+x binary-linux-22 | ||
|
||
RUN mkdir matchstick | ||
WORKDIR /matchstick | ||
|
||
# Commenting out for now as it seems there's no need to copy when using bind mount | ||
# COPY ./ . | ||
|
||
CMD ../binary-linux-22 ${ARGS} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
{ | ||
"version": "0.6.0", | ||
"timestamp": 1716213533842 | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,70 @@ | ||
import { Address, BigInt, ethereum } from '@graphprotocol/graph-ts' | ||
import { assert, beforeAll, createMockedFunction, describe, log, newMockEvent, test } from 'matchstick-as' | ||
import { PoolCreated } from '../src/types/Factory/Factory' | ||
import { handlePoolCreated } from '../src/mappings/factory' | ||
import { FACTORY_ADDRESS } from '../src/utils/constants' | ||
|
||
const USDC_MAINNET_ADDRESS = '0xa0b86991c6218b36c1d19d4a2e9eb0ce3606eb48' | ||
const WETH_MAINNET_ADDRESS = '0xc02aaa39b223fe8d0a0e5c4f27ead9083c756cc2' | ||
const USDC_WETH_03_MAINNET_POOL = '0x8ad599c3a0ff1de082011efddc58f1908eb6e6d8' | ||
const POOL_FEE_TIER_03 = 3000 | ||
const POOL_TICK_SPACING_03 = 60 | ||
|
||
describe('handleMint', () => { | ||
beforeAll(() => { | ||
// todo: dedupe this with handlePoolCreated | ||
const mockEvent = newMockEvent() | ||
const token0Address = Address.fromString(USDC_MAINNET_ADDRESS) | ||
const token1Address = Address.fromString(WETH_MAINNET_ADDRESS) | ||
const poolAddress = Address.fromString(USDC_WETH_03_MAINNET_POOL) | ||
const parameters = [ | ||
new ethereum.EventParam('token0', ethereum.Value.fromAddress(token0Address)), | ||
new ethereum.EventParam('token1', ethereum.Value.fromAddress(token1Address)), | ||
new ethereum.EventParam('fee', ethereum.Value.fromI32(POOL_FEE_TIER_03)), | ||
new ethereum.EventParam('tickSpacing', ethereum.Value.fromI32(POOL_TICK_SPACING_03)), | ||
new ethereum.EventParam('pool', ethereum.Value.fromAddress(poolAddress)) | ||
] | ||
|
||
const poolCreatedEvent = new PoolCreated( | ||
mockEvent.address, | ||
mockEvent.logIndex, | ||
mockEvent.transactionLogIndex, | ||
mockEvent.logType, | ||
mockEvent.block, | ||
mockEvent.transaction, | ||
parameters, | ||
mockEvent.receipt | ||
) | ||
|
||
// create mock contract calls for token0 | ||
createMockedFunction(token0Address, 'symbol', 'symbol():(string)').returns([ethereum.Value.fromString('USDC')]) | ||
createMockedFunction(token0Address, 'name', 'name():(string)').returns([ethereum.Value.fromString('USD Coin')]) | ||
createMockedFunction(token0Address, 'totalSupply', 'totalSupply():(uint256)').returns([ | ||
ethereum.Value.fromUnsignedBigInt(BigInt.fromString('300')) | ||
]) | ||
createMockedFunction(token0Address, 'decimals', 'decimals():(uint32)').returns([ | ||
ethereum.Value.fromUnsignedBigInt(BigInt.fromString('6')) | ||
]) | ||
|
||
// create mock contract calls for token1 | ||
createMockedFunction(token1Address, 'symbol', 'symbol():(string)').returns([ethereum.Value.fromString('WETH')]) | ||
createMockedFunction(token1Address, 'name', 'name():(string)').returns([ethereum.Value.fromString('Wrapped Ether')]) | ||
createMockedFunction(token1Address, 'totalSupply', 'totalSupply():(uint256)').returns([ | ||
ethereum.Value.fromUnsignedBigInt(BigInt.fromString('100')) | ||
]) | ||
createMockedFunction(token1Address, 'decimals', 'decimals():(uint32)').returns([ | ||
ethereum.Value.fromUnsignedBigInt(BigInt.fromString('18')) | ||
]) | ||
|
||
assert.notInStore('Factory', FACTORY_ADDRESS) | ||
assert.notInStore('Pool', USDC_WETH_03_MAINNET_POOL) | ||
assert.notInStore('Token', USDC_MAINNET_ADDRESS) | ||
assert.notInStore('Token', WETH_MAINNET_ADDRESS) | ||
|
||
handlePoolCreated(poolCreatedEvent) | ||
}) | ||
|
||
test('success - mint event', () => { | ||
log.success('mint event success', []) | ||
}) | ||
}) |
Oops, something went wrong.