├── .eslintignore ├── src ├── tsconfig.json ├── mappings │ ├── uniswapV3 │ │ ├── uniswapV3Mapping.ts │ │ ├── uniswapV3RewardTokenMapping.ts │ │ ├── uniswapV3PoolMapping.ts │ │ ├── uniswapV3TokenStakerMapping.ts │ │ └── uniswapV3PositionsNftMapping.ts │ ├── ERC20.ts │ ├── unipoolGivPower.ts │ ├── giversPFP.ts │ ├── merkleDistro.ts │ ├── gardenUnipool.ts │ ├── givPower.ts │ ├── unipool.ts │ └── tokenDistro.ts ├── utils │ ├── math.ts │ ├── constants.ts │ ├── optimismGivPowerLocks.ts │ ├── tokenDistroHelper.ts │ └── misc.ts ├── configuration.ts └── commons │ └── uniswapV3RewardRecorder.ts ├── .prettierrc.js ├── funding.json ├── tsconfig.json ├── .eslintrc.js ├── .gitignore ├── .github └── workflows │ ├── graph-build.yaml │ ├── graph-studio-develop.yaml │ ├── graph-main.yaml │ ├── graph-studio-main.yaml │ └── graph-develop.yaml ├── scripts └── generate-manifests.ts ├── schema.graphql ├── abis ├── MerkleDistro.json ├── ERC20.json ├── UniswapV3RewardToken.json ├── UnipoolTokenDistributor.json ├── UniswapV3.json ├── UniswapV3Staker.json ├── TokenDistro.json └── UniswapV3Pool.json ├── package.json ├── README.md ├── subgraph.template.yaml └── networks.yaml /.eslintignore: -------------------------------------------------------------------------------- 1 | src/types -------------------------------------------------------------------------------- /src/tsconfig.json: -------------------------------------------------------------------------------- 1 | { 2 | "extends": "assemblyscript/std/assembly", 3 | } 4 | -------------------------------------------------------------------------------- /.prettierrc.js: -------------------------------------------------------------------------------- 1 | module.exports = { 2 | semi: true, 3 | trailingComma: "all", 4 | singleQuote: true, 5 | tabWidth: 2 6 | }; -------------------------------------------------------------------------------- /funding.json: -------------------------------------------------------------------------------- 1 | { 2 | "opRetro": { 3 | "projectId": "0xe434930e189c807b137ff0d8e2fa6a95eaa57dde574143a02ca0d7fb31a40bea" 4 | } 5 | } 6 | -------------------------------------------------------------------------------- /src/mappings/uniswapV3/uniswapV3Mapping.ts: -------------------------------------------------------------------------------- 1 | // import { Transfer } from '../../generated/uniswapV3/uniswapV3'; 2 | // 3 | // export function handleTransfer(event: Transfer): void { 4 | // 5 | // } 6 | -------------------------------------------------------------------------------- /src/utils/math.ts: -------------------------------------------------------------------------------- 1 | import { BigDecimal, BigInt } from '@graphprotocol/graph-ts'; 2 | 3 | export function scaleDown(num: BigInt): BigDecimal { 4 | return num.divDecimal(BigInt.fromI32(10).pow(u8(18)).toBigDecimal()); 5 | } 6 | -------------------------------------------------------------------------------- /tsconfig.json: -------------------------------------------------------------------------------- 1 | { 2 | "compilerOptions": { 3 | "lib": ["ES6"], 4 | "alwaysStrict": true, 5 | "noImplicitAny": true, 6 | "noImplicitReturns": true, 7 | "noImplicitThis": true, 8 | "noEmitOnError": true, 9 | "strictNullChecks": true, 10 | "moduleResolution": "Node" 11 | }, 12 | "exclude": ["src"] 13 | } 14 | -------------------------------------------------------------------------------- /src/utils/constants.ts: -------------------------------------------------------------------------------- 1 | // eslint-disable-next-line @typescript-eslint/ban-ts-comment 2 | // @ts-ignore 3 | export const MAX_LOCK_ROUNDS: i64 = 26; 4 | export const ZERO_ADDRESS = '0x0000000000000000000000000000000000000000'; 5 | export const GIVBACK = 'givback'; 6 | export const PRAISE = 'praise'; 7 | export const GIVDROP = 'givdrop'; 8 | export const UNIPOOL = 'unipool'; 9 | export const UNISWAP_V3 = 'uniswapV3'; 10 | -------------------------------------------------------------------------------- /.eslintrc.js: -------------------------------------------------------------------------------- 1 | // eslint-disable-next-line no-undef 2 | module.exports = { 3 | root: true, 4 | parser: '@typescript-eslint/parser', 5 | plugins: ['@typescript-eslint', 'prettier'], 6 | extends: ['eslint:recommended', 'plugin:@typescript-eslint/recommended'], 7 | rules: { 8 | 'comma-spacing': ['error', { before: false, after: true }], 9 | 'prefer-const': ['off'], 10 | 'prettier/prettier': 'error', 11 | '@typescript-eslint/no-empty-function': 'off', 12 | }, 13 | }; 14 | -------------------------------------------------------------------------------- /.gitignore: -------------------------------------------------------------------------------- 1 | # Logs 2 | logs 3 | *.log 4 | npm-debug.log* 5 | yarn-debug.log* 6 | yarn-error.log* 7 | lerna-debug.log* 8 | 9 | # Dependency directories 10 | node_modules/ 11 | 12 | # Optional eslint cache 13 | .eslintcache 14 | 15 | # Yarn Integrity file 16 | .yarn-integrity 17 | 18 | # dotenv environment variables file 19 | .env 20 | .env.test 21 | 22 | # Truffle and Graph build artifacts 23 | build/ 24 | generated/ 25 | 26 | # Subgraph stuff 27 | subgraph.yaml 28 | src/types/ 29 | subgraph.*.yaml 30 | 31 | 32 | # Jetbrains 33 | .idea/ 34 | -------------------------------------------------------------------------------- /.github/workflows/graph-build.yaml: -------------------------------------------------------------------------------- 1 | name: Build after pull request 2 | 3 | on: pull_request 4 | jobs: 5 | build: 6 | runs-on: ubuntu-latest 7 | steps: 8 | - uses: actions/checkout@v2 9 | - name: Install node 10 | uses: actions/setup-node@v1 11 | with: 12 | node-version: 18 13 | - name: Install 14 | run: yarn --frozen-lockfile 15 | - name: Lint 16 | run: yarn lint 17 | - name: Generate Manifests 18 | run: yarn generate-manifests 19 | - name: Build 20 | run: yarn build 21 | -------------------------------------------------------------------------------- /src/mappings/uniswapV3/uniswapV3RewardTokenMapping.ts: -------------------------------------------------------------------------------- 1 | import { 2 | RewardPaid, 3 | Approval, 4 | OwnershipTransferred, 5 | Transfer, 6 | } from '../../types/UniswapV3RewardToken/UniswapV3RewardToken'; 7 | import { updateTokenAllocationDistributor } from '../../utils/tokenDistroHelper'; 8 | import { UNISWAP_V3 } from '../../utils/constants'; 9 | 10 | export function handleRewardPaid(event: RewardPaid): void { 11 | updateTokenAllocationDistributor(event.transaction.hash.toHex(), UNISWAP_V3); 12 | } 13 | 14 | export function handleApproval(event: Approval): void {} 15 | export function handleOwnershipTransferred(event: OwnershipTransferred): void {} 16 | export function handleTransfer(event: Transfer): void {} 17 | -------------------------------------------------------------------------------- /src/mappings/ERC20.ts: -------------------------------------------------------------------------------- 1 | import { Address } from '@graphprotocol/graph-ts'; 2 | import { Transfer } from '../types/ERC20/ERC20'; 3 | import { getUserTokenBalance } from '../utils/misc'; 4 | 5 | export function handleTransfer(event: Transfer): void { 6 | const fromAddress = event.params.from; 7 | const toAddress = event.params.to; 8 | const amount = event.params.value; 9 | 10 | if (fromAddress.toHex() != Address.zero().toHex()) { 11 | const fromBalance = getUserTokenBalance(event.address, fromAddress); 12 | fromBalance.balance = fromBalance.balance.minus(amount); 13 | fromBalance.updatedAt = event.block.timestamp; 14 | fromBalance.save(); 15 | } 16 | 17 | if (toAddress.toHex() != Address.zero().toHex()) { 18 | const toBalance = getUserTokenBalance(event.address, toAddress); 19 | toBalance.balance = toBalance.balance.plus(amount); 20 | toBalance.updatedAt = event.block.timestamp; 21 | toBalance.save(); 22 | } 23 | } 24 | -------------------------------------------------------------------------------- /scripts/generate-manifests.ts: -------------------------------------------------------------------------------- 1 | import * as yaml from 'js-yaml'; 2 | import * as Handlebars from 'handlebars'; 3 | import * as fs from 'fs-extra'; 4 | import * as path from 'path'; 5 | 6 | const generateManifests = async (): Promise => { 7 | const networksFilePath = path.resolve(__dirname, '../networks.yaml'); 8 | const networks = yaml.load( 9 | await fs.readFile(networksFilePath, { encoding: 'utf-8' }), 10 | ) as Record>; 11 | 12 | const template = fs.readFileSync('subgraph.template.yaml').toString(); 13 | Handlebars.registerHelper('isdefined', function (value) { 14 | return value !== undefined; 15 | }); 16 | Object.entries(networks).forEach(([network, config]) => { 17 | fs.writeFileSync( 18 | `subgraph${network === 'mainnet' ? '' : `.${network}`}.yaml`, 19 | Handlebars.compile(template)(config), 20 | ); 21 | }); 22 | 23 | // eslint-disable-next-line no-console 24 | console.log('🎉 subgraph successfully generated\n'); 25 | }; 26 | 27 | generateManifests(); 28 | -------------------------------------------------------------------------------- /src/mappings/unipoolGivPower.ts: -------------------------------------------------------------------------------- 1 | import { 2 | DepositTokenDeposited, 3 | DepositTokenWithdrawn, 4 | } from '../types/UnipoolGIVPower/UnipoolGIVPower'; 5 | import { getUserTokenBalance } from '../utils/misc'; 6 | 7 | export { 8 | handleTokenUnlocked, 9 | handleTokenLocked, 10 | handleUpgrade, 11 | } from './givPower'; 12 | 13 | export function handleDepositTokenDeposited( 14 | event: DepositTokenDeposited, 15 | ): void { 16 | const account = event.params.account; 17 | const balance = getUserTokenBalance(event.address, account); 18 | const amount = event.params.amount; 19 | balance.balance = balance.balance.plus(amount); 20 | balance.updatedAt = event.block.timestamp; 21 | balance.save(); 22 | } 23 | 24 | export function handleDepositTokenWithdrawn( 25 | event: DepositTokenWithdrawn, 26 | ): void { 27 | const account = event.params.account; 28 | const balance = getUserTokenBalance(event.address, account); 29 | const amount = event.params.amount; 30 | balance.balance = balance.balance.minus(amount); 31 | balance.updatedAt = event.block.timestamp; 32 | balance.save(); 33 | } 34 | -------------------------------------------------------------------------------- /src/mappings/uniswapV3/uniswapV3PoolMapping.ts: -------------------------------------------------------------------------------- 1 | import { 2 | Initialize, 3 | Swap, 4 | UniswapV3Pool, 5 | } from '../../types/UniswapV3Pool/UniswapV3Pool'; 6 | import { UniswapV3Pool as Pool } from '../../types/schema'; 7 | import { BigInt, log } from '@graphprotocol/graph-ts'; 8 | import { recordUniswapV3InfinitePositionReward } from '../../commons/uniswapV3RewardRecorder'; 9 | 10 | export function handleInitialize(event: Initialize): void { 11 | const poolContract = UniswapV3Pool.bind(event.address); 12 | const liquidity = poolContract.liquidity(); 13 | const pool = new Pool(event.address.toHex()); 14 | pool.token0 = poolContract.token0().toHex(); 15 | pool.token1 = poolContract.token1().toHex(); 16 | pool.sqrtPriceX96 = event.params.sqrtPriceX96; 17 | pool.tick = BigInt.fromI32(event.params.tick); 18 | pool.liquidity = liquidity; 19 | pool.save(); 20 | } 21 | 22 | export function handleSwap(event: Swap): void { 23 | const pool = Pool.load(event.address.toHex()); 24 | if (!pool) { 25 | log.error('Swap event of UniswapV3Pool {} before initialization', [ 26 | event.address.toHex(), 27 | ]); 28 | return; 29 | } 30 | pool.sqrtPriceX96 = event.params.sqrtPriceX96; 31 | pool.tick = BigInt.fromI32(event.params.tick); 32 | pool.liquidity = event.params.liquidity; 33 | pool.save(); 34 | 35 | recordUniswapV3InfinitePositionReward(event.block.timestamp); 36 | } 37 | -------------------------------------------------------------------------------- /src/mappings/giversPFP.ts: -------------------------------------------------------------------------------- 1 | import { Transfer } from '../types/GiversPFP/GiversPFP'; 2 | import { getGiversPFPTokenId, getUserEntity } from '../utils/misc'; 3 | import { Address, log, dataSource } from '@graphprotocol/graph-ts'; 4 | import { GiversPFPToken } from '../types/schema'; 5 | 6 | const network = dataSource.network(); 7 | const imageIpfsBaseHash = 8 | network == 'goerli' 9 | ? 'ipfs://Qmcee5jErZSmLxxEE1K3HAKfyAhDAtu361tJqxLrMU7uW3/' 10 | : 'ipfs://QmRn7wJhf2LkCCY8EsBkzFQZpPqMRi13y6QVGQJodeJxnE/'; 11 | 12 | export function handleTransfer(event: Transfer): void { 13 | const from = event.params.from; 14 | const to = event.params.to; 15 | const id = event.params.tokenId.toI32(); 16 | 17 | const tokenId = getGiversPFPTokenId(event.address, id); 18 | let token = GiversPFPToken.load(tokenId); 19 | 20 | if (from.toHex() != Address.zero().toHex()) { 21 | if (token == null) { 22 | log.error( 23 | 'transfer GiversPFP {} from non zero address {} but the source does not exists!', 24 | [id.toString(10), from.toHex()], 25 | ); 26 | } 27 | } 28 | 29 | if (token == null) { 30 | token = new GiversPFPToken(tokenId); 31 | token.tokenId = id; 32 | token.contractAddress = event.address.toHex(); 33 | token.imageIpfs = imageIpfsBaseHash + id.toString() + '.png'; 34 | } 35 | getUserEntity(to); 36 | token.user = to.toHex(); 37 | token.save(); 38 | } 39 | -------------------------------------------------------------------------------- /src/mappings/merkleDistro.ts: -------------------------------------------------------------------------------- 1 | import { Claimed } from '../types/MerkleDistro/MerkleDistro'; 2 | import { GIVDROP } from '../utils/constants'; 3 | import { TokenAllocation, TransactionTokenAllocation } from '../types/schema'; 4 | import { 5 | getTokenDistroBalance, 6 | updateTokenAllocationDistributor, 7 | } from '../../src/utils/tokenDistroHelper'; 8 | 9 | export function handleClaimed(event: Claimed): void { 10 | updateTokenAllocationDistributor(event.transaction.hash.toHex(), GIVDROP); 11 | 12 | const transactionTokenAllocations = TransactionTokenAllocation.load( 13 | event.transaction.hash.toHex(), 14 | ); 15 | 16 | if (!transactionTokenAllocations) { 17 | return; 18 | } 19 | for ( 20 | let i = 0; 21 | i < transactionTokenAllocations.tokenAllocationIds.length; 22 | i++ 23 | ) { 24 | const tokenAllocation = TokenAllocation.load( 25 | transactionTokenAllocations.tokenAllocationIds[i], 26 | ); 27 | if (!tokenAllocation) { 28 | continue; 29 | } 30 | 31 | if ( 32 | tokenAllocation.recipient == event.params.recipient.toHex() && 33 | tokenAllocation.amount.equals(event.params.amount) 34 | ) { 35 | const tokenDistroBalance = getTokenDistroBalance( 36 | tokenAllocation.tokenDistroAddress, 37 | tokenAllocation.recipient, 38 | ); 39 | 40 | if (tokenDistroBalance) { 41 | tokenDistroBalance.givDropClaimed = true; 42 | tokenDistroBalance.save(); 43 | } 44 | } 45 | } 46 | } 47 | 48 | export const handleOwnershipTransferred = (): void => {}; 49 | -------------------------------------------------------------------------------- /src/utils/optimismGivPowerLocks.ts: -------------------------------------------------------------------------------- 1 | export const TO_UPDATE_GIV_POWER_LOCKS_IDS = [ 2 | '0x0f46540678c7e6d2ef983b382cc07fa815ab148c-26-58', 3 | '0x10a84b835c5df26f2a380b3e00bcc84a66cd2d34-6-39', 4 | '0x1b3fd358c66974572cd7c77b5be7759c67c178b1-26-59', 5 | '0x1ccd9f598a51ce30a912c0b1713dec9478762deb-26-58', 6 | '0x2a8fe25896fcce82c49c2db923abfa4198ad3394-26-58', 7 | '0x2a8fe25896fcce82c49c2db923abfa4198ad3394-26-59', 8 | '0x2a8fe25896fcce82c49c2db923abfa4198ad3394-3-35', 9 | '0x302e2a0d4291ac14aa1160504ca45a0a1f2e7a5c-26-58', 10 | '0x33878e070db7f70d2953fe0278cd32adf8104572-26-58', 11 | '0x33878e070db7f70d2953fe0278cd32adf8104572-26-59', 12 | '0x5a7c338fce14bef491590e13d03a221af1be80ab-7-40', 13 | '0x5ffd23b1b0350debb17a2cb668929ac5f76d0e18-6-38', 14 | '0x6433a7994681f87e717dc761490be9553713546f-26-58', 15 | '0x7587cfbd20e5a970209526b4d1f69dbaae8bed37-26-58', 16 | '0x7587cfbd20e5a970209526b4d1f69dbaae8bed37-26-59', 17 | '0x826976d7c600d45fb8287ca1d7c76fc8eb732030-5-37', 18 | '0x8e4bdd156e4dd802dd919f4fd2645681ce99a538-6-38', 19 | '0xa4d506434445bb7303ea34a07bc38484cdc64a95-1-33', 20 | '0xa64f2228ccec96076c82abb903021c33859082f8-26-58', 21 | '0xa64f2228ccec96076c82abb903021c33859082f8-26-59', 22 | '0xad62d4fdd2d071536dbcb72202f1ef51b17ece30-4-37', 23 | '0xad7575aefd4d64520c3269fd24eae1b0e13dbe7b-26-58', 24 | '0xc46c67bb7e84490d7ebdd0b8ecdaca68cf3823f4-26-58', 25 | '0xcd192b61a8dd586a97592555c1f5709e032f2505-1-33', 26 | '0xcd192b61a8dd586a97592555c1f5709e032f2505-3-35', 27 | '0xcd192b61a8dd586a97592555c1f5709e032f2505-3-36', 28 | '0xcd192b61a8dd586a97592555c1f5709e032f2505-4-37', 29 | '0xe564ef4523cb7931bafd6ecb36814b2b3691e1a4-26-59', 30 | '0xed8db37778804a913670d9367aaf4f043aad938b-26-59', 31 | '0xfe229fc3c1982d8eaaf12ada33e57ee2f99efaf4-26-58', 32 | '0xff75e131c711e4310c045317779d39b3b4f718c4-26-58', 33 | ]; 34 | -------------------------------------------------------------------------------- /src/mappings/uniswapV3/uniswapV3TokenStakerMapping.ts: -------------------------------------------------------------------------------- 1 | import { 2 | TokenStaked, 3 | TokenUnstaked, 4 | UniswapV3Staker, 5 | } from '../../types/UniswapV3Staker/UniswapV3Staker'; 6 | import { UniswapPosition } from '../../types/schema'; 7 | import { networkUniswapV3Config } from '../../configuration'; 8 | import { dataSource } from '@graphprotocol/graph-ts'; 9 | 10 | const network = dataSource.network(); 11 | 12 | const uniswapV3Config = 13 | network == 'kovan' 14 | ? networkUniswapV3Config.kovan 15 | : networkUniswapV3Config.mainnet; 16 | 17 | const uniswapRewardTokenIncentiveId = uniswapV3Config.UNISWAP_V3_INCENTIVE_ID; 18 | 19 | export function handleTokenStaked(event: TokenStaked): void { 20 | const incentiveId = event.params.incentiveId.toHex(); 21 | if (incentiveId != uniswapRewardTokenIncentiveId) { 22 | return; 23 | } 24 | const contract = UniswapV3Staker.bind(event.address); 25 | let uniswapStakedPosition = UniswapPosition.load( 26 | event.params.tokenId.toString(), 27 | ); 28 | if (!uniswapStakedPosition) { 29 | uniswapStakedPosition = new UniswapPosition( 30 | event.params.tokenId.toString(), 31 | ); 32 | } 33 | 34 | const tokenId = event.params.tokenId; 35 | const staker = contract.deposits(tokenId).value0.toHex(); 36 | uniswapStakedPosition.staked = true; 37 | uniswapStakedPosition.staker = staker; 38 | uniswapStakedPosition.tokenId = tokenId.toString(); 39 | uniswapStakedPosition.save(); 40 | } 41 | 42 | export function handleTokenUnstaked(event: TokenUnstaked): void { 43 | const incentiveId = event.params.incentiveId.toHex(); 44 | 45 | if (incentiveId != uniswapRewardTokenIncentiveId) { 46 | return; 47 | } 48 | 49 | const uniswapStakedPosition = UniswapPosition.load( 50 | event.params.tokenId.toString(), 51 | ); 52 | if (!uniswapStakedPosition) { 53 | return; 54 | } 55 | uniswapStakedPosition.staked = false; 56 | uniswapStakedPosition.staker = null; 57 | uniswapStakedPosition.save(); 58 | } 59 | -------------------------------------------------------------------------------- /.github/workflows/graph-studio-develop.yaml: -------------------------------------------------------------------------------- 1 | name: Deploy to Graph Studio 2 | 3 | on: 4 | push: 5 | branches: [develop] 6 | 7 | jobs: 8 | lint: 9 | runs-on: ubuntu-latest 10 | steps: 11 | - uses: actions/checkout@v2 12 | - name: Install node 13 | uses: actions/setup-node@v1 14 | with: 15 | node-version: 18 16 | - name: Install 17 | run: yarn --frozen-lockfile 18 | - name: Lint 19 | run: yarn lint 20 | 21 | deploy-staging-gnosis: 22 | needs: lint 23 | runs-on: ubuntu-latest 24 | steps: 25 | - uses: actions/checkout@v2 26 | - name: Install node 27 | uses: actions/setup-node@v1 28 | with: 29 | node-version: 18 30 | - name: Install 31 | run: yarn --frozen-lockfile 32 | - name: Generate Manifest 33 | run: yarn generate-manifests 34 | - uses: balancer-labs/graph-deploy@v0.0.1 35 | with: 36 | graph_deploy_key: ${{secrets.GRAPH_DEPLOY_KEY}} 37 | graph_version_label: ${GITHUB_SHA::8} 38 | graph_subgraph_name: 'giveconomy-staging-gnosischain' 39 | graph_account: 'giveth' 40 | graph_config_file: 'subgraph.deployment-7-gnosis.yaml' 41 | graph_deploy_studio: true 42 | 43 | deploy-staging-optimism-sepolia: 44 | needs: lint 45 | runs-on: ubuntu-latest 46 | steps: 47 | - uses: actions/checkout@v2 48 | - name: Install node 49 | uses: actions/setup-node@v1 50 | with: 51 | node-version: 18 52 | - name: Install 53 | run: yarn --frozen-lockfile 54 | - name: Generate Manifest 55 | run: yarn generate-manifests 56 | - uses: balancer-labs/graph-deploy@v0.0.1 57 | with: 58 | graph_deploy_key: ${{secrets.GRAPH_DEPLOY_KEY}} 59 | graph_version_label: ${GITHUB_SHA::8} 60 | graph_subgraph_name: 'giveconomy-staging-op-sepolia' 61 | graph_account: 'giveth' 62 | graph_config_file: 'subgraph.deployment-7-optimism-sepolia.yaml' 63 | graph_deploy_studio: true 64 | -------------------------------------------------------------------------------- /src/configuration.ts: -------------------------------------------------------------------------------- 1 | //https://www.notion.so/giveth/Testing-Deployment-218c3f503a04421ba3f51e438f4d6acf 2 | 3 | export class IUniswapV3Config { 4 | UNISWAP_INFINITE_POSITION: string; 5 | UNISWAP_V3_STAKER_ADDRESS: string; 6 | UNISWAP_V3_REWARD_TOKEN: string; 7 | UNISWAP_V3_POOL_ADDRESS: string; 8 | INCENTIVE_START_TIME: string; 9 | INCENTIVE_END_TIME: string; 10 | INCENTIVE_REFUNDEE_ADDRESS: string; 11 | MAINNET_WETH_TOKEN_ADDRESS: string; 12 | MAINNET_GIV_TOKEN_ADDRESS: string; 13 | UNISWAP_V3_INCENTIVE_ID: string; 14 | } 15 | 16 | export class INetworkUniswapV3Config { 17 | kovan: IUniswapV3Config; 18 | mainnet: IUniswapV3Config; 19 | } 20 | 21 | export const networkUniswapV3Config: INetworkUniswapV3Config = { 22 | kovan: { 23 | UNISWAP_INFINITE_POSITION: '9985', 24 | UNISWAP_V3_STAKER_ADDRESS: '0x1f98407aaB862CdDeF78Ed252D6f557aA5b0f00d', 25 | UNISWAP_V3_REWARD_TOKEN: '0xDfbb5C70006B357d30BB335f55a01e6b0151Bcb5', 26 | UNISWAP_V3_POOL_ADDRESS: '0x3c2455a3ee0d824941c9329c01a66b86078c3e82', 27 | INCENTIVE_START_TIME: '1640272200', 28 | INCENTIVE_END_TIME: '1655997000', 29 | INCENTIVE_REFUNDEE_ADDRESS: '0x5f672d71399d8cdba64f596394b4f4381247e025', 30 | MAINNET_WETH_TOKEN_ADDRESS: '0xd0a1e359811322d97991e03f863a0c30c2cf029c', 31 | MAINNET_GIV_TOKEN_ADDRESS: '0x29434A25abd94AE882aA883eea81585Aaa5b078D', 32 | UNISWAP_V3_INCENTIVE_ID: 33 | '0xe95ce1ce8cc1078b98ea9585ea7e54af8b8f75cd4051267820ab3028af7514fd', 34 | }, 35 | mainnet: { 36 | UNISWAP_INFINITE_POSITION: '192722', 37 | UNISWAP_V3_STAKER_ADDRESS: '0x1f98407aaB862CdDeF78Ed252D6f557aA5b0f00d', 38 | UNISWAP_V3_REWARD_TOKEN: '0x3115e5aAa3D6f742d09fbB649150dfE285a9c2A3', 39 | UNISWAP_V3_POOL_ADDRESS: '0xc763b6b3d0f75167db95daa6a0a0d75dd467c4e1', 40 | INCENTIVE_START_TIME: '1640361600', 41 | INCENTIVE_END_TIME: '1656086400', 42 | INCENTIVE_REFUNDEE_ADDRESS: '0x34d27210cC319EC5281bDc4DC2ad8FbcF4EAEAEB', 43 | MAINNET_WETH_TOKEN_ADDRESS: '0xc02aaa39b223fe8d0a0e5c4f27ead9083c756cc2', 44 | MAINNET_GIV_TOKEN_ADDRESS: '0x900db999074d9277c5da2a43f252d74366230da0', 45 | UNISWAP_V3_INCENTIVE_ID: 46 | '0x07421267a74d7dc99279300571a9eb5035c96b6807c1a2a8d5ff284d065c3d24', 47 | }, 48 | }; 49 | -------------------------------------------------------------------------------- /src/commons/uniswapV3RewardRecorder.ts: -------------------------------------------------------------------------------- 1 | import { UniswapInfinitePosition } from '../types/schema'; 2 | import { IUniswapV3Config, networkUniswapV3Config } from '../configuration'; 3 | import { 4 | UniswapV3Staker, 5 | UniswapV3Staker__getRewardInfoInputKeyStruct, 6 | } from '../types/UniswapV3Staker/UniswapV3Staker'; 7 | import { 8 | Address, 9 | BigInt, 10 | ethereum, 11 | log, 12 | dataSource, 13 | } from '@graphprotocol/graph-ts'; 14 | 15 | class UniswapV3IncentiveKey extends UniswapV3Staker__getRewardInfoInputKeyStruct { 16 | constructor(tuple: Array) { 17 | super(); 18 | 19 | for (let i = 0; i < tuple.length; i++) { 20 | this[i] = tuple[i]; 21 | } 22 | } 23 | } 24 | 25 | const network = dataSource.network(); 26 | 27 | const uniswapV3Config: IUniswapV3Config = 28 | network == 'kovan' 29 | ? networkUniswapV3Config.kovan 30 | : networkUniswapV3Config.mainnet; 31 | 32 | const UNISWAP_V3_INCENTIVE: Array = [ 33 | ethereum.Value.fromAddress( 34 | Address.fromString(uniswapV3Config.UNISWAP_V3_REWARD_TOKEN), 35 | ), 36 | ethereum.Value.fromAddress( 37 | Address.fromString(uniswapV3Config.UNISWAP_V3_POOL_ADDRESS), 38 | ), 39 | ethereum.Value.fromUnsignedBigInt( 40 | BigInt.fromString(uniswapV3Config.INCENTIVE_START_TIME), 41 | ), 42 | ethereum.Value.fromUnsignedBigInt( 43 | BigInt.fromString(uniswapV3Config.INCENTIVE_END_TIME), 44 | ), 45 | ethereum.Value.fromAddress( 46 | Address.fromString(uniswapV3Config.INCENTIVE_REFUNDEE_ADDRESS), 47 | ), 48 | ]; 49 | 50 | const incentiveKey = new UniswapV3IncentiveKey(UNISWAP_V3_INCENTIVE); 51 | 52 | export function recordUniswapV3InfinitePositionReward(timestamp: BigInt): void { 53 | const position = UniswapInfinitePosition.load( 54 | uniswapV3Config.UNISWAP_INFINITE_POSITION, 55 | ); 56 | if (position) { 57 | const contract = UniswapV3Staker.bind( 58 | Address.fromString(uniswapV3Config.UNISWAP_V3_STAKER_ADDRESS), 59 | ); 60 | const result = contract.try_getRewardInfo( 61 | incentiveKey, 62 | BigInt.fromString(uniswapV3Config.UNISWAP_INFINITE_POSITION), 63 | ); 64 | if (result.reverted) { 65 | log.error('getRewardInfo reverted!', []); 66 | return; 67 | } 68 | position.lastRewardAmount = result.value.value0; 69 | position.lastUpdateTimeStamp = timestamp; 70 | position.save(); 71 | } 72 | } 73 | -------------------------------------------------------------------------------- /.github/workflows/graph-main.yaml: -------------------------------------------------------------------------------- 1 | name: Deploy Graph 2 | 3 | on: 4 | push: 5 | branches: [main] 6 | 7 | jobs: 8 | lint: 9 | runs-on: ubuntu-latest 10 | steps: 11 | - uses: actions/checkout@v2 12 | - name: Install node 13 | uses: actions/setup-node@v1 14 | with: 15 | node-version: 18 16 | - name: Install 17 | run: yarn --frozen-lockfile 18 | - name: Lint 19 | run: yarn lint 20 | 21 | deploy-mainnet: 22 | needs: lint 23 | runs-on: ubuntu-latest 24 | steps: 25 | - uses: actions/checkout@v2 26 | - name: Install node 27 | uses: actions/setup-node@v1 28 | with: 29 | node-version: 18 30 | - name: Install 31 | run: yarn --frozen-lockfile 32 | - name: Generate Manifest 33 | run: yarn generate-manifests 34 | - uses: gtaschuk/graph-deploy@v0.1.9 35 | with: 36 | graph_access_token: ${{ secrets.GRAPH_ACCESS_TOKEN }} 37 | graph_subgraph_name: giveth-economy-second-mainnet 38 | graph_account: giveth 39 | graph_config_file: subgraph.production-mainnet.yaml 40 | 41 | deploy-gnosis: 42 | needs: lint 43 | runs-on: ubuntu-latest 44 | steps: 45 | - uses: actions/checkout@v2 46 | - name: Install node 47 | uses: actions/setup-node@v1 48 | with: 49 | node-version: 18 50 | - name: Install 51 | run: yarn --frozen-lockfile 52 | - name: Generate Manifest 53 | run: yarn generate-manifests 54 | - uses: gtaschuk/graph-deploy@v0.1.9 55 | with: 56 | graph_access_token: ${{ secrets.GRAPH_ACCESS_TOKEN }} 57 | graph_subgraph_name: giveth-economy-second-xdai 58 | graph_account: giveth 59 | graph_config_file: subgraph.production-gnosis.yaml 60 | 61 | deploy-optimism: 62 | needs: lint 63 | runs-on: ubuntu-latest 64 | steps: 65 | - uses: actions/checkout@v2 66 | - name: Install node 67 | uses: actions/setup-node@v1 68 | with: 69 | node-version: 18 70 | - name: Install 71 | run: yarn --frozen-lockfile 72 | - name: Generate Manifest 73 | run: yarn generate-manifests 74 | - uses: gtaschuk/graph-deploy@v0.1.9 75 | with: 76 | graph_access_token: ${{ secrets.GRAPH_ACCESS_TOKEN }} 77 | graph_subgraph_name: giveconomy-optimism-mainnet 78 | graph_account: giveth 79 | graph_config_file: subgraph.production-optimism-mainnet.yaml 80 | -------------------------------------------------------------------------------- /src/mappings/gardenUnipool.ts: -------------------------------------------------------------------------------- 1 | import { Staked, Withdrawn } from '../types/Unipool/UnipoolTokenDistributor'; 2 | export { handleRewardAdded, handleRewardPaid } from './unipool'; 3 | import * as Unipool from './unipool'; 4 | import { Address, BigInt, log } from '@graphprotocol/graph-ts'; 5 | import { 6 | getGivPowerSnapshotId, 7 | getUserEntity, 8 | getUserUnipoolBalance, 9 | } from '../../src/utils/misc'; 10 | 11 | import { UserGivPowerSnapshot } from '../../src/types/schema'; 12 | 13 | function updateSnapshot( 14 | contractAddress: Address, 15 | userAddress: Address, 16 | currentTimestamp: BigInt, 17 | ): void { 18 | const user = getUserEntity(userAddress); 19 | const userBalance = getUserUnipoolBalance(contractAddress, userAddress); 20 | 21 | const newSnapshotId = getGivPowerSnapshotId(userAddress, currentTimestamp); 22 | let newSnapshot = UserGivPowerSnapshot.load(newSnapshotId); 23 | if (!newSnapshot) { 24 | newSnapshot = new UserGivPowerSnapshot(newSnapshotId); 25 | newSnapshot.user = userAddress.toHex(); 26 | newSnapshot.timestamp = currentTimestamp; 27 | newSnapshot.givPowerAmount = BigInt.zero(); 28 | newSnapshot.cumulativeGivPowerAmount = BigInt.zero(); 29 | } 30 | const lastSnapshotTimestamp = user.lastGivPowerUpdateTime; 31 | 32 | newSnapshot.givPowerAmount = userBalance.balance; 33 | 34 | if (!lastSnapshotTimestamp.isZero()) { 35 | const lastSnapshotId = getGivPowerSnapshotId( 36 | userAddress, 37 | lastSnapshotTimestamp, 38 | ); 39 | 40 | const lastSnapshot = UserGivPowerSnapshot.load(lastSnapshotId); 41 | 42 | if (!lastSnapshot) { 43 | log.error('Snapshot was not saved for time {} of user {}', [ 44 | lastSnapshotTimestamp.toString(), 45 | userAddress.toHex(), 46 | ]); 47 | } else { 48 | newSnapshot.cumulativeGivPowerAmount = 49 | lastSnapshot.cumulativeGivPowerAmount.plus( 50 | lastSnapshot.givPowerAmount.times( 51 | currentTimestamp.minus(lastSnapshot.timestamp), 52 | ), 53 | ); 54 | } 55 | } 56 | 57 | newSnapshot.save(); 58 | 59 | user.lastGivPowerUpdateTime = currentTimestamp; 60 | user.save(); 61 | } 62 | 63 | export function handleStaked(event: Staked): void { 64 | Unipool.handleStaked(event); 65 | updateSnapshot(event.address, event.params.user, event.block.timestamp); 66 | } 67 | 68 | export function handleWithdrawn(event: Withdrawn): void { 69 | Unipool.handleWithdrawn(event); 70 | updateSnapshot(event.address, event.params.user, event.block.timestamp); 71 | } 72 | -------------------------------------------------------------------------------- /src/mappings/givPower.ts: -------------------------------------------------------------------------------- 1 | import { BigInt } from '@graphprotocol/graph-ts'; 2 | import { 3 | TokenLocked, 4 | TokenUnlocked, 5 | Upgraded, 6 | Transfer, 7 | } from '../types/GIVPower/GIVPower'; 8 | import { TokenLock } from '../types/schema'; 9 | import { 10 | getGIVPower, 11 | getTokenLockId, 12 | getUserEntity, 13 | updateGivPower, 14 | } from '../utils/misc'; 15 | import { MAX_LOCK_ROUNDS } from '../utils/constants'; 16 | 17 | export function handleTokenLocked(event: TokenLocked): void { 18 | const userAddress = event.params.account; 19 | const lockAmount = event.params.amount; 20 | 21 | const user = getUserEntity(userAddress); 22 | user.givLocked = user.givLocked.plus(lockAmount); 23 | user.save(); 24 | 25 | const rounds = event.params.rounds.toI32(); 26 | const untilRound = event.params.untilRound.toI32(); 27 | 28 | const lockId = getTokenLockId(userAddress, rounds, untilRound); 29 | let tokenLock = TokenLock.load(lockId); 30 | 31 | const givPower = getGIVPower(event.address); 32 | const initialDate = givPower.initialDate; 33 | const roundDuration = givPower.roundDuration; 34 | 35 | if (tokenLock == null) { 36 | tokenLock = new TokenLock(lockId); 37 | tokenLock.user = userAddress.toHex(); 38 | tokenLock.amount = BigInt.zero(); 39 | tokenLock.untilRound = untilRound; 40 | tokenLock.rounds = rounds; 41 | tokenLock.unlocked = false; 42 | tokenLock.unlockableAt = initialDate.plus( 43 | BigInt.fromI64((untilRound + 1) * roundDuration), 44 | ); 45 | } 46 | 47 | tokenLock.amount = tokenLock.amount.plus(lockAmount); 48 | tokenLock.save(); 49 | 50 | givPower.locksCreated += 1; 51 | givPower.totalGIVLocked = givPower.totalGIVLocked.plus(lockAmount); 52 | 53 | givPower.save(); 54 | } 55 | 56 | export function handleTokenUnlocked(event: TokenUnlocked): void { 57 | const userAddress = event.params.account; 58 | const unlockAmount = event.params.amount; 59 | 60 | const user = getUserEntity(userAddress); 61 | user.givLocked = user.givLocked.minus(unlockAmount); 62 | user.save(); 63 | 64 | const givpower = getGIVPower(event.address); 65 | givpower.totalGIVLocked = givpower.totalGIVLocked.minus(unlockAmount); 66 | givpower.save(); 67 | 68 | const round = event.params.round.toI32(); 69 | for (let i = 0; i <= MAX_LOCK_ROUNDS; i += 1) { 70 | const lockId = getTokenLockId(userAddress, i, round); 71 | const tokenLock = TokenLock.load(lockId); 72 | if (tokenLock) { 73 | tokenLock.unlockedAt = event.block.timestamp; 74 | tokenLock.amount = BigInt.zero(); 75 | tokenLock.unlocked = true; 76 | tokenLock.save(); 77 | } 78 | } 79 | } 80 | 81 | export function handleUpgrade(event: Upgraded): void { 82 | updateGivPower(event.address); 83 | } 84 | -------------------------------------------------------------------------------- /.github/workflows/graph-studio-main.yaml: -------------------------------------------------------------------------------- 1 | name: Deploy
to Graph Studio 2 | 3 | on: 4 | push: 5 | branches: [main] 6 | 7 | jobs: 8 | lint: 9 | runs-on: ubuntu-latest 10 | steps: 11 | - uses: actions/checkout@v2 12 | - name: Install node 13 | uses: actions/setup-node@v1 14 | with: 15 | node-version: 18 16 | - name: Install 17 | run: yarn --frozen-lockfile 18 | - name: Lint 19 | run: yarn lint 20 | 21 | deploy-mainnet: 22 | needs: lint 23 | runs-on: ubuntu-latest 24 | steps: 25 | - uses: actions/checkout@v2 26 | - name: Install node 27 | uses: actions/setup-node@v1 28 | with: 29 | node-version: 18 30 | - name: Install 31 | run: yarn --frozen-lockfile 32 | - name: Generate Manifest 33 | run: yarn generate-manifests 34 | - uses: balancer-labs/graph-deploy@v0.0.1 35 | with: 36 | graph_deploy_key: ${{secrets.GRAPH_DEPLOY_KEY}} 37 | graph_version_label: ${GITHUB_SHA::8} 38 | graph_subgraph_name: 'giveth-giveconomy-mainnet' 39 | graph_account: 'giveth' 40 | graph_config_file: 'subgraph.production-mainnet.yaml' 41 | graph_deploy_studio: true 42 | 43 | deploy-gnosis: 44 | needs: lint 45 | runs-on: ubuntu-latest 46 | steps: 47 | - uses: actions/checkout@v2 48 | - name: Install node 49 | uses: actions/setup-node@v1 50 | with: 51 | node-version: 18 52 | - name: Install 53 | run: yarn --frozen-lockfile 54 | - name: Generate Manifest 55 | run: yarn generate-manifests 56 | - uses: balancer-labs/graph-deploy@v0.0.1 57 | with: 58 | graph_deploy_key: ${{secrets.GRAPH_DEPLOY_KEY}} 59 | graph_version_label: ${GITHUB_SHA::8} 60 | graph_subgraph_name: 'giveth-giveconomy-gnosischain' 61 | graph_account: 'giveth' 62 | graph_config_file: 'subgraph.production-gnosis.yaml' 63 | graph_deploy_studio: true 64 | 65 | deploy-optimism: 66 | needs: lint 67 | runs-on: ubuntu-latest 68 | steps: 69 | - uses: actions/checkout@v2 70 | - name: Install node 71 | uses: actions/setup-node@v1 72 | with: 73 | node-version: 18 74 | - name: Install 75 | run: yarn --frozen-lockfile 76 | - name: Generate Manifest 77 | run: yarn generate-manifests 78 | - uses: balancer-labs/graph-deploy@v0.0.1 79 | with: 80 | graph_deploy_key: ${{secrets.GRAPH_DEPLOY_KEY}} 81 | graph_version_label: ${GITHUB_SHA::8} 82 | graph_subgraph_name: 'giveth-giveconomy-optimism' 83 | graph_account: 'giveth' 84 | graph_config_file: 'subgraph.production-optimism-mainnet.yaml' 85 | graph_deploy_studio: true 86 | -------------------------------------------------------------------------------- /.github/workflows/graph-develop.yaml: -------------------------------------------------------------------------------- 1 | name: Deploy Graph to Develop 2 | 3 | on: 4 | push: 5 | branches: [develop] 6 | 7 | jobs: 8 | lint: 9 | runs-on: ubuntu-latest 10 | steps: 11 | - uses: actions/checkout@v2 12 | - name: Install node 13 | uses: actions/setup-node@v1 14 | with: 15 | node-version: 18 16 | - name: Install 17 | run: yarn --frozen-lockfile 18 | - name: Lint 19 | run: yarn lint 20 | 21 | deploy-staging-goerli: 22 | needs: lint 23 | runs-on: ubuntu-latest 24 | steps: 25 | - uses: actions/checkout@v2 26 | - name: Install node 27 | uses: actions/setup-node@v1 28 | with: 29 | node-version: 18 30 | - name: Install 31 | run: yarn --frozen-lockfile 32 | - name: Generate Manifest 33 | run: yarn generate-manifests 34 | - uses: gtaschuk/graph-deploy@v0.1.9 35 | with: 36 | graph_access_token: ${{ secrets.GRAPH_ACCESS_TOKEN }} 37 | graph_subgraph_name: giveth-economy-goerli-staging 38 | graph_account: giveth 39 | graph_config_file: subgraph.deployment-7-goerli.yaml 40 | 41 | deploy-staging-gnosis: 42 | needs: lint 43 | runs-on: ubuntu-latest 44 | steps: 45 | - uses: actions/checkout@v2 46 | - name: Install node 47 | uses: actions/setup-node@v1 48 | with: 49 | node-version: 18 50 | - name: Install 51 | run: yarn --frozen-lockfile 52 | - name: Generate Manifest 53 | run: yarn generate-manifests 54 | - uses: gtaschuk/graph-deploy@v0.1.9 55 | with: 56 | graph_access_token: ${{ secrets.GRAPH_ACCESS_TOKEN }} 57 | graph_subgraph_name: giveth-economy-xdai-staging 58 | graph_account: giveth 59 | graph_config_file: subgraph.deployment-7-gnosis.yaml 60 | 61 | deploy-staging-optimism-goerli: 62 | needs: lint 63 | runs-on: ubuntu-latest 64 | steps: 65 | - uses: actions/checkout@v2 66 | - name: Install node 67 | uses: actions/setup-node@v1 68 | with: 69 | node-version: 18 70 | - name: Install 71 | run: yarn --frozen-lockfile 72 | - name: Generate Manifest 73 | run: yarn generate-manifests 74 | - uses: gtaschuk/graph-deploy@v0.1.9 75 | with: 76 | graph_access_token: ${{ secrets.GRAPH_ACCESS_TOKEN }} 77 | graph_subgraph_name: giveth-economy-optim-staging 78 | graph_account: giveth 79 | graph_config_file: subgraph.deployment-7-optimism-goerli.yaml 80 | 81 | deploy-staging-optimism-sepolia: 82 | needs: lint 83 | runs-on: ubuntu-latest 84 | steps: 85 | - uses: actions/checkout@v2 86 | - name: Install node 87 | uses: actions/setup-node@v1 88 | with: 89 | node-version: 18 90 | - name: Install 91 | run: yarn --frozen-lockfile 92 | - name: Generate Manifest 93 | run: yarn generate-manifests 94 | - uses: gtaschuk/graph-deploy@v0.1.9 95 | with: 96 | graph_access_token: ${{ secrets.GRAPH_ACCESS_TOKEN }} 97 | graph_subgraph_name: giveth-economy-optim-sepolia 98 | graph_account: giveth 99 | graph_config_file: subgraph.deployment-7-optimism-sepolia.yaml 100 | -------------------------------------------------------------------------------- /src/mappings/unipool.ts: -------------------------------------------------------------------------------- 1 | import { Address } from '@graphprotocol/graph-ts'; 2 | import { 3 | RewardAdded, 4 | RewardPaid, 5 | Staked, 6 | UnipoolTokenDistributor as UnipoolContract, 7 | Withdrawn, 8 | } from '../types/Unipool/UnipoolTokenDistributor'; 9 | import { UNIPOOL } from '../utils/constants'; 10 | import { 11 | getUnipool, 12 | getUserUnipoolBalance, 13 | recordBalanceChange, 14 | } from '../utils/misc'; 15 | import { updateTokenAllocationDistributor } from '../utils/tokenDistroHelper'; 16 | 17 | function updateReward(address: Address, userAddress: Address): void { 18 | const unipool = getUnipool(address); 19 | const contract = UnipoolContract.bind(Address.fromString(unipool.id)); 20 | 21 | const callRewardPerTokenStored = contract.try_rewardPerTokenStored(); 22 | if (!callRewardPerTokenStored.reverted) { 23 | unipool.rewardPerTokenStored = callRewardPerTokenStored.value; 24 | } 25 | 26 | const callLastUpdateDate = contract.try_lastUpdateTime(); 27 | 28 | if (!callLastUpdateDate.reverted) { 29 | unipool.lastUpdateTime = callLastUpdateDate.value; 30 | } 31 | unipool.save(); 32 | 33 | if (userAddress.toHex() != Address.zero().toHex()) { 34 | const userUnipoolBalance = getUserUnipoolBalance(address, userAddress); 35 | userUnipoolBalance.rewards = contract.rewards(userAddress); 36 | userUnipoolBalance.rewardPerTokenPaid = 37 | contract.userRewardPerTokenPaid(userAddress); 38 | userUnipoolBalance.save(); 39 | } 40 | } 41 | 42 | export function handleRewardAdded(event: RewardAdded): void { 43 | updateReward(event.address, Address.zero()); 44 | 45 | const unipool = getUnipool(event.address); 46 | const contract = UnipoolContract.bind(Address.fromString(unipool.id)); 47 | 48 | unipool.rewardRate = contract.rewardRate(); 49 | unipool.periodFinish = contract.periodFinish(); 50 | unipool.save(); 51 | } 52 | 53 | export function handleRewardPaid(event: RewardPaid): void { 54 | updateReward(event.address, event.params.user); 55 | updateTokenAllocationDistributor(event.transaction.hash.toHex(), UNIPOOL); 56 | } 57 | 58 | export function handleStaked(event: Staked): void { 59 | updateReward(event.address, event.params.user); 60 | 61 | const unipool = getUnipool(event.address); 62 | unipool.totalSupply = unipool.totalSupply.plus(event.params.amount); 63 | unipool.save(); 64 | 65 | const userBalance = getUserUnipoolBalance(event.address, event.params.user); 66 | userBalance.balance = userBalance.balance.plus(event.params.amount); 67 | userBalance.updatedAt = event.block.timestamp; 68 | userBalance.save(); 69 | 70 | recordBalanceChange( 71 | event, 72 | event.params.user, 73 | event.params.amount, 74 | userBalance.balance, 75 | ); 76 | } 77 | 78 | export function handleWithdrawn(event: Withdrawn): void { 79 | updateReward(event.address, event.params.user); 80 | 81 | const unipool = getUnipool(event.address); 82 | unipool.totalSupply = unipool.totalSupply.minus(event.params.amount); 83 | unipool.save(); 84 | 85 | const userBalance = getUserUnipoolBalance(event.address, event.params.user); 86 | userBalance.balance = userBalance.balance.minus(event.params.amount); 87 | userBalance.updatedAt = event.block.timestamp; 88 | userBalance.save(); 89 | 90 | recordBalanceChange( 91 | event, 92 | event.params.user, 93 | event.params.amount.neg(), 94 | userBalance.balance, 95 | ); 96 | } 97 | -------------------------------------------------------------------------------- /schema.graphql: -------------------------------------------------------------------------------- 1 | type GIVPower @entity { 2 | id: ID! 3 | initialDate: BigInt! 4 | locksCreated: Int! 5 | roundDuration: Int! 6 | totalGIVLocked: BigInt! 7 | } 8 | 9 | type TokenLock @entity { 10 | id: ID! 11 | user: User! 12 | amount: BigInt! 13 | rounds: Int! 14 | untilRound: Int! 15 | unlockableAt: BigInt 16 | unlockedAt: BigInt 17 | unlocked: Boolean! 18 | } 19 | 20 | type User @entity { 21 | id: ID! 22 | givLocked: BigInt! 23 | lastGivPowerUpdateTime: BigInt! 24 | locksOwned: [TokenLock!] @derivedFrom(field: "user") 25 | tokensBalance: [TokenBalance!] @derivedFrom(field: "user") 26 | unipoolsBalance: [UnipoolBalance!] @derivedFrom(field: "user") 27 | tokenDistroBalance: [TokenDistroBalance!] @derivedFrom(field: "user") 28 | giversPFPToken: [GiversPFPToken!] @derivedFrom(field: "user") 29 | } 30 | 31 | type UserGivPowerSnapshot @entity { 32 | id: ID! 33 | timestamp: BigInt! 34 | user: User! 35 | givPowerAmount: BigInt! 36 | cumulativeGivPowerAmount: BigInt! 37 | } 38 | 39 | type TokenBalance @entity { 40 | id: ID! 41 | balance: BigInt! 42 | user: User! 43 | token: String! 44 | updatedAt: BigInt! 45 | } 46 | 47 | type UnipoolBalance @entity { 48 | id: ID! 49 | balance: BigInt! 50 | user: User! 51 | unipool: String! 52 | rewards: BigInt! 53 | rewardPerTokenPaid: BigInt! 54 | updatedAt: BigInt! 55 | } 56 | 57 | type BalanceChange @entity { 58 | id: ID! 59 | account: String! 60 | contractAddress: String! 61 | time: BigInt! 62 | block: BigInt! 63 | amount: BigInt! 64 | newBalance: BigInt! 65 | } 66 | 67 | type Unipool @entity { 68 | id: ID! 69 | periodFinish: BigInt 70 | totalSupply: BigInt! 71 | rewardRate: BigInt! 72 | lastUpdateTime: BigInt 73 | rewardPerTokenStored: BigInt! 74 | } 75 | 76 | type TokenDistroBalance @entity { 77 | id: ID! 78 | user: User! 79 | allocatedTokens: BigInt! 80 | allocationCount: BigInt! 81 | claimed: BigInt! 82 | givback: BigInt! 83 | givDropClaimed: Boolean 84 | givbackLiquidPart: BigInt! 85 | tokenDistroAddress: String 86 | } 87 | 88 | type TokenAllocation @entity { 89 | id: ID! 90 | recipient: String! 91 | amount: BigInt! 92 | timestamp: BigInt! 93 | txHash: String! 94 | distributor: String 95 | givback: Boolean 96 | praise: Boolean 97 | tokenDistroAddress: String! 98 | } 99 | 100 | type TransactionTokenAllocation @entity { 101 | id: ID! 102 | tokenAllocationIds: [String!]! 103 | } 104 | 105 | type TokenDistro @entity { 106 | id: ID! 107 | totalTokens: BigInt 108 | startTime: BigInt 109 | cliffTime: BigInt 110 | duration: BigInt 111 | initialAmount: BigInt 112 | lockedAmount: BigInt 113 | } 114 | 115 | type UniswapPosition @entity { 116 | id: ID! 117 | tokenId: String! 118 | token0: String! 119 | token1: String! 120 | liquidity: BigInt! 121 | tickLower: Int! 122 | tickUpper: Int! 123 | tokenURI: String! 124 | owner: String! 125 | staker: String 126 | staked: Boolean 127 | closed: Boolean 128 | } 129 | 130 | type UniswapV3Pool @entity { 131 | id: ID! 132 | token0: String! 133 | token1: String! 134 | sqrtPriceX96: BigInt! 135 | tick: BigInt! 136 | liquidity: BigInt! 137 | } 138 | 139 | type UniswapInfinitePosition @entity { 140 | id: ID! 141 | lastUpdateTimeStamp: BigInt! 142 | lastRewardAmount: BigInt! 143 | } 144 | 145 | type GiversPFPToken @entity { 146 | id: ID! 147 | tokenId: Int! 148 | user: User! 149 | imageIpfs: String! 150 | contractAddress: String! 151 | } 152 | -------------------------------------------------------------------------------- /abis/MerkleDistro.json: -------------------------------------------------------------------------------- 1 | [ 2 | { 3 | "type": "event", 4 | "name": "Claimed", 5 | "inputs": [ 6 | { 7 | "type": "uint256", 8 | "name": "index", 9 | "internalType": "uint256", 10 | "indexed": false 11 | }, 12 | { 13 | "type": "address", 14 | "name": "account", 15 | "internalType": "address", 16 | "indexed": false 17 | }, 18 | { 19 | "type": "address", 20 | "name": "recipient", 21 | "internalType": "address", 22 | "indexed": false 23 | }, 24 | { 25 | "type": "uint256", 26 | "name": "amount", 27 | "internalType": "uint256", 28 | "indexed": false 29 | } 30 | ], 31 | "anonymous": false 32 | }, 33 | { 34 | "type": "event", 35 | "name": "OwnershipTransferred", 36 | "inputs": [ 37 | { 38 | "type": "address", 39 | "name": "previousOwner", 40 | "internalType": "address", 41 | "indexed": true 42 | }, 43 | { 44 | "type": "address", 45 | "name": "newOwner", 46 | "internalType": "address", 47 | "indexed": true 48 | } 49 | ], 50 | "anonymous": false 51 | }, 52 | { 53 | "type": "function", 54 | "stateMutability": "nonpayable", 55 | "outputs": [], 56 | "name": "claim", 57 | "inputs": [ 58 | { "type": "uint256", "name": "index", "internalType": "uint256" }, 59 | { "type": "uint256", "name": "amount", "internalType": "uint256" }, 60 | { 61 | "type": "bytes32[]", 62 | "name": "merkleProof", 63 | "internalType": "bytes32[]" 64 | } 65 | ] 66 | }, 67 | { 68 | "type": "function", 69 | "stateMutability": "nonpayable", 70 | "outputs": [], 71 | "name": "claimTo", 72 | "inputs": [ 73 | { "type": "uint256", "name": "index", "internalType": "uint256" }, 74 | { "type": "address", "name": "account", "internalType": "address" }, 75 | { "type": "address", "name": "recipient", "internalType": "address" }, 76 | { "type": "uint256", "name": "amount", "internalType": "uint256" }, 77 | { 78 | "type": "bytes32[]", 79 | "name": "merkleProof", 80 | "internalType": "bytes32[]" 81 | } 82 | ] 83 | }, 84 | { 85 | "type": "function", 86 | "stateMutability": "nonpayable", 87 | "outputs": [], 88 | "name": "initialize", 89 | "inputs": [ 90 | { 91 | "type": "address", 92 | "name": "_tokenDistro", 93 | "internalType": "contract IDistro" 94 | }, 95 | { "type": "bytes32", "name": "_merkleRoot", "internalType": "bytes32" } 96 | ] 97 | }, 98 | { 99 | "type": "function", 100 | "stateMutability": "view", 101 | "outputs": [{ "type": "bool", "name": "", "internalType": "bool" }], 102 | "name": "isClaimed", 103 | "inputs": [ 104 | { "type": "uint256", "name": "index", "internalType": "uint256" } 105 | ] 106 | }, 107 | { 108 | "type": "function", 109 | "stateMutability": "view", 110 | "outputs": [{ "type": "bytes32", "name": "", "internalType": "bytes32" }], 111 | "name": "merkleRoot", 112 | "inputs": [] 113 | }, 114 | { 115 | "type": "function", 116 | "stateMutability": "view", 117 | "outputs": [{ "type": "address", "name": "", "internalType": "address" }], 118 | "name": "owner", 119 | "inputs": [] 120 | }, 121 | { 122 | "type": "function", 123 | "stateMutability": "nonpayable", 124 | "outputs": [], 125 | "name": "renounceOwnership", 126 | "inputs": [] 127 | }, 128 | { 129 | "type": "function", 130 | "stateMutability": "view", 131 | "outputs": [ 132 | { "type": "address", "name": "", "internalType": "contract IDistro" } 133 | ], 134 | "name": "tokenDistro", 135 | "inputs": [] 136 | }, 137 | { 138 | "type": "function", 139 | "stateMutability": "nonpayable", 140 | "outputs": [], 141 | "name": "transferOwnership", 142 | "inputs": [ 143 | { "type": "address", "name": "newOwner", "internalType": "address" } 144 | ] 145 | } 146 | ] 147 | -------------------------------------------------------------------------------- /package.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "@giveth/givpower-subgraph", 3 | "version": "1.5.0", 4 | "description": "Template for subgraph development boilerplate", 5 | "scripts": { 6 | "auth": "graph auth https://api.thegraph.com/deploy/", 7 | "lint": "eslint ./src", 8 | "deploy:mateo": "yarn generate-manifests && graph deploy --product hosted-service mateodaza/givpower-subgraph subgraph.deployment-7.yaml", 9 | "deploy:gnosis:deployment-6:amin": "yarn generate-manifests && graph deploy --product hosted-service aminlatifi/givpower-deployment-six subgraph.deployment-6-gnosis.yaml", 10 | "deploy:kovan:deployment-6:amin": "yarn generate-manifests && graph deploy --product hosted-service aminlatifi/givpower-deployment-six-kovan subgraph.deployment-6-kovan.yaml", 11 | "deploy:deployment-7": "yarn generate-manifests && graph deploy --product hosted-service mateodaza/givpower-subgraph subgraph.deployment-7.yaml", 12 | "deploy:gnosis:deployment-7": "yarn generate-manifests && graph deploy --product hosted-service aminlatifi/giveconomy-xdai-deployment-seven subgraph.deployment-7-gnosis.yaml", 13 | "deploy:gnosis:develop": "yarn generate-manifests && graph deploy --product hosted-service giveth/giveth-economy-second-xdai-staging subgraph.deployment-7-gnosis.yaml", 14 | "deploy:optimism-goerli:develop": "yarn generate-manifests && graph deploy --product hosted-service giveth/giveth-economy-optim-staging subgraph.deployment-7-optimism-goerli.yaml", 15 | "deploy:optimism-sepolia:develop": "yarn generate-manifests && graph deploy --product hosted-service giveth/giveth-economy-optim-sepolia subgraph.deployment-7-optimism-sepolia.yaml", 16 | "deploy:optimism-mainnet:production": "yarn generate-manifests && graph deploy --product subgraph-studio giveth-giveconomy-optimism subgraph.production-optimism-mainnet.yaml", 17 | "deploy:kovan:develop": "yarn generate-manifests && graph deploy --product hosted-service giveth/giveth-economy-second-kovan-staging subgraph.deployment-7-kovan.yaml", 18 | "deploy:kovan:deployment-7:mohammad": "yarn generate-manifests && graph deploy --product hosted-service mohammadranjbarz/giv-economy-kovan subgraph.deployment-7-kovan.yaml", 19 | "deploy:goerli:develop": "yarn generate-manifests && graph deploy --product hosted-service giveth/giveth-economy-goerli-staging subgraph.deployment-7-goerli.yaml", 20 | "deploy:gnosis:production": "yarn generate-manifests && graph deploy --product hosted-service giveth/giveth-economy-second-xdai subgraph.production-gnosis.yaml", 21 | "deploy:gnosis:production-mateo": "yarn generate-manifests && graph deploy --product hosted-service mateodaza/giveth-economy-second-xdai subgraph.production-gnosis.yaml", 22 | "deploy:mainnet:production": "yarn generate-manifests && graph deploy --product hosted-service giveth/giveth-economy-second-mainnet subgraph.production-mainnet.yaml", 23 | "deploy:mainnet:production-mateo": "yarn generate-manifests && graph deploy --product hosted-service mateodaza/giveth-economy-second-mainnet subgraph.production-mainnet.yaml", 24 | "deploy:mainnet": "yarn deploy ORGANISATION/SUBGRAPH", 25 | "codegen:deployment-6": "yarn generate-manifests && graph codegen subgraph.deployment-6.yaml --output-dir src/types/", 26 | "codegen:deployment-7": "yarn generate-manifests && graph codegen subgraph.deployment-7-gnosis.yaml --output-dir src/types/", 27 | "build:deployment-6": "yarn generate-manifests && graph build subgraph.deployment-6.yaml", 28 | "build:deployment-7": "yarn generate-manifests && graph build subgraph.deployment-7.yaml", 29 | "build:deployment-mainnet": "yarn generate-manifests && graph build subgraph.production-mainnet.yaml", 30 | "build": "yarn generate-manifests && graph build subgraph.model.yaml", 31 | "generate-manifests": "ts-node ./scripts/generate-manifests && graph codegen subgraph.model.yaml --output-dir src/types/" 32 | }, 33 | "repository": { 34 | "type": "git", 35 | "url": "https://github.com/Giveth/giveconomy-subgraph.git" 36 | }, 37 | "contributors": [], 38 | "license": "MIT", 39 | "bugs": { 40 | "url": "https://github.com/Giveth/giveconomy-subgraph" 41 | }, 42 | "homepage": "https://github.com/Giveth/giveconomy-subgraph", 43 | "dependencies": { 44 | "@graphprotocol/graph-cli": "^0.68.5", 45 | "@graphprotocol/graph-ts": "^0.33.0", 46 | "fs-extra": "^8.1.0", 47 | "handlebars": "^4.7.6", 48 | "js-yaml": "^4.1.0" 49 | }, 50 | "devDependencies": { 51 | "@types/fs-extra": "^9.0.2", 52 | "@types/js-yaml": "^4.0.5", 53 | "@types/node": "^14.14.37", 54 | "eslint": "^7.10.0", 55 | "eslint-config-airbnb-base-typescript-prettier": "^4.1.0", 56 | "prettier": "^2.1.2", 57 | "ts-node": "^10.9.1", 58 | "typescript": "^4.0.3" 59 | }, 60 | "packageManager": "yarn@1.22.19+sha1.4ba7fc5c6e704fce2066ecbfb0b0d8976fe62447" 61 | } 62 | -------------------------------------------------------------------------------- /abis/ERC20.json: -------------------------------------------------------------------------------- 1 | [ 2 | { 3 | "constant": true, 4 | "inputs": [ 5 | 6 | ], 7 | "name": "name", 8 | "outputs": [ 9 | { 10 | "name": "", 11 | "type": "string" 12 | } 13 | ], 14 | "payable": false, 15 | "stateMutability": "view", 16 | "type": "function" 17 | }, 18 | { 19 | "constant": false, 20 | "inputs": [ 21 | { 22 | "name": "_spender", 23 | "type": "address" 24 | }, 25 | { 26 | "name": "_value", 27 | "type": "uint256" 28 | } 29 | ], 30 | "name": "approve", 31 | "outputs": [ 32 | { 33 | "name": "", 34 | "type": "bool" 35 | } 36 | ], 37 | "payable": false, 38 | "stateMutability": "nonpayable", 39 | "type": "function" 40 | }, 41 | { 42 | "constant": true, 43 | "inputs": [ 44 | 45 | ], 46 | "name": "totalSupply", 47 | "outputs": [ 48 | { 49 | "name": "", 50 | "type": "uint256" 51 | } 52 | ], 53 | "payable": false, 54 | "stateMutability": "view", 55 | "type": "function" 56 | }, 57 | { 58 | "constant": false, 59 | "inputs": [ 60 | { 61 | "name": "_from", 62 | "type": "address" 63 | }, 64 | { 65 | "name": "_to", 66 | "type": "address" 67 | }, 68 | { 69 | "name": "_value", 70 | "type": "uint256" 71 | } 72 | ], 73 | "name": "transferFrom", 74 | "outputs": [ 75 | { 76 | "name": "", 77 | "type": "bool" 78 | } 79 | ], 80 | "payable": false, 81 | "stateMutability": "nonpayable", 82 | "type": "function" 83 | }, 84 | { 85 | "constant": true, 86 | "inputs": [ 87 | 88 | ], 89 | "name": "decimals", 90 | "outputs": [ 91 | { 92 | "name": "", 93 | "type": "uint8" 94 | } 95 | ], 96 | "payable": false, 97 | "stateMutability": "view", 98 | "type": "function" 99 | }, 100 | { 101 | "constant": true, 102 | "inputs": [ 103 | { 104 | "name": "_owner", 105 | "type": "address" 106 | } 107 | ], 108 | "name": "balanceOf", 109 | "outputs": [ 110 | { 111 | "name": "balance", 112 | "type": "uint256" 113 | } 114 | ], 115 | "payable": false, 116 | "stateMutability": "view", 117 | "type": "function" 118 | }, 119 | { 120 | "constant": true, 121 | "inputs": [ 122 | 123 | ], 124 | "name": "symbol", 125 | "outputs": [ 126 | { 127 | "name": "", 128 | "type": "string" 129 | } 130 | ], 131 | "payable": false, 132 | "stateMutability": "view", 133 | "type": "function" 134 | }, 135 | { 136 | "constant": false, 137 | "inputs": [ 138 | { 139 | "name": "_to", 140 | "type": "address" 141 | }, 142 | { 143 | "name": "_value", 144 | "type": "uint256" 145 | } 146 | ], 147 | "name": "transfer", 148 | "outputs": [ 149 | { 150 | "name": "", 151 | "type": "bool" 152 | } 153 | ], 154 | "payable": false, 155 | "stateMutability": "nonpayable", 156 | "type": "function" 157 | }, 158 | { 159 | "constant": true, 160 | "inputs": [ 161 | { 162 | "name": "_owner", 163 | "type": "address" 164 | }, 165 | { 166 | "name": "_spender", 167 | "type": "address" 168 | } 169 | ], 170 | "name": "allowance", 171 | "outputs": [ 172 | { 173 | "name": "", 174 | "type": "uint256" 175 | } 176 | ], 177 | "payable": false, 178 | "stateMutability": "view", 179 | "type": "function" 180 | }, 181 | { 182 | "payable": true, 183 | "stateMutability": "payable", 184 | "type": "fallback" 185 | }, 186 | { 187 | "anonymous": false, 188 | "inputs": [ 189 | { 190 | "indexed": true, 191 | "name": "owner", 192 | "type": "address" 193 | }, 194 | { 195 | "indexed": true, 196 | "name": "spender", 197 | "type": "address" 198 | }, 199 | { 200 | "indexed": false, 201 | "name": "value", 202 | "type": "uint256" 203 | } 204 | ], 205 | "name": "Approval", 206 | "type": "event" 207 | }, 208 | { 209 | "anonymous": false, 210 | "inputs": [ 211 | { 212 | "indexed": true, 213 | "name": "from", 214 | "type": "address" 215 | }, 216 | { 217 | "indexed": true, 218 | "name": "to", 219 | "type": "address" 220 | }, 221 | { 222 | "indexed": false, 223 | "name": "value", 224 | "type": "uint256" 225 | } 226 | ], 227 | "name": "Transfer", 228 | "type": "event" 229 | } 230 | ] 231 | -------------------------------------------------------------------------------- /src/utils/tokenDistroHelper.ts: -------------------------------------------------------------------------------- 1 | import { 2 | TokenAllocation, 3 | TokenDistro, 4 | TokenDistroBalance, 5 | TransactionTokenAllocation, 6 | } from '../types/schema'; 7 | import { Address, BigInt, log } from '@graphprotocol/graph-ts'; 8 | import { TokenDistro as TokenDistroContract } from '../types/TokenDistro/TokenDistro'; 9 | import { getUserEntity } from './misc'; 10 | export function saveTokenAllocation( 11 | recipient: string, 12 | txHash: string, 13 | logIndex: BigInt, 14 | amount: BigInt, 15 | timestamp: BigInt, 16 | tokenDistroAddress: string, 17 | ): void { 18 | let transactionTokenAllocations = TransactionTokenAllocation.load(txHash); 19 | if (!transactionTokenAllocations) { 20 | transactionTokenAllocations = new TransactionTokenAllocation(txHash); 21 | transactionTokenAllocations.tokenAllocationIds = []; 22 | } 23 | const tokenAllocationIds = transactionTokenAllocations.tokenAllocationIds; 24 | const entityId = `${txHash}-${logIndex}`; 25 | const entity = new TokenAllocation(entityId); 26 | entity.amount = amount; 27 | entity.timestamp = timestamp; 28 | entity.recipient = recipient; 29 | entity.txHash = txHash; 30 | entity.tokenDistroAddress = tokenDistroAddress; 31 | entity.save(); 32 | tokenAllocationIds.push(entityId); 33 | transactionTokenAllocations.tokenAllocationIds = tokenAllocationIds; 34 | transactionTokenAllocations.save(); 35 | } 36 | export function getTokenDistroBalance( 37 | tokenDistro: string, 38 | userAddress: string, 39 | ): TokenDistroBalance { 40 | const id = tokenDistro + '-' + userAddress; 41 | let tokenDistroBalance = TokenDistroBalance.load(id); 42 | 43 | getUserEntity(Address.fromString(userAddress)); 44 | 45 | if (!tokenDistroBalance) { 46 | tokenDistroBalance = new TokenDistroBalance(id); 47 | tokenDistroBalance.user = userAddress; 48 | tokenDistroBalance.allocatedTokens = BigInt.zero(); 49 | tokenDistroBalance.allocationCount = BigInt.zero(); 50 | tokenDistroBalance.claimed = BigInt.zero(); 51 | tokenDistroBalance.givback = BigInt.zero(); 52 | tokenDistroBalance.givbackLiquidPart = BigInt.zero(); 53 | tokenDistroBalance.tokenDistroAddress = tokenDistro; 54 | tokenDistroBalance.save(); 55 | } 56 | 57 | return tokenDistroBalance; 58 | } 59 | 60 | function getOrUpdateTokenDistro( 61 | address: Address, 62 | reFetch: boolean, 63 | ): TokenDistro { 64 | let tokenDistro = TokenDistro.load(address.toHex()); 65 | 66 | if (tokenDistro && !reFetch) { 67 | log.info('Token Distro existed' + address.toHex(), []); 68 | return tokenDistro; 69 | } 70 | if (!tokenDistro) tokenDistro = new TokenDistro(address.toHex()); 71 | 72 | const contract = TokenDistroContract.bind(address); 73 | tokenDistro.lockedAmount = contract.lockedAmount(); 74 | tokenDistro.startTime = contract.startTime(); 75 | tokenDistro.cliffTime = contract.cliffTime(); 76 | tokenDistro.duration = contract.duration(); 77 | tokenDistro.initialAmount = contract.initialAmount(); 78 | tokenDistro.totalTokens = contract.totalTokens(); 79 | tokenDistro.save(); 80 | return tokenDistro; 81 | } 82 | 83 | export function getTokenDistro(address: Address): TokenDistro { 84 | return getOrUpdateTokenDistro(address, false); 85 | } 86 | 87 | export function updateTokenDistro(address: Address): TokenDistro { 88 | return getOrUpdateTokenDistro(address, true); 89 | } 90 | 91 | export function updateTokenAllocationDistributor( 92 | txHash: string, 93 | distributor: string, 94 | ): void { 95 | const transactionTokenAllocations = TransactionTokenAllocation.load(txHash); 96 | if (!transactionTokenAllocations) { 97 | return; 98 | } 99 | for ( 100 | let i = 0; 101 | i < transactionTokenAllocations.tokenAllocationIds.length; 102 | i++ 103 | ) { 104 | const entity = TokenAllocation.load( 105 | transactionTokenAllocations.tokenAllocationIds[i], 106 | ); 107 | if (!entity) { 108 | continue; 109 | } 110 | entity.distributor = distributor; 111 | entity.save(); 112 | } 113 | } 114 | 115 | export function addAllocatedTokens( 116 | to: string, 117 | value: BigInt, 118 | tokenDistroAddress: string, 119 | ): void { 120 | const allocatedBalance = getTokenDistroBalance(tokenDistroAddress, to); 121 | allocatedBalance.allocatedTokens = 122 | allocatedBalance.allocatedTokens.plus(value); 123 | allocatedBalance.allocationCount = allocatedBalance.allocationCount.plus( 124 | BigInt.fromI32(1), 125 | ); 126 | allocatedBalance.save(); 127 | } 128 | 129 | export function addClaimed( 130 | to: string, 131 | value: BigInt, 132 | tokenDistroAddress: string, 133 | ): void { 134 | const claimBalance = getTokenDistroBalance(tokenDistroAddress, to); 135 | claimBalance.claimed = claimBalance.claimed.plus(value); 136 | claimBalance.givback = BigInt.zero(); 137 | claimBalance.givbackLiquidPart = BigInt.zero(); 138 | claimBalance.save(); 139 | } 140 | -------------------------------------------------------------------------------- /src/mappings/uniswapV3/uniswapV3PositionsNftMapping.ts: -------------------------------------------------------------------------------- 1 | import { 2 | IncreaseLiquidity, 3 | UniswapV3PositionsNFT, 4 | Transfer, 5 | DecreaseLiquidity, 6 | } from '../../types/UniswapV3PositionsNFT/UniswapV3PositionsNFT'; 7 | import { 8 | UniswapInfinitePosition, 9 | UniswapPosition, 10 | UniswapV3Pool as Pool, 11 | } from '../../types/schema'; 12 | import { networkUniswapV3Config } from '../../configuration'; 13 | import { Address, BigInt, dataSource, log } from '@graphprotocol/graph-ts'; 14 | import { recordUniswapV3InfinitePositionReward } from '../../commons/uniswapV3RewardRecorder'; 15 | import { UniswapV3Pool } from '../../types/UniswapV3Pool/UniswapV3Pool'; 16 | 17 | const network = dataSource.network(); 18 | 19 | const uniswapV3Config = 20 | network == 'kovan' 21 | ? networkUniswapV3Config.kovan 22 | : networkUniswapV3Config.mainnet; 23 | 24 | const fee: i32 = 3000; 25 | 26 | function updateUniswapV3PoolLiquidity(): void { 27 | const pool = Pool.load(uniswapV3Config.UNISWAP_V3_POOL_ADDRESS.toLowerCase()); 28 | if (!pool) { 29 | log.error('Increase/Decrease liquidity: UniswapV3Pool {} does not saved', [ 30 | uniswapV3Config.UNISWAP_V3_POOL_ADDRESS, 31 | ]); 32 | return; 33 | } 34 | const poolContract = UniswapV3Pool.bind( 35 | Address.fromString(uniswapV3Config.UNISWAP_V3_POOL_ADDRESS), 36 | ); 37 | pool.liquidity = poolContract.liquidity(); 38 | pool.save(); 39 | } 40 | 41 | export function handleIncreaseLiquidity(event: IncreaseLiquidity): void { 42 | const tokenId = event.params.tokenId; 43 | const uniswapToken = UniswapPosition.load(tokenId.toString()); 44 | if (uniswapToken) { 45 | uniswapToken.liquidity = uniswapToken.liquidity.plus( 46 | event.params.liquidity, 47 | ); 48 | uniswapToken.closed = false; 49 | uniswapToken.save(); 50 | 51 | recordUniswapV3InfinitePositionReward(event.block.timestamp); 52 | return; 53 | } 54 | const contract = UniswapV3PositionsNFT.bind(event.address); 55 | const positionsResult = contract.try_positions(tokenId); 56 | if (positionsResult.reverted) { 57 | return; 58 | } 59 | const positions = positionsResult.value; 60 | const token0 = positions.value2.toHex(); 61 | const token1 = positions.value3.toHex(); 62 | 63 | const isGivEthLiquidity: boolean = 64 | (token0 == uniswapV3Config.MAINNET_GIV_TOKEN_ADDRESS.toLowerCase() && 65 | token1 == uniswapV3Config.MAINNET_WETH_TOKEN_ADDRESS.toLowerCase()) || 66 | (token0 == uniswapV3Config.MAINNET_WETH_TOKEN_ADDRESS.toLowerCase() && 67 | token1 == uniswapV3Config.MAINNET_GIV_TOKEN_ADDRESS.toLowerCase()); 68 | 69 | //value4 is fee 70 | if (positions.value4 == fee && isGivEthLiquidity == true) { 71 | const owner = contract.ownerOf(tokenId).toHex(); 72 | const uniswapStakedPosition = new UniswapPosition(tokenId.toString()); 73 | uniswapStakedPosition.tokenId = tokenId.toString(); 74 | uniswapStakedPosition.liquidity = positions.value7; 75 | uniswapStakedPosition.token0 = token0; 76 | uniswapStakedPosition.token1 = token1; 77 | uniswapStakedPosition.tokenURI = contract.tokenURI(tokenId); 78 | uniswapStakedPosition.tickLower = positions.value5; 79 | uniswapStakedPosition.tickUpper = positions.value6; 80 | uniswapStakedPosition.owner = owner; 81 | uniswapStakedPosition.closed = false; 82 | uniswapStakedPosition.save(); 83 | 84 | if (uniswapV3Config.UNISWAP_INFINITE_POSITION == tokenId.toString()) { 85 | const uniswapInfinitePosition = new UniswapInfinitePosition( 86 | tokenId.toString(), 87 | ); 88 | uniswapInfinitePosition.lastRewardAmount = BigInt.zero(); 89 | uniswapInfinitePosition.lastUpdateTimeStamp = event.block.timestamp; 90 | uniswapInfinitePosition.save(); 91 | } else { 92 | recordUniswapV3InfinitePositionReward(event.block.timestamp); 93 | } 94 | 95 | updateUniswapV3PoolLiquidity(); 96 | } 97 | } 98 | 99 | export function handleDecreaseLiquidity(event: DecreaseLiquidity): void { 100 | const tokenId = event.params.tokenId; 101 | const uniswapStakedPosition = UniswapPosition.load(tokenId.toString()); 102 | if (!uniswapStakedPosition) { 103 | // In decrease we dont check token0, token1, we just check if we have it we know it's our NFT otherwise we do nothing 104 | return; 105 | } 106 | uniswapStakedPosition.liquidity = uniswapStakedPosition.liquidity.minus( 107 | event.params.liquidity, 108 | ); 109 | if (uniswapStakedPosition.liquidity.equals(BigInt.fromString('0'))) { 110 | uniswapStakedPosition.closed = true; 111 | } 112 | uniswapStakedPosition.save(); 113 | 114 | recordUniswapV3InfinitePositionReward(event.block.timestamp); 115 | updateUniswapV3PoolLiquidity(); 116 | } 117 | 118 | export function handleTransfer(event: Transfer): void { 119 | const position = UniswapPosition.load(event.params.tokenId.toString()); 120 | if (!position) { 121 | return; 122 | } 123 | position.owner = event.params.to.toHex(); 124 | position.save(); 125 | } 126 | -------------------------------------------------------------------------------- /src/mappings/tokenDistro.ts: -------------------------------------------------------------------------------- 1 | import { 2 | Allocate, 3 | Assign, 4 | Claim, 5 | GivBackPaid, 6 | TokenDistro, 7 | StartTimeChanged, 8 | ChangeAddress, 9 | DurationChanged, 10 | PraiseRewardPaid, 11 | } from '../types/TokenDistro/TokenDistro'; 12 | import { 13 | TokenAllocation, 14 | TransactionTokenAllocation, 15 | TokenDistroBalance, 16 | } from '../types/schema'; 17 | import { GIVBACK, PRAISE } from '../utils/constants'; 18 | import { BigInt, log } from '@graphprotocol/graph-ts'; 19 | import { 20 | addAllocatedTokens, 21 | addClaimed, 22 | getTokenDistroBalance, 23 | saveTokenAllocation, 24 | updateTokenDistro, 25 | } from '../../src/utils/tokenDistroHelper'; 26 | 27 | export function handleAllocate(event: Allocate): void { 28 | saveTokenAllocation( 29 | event.params.grantee.toHex(), 30 | event.transaction.hash.toHex(), 31 | event.transactionLogIndex, 32 | event.params.amount, 33 | event.block.timestamp, 34 | event.address.toHex(), 35 | ); 36 | addAllocatedTokens( 37 | event.params.grantee.toHex(), 38 | event.params.amount, 39 | event.address.toHex(), 40 | ); 41 | } 42 | 43 | export function handleAssign(event: Assign): void { 44 | updateTokenDistro(event.address); 45 | } 46 | 47 | export function handleChangeAddress(event: ChangeAddress): void { 48 | const oldBalance = getTokenDistroBalance( 49 | event.address.toHex(), 50 | event.params.oldAddress.toHex(), 51 | ); 52 | const newBalance = getTokenDistroBalance( 53 | event.address.toHex(), 54 | event.params.newAddress.toHex(), 55 | ); 56 | 57 | // New Address allocatedTokens amount should be zero 58 | newBalance.allocatedTokens = newBalance.allocatedTokens.plus( 59 | oldBalance.allocatedTokens, 60 | ); 61 | oldBalance.allocatedTokens = BigInt.zero(); 62 | 63 | // New Address claimed amount should be zero 64 | newBalance.claimed = newBalance.claimed.plus(oldBalance.claimed); 65 | oldBalance.claimed = BigInt.zero(); 66 | 67 | newBalance.givback = newBalance.givback.plus(oldBalance.givback); 68 | oldBalance.givback = BigInt.zero(); 69 | 70 | newBalance.givbackLiquidPart = newBalance.givbackLiquidPart.plus( 71 | oldBalance.givbackLiquidPart, 72 | ); 73 | oldBalance.givbackLiquidPart = BigInt.zero(); 74 | 75 | oldBalance.save(); 76 | newBalance.save(); 77 | } 78 | 79 | export function handleClaim(event: Claim): void { 80 | addClaimed( 81 | event.params.grantee.toHex(), 82 | event.params.amount, 83 | event.address.toHex(), 84 | ); 85 | } 86 | 87 | export function handleGivBackPaid(event: GivBackPaid): void { 88 | const transactionTokenAllocations = TransactionTokenAllocation.load( 89 | event.transaction.hash.toHex(), 90 | ); 91 | 92 | if (!transactionTokenAllocations) { 93 | return; 94 | } 95 | 96 | const contract = TokenDistro.bind(event.address); 97 | const globallyClaimableNow = contract.try_globallyClaimableAt( 98 | event.block.timestamp, 99 | ); 100 | const totalTokens = contract.totalTokens(); 101 | 102 | for ( 103 | let i = 0; 104 | i < transactionTokenAllocations.tokenAllocationIds.length; 105 | i++ 106 | ) { 107 | const tokenAllocation = TokenAllocation.load( 108 | transactionTokenAllocations.tokenAllocationIds[i], 109 | ); 110 | if (!tokenAllocation) { 111 | continue; 112 | } 113 | tokenAllocation.givback = true; 114 | tokenAllocation.distributor = GIVBACK; 115 | tokenAllocation.save(); 116 | 117 | const balance = getTokenDistroBalance( 118 | tokenAllocation.tokenDistroAddress, 119 | tokenAllocation.recipient, 120 | ); 121 | if (!balance) { 122 | continue; 123 | } 124 | 125 | balance.givback = balance.givback.plus(tokenAllocation.amount); 126 | 127 | if (!globallyClaimableNow.reverted) { 128 | balance.givbackLiquidPart = balance.givbackLiquidPart.plus( 129 | tokenAllocation.amount 130 | .times(globallyClaimableNow.value) 131 | .div(totalTokens), 132 | ); 133 | } 134 | 135 | balance.save(); 136 | } 137 | } 138 | 139 | export function handlePraiseRewardPaid(event: PraiseRewardPaid): void { 140 | const transactionTokenAllocations = TransactionTokenAllocation.load( 141 | event.transaction.hash.toHex(), 142 | ); 143 | 144 | if (!transactionTokenAllocations) { 145 | return; 146 | } 147 | 148 | for ( 149 | let i = 0; 150 | i < transactionTokenAllocations.tokenAllocationIds.length; 151 | i++ 152 | ) { 153 | const tokenAllocation = TokenAllocation.load( 154 | transactionTokenAllocations.tokenAllocationIds[i], 155 | ); 156 | if (!tokenAllocation) { 157 | continue; 158 | } 159 | tokenAllocation.praise = true; 160 | tokenAllocation.distributor = PRAISE; 161 | tokenAllocation.save(); 162 | } 163 | } 164 | 165 | export function handleRoleAdminChanged(): void {} 166 | 167 | export function handleRoleGranted(): void {} 168 | 169 | export function handleRoleRevoked(): void {} 170 | 171 | export function handleStartTimeChanged(event: StartTimeChanged): void { 172 | updateTokenDistro(event.address); 173 | } 174 | 175 | export function handleDurationChanged(event: DurationChanged): void { 176 | updateTokenDistro(event.address); 177 | } 178 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # Giveth Economy Subgraph 2 | 3 | ## 1. Project Overview 4 | 5 | ### Purpose 6 | The Giveth Economy Subgraph is a Graph Protocol subgraph that is built for the Giveth Economy smart contracts. It is used to index and make queryable the Giveth Economy smart contracts. 7 | 8 | ### Key Features 9 | - Supports GIVeconomy DeFi protocol variety of balances, e.g. GIV Power, GIV Token Lock, GIV Merkle Distro, GIV Uniswap V3 Liquidity Mining, Givers PFP, etc. 10 | - Provides historical snapshots of GIV Power 11 | - Provides GIVPower locked positions information, e.g. amount, unlocked, unlockable at,... 12 | - Automatic indexing config generation using handlebars templates 13 | 14 | ### Live Links 15 | - Mainnet Subgraph: https://thegraph.com/hosted-service/subgraph/giveth/giveth-economy-second-mainnet 16 | - Gnosis Chain Subgraph: https://thegraph.com/hosted-service/subgraph/giveth/giveth-economy-second-xdai 17 | 18 | ## 2. System Architecture 19 | 20 | ### Flow Diagram 21 | ```mermaid 22 | flowchart LR 23 | A(Config networks.yaml) --> |generate manifest| B(Subgraph Deployment yaml file) 24 | B --> |deploy| C(The Graph) 25 | ``` 26 | 27 | ### Tech Stack 28 | - Graph Protocol 29 | - TypeScript/AssemblyScript 30 | - GraphQL 31 | - Handlebars 32 | 33 | ### Data Flow 34 | 1. Smart contracts emit events 35 | 2. Subgraph event handlers process these events 36 | 3. Data is stored in entities according to the schema 37 | 4. GraphQL API provides query access to the indexed data 38 | 39 | ## 3. Getting Started 40 | 41 | ### Prerequisites 42 | - Node.js (v14 or higher) 43 | - NPM or Yarn package manager 44 | - Access to The Graph hosted service 45 | 46 | ### Installation Steps 47 | 1. Clone the repository: 48 | ```bash 49 | git clone https://github.com/Giveth/giveconomy-subgraph.git 50 | cd giveconomy-subgraph 51 | ``` 52 | 53 | 2. Install dependencies: 54 | ```bash 55 | yarn install 56 | ``` 57 | 58 | 3. Authenticate with The Graph: 59 | ```bash 60 | yarn auth 61 | ``` 62 | 63 | ### Configuration 64 | The subgraph configuration is managed through: 65 | - `subgraph.template.yaml`: Template for subgraph configuration. No need to write manually if you use the networks.yaml file and the generate-manifests command. 66 | - `networks.yaml`: A template to configure contract addresses and start blocks for each network. This will be processed by the generate-manifests command to create the subgraph deployment yaml file. 67 | 68 | ## 4. Usage Instructions 69 | 70 | ### Running the Application 71 | To build and deploy the subgraph: 72 | 73 | 1. Update the networks.yaml file with the correct contract addresses and start blocks for each network. 74 | 75 | 2. Build: This will generate the subgraph deployment yaml file and subgraph code. 76 | ```bash 77 | yarn build 78 | ``` 79 | 80 | 3. Deploy to specific network: 81 | ```bash 82 | # For Gnosis Chain 83 | yarn deploy:gnosis:production 84 | 85 | # For Mainnet 86 | yarn deploy:mainnet:production 87 | ``` 88 | Look at the corresponding scripts in the package.json to customize it for new networks. 89 | 90 | ### Testing 91 | The subgraph includes linting and type checking: 92 | ```bash 93 | yarn lint 94 | ``` 95 | 96 | ### Build Issues 97 | Test type and build issues with build command. 98 | ```bash 99 | yarn build 100 | ``` 101 | 102 | ## 5. Deployment Process 103 | 104 | ### Deployment Steps 105 | 1. Update contract addresses in `networks.yaml` if needed 106 | 2. Generate manifests with updated configurations 107 | 3. Build the subgraph 108 | 4. Deploy to the appropriate environment 109 | 110 | ### CI/CD Integration 111 | Deployments are managed through GitHub Actions in the `.github/workflows` directory. 112 | 113 | ## 6. Troubleshooting 114 | 115 | ### Common Issues 116 | 1. **Deployment Failures** 117 | - Check network configuration in `networks.yaml` 118 | - Verify contract addresses and start blocks 119 | - Ensure proper authentication with The Graph 120 | - Check the graph hosted service accessability 121 | 122 | 2. **Query Errors** 123 | - Verify entity schema matches the GraphQL schema 124 | - Check subgraph health, i.e. sync status, indexing status, etc. 125 | 126 | ### Logs and Debugging 127 | - Use Graph Protocol's dashboard to monitor indexing status 128 | - Check deployment logs in The Graph's hosted service 129 | - Monitor subgraph health through GraphQL queries, e.g. block number,... 130 | - Unreliable subgraph results due to malfunctioning subgraph nodes 131 | 132 | ## Schema Documentation 133 | 134 | The subgraph defines several key entities: 135 | 136 | ### Core Entities 137 | - `GIVPower`: Tracks overall GIV Power balances 138 | - `ERC20`: Tracks ERC20 token balances, i.e. simple tokens and LP tokens 139 | - `TokenLock`: Records individual token locks 140 | - `User`: Manages user balances and relationships 141 | - `Unipool`: Tracks liquidity pool information 142 | - `TokenDistro`: Manages token distribution parameters 143 | 144 | ### Uniswap V3 Entities 145 | - `UniswapPosition`: Tracks liquidity positions 146 | - `UniswapV3Pool`: Records pool state 147 | - `UniswapInfinitePosition`: Manages infinite positions 148 | 149 | ### Additional Entities 150 | - `TokenBalance`: User token balances 151 | - `UnipoolBalance`: User pool balances 152 | - `TokenAllocation`: Token distribution records 153 | - `GiversPFPToken`: Givers PFP token information 154 | 155 | For detailed schema information, refer to `schema.graphql`. 156 | -------------------------------------------------------------------------------- /src/utils/misc.ts: -------------------------------------------------------------------------------- 1 | import { Address, BigInt, dataSource, ethereum } from '@graphprotocol/graph-ts'; 2 | import { 3 | GIVPower, 4 | TokenBalance, 5 | User, 6 | Unipool, 7 | UnipoolBalance, 8 | BalanceChange, 9 | TokenLock, 10 | } from '../types/schema'; 11 | import { GIVPower as GIVPowerContract } from '../types/GIVPower/GIVPower'; 12 | import { UnipoolTokenDistributor as UnipoolContract } from '../types/Unipool/UnipoolTokenDistributor'; 13 | import { TO_UPDATE_GIV_POWER_LOCKS_IDS } from '../utils/optimismGivPowerLocks'; 14 | 15 | export function getUserEntity(userAddress: Address): User { 16 | let user = User.load(userAddress.toHex()); 17 | 18 | if (user == null) { 19 | user = new User(userAddress.toHex()); 20 | user.givLocked = BigInt.zero(); 21 | user.lastGivPowerUpdateTime = BigInt.zero(); 22 | user.save(); 23 | } 24 | 25 | return user; 26 | } 27 | 28 | export function getGIVPower(givPowerAddress: Address): GIVPower { 29 | let givpower = GIVPower.load(givPowerAddress.toHex()); 30 | 31 | if (givpower == null) { 32 | givpower = new GIVPower(givPowerAddress.toHex()); 33 | const givPowerContract = GIVPowerContract.bind(givPowerAddress); 34 | const dateCall = givPowerContract.try_INITIAL_DATE(); 35 | const durationCall = givPowerContract.try_ROUND_DURATION(); 36 | 37 | let initialDate = dateCall.reverted ? BigInt.zero() : dateCall.value; 38 | let roundDuration = durationCall.reverted ? 0 : durationCall.value.toI32(); 39 | 40 | givpower.initialDate = initialDate; 41 | givpower.roundDuration = roundDuration; 42 | givpower.locksCreated = 0; 43 | givpower.totalGIVLocked = BigInt.zero(); 44 | givpower.save(); 45 | } 46 | 47 | return givpower; 48 | } 49 | 50 | export function updateGivPowerLocks(givPowerAddress: Address): void { 51 | const network = dataSource.network(); 52 | if (network == 'optimism') { 53 | const givPowerContract = GIVPowerContract.bind(givPowerAddress); 54 | const dateCall = givPowerContract.try_INITIAL_DATE(); 55 | const durationCall = givPowerContract.try_ROUND_DURATION(); 56 | 57 | const initialDate = dateCall.reverted ? BigInt.zero() : dateCall.value; 58 | const roundDuration = durationCall.reverted 59 | ? 0 60 | : durationCall.value.toI32(); 61 | 62 | for (let i = 0; i < TO_UPDATE_GIV_POWER_LOCKS_IDS.length; i += 1) { 63 | const lock = TokenLock.load(TO_UPDATE_GIV_POWER_LOCKS_IDS[i]); 64 | if (!lock) continue; 65 | lock.unlockableAt = initialDate.plus( 66 | BigInt.fromI64((lock.untilRound + 1) * roundDuration), 67 | ); 68 | lock.save(); 69 | } 70 | } 71 | } 72 | 73 | export function updateGivPower(givPowerAddress: Address): void { 74 | const givPower = getGIVPower(givPowerAddress); 75 | 76 | const givPowerContract = GIVPowerContract.bind(givPowerAddress); 77 | const dateCall = givPowerContract.try_INITIAL_DATE(); 78 | const durationCall = givPowerContract.try_ROUND_DURATION(); 79 | 80 | const initialDate = dateCall.reverted ? BigInt.zero() : dateCall.value; 81 | const roundDuration = durationCall.reverted ? 0 : durationCall.value.toI32(); 82 | 83 | givPower.initialDate = initialDate; 84 | givPower.roundDuration = roundDuration; 85 | 86 | givPower.save(); 87 | 88 | updateGivPowerLocks(givPowerAddress); 89 | } 90 | 91 | export function getTokenLockId( 92 | userAddress: Address, 93 | rounds: i32, 94 | untilRound: i32, 95 | ): string { 96 | return ( 97 | userAddress.toHex() + '-' + rounds.toString() + '-' + untilRound.toString() 98 | ); 99 | } 100 | 101 | export function getUserTokenBalance( 102 | tokenAddress: Address, 103 | userAddress: Address, 104 | ): TokenBalance { 105 | // To generate user entity if not exists 106 | getUserEntity(userAddress); 107 | 108 | const id = tokenAddress.toHex() + '-' + userAddress.toHex(); 109 | let tokenBalance = TokenBalance.load(id); 110 | 111 | if (tokenBalance == null) { 112 | tokenBalance = new TokenBalance(id); 113 | tokenBalance.token = tokenAddress.toHex(); 114 | tokenBalance.user = userAddress.toHex(); 115 | tokenBalance.balance = BigInt.zero(); 116 | tokenBalance.updatedAt = BigInt.zero(); 117 | tokenBalance.save(); 118 | } 119 | 120 | return tokenBalance; 121 | } 122 | 123 | export function getUserUnipoolBalance( 124 | unipoolAddress: Address, 125 | userAddress: Address, 126 | ): UnipoolBalance { 127 | // To generate user entity if not exists 128 | getUserEntity(userAddress); 129 | 130 | const id = unipoolAddress.toHex() + '-' + userAddress.toHex(); 131 | let unipoolBalance = UnipoolBalance.load(id); 132 | 133 | if (unipoolBalance == null) { 134 | unipoolBalance = new UnipoolBalance(id); 135 | unipoolBalance.unipool = unipoolAddress.toHex(); 136 | unipoolBalance.user = userAddress.toHex(); 137 | unipoolBalance.balance = BigInt.zero(); 138 | unipoolBalance.rewards = BigInt.zero(); 139 | unipoolBalance.rewardPerTokenPaid = BigInt.zero(); 140 | unipoolBalance.updatedAt = BigInt.zero(); 141 | unipoolBalance.save(); 142 | } 143 | 144 | return unipoolBalance; 145 | } 146 | 147 | export function getUnipool(address: Address): Unipool { 148 | let unipool = Unipool.load(address.toHex()); 149 | 150 | if (unipool == null) { 151 | unipool = new Unipool(address.toHex()); 152 | 153 | const contract = UnipoolContract.bind(address); 154 | unipool.lastUpdateTime = contract.lastUpdateTime(); 155 | unipool.periodFinish = contract.periodFinish(); 156 | unipool.rewardPerTokenStored = contract.rewardPerTokenStored(); 157 | unipool.rewardRate = contract.rewardRate(); 158 | unipool.totalSupply = BigInt.zero(); 159 | unipool.save(); 160 | } 161 | 162 | return unipool; 163 | } 164 | 165 | export function getGivPowerSnapshotId( 166 | userAddress: Address, 167 | timestamp: BigInt, 168 | ): string { 169 | return userAddress.toHex() + '-' + timestamp.toString(); 170 | } 171 | 172 | export function getGiversPFPTokenId( 173 | contractAddress: Address, 174 | tokenId: i32, 175 | ): string { 176 | return contractAddress.toHex() + '-' + tokenId.toString(); 177 | } 178 | 179 | export function recordBalanceChange( 180 | event: ethereum.Event, 181 | account: Address, 182 | amount: BigInt, 183 | newBalance: BigInt, 184 | ): void { 185 | const contractAddress = event.address.toHex(); 186 | const block = event.block; 187 | 188 | // Key is contractAddress-blockNumber-transactionIndex-logIndex 189 | const id = `${contractAddress}-${block.number}-${padZeroLeft( 190 | event.transaction.index.toString(), 191 | 4, 192 | )}-${padZeroLeft(event.logIndex.toString(), 4)}`; 193 | 194 | const balanceChange = new BalanceChange(id); 195 | balanceChange.account = account.toHex(); 196 | balanceChange.contractAddress = contractAddress; 197 | balanceChange.time = block.timestamp; 198 | balanceChange.block = block.number; 199 | balanceChange.amount = amount; 200 | balanceChange.newBalance = newBalance; 201 | balanceChange.save(); 202 | } 203 | 204 | export function padLeft(str: string, len: i32, char: string): string { 205 | while (str.length < len) { 206 | str = char + str; 207 | } 208 | return str; 209 | } 210 | 211 | export function padZeroLeft(str: string, len: i32): string { 212 | return padLeft(str, len, '0'); 213 | } 214 | -------------------------------------------------------------------------------- /abis/UniswapV3RewardToken.json: -------------------------------------------------------------------------------- 1 | [ 2 | { 3 | "anonymous": false, 4 | "inputs": [ 5 | { 6 | "indexed": true, 7 | "internalType": "address", 8 | "name": "owner", 9 | "type": "address" 10 | }, 11 | { 12 | "indexed": true, 13 | "internalType": "address", 14 | "name": "spender", 15 | "type": "address" 16 | }, 17 | { 18 | "indexed": false, 19 | "internalType": "uint256", 20 | "name": "value", 21 | "type": "uint256" 22 | } 23 | ], 24 | "name": "Approval", 25 | "type": "event" 26 | }, 27 | { 28 | "anonymous": false, 29 | "inputs": [ 30 | { 31 | "indexed": true, 32 | "internalType": "address", 33 | "name": "previousOwner", 34 | "type": "address" 35 | }, 36 | { 37 | "indexed": true, 38 | "internalType": "address", 39 | "name": "newOwner", 40 | "type": "address" 41 | } 42 | ], 43 | "name": "OwnershipTransferred", 44 | "type": "event" 45 | }, 46 | { 47 | "anonymous": false, 48 | "inputs": [ 49 | { 50 | "indexed": true, 51 | "internalType": "address", 52 | "name": "user", 53 | "type": "address" 54 | }, 55 | { 56 | "indexed": false, 57 | "internalType": "uint256", 58 | "name": "reward", 59 | "type": "uint256" 60 | } 61 | ], 62 | "name": "RewardPaid", 63 | "type": "event" 64 | }, 65 | { 66 | "anonymous": false, 67 | "inputs": [ 68 | { 69 | "indexed": true, 70 | "internalType": "address", 71 | "name": "from", 72 | "type": "address" 73 | }, 74 | { 75 | "indexed": true, 76 | "internalType": "address", 77 | "name": "to", 78 | "type": "address" 79 | }, 80 | { 81 | "indexed": false, 82 | "internalType": "uint256", 83 | "name": "value", 84 | "type": "uint256" 85 | } 86 | ], 87 | "name": "Transfer", 88 | "type": "event" 89 | }, 90 | { 91 | "inputs": [ 92 | { 93 | "internalType": "address", 94 | "name": "owner", 95 | "type": "address" 96 | }, 97 | { 98 | "internalType": "address", 99 | "name": "spender", 100 | "type": "address" 101 | } 102 | ], 103 | "name": "allowance", 104 | "outputs": [ 105 | { 106 | "internalType": "uint256", 107 | "name": "", 108 | "type": "uint256" 109 | } 110 | ], 111 | "stateMutability": "view", 112 | "type": "function" 113 | }, 114 | { 115 | "inputs": [ 116 | { 117 | "internalType": "address", 118 | "name": "spender", 119 | "type": "address" 120 | }, 121 | { 122 | "internalType": "uint256", 123 | "name": "value", 124 | "type": "uint256" 125 | } 126 | ], 127 | "name": "approve", 128 | "outputs": [ 129 | { 130 | "internalType": "bool", 131 | "name": "", 132 | "type": "bool" 133 | } 134 | ], 135 | "stateMutability": "nonpayable", 136 | "type": "function" 137 | }, 138 | { 139 | "inputs": [ 140 | { 141 | "internalType": "address", 142 | "name": "account", 143 | "type": "address" 144 | } 145 | ], 146 | "name": "balanceOf", 147 | "outputs": [ 148 | { 149 | "internalType": "uint256", 150 | "name": "", 151 | "type": "uint256" 152 | } 153 | ], 154 | "stateMutability": "view", 155 | "type": "function" 156 | }, 157 | { 158 | "inputs": [], 159 | "name": "decimals", 160 | "outputs": [ 161 | { 162 | "internalType": "uint8", 163 | "name": "", 164 | "type": "uint8" 165 | } 166 | ], 167 | "stateMutability": "view", 168 | "type": "function" 169 | }, 170 | { 171 | "inputs": [], 172 | "name": "initialBalance", 173 | "outputs": [ 174 | { 175 | "internalType": "uint256", 176 | "name": "", 177 | "type": "uint256" 178 | } 179 | ], 180 | "stateMutability": "view", 181 | "type": "function" 182 | }, 183 | { 184 | "inputs": [ 185 | { 186 | "internalType": "contract IDistro", 187 | "name": "_tokenDistribution", 188 | "type": "address" 189 | }, 190 | { 191 | "internalType": "address", 192 | "name": "_uniswapV3Staker", 193 | "type": "address" 194 | } 195 | ], 196 | "name": "initialize", 197 | "outputs": [], 198 | "stateMutability": "nonpayable", 199 | "type": "function" 200 | }, 201 | { 202 | "inputs": [], 203 | "name": "name", 204 | "outputs": [ 205 | { 206 | "internalType": "string", 207 | "name": "", 208 | "type": "string" 209 | } 210 | ], 211 | "stateMutability": "view", 212 | "type": "function" 213 | }, 214 | { 215 | "inputs": [], 216 | "name": "owner", 217 | "outputs": [ 218 | { 219 | "internalType": "address", 220 | "name": "", 221 | "type": "address" 222 | } 223 | ], 224 | "stateMutability": "view", 225 | "type": "function" 226 | }, 227 | { 228 | "inputs": [], 229 | "name": "renounceOwnership", 230 | "outputs": [], 231 | "stateMutability": "nonpayable", 232 | "type": "function" 233 | }, 234 | { 235 | "inputs": [], 236 | "name": "symbol", 237 | "outputs": [ 238 | { 239 | "internalType": "string", 240 | "name": "", 241 | "type": "string" 242 | } 243 | ], 244 | "stateMutability": "view", 245 | "type": "function" 246 | }, 247 | { 248 | "inputs": [], 249 | "name": "tokenDistro", 250 | "outputs": [ 251 | { 252 | "internalType": "contract IDistro", 253 | "name": "", 254 | "type": "address" 255 | } 256 | ], 257 | "stateMutability": "view", 258 | "type": "function" 259 | }, 260 | { 261 | "inputs": [], 262 | "name": "totalSupply", 263 | "outputs": [ 264 | { 265 | "internalType": "uint256", 266 | "name": "", 267 | "type": "uint256" 268 | } 269 | ], 270 | "stateMutability": "view", 271 | "type": "function" 272 | }, 273 | { 274 | "inputs": [ 275 | { 276 | "internalType": "address", 277 | "name": "to", 278 | "type": "address" 279 | }, 280 | { 281 | "internalType": "uint256", 282 | "name": "value", 283 | "type": "uint256" 284 | } 285 | ], 286 | "name": "transfer", 287 | "outputs": [ 288 | { 289 | "internalType": "bool", 290 | "name": "", 291 | "type": "bool" 292 | } 293 | ], 294 | "stateMutability": "nonpayable", 295 | "type": "function" 296 | }, 297 | { 298 | "inputs": [ 299 | { 300 | "internalType": "address", 301 | "name": "from", 302 | "type": "address" 303 | }, 304 | { 305 | "internalType": "address", 306 | "name": "to", 307 | "type": "address" 308 | }, 309 | { 310 | "internalType": "uint256", 311 | "name": "value", 312 | "type": "uint256" 313 | } 314 | ], 315 | "name": "transferFrom", 316 | "outputs": [ 317 | { 318 | "internalType": "bool", 319 | "name": "", 320 | "type": "bool" 321 | } 322 | ], 323 | "stateMutability": "nonpayable", 324 | "type": "function" 325 | }, 326 | { 327 | "inputs": [ 328 | { 329 | "internalType": "address", 330 | "name": "newOwner", 331 | "type": "address" 332 | } 333 | ], 334 | "name": "transferOwnership", 335 | "outputs": [], 336 | "stateMutability": "nonpayable", 337 | "type": "function" 338 | }, 339 | { 340 | "inputs": [], 341 | "name": "uniswapV3Staker", 342 | "outputs": [ 343 | { 344 | "internalType": "address", 345 | "name": "", 346 | "type": "address" 347 | } 348 | ], 349 | "stateMutability": "view", 350 | "type": "function" 351 | } 352 | ] -------------------------------------------------------------------------------- /abis/UnipoolTokenDistributor.json: -------------------------------------------------------------------------------- 1 | [ 2 | { 3 | "anonymous": false, 4 | "inputs": [ 5 | { 6 | "indexed": true, 7 | "internalType": "address", 8 | "name": "previousOwner", 9 | "type": "address" 10 | }, 11 | { 12 | "indexed": true, 13 | "internalType": "address", 14 | "name": "newOwner", 15 | "type": "address" 16 | } 17 | ], 18 | "name": "OwnershipTransferred", 19 | "type": "event" 20 | }, 21 | { 22 | "anonymous": false, 23 | "inputs": [ 24 | { 25 | "indexed": false, 26 | "internalType": "uint256", 27 | "name": "reward", 28 | "type": "uint256" 29 | } 30 | ], 31 | "name": "RewardAdded", 32 | "type": "event" 33 | }, 34 | { 35 | "anonymous": false, 36 | "inputs": [ 37 | { 38 | "indexed": true, 39 | "internalType": "address", 40 | "name": "user", 41 | "type": "address" 42 | }, 43 | { 44 | "indexed": false, 45 | "internalType": "uint256", 46 | "name": "reward", 47 | "type": "uint256" 48 | } 49 | ], 50 | "name": "RewardPaid", 51 | "type": "event" 52 | }, 53 | { 54 | "anonymous": false, 55 | "inputs": [ 56 | { 57 | "indexed": true, 58 | "internalType": "address", 59 | "name": "user", 60 | "type": "address" 61 | }, 62 | { 63 | "indexed": false, 64 | "internalType": "uint256", 65 | "name": "amount", 66 | "type": "uint256" 67 | } 68 | ], 69 | "name": "Staked", 70 | "type": "event" 71 | }, 72 | { 73 | "anonymous": false, 74 | "inputs": [ 75 | { 76 | "indexed": true, 77 | "internalType": "address", 78 | "name": "user", 79 | "type": "address" 80 | }, 81 | { 82 | "indexed": false, 83 | "internalType": "uint256", 84 | "name": "amount", 85 | "type": "uint256" 86 | } 87 | ], 88 | "name": "Withdrawn", 89 | "type": "event" 90 | }, 91 | { 92 | "inputs": [ 93 | { 94 | "internalType": "contract IERC20Upgradeable", 95 | "name": "_uni", 96 | "type": "address" 97 | } 98 | ], 99 | "name": "__LPTokenWrapper_initialize", 100 | "outputs": [], 101 | "stateMutability": "nonpayable", 102 | "type": "function" 103 | }, 104 | { 105 | "inputs": [ 106 | { "internalType": "address", "name": "account", "type": "address" } 107 | ], 108 | "name": "balanceOf", 109 | "outputs": [{ "internalType": "uint256", "name": "", "type": "uint256" }], 110 | "stateMutability": "view", 111 | "type": "function" 112 | }, 113 | { 114 | "inputs": [], 115 | "name": "duration", 116 | "outputs": [{ "internalType": "uint256", "name": "", "type": "uint256" }], 117 | "stateMutability": "view", 118 | "type": "function" 119 | }, 120 | { 121 | "inputs": [ 122 | { "internalType": "address", "name": "account", "type": "address" } 123 | ], 124 | "name": "earned", 125 | "outputs": [{ "internalType": "uint256", "name": "", "type": "uint256" }], 126 | "stateMutability": "view", 127 | "type": "function" 128 | }, 129 | { 130 | "inputs": [], 131 | "name": "exit", 132 | "outputs": [], 133 | "stateMutability": "nonpayable", 134 | "type": "function" 135 | }, 136 | { 137 | "inputs": [], 138 | "name": "getReward", 139 | "outputs": [], 140 | "stateMutability": "nonpayable", 141 | "type": "function" 142 | }, 143 | { 144 | "inputs": [ 145 | { 146 | "internalType": "contract IDistro", 147 | "name": "_tokenDistribution", 148 | "type": "address" 149 | }, 150 | { 151 | "internalType": "contract IERC20Upgradeable", 152 | "name": "_uni", 153 | "type": "address" 154 | }, 155 | { "internalType": "uint256", "name": "_duration", "type": "uint256" } 156 | ], 157 | "name": "initialize", 158 | "outputs": [], 159 | "stateMutability": "nonpayable", 160 | "type": "function" 161 | }, 162 | { 163 | "inputs": [], 164 | "name": "lastTimeRewardApplicable", 165 | "outputs": [{ "internalType": "uint256", "name": "", "type": "uint256" }], 166 | "stateMutability": "view", 167 | "type": "function" 168 | }, 169 | { 170 | "inputs": [], 171 | "name": "lastUpdateTime", 172 | "outputs": [{ "internalType": "uint256", "name": "", "type": "uint256" }], 173 | "stateMutability": "view", 174 | "type": "function" 175 | }, 176 | { 177 | "inputs": [ 178 | { "internalType": "uint256", "name": "reward", "type": "uint256" } 179 | ], 180 | "name": "notifyRewardAmount", 181 | "outputs": [], 182 | "stateMutability": "nonpayable", 183 | "type": "function" 184 | }, 185 | { 186 | "inputs": [], 187 | "name": "owner", 188 | "outputs": [{ "internalType": "address", "name": "", "type": "address" }], 189 | "stateMutability": "view", 190 | "type": "function" 191 | }, 192 | { 193 | "inputs": [], 194 | "name": "periodFinish", 195 | "outputs": [{ "internalType": "uint256", "name": "", "type": "uint256" }], 196 | "stateMutability": "view", 197 | "type": "function" 198 | }, 199 | { 200 | "inputs": [], 201 | "name": "renounceOwnership", 202 | "outputs": [], 203 | "stateMutability": "nonpayable", 204 | "type": "function" 205 | }, 206 | { 207 | "inputs": [], 208 | "name": "rewardDistribution", 209 | "outputs": [{ "internalType": "address", "name": "", "type": "address" }], 210 | "stateMutability": "view", 211 | "type": "function" 212 | }, 213 | { 214 | "inputs": [], 215 | "name": "rewardPerToken", 216 | "outputs": [{ "internalType": "uint256", "name": "", "type": "uint256" }], 217 | "stateMutability": "view", 218 | "type": "function" 219 | }, 220 | { 221 | "inputs": [], 222 | "name": "rewardPerTokenStored", 223 | "outputs": [{ "internalType": "uint256", "name": "", "type": "uint256" }], 224 | "stateMutability": "view", 225 | "type": "function" 226 | }, 227 | { 228 | "inputs": [], 229 | "name": "rewardRate", 230 | "outputs": [{ "internalType": "uint256", "name": "", "type": "uint256" }], 231 | "stateMutability": "view", 232 | "type": "function" 233 | }, 234 | { 235 | "inputs": [{ "internalType": "address", "name": "", "type": "address" }], 236 | "name": "rewards", 237 | "outputs": [{ "internalType": "uint256", "name": "", "type": "uint256" }], 238 | "stateMutability": "view", 239 | "type": "function" 240 | }, 241 | { 242 | "inputs": [ 243 | { 244 | "internalType": "address", 245 | "name": "_rewardDistribution", 246 | "type": "address" 247 | } 248 | ], 249 | "name": "setRewardDistribution", 250 | "outputs": [], 251 | "stateMutability": "nonpayable", 252 | "type": "function" 253 | }, 254 | { 255 | "inputs": [ 256 | { "internalType": "uint256", "name": "amount", "type": "uint256" } 257 | ], 258 | "name": "stake", 259 | "outputs": [], 260 | "stateMutability": "nonpayable", 261 | "type": "function" 262 | }, 263 | { 264 | "inputs": [ 265 | { "internalType": "uint256", "name": "amount", "type": "uint256" }, 266 | { "internalType": "bytes", "name": "permit", "type": "bytes" } 267 | ], 268 | "name": "stakeWithPermit", 269 | "outputs": [], 270 | "stateMutability": "nonpayable", 271 | "type": "function" 272 | }, 273 | { 274 | "inputs": [], 275 | "name": "tokenDistro", 276 | "outputs": [ 277 | { "internalType": "contract IDistro", "name": "", "type": "address" } 278 | ], 279 | "stateMutability": "view", 280 | "type": "function" 281 | }, 282 | { 283 | "inputs": [], 284 | "name": "totalSupply", 285 | "outputs": [{ "internalType": "uint256", "name": "", "type": "uint256" }], 286 | "stateMutability": "view", 287 | "type": "function" 288 | }, 289 | { 290 | "inputs": [ 291 | { "internalType": "address", "name": "newOwner", "type": "address" } 292 | ], 293 | "name": "transferOwnership", 294 | "outputs": [], 295 | "stateMutability": "nonpayable", 296 | "type": "function" 297 | }, 298 | { 299 | "inputs": [], 300 | "name": "uni", 301 | "outputs": [ 302 | { 303 | "internalType": "contract IERC20Upgradeable", 304 | "name": "", 305 | "type": "address" 306 | } 307 | ], 308 | "stateMutability": "view", 309 | "type": "function" 310 | }, 311 | { 312 | "inputs": [{ "internalType": "address", "name": "", "type": "address" }], 313 | "name": "userRewardPerTokenPaid", 314 | "outputs": [{ "internalType": "uint256", "name": "", "type": "uint256" }], 315 | "stateMutability": "view", 316 | "type": "function" 317 | }, 318 | { 319 | "inputs": [ 320 | { "internalType": "uint256", "name": "amount", "type": "uint256" } 321 | ], 322 | "name": "withdraw", 323 | "outputs": [], 324 | "stateMutability": "nonpayable", 325 | "type": "function" 326 | } 327 | ] 328 | -------------------------------------------------------------------------------- /abis/UniswapV3.json: -------------------------------------------------------------------------------- 1 | [ 2 | { 3 | "inputs": [ 4 | { 5 | "internalType": "address", 6 | "name": "initialMinter", 7 | "type": "address" 8 | } 9 | ], 10 | "stateMutability": "nonpayable", 11 | "type": "constructor" 12 | }, 13 | { 14 | "anonymous": false, 15 | "inputs": [ 16 | { 17 | "indexed": true, 18 | "internalType": "address", 19 | "name": "owner", 20 | "type": "address" 21 | }, 22 | { 23 | "indexed": true, 24 | "internalType": "address", 25 | "name": "spender", 26 | "type": "address" 27 | }, 28 | { 29 | "indexed": false, 30 | "internalType": "uint256", 31 | "name": "value", 32 | "type": "uint256" 33 | } 34 | ], 35 | "name": "Approval", 36 | "type": "event" 37 | }, 38 | { 39 | "anonymous": false, 40 | "inputs": [ 41 | { 42 | "indexed": true, 43 | "internalType": "address", 44 | "name": "authorizer", 45 | "type": "address" 46 | }, 47 | { 48 | "indexed": true, 49 | "internalType": "bytes32", 50 | "name": "nonce", 51 | "type": "bytes32" 52 | } 53 | ], 54 | "name": "AuthorizationUsed", 55 | "type": "event" 56 | }, 57 | { 58 | "anonymous": false, 59 | "inputs": [ 60 | { 61 | "indexed": true, 62 | "internalType": "address", 63 | "name": "minter", 64 | "type": "address" 65 | } 66 | ], 67 | "name": "ChangeMinter", 68 | "type": "event" 69 | }, 70 | { 71 | "anonymous": false, 72 | "inputs": [ 73 | { 74 | "indexed": true, 75 | "internalType": "address", 76 | "name": "from", 77 | "type": "address" 78 | }, 79 | { 80 | "indexed": true, 81 | "internalType": "address", 82 | "name": "to", 83 | "type": "address" 84 | }, 85 | { 86 | "indexed": false, 87 | "internalType": "uint256", 88 | "name": "value", 89 | "type": "uint256" 90 | } 91 | ], 92 | "name": "Transfer", 93 | "type": "event" 94 | }, 95 | { 96 | "inputs": [ 97 | 98 | ], 99 | "name": "EIP712DOMAIN_HASH", 100 | "outputs": [ 101 | { 102 | "internalType": "bytes32", 103 | "name": "", 104 | "type": "bytes32" 105 | } 106 | ], 107 | "stateMutability": "view", 108 | "type": "function" 109 | }, 110 | { 111 | "inputs": [ 112 | 113 | ], 114 | "name": "NAME_HASH", 115 | "outputs": [ 116 | { 117 | "internalType": "bytes32", 118 | "name": "", 119 | "type": "bytes32" 120 | } 121 | ], 122 | "stateMutability": "view", 123 | "type": "function" 124 | }, 125 | { 126 | "inputs": [ 127 | 128 | ], 129 | "name": "PERMIT_TYPEHASH", 130 | "outputs": [ 131 | { 132 | "internalType": "bytes32", 133 | "name": "", 134 | "type": "bytes32" 135 | } 136 | ], 137 | "stateMutability": "view", 138 | "type": "function" 139 | }, 140 | { 141 | "inputs": [ 142 | 143 | ], 144 | "name": "TRANSFER_WITH_AUTHORIZATION_TYPEHASH", 145 | "outputs": [ 146 | { 147 | "internalType": "bytes32", 148 | "name": "", 149 | "type": "bytes32" 150 | } 151 | ], 152 | "stateMutability": "view", 153 | "type": "function" 154 | }, 155 | { 156 | "inputs": [ 157 | 158 | ], 159 | "name": "VERSION_HASH", 160 | "outputs": [ 161 | { 162 | "internalType": "bytes32", 163 | "name": "", 164 | "type": "bytes32" 165 | } 166 | ], 167 | "stateMutability": "view", 168 | "type": "function" 169 | }, 170 | { 171 | "inputs": [ 172 | { 173 | "internalType": "address", 174 | "name": "", 175 | "type": "address" 176 | }, 177 | { 178 | "internalType": "address", 179 | "name": "", 180 | "type": "address" 181 | } 182 | ], 183 | "name": "allowance", 184 | "outputs": [ 185 | { 186 | "internalType": "uint256", 187 | "name": "", 188 | "type": "uint256" 189 | } 190 | ], 191 | "stateMutability": "view", 192 | "type": "function" 193 | }, 194 | { 195 | "inputs": [ 196 | { 197 | "internalType": "address", 198 | "name": "spender", 199 | "type": "address" 200 | }, 201 | { 202 | "internalType": "uint256", 203 | "name": "value", 204 | "type": "uint256" 205 | } 206 | ], 207 | "name": "approve", 208 | "outputs": [ 209 | { 210 | "internalType": "bool", 211 | "name": "", 212 | "type": "bool" 213 | } 214 | ], 215 | "stateMutability": "nonpayable", 216 | "type": "function" 217 | }, 218 | { 219 | "inputs": [ 220 | { 221 | "internalType": "address", 222 | "name": "", 223 | "type": "address" 224 | }, 225 | { 226 | "internalType": "bytes32", 227 | "name": "", 228 | "type": "bytes32" 229 | } 230 | ], 231 | "name": "authorizationState", 232 | "outputs": [ 233 | { 234 | "internalType": "bool", 235 | "name": "", 236 | "type": "bool" 237 | } 238 | ], 239 | "stateMutability": "view", 240 | "type": "function" 241 | }, 242 | { 243 | "inputs": [ 244 | { 245 | "internalType": "address", 246 | "name": "", 247 | "type": "address" 248 | } 249 | ], 250 | "name": "balanceOf", 251 | "outputs": [ 252 | { 253 | "internalType": "uint256", 254 | "name": "", 255 | "type": "uint256" 256 | } 257 | ], 258 | "stateMutability": "view", 259 | "type": "function" 260 | }, 261 | { 262 | "inputs": [ 263 | { 264 | "internalType": "uint256", 265 | "name": "value", 266 | "type": "uint256" 267 | } 268 | ], 269 | "name": "burn", 270 | "outputs": [ 271 | { 272 | "internalType": "bool", 273 | "name": "", 274 | "type": "bool" 275 | } 276 | ], 277 | "stateMutability": "nonpayable", 278 | "type": "function" 279 | }, 280 | { 281 | "inputs": [ 282 | { 283 | "internalType": "address", 284 | "name": "newMinter", 285 | "type": "address" 286 | } 287 | ], 288 | "name": "changeMinter", 289 | "outputs": [ 290 | 291 | ], 292 | "stateMutability": "nonpayable", 293 | "type": "function" 294 | }, 295 | { 296 | "inputs": [ 297 | 298 | ], 299 | "name": "decimals", 300 | "outputs": [ 301 | { 302 | "internalType": "uint8", 303 | "name": "", 304 | "type": "uint8" 305 | } 306 | ], 307 | "stateMutability": "view", 308 | "type": "function" 309 | }, 310 | { 311 | "inputs": [ 312 | 313 | ], 314 | "name": "getChainId", 315 | "outputs": [ 316 | { 317 | "internalType": "uint256", 318 | "name": "chainId", 319 | "type": "uint256" 320 | } 321 | ], 322 | "stateMutability": "view", 323 | "type": "function" 324 | }, 325 | { 326 | "inputs": [ 327 | 328 | ], 329 | "name": "getDomainSeparator", 330 | "outputs": [ 331 | { 332 | "internalType": "bytes32", 333 | "name": "", 334 | "type": "bytes32" 335 | } 336 | ], 337 | "stateMutability": "view", 338 | "type": "function" 339 | }, 340 | { 341 | "inputs": [ 342 | 343 | ], 344 | "name": "initialBalance", 345 | "outputs": [ 346 | { 347 | "internalType": "uint256", 348 | "name": "", 349 | "type": "uint256" 350 | } 351 | ], 352 | "stateMutability": "view", 353 | "type": "function" 354 | }, 355 | { 356 | "inputs": [ 357 | { 358 | "internalType": "address", 359 | "name": "to", 360 | "type": "address" 361 | }, 362 | { 363 | "internalType": "uint256", 364 | "name": "value", 365 | "type": "uint256" 366 | } 367 | ], 368 | "name": "mint", 369 | "outputs": [ 370 | { 371 | "internalType": "bool", 372 | "name": "", 373 | "type": "bool" 374 | } 375 | ], 376 | "stateMutability": "nonpayable", 377 | "type": "function" 378 | }, 379 | { 380 | "inputs": [ 381 | 382 | ], 383 | "name": "minter", 384 | "outputs": [ 385 | { 386 | "internalType": "address", 387 | "name": "", 388 | "type": "address" 389 | } 390 | ], 391 | "stateMutability": "view", 392 | "type": "function" 393 | }, 394 | { 395 | "inputs": [ 396 | 397 | ], 398 | "name": "name", 399 | "outputs": [ 400 | { 401 | "internalType": "string", 402 | "name": "", 403 | "type": "string" 404 | } 405 | ], 406 | "stateMutability": "view", 407 | "type": "function" 408 | }, 409 | { 410 | "inputs": [ 411 | { 412 | "internalType": "address", 413 | "name": "", 414 | "type": "address" 415 | } 416 | ], 417 | "name": "nonces", 418 | "outputs": [ 419 | { 420 | "internalType": "uint256", 421 | "name": "", 422 | "type": "uint256" 423 | } 424 | ], 425 | "stateMutability": "view", 426 | "type": "function" 427 | }, 428 | { 429 | "inputs": [ 430 | { 431 | "internalType": "address", 432 | "name": "owner", 433 | "type": "address" 434 | }, 435 | { 436 | "internalType": "address", 437 | "name": "spender", 438 | "type": "address" 439 | }, 440 | { 441 | "internalType": "uint256", 442 | "name": "value", 443 | "type": "uint256" 444 | }, 445 | { 446 | "internalType": "uint256", 447 | "name": "deadline", 448 | "type": "uint256" 449 | }, 450 | { 451 | "internalType": "uint8", 452 | "name": "v", 453 | "type": "uint8" 454 | }, 455 | { 456 | "internalType": "bytes32", 457 | "name": "r", 458 | "type": "bytes32" 459 | }, 460 | { 461 | "internalType": "bytes32", 462 | "name": "s", 463 | "type": "bytes32" 464 | } 465 | ], 466 | "name": "permit", 467 | "outputs": [ 468 | 469 | ], 470 | "stateMutability": "nonpayable", 471 | "type": "function" 472 | }, 473 | { 474 | "inputs": [ 475 | 476 | ], 477 | "name": "symbol", 478 | "outputs": [ 479 | { 480 | "internalType": "string", 481 | "name": "", 482 | "type": "string" 483 | } 484 | ], 485 | "stateMutability": "view", 486 | "type": "function" 487 | }, 488 | { 489 | "inputs": [ 490 | 491 | ], 492 | "name": "totalSupply", 493 | "outputs": [ 494 | { 495 | "internalType": "uint256", 496 | "name": "", 497 | "type": "uint256" 498 | } 499 | ], 500 | "stateMutability": "view", 501 | "type": "function" 502 | }, 503 | { 504 | "inputs": [ 505 | { 506 | "internalType": "address", 507 | "name": "to", 508 | "type": "address" 509 | }, 510 | { 511 | "internalType": "uint256", 512 | "name": "value", 513 | "type": "uint256" 514 | } 515 | ], 516 | "name": "transfer", 517 | "outputs": [ 518 | { 519 | "internalType": "bool", 520 | "name": "", 521 | "type": "bool" 522 | } 523 | ], 524 | "stateMutability": "nonpayable", 525 | "type": "function" 526 | }, 527 | { 528 | "inputs": [ 529 | { 530 | "internalType": "address", 531 | "name": "from", 532 | "type": "address" 533 | }, 534 | { 535 | "internalType": "address", 536 | "name": "to", 537 | "type": "address" 538 | }, 539 | { 540 | "internalType": "uint256", 541 | "name": "value", 542 | "type": "uint256" 543 | } 544 | ], 545 | "name": "transferFrom", 546 | "outputs": [ 547 | { 548 | "internalType": "bool", 549 | "name": "", 550 | "type": "bool" 551 | } 552 | ], 553 | "stateMutability": "nonpayable", 554 | "type": "function" 555 | }, 556 | { 557 | "inputs": [ 558 | { 559 | "internalType": "address", 560 | "name": "from", 561 | "type": "address" 562 | }, 563 | { 564 | "internalType": "address", 565 | "name": "to", 566 | "type": "address" 567 | }, 568 | { 569 | "internalType": "uint256", 570 | "name": "value", 571 | "type": "uint256" 572 | }, 573 | { 574 | "internalType": "uint256", 575 | "name": "validAfter", 576 | "type": "uint256" 577 | }, 578 | { 579 | "internalType": "uint256", 580 | "name": "validBefore", 581 | "type": "uint256" 582 | }, 583 | { 584 | "internalType": "bytes32", 585 | "name": "nonce", 586 | "type": "bytes32" 587 | }, 588 | { 589 | "internalType": "uint8", 590 | "name": "v", 591 | "type": "uint8" 592 | }, 593 | { 594 | "internalType": "bytes32", 595 | "name": "r", 596 | "type": "bytes32" 597 | }, 598 | { 599 | "internalType": "bytes32", 600 | "name": "s", 601 | "type": "bytes32" 602 | } 603 | ], 604 | "name": "transferWithAuthorization", 605 | "outputs": [ 606 | 607 | ], 608 | "stateMutability": "nonpayable", 609 | "type": "function" 610 | } 611 | ] -------------------------------------------------------------------------------- /subgraph.template.yaml: -------------------------------------------------------------------------------- 1 | specVersion: 0.0.2 2 | description: Giveth Subgraph 3 | schema: 4 | file: ./schema.graphql 5 | dataSources: 6 | {{#if (isdefined GIVPower)}} 7 | - kind: ethereum/contract 8 | name: GIVPower 9 | network: '{{network}}' 10 | source: 11 | address: '{{GIVPower.address}}' 12 | abi: GIVPower 13 | startBlock: {{ GIVPower.startBlock }} 14 | mapping: 15 | kind: ethereum/events 16 | apiVersion: 0.0.5 17 | language: wasm/assemblyscript 18 | abis: 19 | - name: GIVPower 20 | file: ./abis/GIVPower.json 21 | entities: 22 | - User 23 | - TokenLock 24 | eventHandlers: 25 | - event: TokenLocked(indexed address,uint256,uint256,uint256) 26 | handler: handleTokenLocked 27 | - event: TokenUnlocked(indexed address,uint256,uint256) 28 | handler: handleTokenUnlocked 29 | - event: Upgraded(indexed address) 30 | handler: handleUpgrade 31 | file: ./src/mappings/givPower.ts 32 | 33 | - kind: ethereum/contract 34 | name: 'gardenUnipool' 35 | network: '{{network}}' 36 | source: 37 | address: '{{GIVPower.address}}' 38 | abi: UnipoolTokenDistributor 39 | startBlock: {{ GIVPower.gardenUnipoolStartBlock }} 40 | mapping: 41 | kind: ethereum/events 42 | apiVersion: 0.0.5 43 | language: wasm/assemblyscript 44 | abis: 45 | - name: UnipoolTokenDistributor 46 | file: ./abis/UnipoolTokenDistributor.json 47 | entities: 48 | - Unipool 49 | - UnipoolBalance 50 | eventHandlers: 51 | - event: RewardPaid(indexed address,uint256) 52 | handler: handleRewardPaid 53 | - event: Staked(indexed address,uint256) 54 | handler: handleStaked 55 | - event: Withdrawn(indexed address,uint256) 56 | handler: handleWithdrawn 57 | - event: RewardAdded(uint256) 58 | handler: handleRewardAdded 59 | file: ./src/mappings/gardenUnipool.ts 60 | 61 | {{/if}} 62 | 63 | {{#if (isdefined UnipoolGIVPower)}} 64 | - kind: ethereum/contract 65 | name: UnipoolGIVPower 66 | network: '{{network}}' 67 | source: 68 | address: '{{UnipoolGIVPower.address}}' 69 | abi: UnipoolGIVPower 70 | startBlock: {{ UnipoolGIVPower.startBlock }} 71 | mapping: 72 | kind: ethereum/events 73 | apiVersion: 0.0.5 74 | language: wasm/assemblyscript 75 | abis: 76 | - name: UnipoolGIVPower 77 | file: ./abis/UnipoolGIVPower.json 78 | - name: GIVPower 79 | file: ./abis/GIVPower.json 80 | entities: 81 | - User 82 | - TokenLock 83 | - TokenBalance 84 | eventHandlers: 85 | - event: TokenLocked(indexed address,uint256,uint256,uint256) 86 | handler: handleTokenLocked 87 | - event: TokenUnlocked(indexed address,uint256,uint256) 88 | handler: handleTokenUnlocked 89 | - event: Upgraded(indexed address) 90 | handler: handleUpgrade 91 | - event: DepositTokenDeposited(indexed address,uint256) 92 | handler: handleDepositTokenDeposited 93 | - event: DepositTokenWithdrawn(indexed address,uint256) 94 | handler: handleDepositTokenWithdrawn 95 | 96 | file: ./src/mappings/unipoolGivPower.ts 97 | 98 | - kind: ethereum/contract 99 | name: 'unipoolGivPowerUnipool' 100 | network: '{{network}}' 101 | source: 102 | address: '{{UnipoolGIVPower.address}}' 103 | abi: UnipoolTokenDistributor 104 | startBlock: {{ UnipoolGIVPower.startBlock }} 105 | mapping: 106 | kind: ethereum/events 107 | apiVersion: 0.0.5 108 | language: wasm/assemblyscript 109 | abis: 110 | - name: UnipoolTokenDistributor 111 | file: ./abis/UnipoolTokenDistributor.json 112 | entities: 113 | - Unipool 114 | - UnipoolBalance 115 | eventHandlers: 116 | - event: RewardPaid(indexed address,uint256) 117 | handler: handleRewardPaid 118 | - event: Staked(indexed address,uint256) 119 | handler: handleStaked 120 | - event: Withdrawn(indexed address,uint256) 121 | handler: handleWithdrawn 122 | - event: RewardAdded(uint256) 123 | handler: handleRewardAdded 124 | file: ./src/mappings/unipool.ts 125 | 126 | {{/if}} 127 | 128 | {{#if (isdefined MerkleDistro)}} 129 | - kind: ethereum/contract 130 | name: MerkleDistro 131 | network: '{{network}}' 132 | source: 133 | address: '{{MerkleDistro.address}}' 134 | abi: MerkleDistro 135 | startBlock: {{ MerkleDistro.startBlock }} 136 | mapping: 137 | kind: ethereum/events 138 | apiVersion: 0.0.5 139 | language: wasm/assemblyscript 140 | abis: 141 | - name: MerkleDistro 142 | file: ./abis/MerkleDistro.json 143 | entities: 144 | - Claimed 145 | - OwnershipTransferred 146 | eventHandlers: 147 | - event: Claimed(uint256,address,address,uint256) 148 | handler: handleClaimed 149 | # - event: OwnershipTransferred(indexed address,indexed address) 150 | # handler: handleOwnershipTransferred 151 | file: ./src/mappings/merkleDistro.ts 152 | {{/if}} 153 | 154 | {{#if (isdefined UniswapV3.Pool)}} 155 | - kind: ethereum/contract 156 | name: UniswapV3Pool 157 | network: '{{network}}' 158 | source: 159 | address: '{{UniswapV3.Pool.address}}' 160 | abi: UniswapV3Pool 161 | startBlock: {{ UniswapV3.Pool.startBlock }} 162 | mapping: 163 | kind: ethereum/events 164 | apiVersion: 0.0.5 165 | language: wasm/assemblyscript 166 | entities: 167 | - Initialize 168 | - Swap 169 | abis: 170 | - name: UniswapV3Pool 171 | file: ./abis/UniswapV3Pool.json 172 | - name: UniswapV3Staker 173 | file: ./abis/UniswapV3Staker.json 174 | eventHandlers: 175 | # We don't need this event handler, but data source should have at least one event handler 176 | - event: Initialize(uint160,int24) 177 | handler: handleInitialize 178 | - event: Swap(indexed address,indexed address,int256,int256,uint160,uint128,int24) 179 | handler: handleSwap 180 | file: ./src/mappings/uniswapV3/uniswapV3PoolMapping.ts 181 | {{/if}} 182 | 183 | {{#if (isdefined UniswapV3.PositionsNft)}} 184 | - kind: ethereum/contract 185 | name: UniswapV3PositionsNFT 186 | network: '{{network}}' 187 | source: 188 | address: '{{UniswapV3.PositionsNft.address}}' 189 | abi: UniswapV3PositionsNFT 190 | startBlock: {{ UniswapV3.PositionsNft.startBlock }} 191 | mapping: 192 | kind: ethereum/events 193 | apiVersion: 0.0.5 194 | language: wasm/assemblyscript 195 | entities: 196 | - IncreaseLiquidity 197 | - DecreaseLiquidity 198 | - Transfer 199 | abis: 200 | - name: UniswapV3PositionsNFT 201 | file: ./abis/uniswapV3PositionsNFT.json 202 | - name: UniswapV3Staker 203 | file: ./abis/UniswapV3Staker.json 204 | - name: UniswapV3Pool 205 | file: ./abis/UniswapV3Pool.json 206 | eventHandlers: 207 | - event: IncreaseLiquidity(indexed uint256,uint128,uint256,uint256) 208 | handler: handleIncreaseLiquidity 209 | - event: DecreaseLiquidity(indexed uint256,uint128,uint256,uint256) 210 | handler: handleDecreaseLiquidity 211 | - event: Transfer(indexed address,indexed address,indexed uint256) 212 | handler: handleTransfer 213 | file: ./src/mappings/uniswapV3/uniswapV3PositionsNftMapping.ts 214 | {{/if}} 215 | 216 | {{#if (isdefined UniswapV3.Staker)}} 217 | - kind: ethereum/contract 218 | name: UniswapV3Staker 219 | network: '{{network}}' 220 | source: 221 | address: '{{UniswapV3.Staker.address}}' 222 | abi: UniswapV3Staker 223 | startBlock: {{ UniswapV3.Staker.startBlock }} 224 | mapping: 225 | kind: ethereum/events 226 | apiVersion: 0.0.5 227 | language: wasm/assemblyscript 228 | entities: 229 | - TokenStaked 230 | - TokenUnstaked 231 | abis: 232 | - name: UniswapV3Staker 233 | file: ./abis/UniswapV3Staker.json 234 | eventHandlers: 235 | - event: TokenStaked(indexed uint256,indexed bytes32,uint128) 236 | handler: handleTokenStaked 237 | - event: TokenUnstaked(indexed uint256,indexed bytes32) 238 | handler: handleTokenUnstaked 239 | file: ./src/mappings/uniswapV3/uniswapV3TokenStakerMapping.ts 240 | 241 | {{/if}} 242 | 243 | {{#if (isdefined UniswapV3.RewardToken)}} 244 | - kind: ethereum/contract 245 | name: UniswapV3RewardToken 246 | network: '{{network}}' 247 | source: 248 | address: '{{UniswapV3.RewardToken.address}}' 249 | abi: UniswapV3RewardToken 250 | startBlock: {{ UniswapV3.RewardToken.startBlock }} 251 | mapping: 252 | kind: ethereum/events 253 | apiVersion: 0.0.5 254 | language: wasm/assemblyscript 255 | entities: 256 | - Approval 257 | - OwnershipTransferred 258 | - RewardPaid 259 | - Transfer 260 | abis: 261 | - name: UniswapV3RewardToken 262 | file: ./abis/UniswapV3RewardToken.json 263 | eventHandlers: 264 | - event: Approval(indexed address,indexed address,uint256) 265 | handler: handleApproval 266 | - event: OwnershipTransferred(indexed address,indexed address) 267 | handler: handleOwnershipTransferred 268 | - event: RewardPaid(indexed address,uint256) 269 | handler: handleRewardPaid 270 | - event: Transfer(indexed address,indexed address,uint256) 271 | handler: handleTransfer 272 | file: ./src/mappings/uniswapV3/uniswapV3RewardTokenMapping.ts 273 | {{/if}} 274 | 275 | {{#each TokenDistro}} 276 | - kind: ethereum/contract 277 | name: '{{name}}' 278 | network: '{{../network}}' 279 | source: 280 | address: '{{address}}' 281 | abi: TokenDistro 282 | startBlock: {{ startBlock }} 283 | mapping: 284 | kind: ethereum/events 285 | apiVersion: 0.0.5 286 | language: wasm/assemblyscript 287 | abis: 288 | - name: TokenDistro 289 | file: ./abis/TokenDistro.json 290 | entities: 291 | - TokenDistroBalance 292 | - TokenAllocation 293 | - TransactionTokenAllocation 294 | - TokenDistroContractInfo 295 | eventHandlers: 296 | - event: Allocate(indexed address,indexed address,uint256) 297 | handler: handleAllocate 298 | - event: Assign(indexed address,indexed address,uint256) 299 | handler: handleAssign 300 | - event: ChangeAddress(indexed address,indexed address) 301 | handler: handleChangeAddress 302 | - event: Claim(indexed address,uint256) 303 | handler: handleClaim 304 | - event: GivBackPaid(address) 305 | handler: handleGivBackPaid 306 | - event: PraiseRewardPaid(address) 307 | handler: handlePraiseRewardPaid 308 | # - event: RoleAdminChanged(indexed bytes32,indexed bytes32,indexed bytes32) 309 | # handler: handleRoleAdminChanged 310 | # - event: RoleGranted(indexed bytes32,indexed address,indexed address) 311 | # handler: handleRoleGranted 312 | # - event: RoleRevoked(indexed bytes32,indexed address,indexed address) 313 | # handler: handleRoleRevoked 314 | - event: StartTimeChanged(uint256,uint256) 315 | handler: handleStartTimeChanged 316 | - event: DurationChanged(uint256) 317 | handler: handleDurationChanged 318 | 319 | file: ./src/mappings/tokenDistro.ts 320 | {{/each}} 321 | 322 | {{#each ERC20}} 323 | - kind: ethereum/contract 324 | name: '{{name}}' 325 | network: '{{../network}}' 326 | source: 327 | address: '{{address}}' 328 | abi: ERC20 329 | startBlock: {{ startBlock }} 330 | mapping: 331 | kind: ethereum/events 332 | apiVersion: 0.0.5 333 | language: wasm/assemblyscript 334 | abis: 335 | - name: ERC20 336 | file: ./abis/ERC20.json 337 | entities: 338 | - TokenBalance 339 | eventHandlers: 340 | - event: Transfer(indexed address,indexed address,uint256) 341 | handler: handleTransfer 342 | file: ./src/mappings/ERC20.ts 343 | 344 | {{/each}} 345 | 346 | {{#each Unipool}} 347 | - kind: ethereum/contract 348 | name: '{{name}}' 349 | network: '{{../network}}' 350 | source: 351 | address: '{{address}}' 352 | abi: UnipoolTokenDistributor 353 | startBlock: {{ startBlock }} 354 | mapping: 355 | kind: ethereum/events 356 | apiVersion: 0.0.5 357 | language: wasm/assemblyscript 358 | abis: 359 | - name: UnipoolTokenDistributor 360 | file: ./abis/UnipoolTokenDistributor.json 361 | entities: 362 | - Unipool 363 | - UnipoolBalance 364 | eventHandlers: 365 | - event: RewardPaid(indexed address,uint256) 366 | handler: handleRewardPaid 367 | - event: Staked(indexed address,uint256) 368 | handler: handleStaked 369 | - event: Withdrawn(indexed address,uint256) 370 | handler: handleWithdrawn 371 | - event: RewardAdded(uint256) 372 | handler: handleRewardAdded 373 | 374 | file: ./src/mappings/unipool.ts 375 | {{/each}} 376 | 377 | {{#if (isdefined GiversPFP)}} 378 | 379 | - kind: ethereum/contract 380 | name: GiversPFP 381 | network: '{{network}}' 382 | source: 383 | address: '{{GiversPFP.address}}' 384 | abi: GiversPFP 385 | startBlock: {{ GiversPFP.startBlock }} 386 | mapping: 387 | kind: ethereum/events 388 | apiVersion: 0.0.5 389 | language: wasm/assemblyscript 390 | abis: 391 | - name: GiversPFP 392 | file: ./abis/GiversPFP.json 393 | entities: 394 | - Transfer 395 | eventHandlers: 396 | - event: Transfer(indexed address,indexed address,indexed uint256) 397 | handler: handleTransfer 398 | file: ./src/mappings/giversPFP.ts 399 | 400 | {{/if}} 401 | -------------------------------------------------------------------------------- /networks.yaml: -------------------------------------------------------------------------------- 1 | ### model config is used to generate general schema and contract types 2 | model: 3 | network: model 4 | GIVPower: 5 | address: '0x0000000000000000000000000000000000000000' 6 | startBlock: 9999999999999 7 | gardenUnipoolStartBlock: 9999999999999 8 | UnipoolGIVPower: 9 | address: '0x0000000000000000000000000000000000000000' 10 | startBlock: 9999999999999 11 | ERC20: 12 | - name: 'ERC20' 13 | address: '0x0000000000000000000000000000000000000000' 14 | startBlock: 9999999999999 15 | Unipool: 16 | - name: 'Unipool' 17 | address: '0x0000000000000000000000000000000000000000' 18 | startBlock: 9999999999999 19 | TokenDistro: 20 | - name: 'TokenDistro' 21 | address: '0x0000000000000000000000000000000000000000' 22 | startBlock: 9999999999999 23 | MerkleDistro: 24 | address: '0x0000000000000000000000000000000000000000' 25 | startBlock: 9999999999999 26 | UniswapV3: 27 | Pool: 28 | address: '0x0000000000000000000000000000000000000000' 29 | startBlock: 9999999999999 30 | PositionsNft: 31 | address: '0x0000000000000000000000000000000000000000' 32 | startBlock: 9999999999999 33 | Staker: 34 | address: '0x0000000000000000000000000000000000000000' 35 | startBlock: 9999999999999 36 | RewardToken: 37 | address: '0x0000000000000000000000000000000000000000' 38 | startBlock: 9999999999999 39 | GiversPFP: 40 | address: '0x0000000000000000000000000000000000000000' 41 | startBlock: 9999999999999 42 | 43 | deployment-6-gnosis: 44 | network: gnosis 45 | GIVPower: 46 | address: '0x898Baa558A401e59Cb2aA77bb8b2D89978Cf506F' 47 | startBlock: 23829546 48 | gardenUnipoolStartBlock: 19713038 49 | 50 | ERC20: 51 | - name: 'DRGIV2' 52 | address: '0x780FE5de651a3ea62E572f591BF848cFEBaf2163' 53 | startBlock: 19711044 54 | - name: 'gGIV' 55 | address: '0x1460aaf51f4e0b1b59bb41981cb4aa5a1b377776' 56 | startBlock: 19711370 57 | - name: 'GIV/HNY LP' 58 | address: '0xE5021d9B578b84f7D272CFDE3E8B58c0Bf37B402' 59 | startBlock: 19711564 60 | - name: 'WETH/GIV LP' 61 | address: '0x0346B748Ce9bdd42995452b5D30b46c296336f07' 62 | startBlock: 19711732 63 | 64 | MerkleDistro: 65 | address: '0x06BA4122FC4F3AbCdAFD2fF1dD83A88A63842309' 66 | startBlock: 19713011 67 | 68 | Unipool: 69 | - name: 'GIV/HNY LM' 70 | address: '0x34F8Cc88b872f13d32084464af56f1052A2eF0f6' 71 | startBlock: 19713018 72 | - name: 'WETH/GIV LM' 73 | address: '0x448d5E09620752f031Ea629993050f8581118438' 74 | startBlock: 19713026 75 | 76 | TokenDistro: 77 | - name: 'GIVstream' 78 | address: '0x74B557bec1A496a8E9BE57e9A1530A15364C87Be' 79 | startBlock: 19713005 80 | 81 | deployment-6-kovan: 82 | network: kovan 83 | 84 | Unipool: 85 | - name: 'BALANCER GIV/ETH LM' 86 | address: '0xc3092EeED159be05dF1c103e3CaAC3DacAe1EdF9' 87 | startBlock: 28896918 88 | - name: 'GIV LM' 89 | # GIV Staking Unipool 90 | address: '0xDfdBDA44b2b9C113475a372c078aAC1279C4d7BE' 91 | startBlock: 28896934 92 | 93 | UniswapV3: 94 | Pool: 95 | address: '0x77c3a14a9dffaa4b4b94f4f274cdbeb0518be24d' 96 | startBlock: 28895711 97 | PositionsNft: 98 | address: '0xc36442b4a4522e871399cd717abdd847ab11fe88' 99 | startBlock: 28683241 100 | Staker: 101 | address: '0x1f98407aaB862CdDeF78Ed252D6f557aA5b0f00d' 102 | startBlock: 28898339 103 | RewardToken: 104 | address: '0x6397b874BC81c4c9bEb8D8f2a0fd121b304F21B2' 105 | startBlock: 28896903 106 | 107 | TokenDistro: 108 | - name: 'GIVstream' 109 | address: '0x373bAa19E92F6204b461b791094012fd259996F4' 110 | startBlock: 28896896 111 | 112 | ERC20: 113 | - name: 'DRGIV' 114 | address: '0x6c16216484069C19530a57762AD6630fB678D00E' 115 | startBlock: 28895444 116 | - name: 'Balancer WETH/GIV LP' 117 | address: '0x02653cae0cad6b3cd73e7dbc4f7a3ce6693c3ed7' 118 | startBlock: 28895593 119 | 120 | deployment-7-gnosis: 121 | network: gnosis 122 | 123 | GIVPower: 124 | address: '0xDAEa66Adc97833781139373DF5B3bcEd3fdda5b1' 125 | startBlock: 24374376 126 | gardenUnipoolStartBlock: 19717442 127 | 128 | Unipool: 129 | - name: 'GIV/DAI LM' 130 | address: '0xe2c436E177C39A5D18AF6923Fc2Fc673f4729C05' 131 | startBlock: 22290367 132 | - name: 'ETH/GIV LM' 133 | address: '0x83535D6DeF8E881E647C00462315bae9A6E7BD09' 134 | startBlock: 19717433 135 | - name: 'HNY/GIV LM' 136 | address: '0xC09147Ac0aC8B5271F03b511c3554e3238Ae3201' 137 | startBlock: 19717426 138 | - name: 'FOX/HNY LM' 139 | address: '0x06851400866e065972ff21e1ECdE035b4772736d' 140 | startBlock: 20735379 141 | - name: 'FOX/DAI LM' 142 | address: '0x93c40bCA6a854B2190a054136a316C4Df7f89f10' 143 | startBlock: 24360606 144 | 145 | TokenDistro: 146 | - name: 'GIVstream' 147 | address: '0x18a46865AAbAf416a970eaA8625CFC430D2364A1' 148 | startBlock: 19717412 149 | - name: 'FOXstream' 150 | address: '0xCA29ec6F4218E230294993E0d77d5ece5a6573D8' 151 | startBlock: 20735375 152 | 153 | ERC20: 154 | - name: 'DRGIV3' 155 | address: '0x83a8eea6427985C523a0c4d9d3E62C051B6580d3' 156 | startBlock: 19714108 157 | - name: 'gDRGIV3' 158 | address: '0x4Bee761229AD815Cc64461783580F629dA0f0350' 159 | startBlock: 19716991 160 | - name: 'HNY/GIV LP' 161 | address: '0x31A5AeA76Af79F592a3A3F46a9f6Cb118990433b' 162 | startBlock: 19714617 163 | - name: 'DAI/GIV LP' 164 | address: '0xB4E0fc187f0EEd740D93eF15Cd14750a2780fc2A' 165 | startBlock: 22279465 166 | - name: 'GIV/ETH LP' 167 | address: '0x437B0da7932b21F54488fD80Ee09b519a6f4d8AD' 168 | startBlock: 19714713 169 | - name: 'FOX/HNY LP' 170 | address: '0xD28C07F802212F04AF41834ec0CC81d2d283124B' 171 | startBlock: 20732925 172 | - name: 'FOX/DAI LP' 173 | address: '0x0714A2fE9574F591a4ed3fD03b63714e8681fBb7' 174 | startBlock: 24360512 175 | 176 | MerkleDistro: 177 | address: '0xc87403C70c9FBfb594d98d3B5E695BBE4C694188' 178 | startBlock: 19717419 179 | 180 | deployment-7-kovan: 181 | network: kovan 182 | 183 | Unipool: 184 | - name: 'GIV/DAI LM' 185 | address: '0x9e4EcF5fE5F58C888C84338525422A1D0915f6ff' 186 | startBlock: 31115701 187 | - name: 'CULT/ETH LM' 188 | address: '0x9D23d449Af3e2c07a286688c85ff5d3d4c219D79' 189 | startBlock: 31509500 190 | - name: 'BALANCER WET/ETH LM' 191 | address: '0x4B319c068685aF260c91407B651918307df30061' 192 | startBlock: 28901423 193 | - name: 'GIV LM' 194 | # GIV Staking Unipool 195 | address: '0x17207684344B206A06BF8651d6e5e1833660418b' 196 | startBlock: 28901438 197 | - name: 'ICHI LM - OLD' 198 | address: '0x76e98f3Db6681E7de4804F97C085bEe0205164f3' 199 | startBlock: 32850829 200 | - name: 'ICH LM - NEW' 201 | address: '0x7CD371D230338C74563A9A23AF72dd009a7D1b1C' 202 | startBlock: 32973882 203 | 204 | UniswapV3: 205 | Pool: 206 | address: '0x3c2455a3ee0d824941c9329c01a66b86078c3e82' 207 | startBlock: 28898483 208 | PositionsNft: 209 | address: '0xc36442b4a4522e871399cd717abdd847ab11fe88' 210 | startBlock: 28683241 211 | Staker: 212 | address: '0x1f98407aaB862CdDeF78Ed252D6f557aA5b0f00d' 213 | startBlock: 28898339 214 | RewardToken: 215 | address: '0xDfbb5C70006B357d30BB335f55a01e6b0151Bcb5' 216 | startBlock: 28901409 217 | 218 | TokenDistro: 219 | - name: 'GIVstream' 220 | address: '0x2C84Ab41b53C52959a794830fe296Fd717c33337' 221 | startBlock: 28901401 222 | - name: 'CULTstream' 223 | address: '0xBb974e08774544a361BCF496fE61DaB9Df29AFFc' 224 | startBlock: 31509486 225 | 226 | ERC20: 227 | - name: 'DRGIV' 228 | address: '0x29434A25abd94AE882aA883eea81585Aaa5b078D' 229 | startBlock: 28898339 230 | - name: 'GIV/DAI LP' 231 | address: '0x6D5481911052a42c109F1f56354BEB07Ec430b85' 232 | startBlock: 31113195 233 | - name: 'CULT/ETH LP' 234 | address: '0x6Bb32725AA31b1a99e7C782e0605B0fB57e4B9E6' 235 | startBlock: 31509190 236 | - name: 'Balancer WETH/GIV LP' 237 | address: '0x8a6b25e33b12d1bb6929a8793961076bd1f9d3eb' 238 | startBlock: 28898529 239 | - name: 'ICHI LP' 240 | address: '0xA0D500fd3479CBCb64a2238082b7a1Df9f87d98D' 241 | startBlock: 27817991 242 | 243 | production-mainnet: 244 | network: mainnet 245 | 246 | ERC20: 247 | - name: 'GIV' 248 | address: '0x900db999074d9277c5da2a43f252d74366230da0' 249 | startBlock: 13816800 250 | - name: 'GIV/DAI LP' 251 | address: '0xbeba1666c62c65e58770376de332891b09461eeb' 252 | startBlock: 14436516 253 | - name: 'BALANCER GIV/ETH LP' 254 | address: '0x7819f1532c49388106f7762328c51ee70edd134c' 255 | startBlock: 13816861 256 | - name: 'CULT/ETH LP' 257 | address: '0x5281E311734869C64ca60eF047fd87759397EFe6' 258 | startBlock: 14122174 259 | - name: 'ICHI LP' 260 | address: '0xc3151A58d519B94E915f66B044De3E55F77c2dd9' 261 | startBlock: 15128219 262 | 263 | Unipool: 264 | - name: 'GIV/DAI' 265 | address: '0xa4523D703F663615Bd41606B46B58dEb2F926D98' 266 | startBlock: 14620191 267 | - name: 'BALANCER GIV/ETH LM' 268 | address: '0xc0dbDcA66a0636236fAbe1B3C16B1bD4C84bB1E1' 269 | startBlock: 13862860 270 | - name: 'GIV LM' 271 | address: '0x4B9EfAE862a1755F7CEcb021856D467E86976755' 272 | startBlock: 13862875 273 | - name: 'CULT/ETH LM' 274 | address: '0xa479103c2618aD514653B53F064Bc6c9dC35a30b' 275 | startBlock: 14919615 276 | - name: 'CULT/ETH LM New' 277 | address: '0xcA128517053e8c459E12E3aCB615bb421d768219' 278 | startBlock: 15889522 279 | - name: 'ICHI LM' 280 | address: '0xA4b727DF6fD608d1835e3440288c73fB28c4eF16' 281 | startBlock: 15230706 282 | 283 | TokenDistro: 284 | - name: 'GIVstream' 285 | address: '0x87dE995F6744B75bBe0255A973081142aDb61f4d' 286 | startBlock: 13862850 287 | - name: 'CULTstream' 288 | address: '0x73f2D115C2cBAa3b5F477A78F7A7CD348D8b70a2' 289 | startBlock: 14919609 290 | 291 | UniswapV3: 292 | Pool: 293 | address: '0xc763b6b3d0f75167db95daa6a0a0d75dd467c4e1' 294 | startBlock: 13821537 295 | PositionsNft: 296 | address: '0xc36442b4a4522e871399cd717abdd847ab11fe88' 297 | startBlock: 13816800 298 | Staker: 299 | address: '0x1f98407aaB862CdDeF78Ed252D6f557aA5b0f00d' 300 | startBlock: 13816800 301 | RewardToken: 302 | address: '0x3115e5aAa3D6f742d09fbB649150dfE285a9c2A3' 303 | startBlock: 13862852 304 | 305 | GiversPFP: 306 | address: '0x78fde77737d5b9ab32fc718c9535c7f1b8ce84db' 307 | startBlock: 16771375 308 | 309 | production-gnosis: 310 | network: gnosis 311 | 312 | GIVPower: 313 | address: '0xD93d3bDBa18ebcB3317a57119ea44ed2Cf41C2F2' 314 | startBlock: 24393329 315 | gardenUnipoolStartBlock: 19731598 316 | 317 | ERC20: 318 | - name: 'GIV' 319 | address: '0x4f4F9b8D5B4d0Dc10506e5551B0513B61fD59e75' 320 | startBlock: 19611188 321 | - name: 'WETH/GIV LP' 322 | address: '0x55FF0cef43F0DF88226E9D87D09fA036017F5586' 323 | startBlock: 19612212 324 | - name: 'GIV/HNY LP' 325 | address: '0x08ea9f608656A4a775EF73f5B187a2F1AE2ae10e' 326 | startBlock: 19612062 327 | - name: 'GIV/DAI LP' 328 | address: '0xB7189A7Ea38FA31210A79fe282AEC5736Ad5fA57' 329 | startBlock: 19818258 330 | - name: 'FOX/HNY LP' 331 | address: '0x8a0bee989c591142414ad67fb604539d917889df' 332 | startBlock: 17890042 333 | - name: 'gGIV' 334 | address: '0xfFBAbEb49be77E5254333d5fdfF72920B989425f' 335 | startBlock: 19719021 336 | - name: 'FOX/DAI LP' 337 | address: '0xc22313fd39f7d4d73a89558f9e8e444c86464bac' 338 | startBlock: 17841457 339 | 340 | MerkleDistro: 341 | address: '0xFad63adEFb8203F7605F25f6a921c8bf45604A5e' 342 | startBlock: 19731578 343 | 344 | TokenDistro: 345 | - name: 'GIVstream' 346 | address: '0xc0dbDcA66a0636236fAbe1B3C16B1bD4C84bB1E1' 347 | startBlock: 19731573 348 | - name: 'FOXstream' 349 | address: '0xA9a37a14E562D0E1d335B4714E3455483ede7A9a' 350 | startBlock: 21392975 351 | 352 | Unipool: 353 | - name: 'ETH/GIV LM' 354 | address: '0xfB429010C1e9D08B7347F968a7d88f0207807EF0' 355 | startBlock: 19731591 356 | - name: 'DAI/GIV LM' 357 | address: '0x24A6067fEd46dc8663794c4d39Ec91b074cf85D4' 358 | startBlock: 22653615 359 | - name: 'HNY/GIV LM' 360 | address: '0x4B9EfAE862a1755F7CEcb021856D467E86976755' 361 | startBlock: 19731583 362 | - name: 'FOX/HNY LM' 363 | address: '0x502EC7a040F486EE6Cb7d634D94764874B29dE68' 364 | startBlock: 21392979 365 | - name: 'FOX/DAI LM' 366 | address: '0x9A333AD00868472c0314F76DB8dA305B83890129' 367 | startBlock: 24387787 368 | 369 | deployment-7-goerli: 370 | network: goerli 371 | 372 | Unipool: 373 | - name: 'GIV LM' 374 | # GIV Staking Unipool 375 | address: '0x929C9353D67af21411d4475B30D960F23C209abd' 376 | startBlock: 7417687 377 | - name: 'GIV/DAI LM' 378 | address: '0x6420Ad2d9B512f1cF0B899794598Ed17da2C5836' 379 | startBlock: 7420032 380 | - name: 'GIV/ETH LM' 381 | address: '0x3E0daD7225E60F1b3Ce46964D6976d9B43166d12' 382 | startBlock: 7420025 383 | - name: 'BALANCER GIV/ETH LM' 384 | address: '0x887673d8295aF9BE0D8e12412c2B87a49cFcd7bd' 385 | startBlock: 7427822 386 | 387 | TokenDistro: 388 | - name: 'GIVstream' 389 | address: '0x4358c99abFe7A9983B6c96785b8870b5412C5B4B' 390 | startBlock: 7417681 391 | 392 | ERC20: 393 | - name: 'DRGIV3' 394 | address: '0xA2470F25bb8b53Bd3924C7AC0C68d32BF2aBd5be' 395 | startBlock: 7417432 396 | - name: 'GIV/DAI LP' 397 | address: '0x0551f038a84cb0d42584a8E3eaf5a409D22F4211' 398 | startBlock: 7417963 399 | - name: 'GIV/ETH LP' 400 | address: '0xDADe0F0f5759FB1F041217BD9cC680950796339F' 401 | startBlock: 7418018 402 | - name: 'Balancer WETH/GIV LP' 403 | address: '0xf8cba1c22b6515982bf43e71b7e8b546a3323ea8' 404 | startBlock: 7425927 405 | 406 | GiversPFP: 407 | address: '0x9F8c0e0353234F6f644fc7AF84Ac006f02cecE77' 408 | startBlock: 8485825 409 | 410 | deployment-7-optimism-goerli: 411 | network: optimism-goerli 412 | 413 | TokenDistro: 414 | - name: 'GIVstream' 415 | address: '0x8D2cBce8ea0256bFFBa6fa4bf7CEC46a1d9b43f6' 416 | startBlock: 9371285 417 | ERC20: 418 | - name: 'GIV' 419 | address: '0xc916Ce4025Cb479d9BA9D798A80094a449667F5D' 420 | startBlock: 9370029 421 | UnipoolGIVPower: 422 | address: '0x632AC305ed88817480d12155A7F1244cC182C298' 423 | startBlock: 12436803 424 | 425 | deployment-7-optimism-sepolia: 426 | network: optimism-sepolia 427 | 428 | TokenDistro: 429 | - name: 'GIVstream' 430 | address: '0x301C739CF6bfb6B47A74878BdEB13f92F13Ae5E7' 431 | startBlock: 8568240 432 | ERC20: 433 | - name: 'GIV' 434 | address: '0x2f2c819210191750F2E11F7CfC5664a0eB4fd5e6' 435 | startBlock: 8566601 436 | UnipoolGIVPower: 437 | address: '0xE6836325B13819CF38f030108255A5213491A725' 438 | startBlock: 8570759 439 | 440 | deployment-7-zkevm-cardona: 441 | network: polygon-zkevm-cardona 442 | 443 | TokenDistro: 444 | - name: 'GIVstream' 445 | address: '0x2Df3e67Be4e441Cddd2d29c3d41DFd7D516f18e6' 446 | startBlock: 5356116 447 | ERC20: 448 | - name: 'GIV' 449 | address: '0xa77390562986F5d08F5aECF5D3Fb82BD16B44548' 450 | startBlock: 4988065 451 | UnipoolGIVPower: 452 | address: '0x7E9f30A74fCDf035018bc007f9930aA171863E33' 453 | startBlock: 5386646 454 | 455 | production-optimism-mainnet: 456 | network: optimism 457 | 458 | TokenDistro: 459 | - name: 'GIVstream' 460 | address: '0xE3Ac7b3e6B4065f4765d76fDC215606483BF3bD1' 461 | startBlock: 108004007 462 | ERC20: 463 | - name: 'GIV' 464 | address: '0x528CDc92eAB044E1E39FE43B9514bfdAB4412B98' 465 | startBlock: 91994520 466 | UnipoolGIVPower: 467 | address: '0x301c739cf6bfb6b47a74878bdeb13f92f13ae5e7' 468 | startBlock: 108350094 469 | 470 | production-zkevm-mainnet: 471 | network: polygon-zkevm 472 | 473 | TokenDistro: 474 | - name: 'GIVstream' 475 | address: '0x4fB9B10ECDe1b048DBC79aBEAB3793edc93a0d54' 476 | startBlock: 15130401 477 | ERC20: 478 | - name: 'GIV' 479 | address: '0xddAFB91475bBf6210a151FA911AC8fdA7dE46Ec2' 480 | startBlock: 15111176 481 | UnipoolGIVPower: 482 | address: '0xc790f82bf6f8709aa4a56dc11afad7af7c2a9867' 483 | startBlock: 15130779 484 | -------------------------------------------------------------------------------- /abis/UniswapV3Staker.json: -------------------------------------------------------------------------------- 1 | [ 2 | { 3 | "inputs": [ 4 | { 5 | "internalType": "contract IUniswapV3Factory", 6 | "name": "_factory", 7 | "type": "address" 8 | }, 9 | { 10 | "internalType": "contract INonfungiblePositionManager", 11 | "name": "_nonfungiblePositionManager", 12 | "type": "address" 13 | }, 14 | { 15 | "internalType": "uint256", 16 | "name": "_maxIncentiveStartLeadTime", 17 | "type": "uint256" 18 | }, 19 | { 20 | "internalType": "uint256", 21 | "name": "_maxIncentiveDuration", 22 | "type": "uint256" 23 | } 24 | ], 25 | "stateMutability": "nonpayable", 26 | "type": "constructor" 27 | }, 28 | { 29 | "anonymous": false, 30 | "inputs": [ 31 | { 32 | "indexed": true, 33 | "internalType": "uint256", 34 | "name": "tokenId", 35 | "type": "uint256" 36 | }, 37 | { 38 | "indexed": true, 39 | "internalType": "address", 40 | "name": "oldOwner", 41 | "type": "address" 42 | }, 43 | { 44 | "indexed": true, 45 | "internalType": "address", 46 | "name": "newOwner", 47 | "type": "address" 48 | } 49 | ], 50 | "name": "DepositTransferred", 51 | "type": "event" 52 | }, 53 | { 54 | "anonymous": false, 55 | "inputs": [ 56 | { 57 | "indexed": true, 58 | "internalType": "contract IERC20Minimal", 59 | "name": "rewardToken", 60 | "type": "address" 61 | }, 62 | { 63 | "indexed": true, 64 | "internalType": "contract IUniswapV3Pool", 65 | "name": "pool", 66 | "type": "address" 67 | }, 68 | { 69 | "indexed": false, 70 | "internalType": "uint256", 71 | "name": "startTime", 72 | "type": "uint256" 73 | }, 74 | { 75 | "indexed": false, 76 | "internalType": "uint256", 77 | "name": "endTime", 78 | "type": "uint256" 79 | }, 80 | { 81 | "indexed": false, 82 | "internalType": "address", 83 | "name": "refundee", 84 | "type": "address" 85 | }, 86 | { 87 | "indexed": false, 88 | "internalType": "uint256", 89 | "name": "reward", 90 | "type": "uint256" 91 | } 92 | ], 93 | "name": "IncentiveCreated", 94 | "type": "event" 95 | }, 96 | { 97 | "anonymous": false, 98 | "inputs": [ 99 | { 100 | "indexed": true, 101 | "internalType": "bytes32", 102 | "name": "incentiveId", 103 | "type": "bytes32" 104 | }, 105 | { 106 | "indexed": false, 107 | "internalType": "uint256", 108 | "name": "refund", 109 | "type": "uint256" 110 | } 111 | ], 112 | "name": "IncentiveEnded", 113 | "type": "event" 114 | }, 115 | { 116 | "anonymous": false, 117 | "inputs": [ 118 | { 119 | "indexed": true, 120 | "internalType": "address", 121 | "name": "to", 122 | "type": "address" 123 | }, 124 | { 125 | "indexed": false, 126 | "internalType": "uint256", 127 | "name": "reward", 128 | "type": "uint256" 129 | } 130 | ], 131 | "name": "RewardClaimed", 132 | "type": "event" 133 | }, 134 | { 135 | "anonymous": false, 136 | "inputs": [ 137 | { 138 | "indexed": true, 139 | "internalType": "uint256", 140 | "name": "tokenId", 141 | "type": "uint256" 142 | }, 143 | { 144 | "indexed": true, 145 | "internalType": "bytes32", 146 | "name": "incentiveId", 147 | "type": "bytes32" 148 | }, 149 | { 150 | "indexed": false, 151 | "internalType": "uint128", 152 | "name": "liquidity", 153 | "type": "uint128" 154 | } 155 | ], 156 | "name": "TokenStaked", 157 | "type": "event" 158 | }, 159 | { 160 | "anonymous": false, 161 | "inputs": [ 162 | { 163 | "indexed": true, 164 | "internalType": "uint256", 165 | "name": "tokenId", 166 | "type": "uint256" 167 | }, 168 | { 169 | "indexed": true, 170 | "internalType": "bytes32", 171 | "name": "incentiveId", 172 | "type": "bytes32" 173 | } 174 | ], 175 | "name": "TokenUnstaked", 176 | "type": "event" 177 | }, 178 | { 179 | "inputs": [ 180 | { 181 | "internalType": "contract IERC20Minimal", 182 | "name": "rewardToken", 183 | "type": "address" 184 | }, 185 | { 186 | "internalType": "address", 187 | "name": "to", 188 | "type": "address" 189 | }, 190 | { 191 | "internalType": "uint256", 192 | "name": "amountRequested", 193 | "type": "uint256" 194 | } 195 | ], 196 | "name": "claimReward", 197 | "outputs": [ 198 | { 199 | "internalType": "uint256", 200 | "name": "reward", 201 | "type": "uint256" 202 | } 203 | ], 204 | "stateMutability": "nonpayable", 205 | "type": "function" 206 | }, 207 | { 208 | "inputs": [ 209 | { 210 | "components": [ 211 | { 212 | "internalType": "contract IERC20Minimal", 213 | "name": "rewardToken", 214 | "type": "address" 215 | }, 216 | { 217 | "internalType": "contract IUniswapV3Pool", 218 | "name": "pool", 219 | "type": "address" 220 | }, 221 | { 222 | "internalType": "uint256", 223 | "name": "startTime", 224 | "type": "uint256" 225 | }, 226 | { 227 | "internalType": "uint256", 228 | "name": "endTime", 229 | "type": "uint256" 230 | }, 231 | { 232 | "internalType": "address", 233 | "name": "refundee", 234 | "type": "address" 235 | } 236 | ], 237 | "internalType": "struct IUniswapV3Staker.IncentiveKey", 238 | "name": "key", 239 | "type": "tuple" 240 | }, 241 | { 242 | "internalType": "uint256", 243 | "name": "reward", 244 | "type": "uint256" 245 | } 246 | ], 247 | "name": "createIncentive", 248 | "outputs": [], 249 | "stateMutability": "nonpayable", 250 | "type": "function" 251 | }, 252 | { 253 | "inputs": [ 254 | { 255 | "internalType": "uint256", 256 | "name": "", 257 | "type": "uint256" 258 | } 259 | ], 260 | "name": "deposits", 261 | "outputs": [ 262 | { 263 | "internalType": "address", 264 | "name": "owner", 265 | "type": "address" 266 | }, 267 | { 268 | "internalType": "uint48", 269 | "name": "numberOfStakes", 270 | "type": "uint48" 271 | }, 272 | { 273 | "internalType": "int24", 274 | "name": "tickLower", 275 | "type": "int24" 276 | }, 277 | { 278 | "internalType": "int24", 279 | "name": "tickUpper", 280 | "type": "int24" 281 | } 282 | ], 283 | "stateMutability": "view", 284 | "type": "function" 285 | }, 286 | { 287 | "inputs": [ 288 | { 289 | "components": [ 290 | { 291 | "internalType": "contract IERC20Minimal", 292 | "name": "rewardToken", 293 | "type": "address" 294 | }, 295 | { 296 | "internalType": "contract IUniswapV3Pool", 297 | "name": "pool", 298 | "type": "address" 299 | }, 300 | { 301 | "internalType": "uint256", 302 | "name": "startTime", 303 | "type": "uint256" 304 | }, 305 | { 306 | "internalType": "uint256", 307 | "name": "endTime", 308 | "type": "uint256" 309 | }, 310 | { 311 | "internalType": "address", 312 | "name": "refundee", 313 | "type": "address" 314 | } 315 | ], 316 | "internalType": "struct IUniswapV3Staker.IncentiveKey", 317 | "name": "key", 318 | "type": "tuple" 319 | } 320 | ], 321 | "name": "endIncentive", 322 | "outputs": [ 323 | { 324 | "internalType": "uint256", 325 | "name": "refund", 326 | "type": "uint256" 327 | } 328 | ], 329 | "stateMutability": "nonpayable", 330 | "type": "function" 331 | }, 332 | { 333 | "inputs": [], 334 | "name": "factory", 335 | "outputs": [ 336 | { 337 | "internalType": "contract IUniswapV3Factory", 338 | "name": "", 339 | "type": "address" 340 | } 341 | ], 342 | "stateMutability": "view", 343 | "type": "function" 344 | }, 345 | { 346 | "inputs": [ 347 | { 348 | "components": [ 349 | { 350 | "internalType": "contract IERC20Minimal", 351 | "name": "rewardToken", 352 | "type": "address" 353 | }, 354 | { 355 | "internalType": "contract IUniswapV3Pool", 356 | "name": "pool", 357 | "type": "address" 358 | }, 359 | { 360 | "internalType": "uint256", 361 | "name": "startTime", 362 | "type": "uint256" 363 | }, 364 | { 365 | "internalType": "uint256", 366 | "name": "endTime", 367 | "type": "uint256" 368 | }, 369 | { 370 | "internalType": "address", 371 | "name": "refundee", 372 | "type": "address" 373 | } 374 | ], 375 | "internalType": "struct IUniswapV3Staker.IncentiveKey", 376 | "name": "key", 377 | "type": "tuple" 378 | }, 379 | { 380 | "internalType": "uint256", 381 | "name": "tokenId", 382 | "type": "uint256" 383 | } 384 | ], 385 | "name": "getRewardInfo", 386 | "outputs": [ 387 | { 388 | "internalType": "uint256", 389 | "name": "reward", 390 | "type": "uint256" 391 | }, 392 | { 393 | "internalType": "uint160", 394 | "name": "secondsInsideX128", 395 | "type": "uint160" 396 | } 397 | ], 398 | "stateMutability": "view", 399 | "type": "function" 400 | }, 401 | { 402 | "inputs": [ 403 | { 404 | "internalType": "bytes32", 405 | "name": "", 406 | "type": "bytes32" 407 | } 408 | ], 409 | "name": "incentives", 410 | "outputs": [ 411 | { 412 | "internalType": "uint256", 413 | "name": "totalRewardUnclaimed", 414 | "type": "uint256" 415 | }, 416 | { 417 | "internalType": "uint160", 418 | "name": "totalSecondsClaimedX128", 419 | "type": "uint160" 420 | }, 421 | { 422 | "internalType": "uint96", 423 | "name": "numberOfStakes", 424 | "type": "uint96" 425 | } 426 | ], 427 | "stateMutability": "view", 428 | "type": "function" 429 | }, 430 | { 431 | "inputs": [], 432 | "name": "maxIncentiveDuration", 433 | "outputs": [ 434 | { 435 | "internalType": "uint256", 436 | "name": "", 437 | "type": "uint256" 438 | } 439 | ], 440 | "stateMutability": "view", 441 | "type": "function" 442 | }, 443 | { 444 | "inputs": [], 445 | "name": "maxIncentiveStartLeadTime", 446 | "outputs": [ 447 | { 448 | "internalType": "uint256", 449 | "name": "", 450 | "type": "uint256" 451 | } 452 | ], 453 | "stateMutability": "view", 454 | "type": "function" 455 | }, 456 | { 457 | "inputs": [ 458 | { 459 | "internalType": "bytes[]", 460 | "name": "data", 461 | "type": "bytes[]" 462 | } 463 | ], 464 | "name": "multicall", 465 | "outputs": [ 466 | { 467 | "internalType": "bytes[]", 468 | "name": "results", 469 | "type": "bytes[]" 470 | } 471 | ], 472 | "stateMutability": "payable", 473 | "type": "function" 474 | }, 475 | { 476 | "inputs": [], 477 | "name": "nonfungiblePositionManager", 478 | "outputs": [ 479 | { 480 | "internalType": "contract INonfungiblePositionManager", 481 | "name": "", 482 | "type": "address" 483 | } 484 | ], 485 | "stateMutability": "view", 486 | "type": "function" 487 | }, 488 | { 489 | "inputs": [ 490 | { 491 | "internalType": "address", 492 | "name": "", 493 | "type": "address" 494 | }, 495 | { 496 | "internalType": "address", 497 | "name": "from", 498 | "type": "address" 499 | }, 500 | { 501 | "internalType": "uint256", 502 | "name": "tokenId", 503 | "type": "uint256" 504 | }, 505 | { 506 | "internalType": "bytes", 507 | "name": "data", 508 | "type": "bytes" 509 | } 510 | ], 511 | "name": "onERC721Received", 512 | "outputs": [ 513 | { 514 | "internalType": "bytes4", 515 | "name": "", 516 | "type": "bytes4" 517 | } 518 | ], 519 | "stateMutability": "nonpayable", 520 | "type": "function" 521 | }, 522 | { 523 | "inputs": [ 524 | { 525 | "internalType": "contract IERC20Minimal", 526 | "name": "", 527 | "type": "address" 528 | }, 529 | { 530 | "internalType": "address", 531 | "name": "", 532 | "type": "address" 533 | } 534 | ], 535 | "name": "rewards", 536 | "outputs": [ 537 | { 538 | "internalType": "uint256", 539 | "name": "", 540 | "type": "uint256" 541 | } 542 | ], 543 | "stateMutability": "view", 544 | "type": "function" 545 | }, 546 | { 547 | "inputs": [ 548 | { 549 | "components": [ 550 | { 551 | "internalType": "contract IERC20Minimal", 552 | "name": "rewardToken", 553 | "type": "address" 554 | }, 555 | { 556 | "internalType": "contract IUniswapV3Pool", 557 | "name": "pool", 558 | "type": "address" 559 | }, 560 | { 561 | "internalType": "uint256", 562 | "name": "startTime", 563 | "type": "uint256" 564 | }, 565 | { 566 | "internalType": "uint256", 567 | "name": "endTime", 568 | "type": "uint256" 569 | }, 570 | { 571 | "internalType": "address", 572 | "name": "refundee", 573 | "type": "address" 574 | } 575 | ], 576 | "internalType": "struct IUniswapV3Staker.IncentiveKey", 577 | "name": "key", 578 | "type": "tuple" 579 | }, 580 | { 581 | "internalType": "uint256", 582 | "name": "tokenId", 583 | "type": "uint256" 584 | } 585 | ], 586 | "name": "stakeToken", 587 | "outputs": [], 588 | "stateMutability": "nonpayable", 589 | "type": "function" 590 | }, 591 | { 592 | "inputs": [ 593 | { 594 | "internalType": "uint256", 595 | "name": "tokenId", 596 | "type": "uint256" 597 | }, 598 | { 599 | "internalType": "bytes32", 600 | "name": "incentiveId", 601 | "type": "bytes32" 602 | } 603 | ], 604 | "name": "stakes", 605 | "outputs": [ 606 | { 607 | "internalType": "uint160", 608 | "name": "secondsPerLiquidityInsideInitialX128", 609 | "type": "uint160" 610 | }, 611 | { 612 | "internalType": "uint128", 613 | "name": "liquidity", 614 | "type": "uint128" 615 | } 616 | ], 617 | "stateMutability": "view", 618 | "type": "function" 619 | }, 620 | { 621 | "inputs": [ 622 | { 623 | "internalType": "uint256", 624 | "name": "tokenId", 625 | "type": "uint256" 626 | }, 627 | { 628 | "internalType": "address", 629 | "name": "to", 630 | "type": "address" 631 | } 632 | ], 633 | "name": "transferDeposit", 634 | "outputs": [], 635 | "stateMutability": "nonpayable", 636 | "type": "function" 637 | }, 638 | { 639 | "inputs": [ 640 | { 641 | "components": [ 642 | { 643 | "internalType": "contract IERC20Minimal", 644 | "name": "rewardToken", 645 | "type": "address" 646 | }, 647 | { 648 | "internalType": "contract IUniswapV3Pool", 649 | "name": "pool", 650 | "type": "address" 651 | }, 652 | { 653 | "internalType": "uint256", 654 | "name": "startTime", 655 | "type": "uint256" 656 | }, 657 | { 658 | "internalType": "uint256", 659 | "name": "endTime", 660 | "type": "uint256" 661 | }, 662 | { 663 | "internalType": "address", 664 | "name": "refundee", 665 | "type": "address" 666 | } 667 | ], 668 | "internalType": "struct IUniswapV3Staker.IncentiveKey", 669 | "name": "key", 670 | "type": "tuple" 671 | }, 672 | { 673 | "internalType": "uint256", 674 | "name": "tokenId", 675 | "type": "uint256" 676 | } 677 | ], 678 | "name": "unstakeToken", 679 | "outputs": [], 680 | "stateMutability": "nonpayable", 681 | "type": "function" 682 | }, 683 | { 684 | "inputs": [ 685 | { 686 | "internalType": "uint256", 687 | "name": "tokenId", 688 | "type": "uint256" 689 | }, 690 | { 691 | "internalType": "address", 692 | "name": "to", 693 | "type": "address" 694 | }, 695 | { 696 | "internalType": "bytes", 697 | "name": "data", 698 | "type": "bytes" 699 | } 700 | ], 701 | "name": "withdrawToken", 702 | "outputs": [], 703 | "stateMutability": "nonpayable", 704 | "type": "function" 705 | } 706 | ] 707 | -------------------------------------------------------------------------------- /abis/TokenDistro.json: -------------------------------------------------------------------------------- 1 | [ 2 | { 3 | "anonymous": false, 4 | "inputs": [ 5 | { 6 | "indexed": true, 7 | "internalType": "address", 8 | "name": "distributor", 9 | "type": "address" 10 | }, 11 | { 12 | "indexed": true, 13 | "internalType": "address", 14 | "name": "grantee", 15 | "type": "address" 16 | }, 17 | { 18 | "indexed": false, 19 | "internalType": "uint256", 20 | "name": "amount", 21 | "type": "uint256" 22 | } 23 | ], 24 | "name": "Allocate", 25 | "type": "event" 26 | }, 27 | { 28 | "anonymous": false, 29 | "inputs": [ 30 | { 31 | "indexed": true, 32 | "internalType": "address", 33 | "name": "admin", 34 | "type": "address" 35 | }, 36 | { 37 | "indexed": true, 38 | "internalType": "address", 39 | "name": "distributor", 40 | "type": "address" 41 | }, 42 | { 43 | "indexed": false, 44 | "internalType": "uint256", 45 | "name": "amount", 46 | "type": "uint256" 47 | } 48 | ], 49 | "name": "Assign", 50 | "type": "event" 51 | }, 52 | { 53 | "anonymous": false, 54 | "inputs": [ 55 | { 56 | "indexed": true, 57 | "internalType": "address", 58 | "name": "oldAddress", 59 | "type": "address" 60 | }, 61 | { 62 | "indexed": true, 63 | "internalType": "address", 64 | "name": "newAddress", 65 | "type": "address" 66 | } 67 | ], 68 | "name": "ChangeAddress", 69 | "type": "event" 70 | }, 71 | { 72 | "anonymous": false, 73 | "inputs": [ 74 | { 75 | "indexed": true, 76 | "internalType": "address", 77 | "name": "grantee", 78 | "type": "address" 79 | }, 80 | { 81 | "indexed": false, 82 | "internalType": "uint256", 83 | "name": "amount", 84 | "type": "uint256" 85 | } 86 | ], 87 | "name": "Claim", 88 | "type": "event" 89 | }, 90 | { 91 | "anonymous": false, 92 | "inputs": [ 93 | { 94 | "indexed": false, 95 | "internalType": "uint256", 96 | "name": "newDuration", 97 | "type": "uint256" 98 | } 99 | ], 100 | "name": "DurationChanged", 101 | "type": "event" 102 | }, 103 | { 104 | "anonymous": false, 105 | "inputs": [ 106 | { 107 | "indexed": false, 108 | "internalType": "address", 109 | "name": "distributor", 110 | "type": "address" 111 | } 112 | ], 113 | "name": "GivBackPaid", 114 | "type": "event" 115 | }, 116 | { 117 | "anonymous": false, 118 | "inputs": [ 119 | { 120 | "indexed": false, 121 | "internalType": "address", 122 | "name": "distributor", 123 | "type": "address" 124 | } 125 | ], 126 | "name": "PraiseRewardPaid", 127 | "type": "event" 128 | }, 129 | { 130 | "anonymous": false, 131 | "inputs": [ 132 | { 133 | "indexed": true, 134 | "internalType": "bytes32", 135 | "name": "role", 136 | "type": "bytes32" 137 | }, 138 | { 139 | "indexed": true, 140 | "internalType": "bytes32", 141 | "name": "previousAdminRole", 142 | "type": "bytes32" 143 | }, 144 | { 145 | "indexed": true, 146 | "internalType": "bytes32", 147 | "name": "newAdminRole", 148 | "type": "bytes32" 149 | } 150 | ], 151 | "name": "RoleAdminChanged", 152 | "type": "event" 153 | }, 154 | { 155 | "anonymous": false, 156 | "inputs": [ 157 | { 158 | "indexed": true, 159 | "internalType": "bytes32", 160 | "name": "role", 161 | "type": "bytes32" 162 | }, 163 | { 164 | "indexed": true, 165 | "internalType": "address", 166 | "name": "account", 167 | "type": "address" 168 | }, 169 | { 170 | "indexed": true, 171 | "internalType": "address", 172 | "name": "sender", 173 | "type": "address" 174 | } 175 | ], 176 | "name": "RoleGranted", 177 | "type": "event" 178 | }, 179 | { 180 | "anonymous": false, 181 | "inputs": [ 182 | { 183 | "indexed": true, 184 | "internalType": "bytes32", 185 | "name": "role", 186 | "type": "bytes32" 187 | }, 188 | { 189 | "indexed": true, 190 | "internalType": "address", 191 | "name": "account", 192 | "type": "address" 193 | }, 194 | { 195 | "indexed": true, 196 | "internalType": "address", 197 | "name": "sender", 198 | "type": "address" 199 | } 200 | ], 201 | "name": "RoleRevoked", 202 | "type": "event" 203 | }, 204 | { 205 | "anonymous": false, 206 | "inputs": [ 207 | { 208 | "indexed": false, 209 | "internalType": "uint256", 210 | "name": "newStartTime", 211 | "type": "uint256" 212 | }, 213 | { 214 | "indexed": false, 215 | "internalType": "uint256", 216 | "name": "newCliffTime", 217 | "type": "uint256" 218 | } 219 | ], 220 | "name": "StartTimeChanged", 221 | "type": "event" 222 | }, 223 | { 224 | "inputs": [], 225 | "name": "DEFAULT_ADMIN_ROLE", 226 | "outputs": [ 227 | { 228 | "internalType": "bytes32", 229 | "name": "", 230 | "type": "bytes32" 231 | } 232 | ], 233 | "stateMutability": "view", 234 | "type": "function" 235 | }, 236 | { 237 | "inputs": [], 238 | "name": "DISTRIBUTOR_ROLE", 239 | "outputs": [ 240 | { 241 | "internalType": "bytes32", 242 | "name": "", 243 | "type": "bytes32" 244 | } 245 | ], 246 | "stateMutability": "view", 247 | "type": "function" 248 | }, 249 | { 250 | "inputs": [ 251 | { 252 | "internalType": "address", 253 | "name": "recipient", 254 | "type": "address" 255 | }, 256 | { 257 | "internalType": "uint256", 258 | "name": "amount", 259 | "type": "uint256" 260 | }, 261 | { 262 | "internalType": "bool", 263 | "name": "claim", 264 | "type": "bool" 265 | } 266 | ], 267 | "name": "allocate", 268 | "outputs": [], 269 | "stateMutability": "nonpayable", 270 | "type": "function" 271 | }, 272 | { 273 | "inputs": [ 274 | { 275 | "internalType": "address[]", 276 | "name": "recipients", 277 | "type": "address[]" 278 | }, 279 | { 280 | "internalType": "uint256[]", 281 | "name": "amounts", 282 | "type": "uint256[]" 283 | } 284 | ], 285 | "name": "allocateMany", 286 | "outputs": [], 287 | "stateMutability": "nonpayable", 288 | "type": "function" 289 | }, 290 | { 291 | "inputs": [ 292 | { 293 | "internalType": "address", 294 | "name": "distributor", 295 | "type": "address" 296 | }, 297 | { 298 | "internalType": "uint256", 299 | "name": "amount", 300 | "type": "uint256" 301 | } 302 | ], 303 | "name": "assign", 304 | "outputs": [], 305 | "stateMutability": "nonpayable", 306 | "type": "function" 307 | }, 308 | { 309 | "inputs": [ 310 | { 311 | "internalType": "address", 312 | "name": "", 313 | "type": "address" 314 | } 315 | ], 316 | "name": "balances", 317 | "outputs": [ 318 | { 319 | "internalType": "uint256", 320 | "name": "allocatedTokens", 321 | "type": "uint256" 322 | }, 323 | { 324 | "internalType": "uint256", 325 | "name": "claimed", 326 | "type": "uint256" 327 | } 328 | ], 329 | "stateMutability": "view", 330 | "type": "function" 331 | }, 332 | { 333 | "inputs": [ 334 | { 335 | "internalType": "address", 336 | "name": "prevRecipient", 337 | "type": "address" 338 | }, 339 | { 340 | "internalType": "address", 341 | "name": "newRecipient", 342 | "type": "address" 343 | } 344 | ], 345 | "name": "cancelAllocation", 346 | "outputs": [], 347 | "stateMutability": "nonpayable", 348 | "type": "function" 349 | }, 350 | { 351 | "inputs": [], 352 | "name": "cancelable", 353 | "outputs": [ 354 | { 355 | "internalType": "bool", 356 | "name": "", 357 | "type": "bool" 358 | } 359 | ], 360 | "stateMutability": "view", 361 | "type": "function" 362 | }, 363 | { 364 | "inputs": [ 365 | { 366 | "internalType": "address", 367 | "name": "newAddress", 368 | "type": "address" 369 | } 370 | ], 371 | "name": "changeAddress", 372 | "outputs": [], 373 | "stateMutability": "nonpayable", 374 | "type": "function" 375 | }, 376 | { 377 | "inputs": [], 378 | "name": "claim", 379 | "outputs": [], 380 | "stateMutability": "nonpayable", 381 | "type": "function" 382 | }, 383 | { 384 | "inputs": [ 385 | { 386 | "internalType": "address", 387 | "name": "account", 388 | "type": "address" 389 | } 390 | ], 391 | "name": "claimTo", 392 | "outputs": [], 393 | "stateMutability": "nonpayable", 394 | "type": "function" 395 | }, 396 | { 397 | "inputs": [ 398 | { 399 | "internalType": "address", 400 | "name": "recipient", 401 | "type": "address" 402 | }, 403 | { 404 | "internalType": "uint256", 405 | "name": "timestamp", 406 | "type": "uint256" 407 | } 408 | ], 409 | "name": "claimableAt", 410 | "outputs": [ 411 | { 412 | "internalType": "uint256", 413 | "name": "", 414 | "type": "uint256" 415 | } 416 | ], 417 | "stateMutability": "view", 418 | "type": "function" 419 | }, 420 | { 421 | "inputs": [ 422 | { 423 | "internalType": "address", 424 | "name": "recipient", 425 | "type": "address" 426 | } 427 | ], 428 | "name": "claimableNow", 429 | "outputs": [ 430 | { 431 | "internalType": "uint256", 432 | "name": "", 433 | "type": "uint256" 434 | } 435 | ], 436 | "stateMutability": "view", 437 | "type": "function" 438 | }, 439 | { 440 | "inputs": [], 441 | "name": "cliffTime", 442 | "outputs": [ 443 | { 444 | "internalType": "uint256", 445 | "name": "", 446 | "type": "uint256" 447 | } 448 | ], 449 | "stateMutability": "view", 450 | "type": "function" 451 | }, 452 | { 453 | "inputs": [], 454 | "name": "duration", 455 | "outputs": [ 456 | { 457 | "internalType": "uint256", 458 | "name": "", 459 | "type": "uint256" 460 | } 461 | ], 462 | "stateMutability": "view", 463 | "type": "function" 464 | }, 465 | { 466 | "inputs": [ 467 | { 468 | "internalType": "bytes32", 469 | "name": "role", 470 | "type": "bytes32" 471 | } 472 | ], 473 | "name": "getRoleAdmin", 474 | "outputs": [ 475 | { 476 | "internalType": "bytes32", 477 | "name": "", 478 | "type": "bytes32" 479 | } 480 | ], 481 | "stateMutability": "view", 482 | "type": "function" 483 | }, 484 | { 485 | "inputs": [ 486 | { 487 | "internalType": "bytes32", 488 | "name": "role", 489 | "type": "bytes32" 490 | }, 491 | { 492 | "internalType": "uint256", 493 | "name": "index", 494 | "type": "uint256" 495 | } 496 | ], 497 | "name": "getRoleMember", 498 | "outputs": [ 499 | { 500 | "internalType": "address", 501 | "name": "", 502 | "type": "address" 503 | } 504 | ], 505 | "stateMutability": "view", 506 | "type": "function" 507 | }, 508 | { 509 | "inputs": [ 510 | { 511 | "internalType": "bytes32", 512 | "name": "role", 513 | "type": "bytes32" 514 | } 515 | ], 516 | "name": "getRoleMemberCount", 517 | "outputs": [ 518 | { 519 | "internalType": "uint256", 520 | "name": "", 521 | "type": "uint256" 522 | } 523 | ], 524 | "stateMutability": "view", 525 | "type": "function" 526 | }, 527 | { 528 | "inputs": [], 529 | "name": "getTimestamp", 530 | "outputs": [ 531 | { 532 | "internalType": "uint256", 533 | "name": "", 534 | "type": "uint256" 535 | } 536 | ], 537 | "stateMutability": "view", 538 | "type": "function" 539 | }, 540 | { 541 | "inputs": [ 542 | { 543 | "internalType": "uint256", 544 | "name": "timestamp", 545 | "type": "uint256" 546 | } 547 | ], 548 | "name": "globallyClaimableAt", 549 | "outputs": [ 550 | { 551 | "internalType": "uint256", 552 | "name": "", 553 | "type": "uint256" 554 | } 555 | ], 556 | "stateMutability": "view", 557 | "type": "function" 558 | }, 559 | { 560 | "inputs": [ 561 | { 562 | "internalType": "bytes32", 563 | "name": "role", 564 | "type": "bytes32" 565 | }, 566 | { 567 | "internalType": "address", 568 | "name": "account", 569 | "type": "address" 570 | } 571 | ], 572 | "name": "grantRole", 573 | "outputs": [], 574 | "stateMutability": "nonpayable", 575 | "type": "function" 576 | }, 577 | { 578 | "inputs": [ 579 | { 580 | "internalType": "bytes32", 581 | "name": "role", 582 | "type": "bytes32" 583 | }, 584 | { 585 | "internalType": "address", 586 | "name": "account", 587 | "type": "address" 588 | } 589 | ], 590 | "name": "hasRole", 591 | "outputs": [ 592 | { 593 | "internalType": "bool", 594 | "name": "", 595 | "type": "bool" 596 | } 597 | ], 598 | "stateMutability": "view", 599 | "type": "function" 600 | }, 601 | { 602 | "inputs": [], 603 | "name": "initialAmount", 604 | "outputs": [ 605 | { 606 | "internalType": "uint256", 607 | "name": "", 608 | "type": "uint256" 609 | } 610 | ], 611 | "stateMutability": "view", 612 | "type": "function" 613 | }, 614 | { 615 | "inputs": [ 616 | { 617 | "internalType": "uint256", 618 | "name": "_totalTokens", 619 | "type": "uint256" 620 | }, 621 | { 622 | "internalType": "uint256", 623 | "name": "_startTime", 624 | "type": "uint256" 625 | }, 626 | { 627 | "internalType": "uint256", 628 | "name": "_cliffPeriod", 629 | "type": "uint256" 630 | }, 631 | { 632 | "internalType": "uint256", 633 | "name": "_duration", 634 | "type": "uint256" 635 | }, 636 | { 637 | "internalType": "uint256", 638 | "name": "_initialPercentage", 639 | "type": "uint256" 640 | }, 641 | { 642 | "internalType": "contract IERC20Upgradeable", 643 | "name": "_token", 644 | "type": "address" 645 | }, 646 | { 647 | "internalType": "bool", 648 | "name": "_cancelable", 649 | "type": "bool" 650 | } 651 | ], 652 | "name": "initialize", 653 | "outputs": [], 654 | "stateMutability": "nonpayable", 655 | "type": "function" 656 | }, 657 | { 658 | "inputs": [], 659 | "name": "lockedAmount", 660 | "outputs": [ 661 | { 662 | "internalType": "uint256", 663 | "name": "", 664 | "type": "uint256" 665 | } 666 | ], 667 | "stateMutability": "view", 668 | "type": "function" 669 | }, 670 | { 671 | "inputs": [ 672 | { 673 | "internalType": "bytes32", 674 | "name": "role", 675 | "type": "bytes32" 676 | }, 677 | { 678 | "internalType": "address", 679 | "name": "account", 680 | "type": "address" 681 | } 682 | ], 683 | "name": "renounceRole", 684 | "outputs": [], 685 | "stateMutability": "nonpayable", 686 | "type": "function" 687 | }, 688 | { 689 | "inputs": [ 690 | { 691 | "internalType": "bytes32", 692 | "name": "role", 693 | "type": "bytes32" 694 | }, 695 | { 696 | "internalType": "address", 697 | "name": "account", 698 | "type": "address" 699 | } 700 | ], 701 | "name": "revokeRole", 702 | "outputs": [], 703 | "stateMutability": "nonpayable", 704 | "type": "function" 705 | }, 706 | { 707 | "inputs": [ 708 | { 709 | "internalType": "address[]", 710 | "name": "recipients", 711 | "type": "address[]" 712 | }, 713 | { 714 | "internalType": "uint256[]", 715 | "name": "amounts", 716 | "type": "uint256[]" 717 | } 718 | ], 719 | "name": "sendGIVbacks", 720 | "outputs": [], 721 | "stateMutability": "nonpayable", 722 | "type": "function" 723 | }, 724 | { 725 | "inputs": [ 726 | { 727 | "internalType": "address[]", 728 | "name": "recipients", 729 | "type": "address[]" 730 | }, 731 | { 732 | "internalType": "uint256[]", 733 | "name": "amounts", 734 | "type": "uint256[]" 735 | } 736 | ], 737 | "name": "sendPraiseRewards", 738 | "outputs": [], 739 | "stateMutability": "nonpayable", 740 | "type": "function" 741 | }, 742 | { 743 | "inputs": [ 744 | { 745 | "internalType": "uint256", 746 | "name": "newDuration", 747 | "type": "uint256" 748 | } 749 | ], 750 | "name": "setDuration", 751 | "outputs": [], 752 | "stateMutability": "nonpayable", 753 | "type": "function" 754 | }, 755 | { 756 | "inputs": [ 757 | { 758 | "internalType": "uint256", 759 | "name": "newStartTime", 760 | "type": "uint256" 761 | } 762 | ], 763 | "name": "setStartTime", 764 | "outputs": [], 765 | "stateMutability": "nonpayable", 766 | "type": "function" 767 | }, 768 | { 769 | "inputs": [], 770 | "name": "startTime", 771 | "outputs": [ 772 | { 773 | "internalType": "uint256", 774 | "name": "", 775 | "type": "uint256" 776 | } 777 | ], 778 | "stateMutability": "view", 779 | "type": "function" 780 | }, 781 | { 782 | "inputs": [ 783 | { 784 | "internalType": "bytes4", 785 | "name": "interfaceId", 786 | "type": "bytes4" 787 | } 788 | ], 789 | "name": "supportsInterface", 790 | "outputs": [ 791 | { 792 | "internalType": "bool", 793 | "name": "", 794 | "type": "bool" 795 | } 796 | ], 797 | "stateMutability": "view", 798 | "type": "function" 799 | }, 800 | { 801 | "inputs": [], 802 | "name": "token", 803 | "outputs": [ 804 | { 805 | "internalType": "contract IERC20Upgradeable", 806 | "name": "", 807 | "type": "address" 808 | } 809 | ], 810 | "stateMutability": "view", 811 | "type": "function" 812 | }, 813 | { 814 | "inputs": [], 815 | "name": "totalTokens", 816 | "outputs": [ 817 | { 818 | "internalType": "uint256", 819 | "name": "", 820 | "type": "uint256" 821 | } 822 | ], 823 | "stateMutability": "view", 824 | "type": "function" 825 | } 826 | ] 827 | -------------------------------------------------------------------------------- /abis/UniswapV3Pool.json: -------------------------------------------------------------------------------- 1 | [ 2 | { 3 | "inputs": [], 4 | "stateMutability": "nonpayable", 5 | "type": "constructor" 6 | }, 7 | { 8 | "anonymous": false, 9 | "inputs": [ 10 | { 11 | "indexed": true, 12 | "internalType": "address", 13 | "name": "owner", 14 | "type": "address" 15 | }, 16 | { 17 | "indexed": true, 18 | "internalType": "int24", 19 | "name": "tickLower", 20 | "type": "int24" 21 | }, 22 | { 23 | "indexed": true, 24 | "internalType": "int24", 25 | "name": "tickUpper", 26 | "type": "int24" 27 | }, 28 | { 29 | "indexed": false, 30 | "internalType": "uint128", 31 | "name": "amount", 32 | "type": "uint128" 33 | }, 34 | { 35 | "indexed": false, 36 | "internalType": "uint256", 37 | "name": "amount0", 38 | "type": "uint256" 39 | }, 40 | { 41 | "indexed": false, 42 | "internalType": "uint256", 43 | "name": "amount1", 44 | "type": "uint256" 45 | } 46 | ], 47 | "name": "Burn", 48 | "type": "event" 49 | }, 50 | { 51 | "anonymous": false, 52 | "inputs": [ 53 | { 54 | "indexed": true, 55 | "internalType": "address", 56 | "name": "owner", 57 | "type": "address" 58 | }, 59 | { 60 | "indexed": false, 61 | "internalType": "address", 62 | "name": "recipient", 63 | "type": "address" 64 | }, 65 | { 66 | "indexed": true, 67 | "internalType": "int24", 68 | "name": "tickLower", 69 | "type": "int24" 70 | }, 71 | { 72 | "indexed": true, 73 | "internalType": "int24", 74 | "name": "tickUpper", 75 | "type": "int24" 76 | }, 77 | { 78 | "indexed": false, 79 | "internalType": "uint128", 80 | "name": "amount0", 81 | "type": "uint128" 82 | }, 83 | { 84 | "indexed": false, 85 | "internalType": "uint128", 86 | "name": "amount1", 87 | "type": "uint128" 88 | } 89 | ], 90 | "name": "Collect", 91 | "type": "event" 92 | }, 93 | { 94 | "anonymous": false, 95 | "inputs": [ 96 | { 97 | "indexed": true, 98 | "internalType": "address", 99 | "name": "sender", 100 | "type": "address" 101 | }, 102 | { 103 | "indexed": true, 104 | "internalType": "address", 105 | "name": "recipient", 106 | "type": "address" 107 | }, 108 | { 109 | "indexed": false, 110 | "internalType": "uint128", 111 | "name": "amount0", 112 | "type": "uint128" 113 | }, 114 | { 115 | "indexed": false, 116 | "internalType": "uint128", 117 | "name": "amount1", 118 | "type": "uint128" 119 | } 120 | ], 121 | "name": "CollectProtocol", 122 | "type": "event" 123 | }, 124 | { 125 | "anonymous": false, 126 | "inputs": [ 127 | { 128 | "indexed": true, 129 | "internalType": "address", 130 | "name": "sender", 131 | "type": "address" 132 | }, 133 | { 134 | "indexed": true, 135 | "internalType": "address", 136 | "name": "recipient", 137 | "type": "address" 138 | }, 139 | { 140 | "indexed": false, 141 | "internalType": "uint256", 142 | "name": "amount0", 143 | "type": "uint256" 144 | }, 145 | { 146 | "indexed": false, 147 | "internalType": "uint256", 148 | "name": "amount1", 149 | "type": "uint256" 150 | }, 151 | { 152 | "indexed": false, 153 | "internalType": "uint256", 154 | "name": "paid0", 155 | "type": "uint256" 156 | }, 157 | { 158 | "indexed": false, 159 | "internalType": "uint256", 160 | "name": "paid1", 161 | "type": "uint256" 162 | } 163 | ], 164 | "name": "Flash", 165 | "type": "event" 166 | }, 167 | { 168 | "anonymous": false, 169 | "inputs": [ 170 | { 171 | "indexed": false, 172 | "internalType": "uint16", 173 | "name": "observationCardinalityNextOld", 174 | "type": "uint16" 175 | }, 176 | { 177 | "indexed": false, 178 | "internalType": "uint16", 179 | "name": "observationCardinalityNextNew", 180 | "type": "uint16" 181 | } 182 | ], 183 | "name": "IncreaseObservationCardinalityNext", 184 | "type": "event" 185 | }, 186 | { 187 | "anonymous": false, 188 | "inputs": [ 189 | { 190 | "indexed": false, 191 | "internalType": "uint160", 192 | "name": "sqrtPriceX96", 193 | "type": "uint160" 194 | }, 195 | { 196 | "indexed": false, 197 | "internalType": "int24", 198 | "name": "tick", 199 | "type": "int24" 200 | } 201 | ], 202 | "name": "Initialize", 203 | "type": "event" 204 | }, 205 | { 206 | "anonymous": false, 207 | "inputs": [ 208 | { 209 | "indexed": false, 210 | "internalType": "address", 211 | "name": "sender", 212 | "type": "address" 213 | }, 214 | { 215 | "indexed": true, 216 | "internalType": "address", 217 | "name": "owner", 218 | "type": "address" 219 | }, 220 | { 221 | "indexed": true, 222 | "internalType": "int24", 223 | "name": "tickLower", 224 | "type": "int24" 225 | }, 226 | { 227 | "indexed": true, 228 | "internalType": "int24", 229 | "name": "tickUpper", 230 | "type": "int24" 231 | }, 232 | { 233 | "indexed": false, 234 | "internalType": "uint128", 235 | "name": "amount", 236 | "type": "uint128" 237 | }, 238 | { 239 | "indexed": false, 240 | "internalType": "uint256", 241 | "name": "amount0", 242 | "type": "uint256" 243 | }, 244 | { 245 | "indexed": false, 246 | "internalType": "uint256", 247 | "name": "amount1", 248 | "type": "uint256" 249 | } 250 | ], 251 | "name": "Mint", 252 | "type": "event" 253 | }, 254 | { 255 | "anonymous": false, 256 | "inputs": [ 257 | { 258 | "indexed": false, 259 | "internalType": "uint8", 260 | "name": "feeProtocol0Old", 261 | "type": "uint8" 262 | }, 263 | { 264 | "indexed": false, 265 | "internalType": "uint8", 266 | "name": "feeProtocol1Old", 267 | "type": "uint8" 268 | }, 269 | { 270 | "indexed": false, 271 | "internalType": "uint8", 272 | "name": "feeProtocol0New", 273 | "type": "uint8" 274 | }, 275 | { 276 | "indexed": false, 277 | "internalType": "uint8", 278 | "name": "feeProtocol1New", 279 | "type": "uint8" 280 | } 281 | ], 282 | "name": "SetFeeProtocol", 283 | "type": "event" 284 | }, 285 | { 286 | "anonymous": false, 287 | "inputs": [ 288 | { 289 | "indexed": true, 290 | "internalType": "address", 291 | "name": "sender", 292 | "type": "address" 293 | }, 294 | { 295 | "indexed": true, 296 | "internalType": "address", 297 | "name": "recipient", 298 | "type": "address" 299 | }, 300 | { 301 | "indexed": false, 302 | "internalType": "int256", 303 | "name": "amount0", 304 | "type": "int256" 305 | }, 306 | { 307 | "indexed": false, 308 | "internalType": "int256", 309 | "name": "amount1", 310 | "type": "int256" 311 | }, 312 | { 313 | "indexed": false, 314 | "internalType": "uint160", 315 | "name": "sqrtPriceX96", 316 | "type": "uint160" 317 | }, 318 | { 319 | "indexed": false, 320 | "internalType": "uint128", 321 | "name": "liquidity", 322 | "type": "uint128" 323 | }, 324 | { 325 | "indexed": false, 326 | "internalType": "int24", 327 | "name": "tick", 328 | "type": "int24" 329 | } 330 | ], 331 | "name": "Swap", 332 | "type": "event" 333 | }, 334 | { 335 | "inputs": [ 336 | { 337 | "internalType": "int24", 338 | "name": "tickLower", 339 | "type": "int24" 340 | }, 341 | { 342 | "internalType": "int24", 343 | "name": "tickUpper", 344 | "type": "int24" 345 | }, 346 | { 347 | "internalType": "uint128", 348 | "name": "amount", 349 | "type": "uint128" 350 | } 351 | ], 352 | "name": "burn", 353 | "outputs": [ 354 | { 355 | "internalType": "uint256", 356 | "name": "amount0", 357 | "type": "uint256" 358 | }, 359 | { 360 | "internalType": "uint256", 361 | "name": "amount1", 362 | "type": "uint256" 363 | } 364 | ], 365 | "stateMutability": "nonpayable", 366 | "type": "function" 367 | }, 368 | { 369 | "inputs": [ 370 | { 371 | "internalType": "address", 372 | "name": "recipient", 373 | "type": "address" 374 | }, 375 | { 376 | "internalType": "int24", 377 | "name": "tickLower", 378 | "type": "int24" 379 | }, 380 | { 381 | "internalType": "int24", 382 | "name": "tickUpper", 383 | "type": "int24" 384 | }, 385 | { 386 | "internalType": "uint128", 387 | "name": "amount0Requested", 388 | "type": "uint128" 389 | }, 390 | { 391 | "internalType": "uint128", 392 | "name": "amount1Requested", 393 | "type": "uint128" 394 | } 395 | ], 396 | "name": "collect", 397 | "outputs": [ 398 | { 399 | "internalType": "uint128", 400 | "name": "amount0", 401 | "type": "uint128" 402 | }, 403 | { 404 | "internalType": "uint128", 405 | "name": "amount1", 406 | "type": "uint128" 407 | } 408 | ], 409 | "stateMutability": "nonpayable", 410 | "type": "function" 411 | }, 412 | { 413 | "inputs": [ 414 | { 415 | "internalType": "address", 416 | "name": "recipient", 417 | "type": "address" 418 | }, 419 | { 420 | "internalType": "uint128", 421 | "name": "amount0Requested", 422 | "type": "uint128" 423 | }, 424 | { 425 | "internalType": "uint128", 426 | "name": "amount1Requested", 427 | "type": "uint128" 428 | } 429 | ], 430 | "name": "collectProtocol", 431 | "outputs": [ 432 | { 433 | "internalType": "uint128", 434 | "name": "amount0", 435 | "type": "uint128" 436 | }, 437 | { 438 | "internalType": "uint128", 439 | "name": "amount1", 440 | "type": "uint128" 441 | } 442 | ], 443 | "stateMutability": "nonpayable", 444 | "type": "function" 445 | }, 446 | { 447 | "inputs": [], 448 | "name": "factory", 449 | "outputs": [ 450 | { 451 | "internalType": "address", 452 | "name": "", 453 | "type": "address" 454 | } 455 | ], 456 | "stateMutability": "view", 457 | "type": "function" 458 | }, 459 | { 460 | "inputs": [], 461 | "name": "fee", 462 | "outputs": [ 463 | { 464 | "internalType": "uint24", 465 | "name": "", 466 | "type": "uint24" 467 | } 468 | ], 469 | "stateMutability": "view", 470 | "type": "function" 471 | }, 472 | { 473 | "inputs": [], 474 | "name": "feeGrowthGlobal0X128", 475 | "outputs": [ 476 | { 477 | "internalType": "uint256", 478 | "name": "", 479 | "type": "uint256" 480 | } 481 | ], 482 | "stateMutability": "view", 483 | "type": "function" 484 | }, 485 | { 486 | "inputs": [], 487 | "name": "feeGrowthGlobal1X128", 488 | "outputs": [ 489 | { 490 | "internalType": "uint256", 491 | "name": "", 492 | "type": "uint256" 493 | } 494 | ], 495 | "stateMutability": "view", 496 | "type": "function" 497 | }, 498 | { 499 | "inputs": [ 500 | { 501 | "internalType": "address", 502 | "name": "recipient", 503 | "type": "address" 504 | }, 505 | { 506 | "internalType": "uint256", 507 | "name": "amount0", 508 | "type": "uint256" 509 | }, 510 | { 511 | "internalType": "uint256", 512 | "name": "amount1", 513 | "type": "uint256" 514 | }, 515 | { 516 | "internalType": "bytes", 517 | "name": "data", 518 | "type": "bytes" 519 | } 520 | ], 521 | "name": "flash", 522 | "outputs": [], 523 | "stateMutability": "nonpayable", 524 | "type": "function" 525 | }, 526 | { 527 | "inputs": [ 528 | { 529 | "internalType": "uint16", 530 | "name": "observationCardinalityNext", 531 | "type": "uint16" 532 | } 533 | ], 534 | "name": "increaseObservationCardinalityNext", 535 | "outputs": [], 536 | "stateMutability": "nonpayable", 537 | "type": "function" 538 | }, 539 | { 540 | "inputs": [ 541 | { 542 | "internalType": "uint160", 543 | "name": "sqrtPriceX96", 544 | "type": "uint160" 545 | } 546 | ], 547 | "name": "initialize", 548 | "outputs": [], 549 | "stateMutability": "nonpayable", 550 | "type": "function" 551 | }, 552 | { 553 | "inputs": [], 554 | "name": "liquidity", 555 | "outputs": [ 556 | { 557 | "internalType": "uint128", 558 | "name": "", 559 | "type": "uint128" 560 | } 561 | ], 562 | "stateMutability": "view", 563 | "type": "function" 564 | }, 565 | { 566 | "inputs": [], 567 | "name": "maxLiquidityPerTick", 568 | "outputs": [ 569 | { 570 | "internalType": "uint128", 571 | "name": "", 572 | "type": "uint128" 573 | } 574 | ], 575 | "stateMutability": "view", 576 | "type": "function" 577 | }, 578 | { 579 | "inputs": [ 580 | { 581 | "internalType": "address", 582 | "name": "recipient", 583 | "type": "address" 584 | }, 585 | { 586 | "internalType": "int24", 587 | "name": "tickLower", 588 | "type": "int24" 589 | }, 590 | { 591 | "internalType": "int24", 592 | "name": "tickUpper", 593 | "type": "int24" 594 | }, 595 | { 596 | "internalType": "uint128", 597 | "name": "amount", 598 | "type": "uint128" 599 | }, 600 | { 601 | "internalType": "bytes", 602 | "name": "data", 603 | "type": "bytes" 604 | } 605 | ], 606 | "name": "mint", 607 | "outputs": [ 608 | { 609 | "internalType": "uint256", 610 | "name": "amount0", 611 | "type": "uint256" 612 | }, 613 | { 614 | "internalType": "uint256", 615 | "name": "amount1", 616 | "type": "uint256" 617 | } 618 | ], 619 | "stateMutability": "nonpayable", 620 | "type": "function" 621 | }, 622 | { 623 | "inputs": [ 624 | { 625 | "internalType": "uint256", 626 | "name": "", 627 | "type": "uint256" 628 | } 629 | ], 630 | "name": "observations", 631 | "outputs": [ 632 | { 633 | "internalType": "uint32", 634 | "name": "blockTimestamp", 635 | "type": "uint32" 636 | }, 637 | { 638 | "internalType": "int56", 639 | "name": "tickCumulative", 640 | "type": "int56" 641 | }, 642 | { 643 | "internalType": "uint160", 644 | "name": "secondsPerLiquidityCumulativeX128", 645 | "type": "uint160" 646 | }, 647 | { 648 | "internalType": "bool", 649 | "name": "initialized", 650 | "type": "bool" 651 | } 652 | ], 653 | "stateMutability": "view", 654 | "type": "function" 655 | }, 656 | { 657 | "inputs": [ 658 | { 659 | "internalType": "uint32[]", 660 | "name": "secondsAgos", 661 | "type": "uint32[]" 662 | } 663 | ], 664 | "name": "observe", 665 | "outputs": [ 666 | { 667 | "internalType": "int56[]", 668 | "name": "tickCumulatives", 669 | "type": "int56[]" 670 | }, 671 | { 672 | "internalType": "uint160[]", 673 | "name": "secondsPerLiquidityCumulativeX128s", 674 | "type": "uint160[]" 675 | } 676 | ], 677 | "stateMutability": "view", 678 | "type": "function" 679 | }, 680 | { 681 | "inputs": [ 682 | { 683 | "internalType": "bytes32", 684 | "name": "", 685 | "type": "bytes32" 686 | } 687 | ], 688 | "name": "positions", 689 | "outputs": [ 690 | { 691 | "internalType": "uint128", 692 | "name": "liquidity", 693 | "type": "uint128" 694 | }, 695 | { 696 | "internalType": "uint256", 697 | "name": "feeGrowthInside0LastX128", 698 | "type": "uint256" 699 | }, 700 | { 701 | "internalType": "uint256", 702 | "name": "feeGrowthInside1LastX128", 703 | "type": "uint256" 704 | }, 705 | { 706 | "internalType": "uint128", 707 | "name": "tokensOwed0", 708 | "type": "uint128" 709 | }, 710 | { 711 | "internalType": "uint128", 712 | "name": "tokensOwed1", 713 | "type": "uint128" 714 | } 715 | ], 716 | "stateMutability": "view", 717 | "type": "function" 718 | }, 719 | { 720 | "inputs": [], 721 | "name": "protocolFees", 722 | "outputs": [ 723 | { 724 | "internalType": "uint128", 725 | "name": "token0", 726 | "type": "uint128" 727 | }, 728 | { 729 | "internalType": "uint128", 730 | "name": "token1", 731 | "type": "uint128" 732 | } 733 | ], 734 | "stateMutability": "view", 735 | "type": "function" 736 | }, 737 | { 738 | "inputs": [ 739 | { 740 | "internalType": "uint8", 741 | "name": "feeProtocol0", 742 | "type": "uint8" 743 | }, 744 | { 745 | "internalType": "uint8", 746 | "name": "feeProtocol1", 747 | "type": "uint8" 748 | } 749 | ], 750 | "name": "setFeeProtocol", 751 | "outputs": [], 752 | "stateMutability": "nonpayable", 753 | "type": "function" 754 | }, 755 | { 756 | "inputs": [], 757 | "name": "slot0", 758 | "outputs": [ 759 | { 760 | "internalType": "uint160", 761 | "name": "sqrtPriceX96", 762 | "type": "uint160" 763 | }, 764 | { 765 | "internalType": "int24", 766 | "name": "tick", 767 | "type": "int24" 768 | }, 769 | { 770 | "internalType": "uint16", 771 | "name": "observationIndex", 772 | "type": "uint16" 773 | }, 774 | { 775 | "internalType": "uint16", 776 | "name": "observationCardinality", 777 | "type": "uint16" 778 | }, 779 | { 780 | "internalType": "uint16", 781 | "name": "observationCardinalityNext", 782 | "type": "uint16" 783 | }, 784 | { 785 | "internalType": "uint8", 786 | "name": "feeProtocol", 787 | "type": "uint8" 788 | }, 789 | { 790 | "internalType": "bool", 791 | "name": "unlocked", 792 | "type": "bool" 793 | } 794 | ], 795 | "stateMutability": "view", 796 | "type": "function" 797 | }, 798 | { 799 | "inputs": [ 800 | { 801 | "internalType": "int24", 802 | "name": "tickLower", 803 | "type": "int24" 804 | }, 805 | { 806 | "internalType": "int24", 807 | "name": "tickUpper", 808 | "type": "int24" 809 | } 810 | ], 811 | "name": "snapshotCumulativesInside", 812 | "outputs": [ 813 | { 814 | "internalType": "int56", 815 | "name": "tickCumulativeInside", 816 | "type": "int56" 817 | }, 818 | { 819 | "internalType": "uint160", 820 | "name": "secondsPerLiquidityInsideX128", 821 | "type": "uint160" 822 | }, 823 | { 824 | "internalType": "uint32", 825 | "name": "secondsInside", 826 | "type": "uint32" 827 | } 828 | ], 829 | "stateMutability": "view", 830 | "type": "function" 831 | }, 832 | { 833 | "inputs": [ 834 | { 835 | "internalType": "address", 836 | "name": "recipient", 837 | "type": "address" 838 | }, 839 | { 840 | "internalType": "bool", 841 | "name": "zeroForOne", 842 | "type": "bool" 843 | }, 844 | { 845 | "internalType": "int256", 846 | "name": "amountSpecified", 847 | "type": "int256" 848 | }, 849 | { 850 | "internalType": "uint160", 851 | "name": "sqrtPriceLimitX96", 852 | "type": "uint160" 853 | }, 854 | { 855 | "internalType": "bytes", 856 | "name": "data", 857 | "type": "bytes" 858 | } 859 | ], 860 | "name": "swap", 861 | "outputs": [ 862 | { 863 | "internalType": "int256", 864 | "name": "amount0", 865 | "type": "int256" 866 | }, 867 | { 868 | "internalType": "int256", 869 | "name": "amount1", 870 | "type": "int256" 871 | } 872 | ], 873 | "stateMutability": "nonpayable", 874 | "type": "function" 875 | }, 876 | { 877 | "inputs": [ 878 | { 879 | "internalType": "int16", 880 | "name": "", 881 | "type": "int16" 882 | } 883 | ], 884 | "name": "tickBitmap", 885 | "outputs": [ 886 | { 887 | "internalType": "uint256", 888 | "name": "", 889 | "type": "uint256" 890 | } 891 | ], 892 | "stateMutability": "view", 893 | "type": "function" 894 | }, 895 | { 896 | "inputs": [], 897 | "name": "tickSpacing", 898 | "outputs": [ 899 | { 900 | "internalType": "int24", 901 | "name": "", 902 | "type": "int24" 903 | } 904 | ], 905 | "stateMutability": "view", 906 | "type": "function" 907 | }, 908 | { 909 | "inputs": [ 910 | { 911 | "internalType": "int24", 912 | "name": "", 913 | "type": "int24" 914 | } 915 | ], 916 | "name": "ticks", 917 | "outputs": [ 918 | { 919 | "internalType": "uint128", 920 | "name": "liquidityGross", 921 | "type": "uint128" 922 | }, 923 | { 924 | "internalType": "int128", 925 | "name": "liquidityNet", 926 | "type": "int128" 927 | }, 928 | { 929 | "internalType": "uint256", 930 | "name": "feeGrowthOutside0X128", 931 | "type": "uint256" 932 | }, 933 | { 934 | "internalType": "uint256", 935 | "name": "feeGrowthOutside1X128", 936 | "type": "uint256" 937 | }, 938 | { 939 | "internalType": "int56", 940 | "name": "tickCumulativeOutside", 941 | "type": "int56" 942 | }, 943 | { 944 | "internalType": "uint160", 945 | "name": "secondsPerLiquidityOutsideX128", 946 | "type": "uint160" 947 | }, 948 | { 949 | "internalType": "uint32", 950 | "name": "secondsOutside", 951 | "type": "uint32" 952 | }, 953 | { 954 | "internalType": "bool", 955 | "name": "initialized", 956 | "type": "bool" 957 | } 958 | ], 959 | "stateMutability": "view", 960 | "type": "function" 961 | }, 962 | { 963 | "inputs": [], 964 | "name": "token0", 965 | "outputs": [ 966 | { 967 | "internalType": "address", 968 | "name": "", 969 | "type": "address" 970 | } 971 | ], 972 | "stateMutability": "view", 973 | "type": "function" 974 | }, 975 | { 976 | "inputs": [], 977 | "name": "token1", 978 | "outputs": [ 979 | { 980 | "internalType": "address", 981 | "name": "", 982 | "type": "address" 983 | } 984 | ], 985 | "stateMutability": "view", 986 | "type": "function" 987 | } 988 | ] 989 | --------------------------------------------------------------------------------