├── .nvmrc ├── abis ├── v3_1_0 │ └── abis │ │ ├── console.json │ │ ├── BalanceDrip.json │ │ ├── FixedPoint.json │ │ ├── Initializable.json │ │ ├── UInt256Array.json │ │ ├── VolumeDrip.json │ │ ├── YieldSource.json │ │ ├── AddressUpgradeable.json │ │ ├── BalanceDripManager.json │ │ ├── ContextUpgradeable.json │ │ ├── ExtendedSafeCast.json │ │ ├── SafeCastUpgradeable.json │ │ ├── SafeMathUpgradeable.json │ │ ├── StringsUpgradeable.json │ │ ├── UniformRandomNumber.json │ │ ├── VolumeDripManager.json │ │ ├── ERC165CheckerUpgradeable.json │ │ ├── EnumerableMapUpgradeable.json │ │ ├── EnumerableSetUpgradeable.json │ │ ├── SafeERC20Upgradeable.json │ │ ├── SortitionSumTreeFactory.json │ │ ├── OpenZeppelinSafeMath_V3_3_0.json │ │ ├── ReentrancyGuardUpgradeable.json │ │ ├── Timestamp.json │ │ ├── RegistryInterface.json │ │ ├── MappedSinglyLinkedList.json │ │ ├── TokenListenerLibrary.json │ │ ├── PeriodicPrizeStrategyDistributorInterface.json │ │ ├── PeriodicPrizeStrategyListenerLibrary.json │ │ ├── TicketInterface.json │ │ ├── ERC165Upgradeable.json │ │ ├── IERC165Upgradeable.json │ │ ├── ReserveInterface.json │ │ ├── PrizePoolBuilder.json │ │ ├── TokenControllerInterface.json │ │ ├── IERC1820ImplementerUpgradeable.json │ │ ├── IERC721ReceiverUpgradeable.json │ │ ├── UInt256ArrayExposed.json │ │ ├── ExtendedSafeCastExposed.json │ │ ├── ProxyFactory.json │ │ ├── PeriodicPrizeStrategyListener.json │ │ ├── PeriodicPrizeStrategyListenerInterface.json │ │ ├── IERC777RecipientUpgradeable.json │ │ ├── ComptrollerStorage.json │ │ ├── OwnableUpgradeable.json │ │ ├── OpenZeppelinProxyFactoryInterface.json │ │ ├── TicketProxyFactory.json │ │ ├── ControlledTokenProxyFactory.json │ │ ├── MultipleWinnersProxyFactory.json │ │ ├── StakePrizePoolProxyFactory.json │ │ ├── yVaultPrizePoolProxyFactory.json │ │ ├── CompoundPrizePoolProxyFactory.json │ │ ├── SingleRandomWinnerProxyFactory.json │ │ ├── MultipleWinnersHarnessProxyFactory.json │ │ ├── yVaultPrizePoolHarnessProxyFactory.json │ │ ├── CompoundPrizePoolHarnessProxyFactory.json │ │ ├── ERC1820ImplementerMock.json │ │ ├── YieldSourceStub.json │ │ ├── TokenListener.json │ │ ├── TokenListenerInterface.json │ │ ├── Constants.json │ │ ├── DoppelgangerWithExec.json │ │ ├── MappedSinglyLinkedListExposed.json │ │ ├── Registry.json │ │ ├── StakePrizePoolBuilder.json │ │ ├── CompoundPrizePoolBuilder.json │ │ ├── VaultPrizePoolBuilder.json │ │ ├── RNGInterface.json │ │ ├── Reserve.json │ │ ├── RNGServiceMock.json │ │ ├── BalanceDripExposed.json │ │ ├── ControlledTokenBuilder.json │ │ ├── PermitAndDepositDai.json │ │ ├── BalanceDripManagerExposed.json │ │ ├── IERC20Upgradeable.json │ │ ├── VolumeDripManagerExposed.json │ │ ├── MultipleWinnersBuilder.json │ │ ├── VolumeDripExposed.json │ │ ├── IERC1820RegistryUpgradeable.json │ │ ├── DaiInterface.json │ │ ├── yVaultInterface.json │ │ ├── ControlledTokenInterface.json │ │ ├── ERC20Upgradeable.json │ │ ├── IERC721Upgradeable.json │ │ └── CTokenInterface.json └── v3_2_0 │ └── abis │ └── CompoundPrizePoolProxyFactory.json ├── Subgraph-V3.code-workspace ├── draftquery.graphql ├── scripts └── package-version.sh ├── testQueries └── testDaiPrizePool.graphql ├── src ├── helpers │ ├── loadOrCreateSablierStream.ts │ ├── common.ts │ ├── loadOrCreatePrizeStrategy.ts │ ├── loadOrCreatePrize.ts │ ├── loadOrCreatePrizeSplit.ts │ ├── loadOrCreatePrizePoolAccount.ts │ ├── loadOrCreatePrizePoolCreditRate.ts │ ├── loadOrCreateStakePrizePool.ts │ ├── loadOrCreateAwardedControlledToken.ts │ ├── loadOrCreateCompoundPrizePool.ts │ ├── loadOrCreateYieldSourcePrizePool.ts │ ├── idTemplates.ts │ ├── loadOrCreateControlledToken.ts │ ├── loadOrCreateSingleRandomWinner.ts │ ├── loadOrCreateExternalAward.ts │ ├── loadOrCreateAccount.ts │ ├── loadOrCreateAwardedExternalErc.ts │ ├── loadOrCreateMultipleWinnersExternalAward.ts │ └── loadOrCreatePrizePool.ts ├── mappingForControlledTokenProxyFactory.ts ├── mappingForTicketProxyFactory.ts ├── mappingForStakePrizePoolProxyFactory.ts ├── mappingForYieldSourcePrizePool.ts ├── mappingForYieldSourcePrizePoolProxyFactory.ts ├── mappingForStakePrizePool.ts ├── mappingForCompoundPrizePoolProxyFactory.ts ├── mappingForCompoundPrizePool.ts ├── mappingForSablierStreamManager.ts ├── mappingForMultipleWinnersProxyFactory.ts ├── mappingForControlledToken.ts └── mappingForPrizePool.ts ├── .gitignore ├── test ├── networks ├── bsc.json ├── celo.json ├── rinkeby.json ├── mainnet.json └── polygon.json ├── LICENSE ├── README.md ├── testquery.gql └── package.json /.nvmrc: -------------------------------------------------------------------------------- 1 | v10.20.1 2 | -------------------------------------------------------------------------------- /abis/v3_1_0/abis/console.json: -------------------------------------------------------------------------------- 1 | [] -------------------------------------------------------------------------------- /abis/v3_1_0/abis/BalanceDrip.json: -------------------------------------------------------------------------------- 1 | [] -------------------------------------------------------------------------------- /abis/v3_1_0/abis/FixedPoint.json: -------------------------------------------------------------------------------- 1 | [] -------------------------------------------------------------------------------- /abis/v3_1_0/abis/Initializable.json: -------------------------------------------------------------------------------- 1 | [] -------------------------------------------------------------------------------- /abis/v3_1_0/abis/UInt256Array.json: -------------------------------------------------------------------------------- 1 | [] -------------------------------------------------------------------------------- /abis/v3_1_0/abis/VolumeDrip.json: -------------------------------------------------------------------------------- 1 | [] -------------------------------------------------------------------------------- /abis/v3_1_0/abis/YieldSource.json: -------------------------------------------------------------------------------- 1 | [] -------------------------------------------------------------------------------- /abis/v3_1_0/abis/AddressUpgradeable.json: -------------------------------------------------------------------------------- 1 | [] -------------------------------------------------------------------------------- /abis/v3_1_0/abis/BalanceDripManager.json: -------------------------------------------------------------------------------- 1 | [] -------------------------------------------------------------------------------- /abis/v3_1_0/abis/ContextUpgradeable.json: -------------------------------------------------------------------------------- 1 | [] -------------------------------------------------------------------------------- /abis/v3_1_0/abis/ExtendedSafeCast.json: -------------------------------------------------------------------------------- 1 | [] -------------------------------------------------------------------------------- /abis/v3_1_0/abis/SafeCastUpgradeable.json: -------------------------------------------------------------------------------- 1 | [] -------------------------------------------------------------------------------- /abis/v3_1_0/abis/SafeMathUpgradeable.json: -------------------------------------------------------------------------------- 1 | [] -------------------------------------------------------------------------------- /abis/v3_1_0/abis/StringsUpgradeable.json: -------------------------------------------------------------------------------- 1 | [] -------------------------------------------------------------------------------- /abis/v3_1_0/abis/UniformRandomNumber.json: -------------------------------------------------------------------------------- 1 | [] -------------------------------------------------------------------------------- /abis/v3_1_0/abis/VolumeDripManager.json: -------------------------------------------------------------------------------- 1 | [] -------------------------------------------------------------------------------- /abis/v3_1_0/abis/ERC165CheckerUpgradeable.json: -------------------------------------------------------------------------------- 1 | [] -------------------------------------------------------------------------------- /abis/v3_1_0/abis/EnumerableMapUpgradeable.json: -------------------------------------------------------------------------------- 1 | [] -------------------------------------------------------------------------------- /abis/v3_1_0/abis/EnumerableSetUpgradeable.json: -------------------------------------------------------------------------------- 1 | [] -------------------------------------------------------------------------------- /abis/v3_1_0/abis/SafeERC20Upgradeable.json: -------------------------------------------------------------------------------- 1 | [] -------------------------------------------------------------------------------- /abis/v3_1_0/abis/SortitionSumTreeFactory.json: -------------------------------------------------------------------------------- 1 | [] -------------------------------------------------------------------------------- /abis/v3_1_0/abis/OpenZeppelinSafeMath_V3_3_0.json: -------------------------------------------------------------------------------- 1 | [] -------------------------------------------------------------------------------- /abis/v3_1_0/abis/ReentrancyGuardUpgradeable.json: -------------------------------------------------------------------------------- 1 | [] -------------------------------------------------------------------------------- /Subgraph-V3.code-workspace: -------------------------------------------------------------------------------- 1 | { 2 | "folders": [ 3 | { 4 | "path": "." 5 | } 6 | ] 7 | } -------------------------------------------------------------------------------- /draftquery.graphql: -------------------------------------------------------------------------------- 1 | { 2 | controlledToken(id:"0x4fb19557fbd8d73ac884efbe291626fd5641c778"){ 3 | id 4 | numberOfHolders 5 | } 6 | } -------------------------------------------------------------------------------- /scripts/package-version.sh: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | echo $(cat package.json | grep \\\"version\\\" | head -1 | awk -F: '{ print $2 }' | sed 's/[\",]//g' | tr -d '[[:space:]]') -------------------------------------------------------------------------------- /testQueries/testDaiPrizePool.graphql: -------------------------------------------------------------------------------- 1 | { 2 | prizePool(id:"0xebfb47a7ad0fd6e57323c8a42b2e5a6a4f68fc1a"){ 3 | id 4 | reserveRegistry 5 | prizes(first: 5){ 6 | id 7 | awardedBlock 8 | lockBlock 9 | } 10 | } 11 | } -------------------------------------------------------------------------------- /abis/v3_1_0/abis/Timestamp.json: -------------------------------------------------------------------------------- 1 | [ 2 | { 3 | "inputs": [], 4 | "name": "blockTime", 5 | "outputs": [ 6 | { 7 | "internalType": "uint256", 8 | "name": "", 9 | "type": "uint256" 10 | } 11 | ], 12 | "stateMutability": "view", 13 | "type": "function" 14 | } 15 | ] -------------------------------------------------------------------------------- /abis/v3_1_0/abis/RegistryInterface.json: -------------------------------------------------------------------------------- 1 | [ 2 | { 3 | "inputs": [], 4 | "name": "lookup", 5 | "outputs": [ 6 | { 7 | "internalType": "address", 8 | "name": "", 9 | "type": "address" 10 | } 11 | ], 12 | "stateMutability": "view", 13 | "type": "function" 14 | } 15 | ] -------------------------------------------------------------------------------- /abis/v3_1_0/abis/MappedSinglyLinkedList.json: -------------------------------------------------------------------------------- 1 | [ 2 | { 3 | "inputs": [], 4 | "name": "SENTINEL", 5 | "outputs": [ 6 | { 7 | "internalType": "address", 8 | "name": "", 9 | "type": "address" 10 | } 11 | ], 12 | "stateMutability": "view", 13 | "type": "function" 14 | } 15 | ] -------------------------------------------------------------------------------- /src/helpers/loadOrCreateSablierStream.ts: -------------------------------------------------------------------------------- 1 | import { SablierStream } from "../../generated/schema" 2 | 3 | export function loadOrCreateSablierStream(id : string) : SablierStream{ 4 | let stream = SablierStream.load(id) 5 | if(!stream){ 6 | stream = new SablierStream(id) 7 | } 8 | return stream as SablierStream 9 | } -------------------------------------------------------------------------------- /.gitignore: -------------------------------------------------------------------------------- 1 | node_modules 2 | .history 3 | build 4 | subgraph.local.yaml 5 | subgraph.kovan.yaml 6 | subgraph.yaml 7 | subgraph.ropsten.yaml 8 | subgraph.rinkeby.yaml 9 | subgraph.mainnet.yaml 10 | subgraph.polygon.yaml 11 | subgraph.bsc.yaml 12 | subgraph.celo.yaml 13 | networks/local.json 14 | generated 15 | generated/schema.ts 16 | build -------------------------------------------------------------------------------- /test: -------------------------------------------------------------------------------- 1 | { 2 | "id": "0x3124db361ba65c12719269459c1acd5233ac5422", 3 | "prizeStrategy": null 4 | }, 5 | { 6 | "id": "0x3836f2044e19dd4449a4f0b20189061ba9338782", 7 | "prizeStrategy": null 8 | }, 9 | { 10 | 11 | rinkeby prizepools that dont have a prizeStrategy on rinkeby-staging. -------------------------------------------------------------------------------- /abis/v3_1_0/abis/TokenListenerLibrary.json: -------------------------------------------------------------------------------- 1 | [ 2 | { 3 | "inputs": [], 4 | "name": "ERC165_INTERFACE_ID_TOKEN_LISTENER", 5 | "outputs": [ 6 | { 7 | "internalType": "bytes4", 8 | "name": "", 9 | "type": "bytes4" 10 | } 11 | ], 12 | "stateMutability": "view", 13 | "type": "function" 14 | } 15 | ] -------------------------------------------------------------------------------- /abis/v3_1_0/abis/PeriodicPrizeStrategyDistributorInterface.json: -------------------------------------------------------------------------------- 1 | [ 2 | { 3 | "inputs": [ 4 | { 5 | "internalType": "uint256", 6 | "name": "randomNumber", 7 | "type": "uint256" 8 | } 9 | ], 10 | "name": "distribute", 11 | "outputs": [], 12 | "stateMutability": "nonpayable", 13 | "type": "function" 14 | } 15 | ] -------------------------------------------------------------------------------- /abis/v3_1_0/abis/PeriodicPrizeStrategyListenerLibrary.json: -------------------------------------------------------------------------------- 1 | [ 2 | { 3 | "inputs": [], 4 | "name": "ERC165_INTERFACE_ID_PERIODIC_PRIZE_STRATEGY_LISTENER", 5 | "outputs": [ 6 | { 7 | "internalType": "bytes4", 8 | "name": "", 9 | "type": "bytes4" 10 | } 11 | ], 12 | "stateMutability": "view", 13 | "type": "function" 14 | } 15 | ] -------------------------------------------------------------------------------- /src/mappingForControlledTokenProxyFactory.ts: -------------------------------------------------------------------------------- 1 | import { 2 | ProxyCreated, 3 | } from '../generated/ControlledTokenProxyFactory/ControlledTokenProxyFactory' 4 | 5 | import { 6 | ControlledToken as ControlledTokenTemplate, 7 | } from '../generated/templates' 8 | 9 | export function handleProxyCreated(event: ProxyCreated): void { 10 | ControlledTokenTemplate.create(event.params.proxy) 11 | } 12 | -------------------------------------------------------------------------------- /abis/v3_1_0/abis/TicketInterface.json: -------------------------------------------------------------------------------- 1 | [ 2 | { 3 | "inputs": [ 4 | { 5 | "internalType": "uint256", 6 | "name": "randomNumber", 7 | "type": "uint256" 8 | } 9 | ], 10 | "name": "draw", 11 | "outputs": [ 12 | { 13 | "internalType": "address", 14 | "name": "", 15 | "type": "address" 16 | } 17 | ], 18 | "stateMutability": "view", 19 | "type": "function" 20 | } 21 | ] -------------------------------------------------------------------------------- /abis/v3_1_0/abis/ERC165Upgradeable.json: -------------------------------------------------------------------------------- 1 | [ 2 | { 3 | "inputs": [ 4 | { 5 | "internalType": "bytes4", 6 | "name": "interfaceId", 7 | "type": "bytes4" 8 | } 9 | ], 10 | "name": "supportsInterface", 11 | "outputs": [ 12 | { 13 | "internalType": "bool", 14 | "name": "", 15 | "type": "bool" 16 | } 17 | ], 18 | "stateMutability": "view", 19 | "type": "function" 20 | } 21 | ] -------------------------------------------------------------------------------- /abis/v3_1_0/abis/IERC165Upgradeable.json: -------------------------------------------------------------------------------- 1 | [ 2 | { 3 | "inputs": [ 4 | { 5 | "internalType": "bytes4", 6 | "name": "interfaceId", 7 | "type": "bytes4" 8 | } 9 | ], 10 | "name": "supportsInterface", 11 | "outputs": [ 12 | { 13 | "internalType": "bool", 14 | "name": "", 15 | "type": "bool" 16 | } 17 | ], 18 | "stateMutability": "view", 19 | "type": "function" 20 | } 21 | ] -------------------------------------------------------------------------------- /abis/v3_1_0/abis/ReserveInterface.json: -------------------------------------------------------------------------------- 1 | [ 2 | { 3 | "inputs": [ 4 | { 5 | "internalType": "address", 6 | "name": "prizePool", 7 | "type": "address" 8 | } 9 | ], 10 | "name": "reserveRateMantissa", 11 | "outputs": [ 12 | { 13 | "internalType": "uint256", 14 | "name": "", 15 | "type": "uint256" 16 | } 17 | ], 18 | "stateMutability": "view", 19 | "type": "function" 20 | } 21 | ] -------------------------------------------------------------------------------- /abis/v3_1_0/abis/PrizePoolBuilder.json: -------------------------------------------------------------------------------- 1 | [ 2 | { 3 | "anonymous": false, 4 | "inputs": [ 5 | { 6 | "indexed": true, 7 | "internalType": "address", 8 | "name": "creator", 9 | "type": "address" 10 | }, 11 | { 12 | "indexed": true, 13 | "internalType": "address", 14 | "name": "prizePool", 15 | "type": "address" 16 | } 17 | ], 18 | "name": "PrizePoolCreated", 19 | "type": "event" 20 | } 21 | ] -------------------------------------------------------------------------------- /src/mappingForTicketProxyFactory.ts: -------------------------------------------------------------------------------- 1 | import { log } from '@graphprotocol/graph-ts' 2 | 3 | import { 4 | ProxyCreated 5 | } from '../generated/TicketProxyFactory/TicketProxyFactory' 6 | 7 | import { 8 | ControlledToken as ControlledTokenTemplate 9 | } from '../generated/templates' 10 | 11 | export function handleProxyCreated(event: ProxyCreated): void { 12 | log.warning("TicketProxyFactory created {}", [event.params.proxy.toHexString()]) 13 | ControlledTokenTemplate.create(event.params.proxy) 14 | } 15 | -------------------------------------------------------------------------------- /src/helpers/common.ts: -------------------------------------------------------------------------------- 1 | import { BigInt } from '@graphprotocol/graph-ts' 2 | 3 | export const ZERO_ADDRESS = "0x0000000000000000000000000000000000000000" 4 | 5 | export const ZERO = BigInt.fromI32(0) 6 | export const ONE = BigInt.fromI32(1) 7 | 8 | export function generateCompositeId(key1: string , key2: string) : string { 9 | return key1 + "-" + key2 10 | } 11 | 12 | export function generateAwardedControlledTokenCompositeId(key1: string , key2: string, key3: string, key4: string) : string { 13 | return key1 + "-" + key2 + "-" + key3 + "-" + key4 14 | } -------------------------------------------------------------------------------- /src/helpers/loadOrCreatePrizeStrategy.ts: -------------------------------------------------------------------------------- 1 | import { Address } from '@graphprotocol/graph-ts' 2 | 3 | import { 4 | PrizeStrategy, 5 | } from '../../generated/schema' 6 | 7 | export function loadOrCreatePrizeStrategy( 8 | prizeStrategy: Address 9 | ): PrizeStrategy { 10 | let _prizeStrategy = PrizeStrategy.load(prizeStrategy.toHex()) 11 | 12 | if (!_prizeStrategy) { 13 | // Create PrizeStrategy Link 14 | _prizeStrategy = new PrizeStrategy(prizeStrategy.toHex()) 15 | _prizeStrategy.save() 16 | } 17 | 18 | return _prizeStrategy as PrizeStrategy 19 | } 20 | -------------------------------------------------------------------------------- /src/mappingForStakePrizePoolProxyFactory.ts: -------------------------------------------------------------------------------- 1 | import { 2 | ProxyCreated, 3 | } from '../generated/StakePrizePoolProxyFactory/StakePrizePoolProxyFactory' 4 | 5 | import { 6 | PrizePool as PrizePoolTemplate, 7 | StakePrizePool as StakePrizeTemplate, 8 | } from '../generated/templates' 9 | 10 | export function handleStakePrizePoolCreated(event: ProxyCreated): void { 11 | // Start listening for events from the dynamically generated contract 12 | PrizePoolTemplate.create(event.params.proxy) 13 | StakePrizeTemplate.create(event.params.proxy) 14 | } 15 | -------------------------------------------------------------------------------- /src/mappingForYieldSourcePrizePool.ts: -------------------------------------------------------------------------------- 1 | import { 2 | YieldSourcePrizePoolInitialized, 3 | } from '../generated/templates/YieldSourcePrizePool/YieldSourcePrizePool' 4 | 5 | import { loadOrCreateYieldSourcePrizePool } from './helpers/loadOrCreateYieldSourcePrizePool' 6 | 7 | export function handleYieldSourcePrizePoolInitialized(event: YieldSourcePrizePoolInitialized): void { 8 | const _yieldSourcePrizePool = loadOrCreateYieldSourcePrizePool(event.address) 9 | _yieldSourcePrizePool.yieldSource = event.params.yieldSource 10 | _yieldSourcePrizePool.save() 11 | } 12 | -------------------------------------------------------------------------------- /src/mappingForYieldSourcePrizePoolProxyFactory.ts: -------------------------------------------------------------------------------- 1 | import { 2 | ProxyCreated, 3 | } from "../generated/YieldSourcePrizePoolProxyFactory/YieldSourcePrizePoolProxyFactory" 4 | 5 | import { 6 | 7 | PrizePool as PrizePoolTemplate, 8 | YieldSourcePrizePool as YieldSourcePrizePoolTemplate, 9 | } from '../generated/templates' 10 | 11 | export function handleProxyCreated(event: ProxyCreated): void { 12 | // Start listening for events from the dynamically generated contract 13 | PrizePoolTemplate.create(event.params.proxy) 14 | YieldSourcePrizePoolTemplate.create(event.params.proxy) 15 | } 16 | -------------------------------------------------------------------------------- /abis/v3_1_0/abis/TokenControllerInterface.json: -------------------------------------------------------------------------------- 1 | [ 2 | { 3 | "inputs": [ 4 | { 5 | "internalType": "address", 6 | "name": "from", 7 | "type": "address" 8 | }, 9 | { 10 | "internalType": "address", 11 | "name": "to", 12 | "type": "address" 13 | }, 14 | { 15 | "internalType": "uint256", 16 | "name": "amount", 17 | "type": "uint256" 18 | } 19 | ], 20 | "name": "beforeTokenTransfer", 21 | "outputs": [], 22 | "stateMutability": "nonpayable", 23 | "type": "function" 24 | } 25 | ] -------------------------------------------------------------------------------- /abis/v3_1_0/abis/IERC1820ImplementerUpgradeable.json: -------------------------------------------------------------------------------- 1 | [ 2 | { 3 | "inputs": [ 4 | { 5 | "internalType": "bytes32", 6 | "name": "interfaceHash", 7 | "type": "bytes32" 8 | }, 9 | { 10 | "internalType": "address", 11 | "name": "account", 12 | "type": "address" 13 | } 14 | ], 15 | "name": "canImplementInterfaceForAddress", 16 | "outputs": [ 17 | { 18 | "internalType": "bytes32", 19 | "name": "", 20 | "type": "bytes32" 21 | } 22 | ], 23 | "stateMutability": "view", 24 | "type": "function" 25 | } 26 | ] -------------------------------------------------------------------------------- /src/mappingForStakePrizePool.ts: -------------------------------------------------------------------------------- 1 | 2 | import { log } from '@graphprotocol/graph-ts' 3 | import { 4 | StakePrizePoolInitialized, 5 | } from '../generated/templates/StakePrizePool/StakePrizePool' 6 | 7 | import { loadOrCreateStakePrizePool } from './helpers/loadOrCreateStakePrizePool' 8 | 9 | export function handleStakePrizePoolInitialized(event: StakePrizePoolInitialized): void { 10 | log.warning("initializing stake pool for {} ", [event.address.toHex()]) 11 | const _stakePrizePool = loadOrCreateStakePrizePool(event.address) 12 | _stakePrizePool.stakeToken = event.params.stakeToken 13 | _stakePrizePool.save() 14 | } 15 | 16 | -------------------------------------------------------------------------------- /src/helpers/loadOrCreatePrize.ts: -------------------------------------------------------------------------------- 1 | import { Prize } from '../../generated/schema' 2 | import { ZERO } from './common' 3 | 4 | import { prizeId } from './idTemplates' 5 | 6 | export function loadOrCreatePrize(prizePoolAddress: string, currentPrizeId: string): Prize { 7 | const id = prizeId( 8 | prizePoolAddress, 9 | currentPrizeId 10 | ) 11 | let prize = Prize.load(id) 12 | 13 | if (!prize) { 14 | prize = new Prize(id) 15 | prize.prizePool = prizePoolAddress 16 | prize.numberOfSubWinners = ZERO 17 | prize.numberOfExternalAwardedErc20Winners = ZERO 18 | prize.save() 19 | } 20 | return prize as Prize 21 | } 22 | -------------------------------------------------------------------------------- /src/mappingForCompoundPrizePoolProxyFactory.ts: -------------------------------------------------------------------------------- 1 | 2 | import { 3 | ProxyCreated, 4 | } from '../generated/CompoundPrizePoolProxyFactory/CompoundPrizePoolProxyFactory' 5 | 6 | import { 7 | PrizePool as PrizePoolTemplate, 8 | CompoundPrizePool as CompoundPrizePoolTemplate, 9 | } from '../generated/templates' 10 | 11 | export function handleProxyCreated(event: ProxyCreated): void { 12 | // Start listening for events from the dynamically generated contract 13 | // PrizePoolV3Template.create(event.params.proxy) 14 | PrizePoolTemplate.create(event.params.proxy) 15 | CompoundPrizePoolTemplate.create(event.params.proxy) 16 | } -------------------------------------------------------------------------------- /src/helpers/loadOrCreatePrizeSplit.ts: -------------------------------------------------------------------------------- 1 | import { Address } from '@graphprotocol/graph-ts' 2 | import { PrizeSplit } from '../../generated/schema' 3 | import { ZERO, ZERO_ADDRESS } from './common' 4 | 5 | export function loadOrCreatePrizeSplit(prizeStrategy: string, index: string): PrizeSplit { 6 | const id = prizeStrategy + "-" + "-" + index.toString() 7 | let prizeSplit = PrizeSplit.load(id) 8 | 9 | if (!prizeSplit) { 10 | prizeSplit = new PrizeSplit(id) 11 | prizeSplit.target = Address.fromString(ZERO_ADDRESS) 12 | prizeSplit.tokenType = ZERO 13 | prizeSplit.percentage = ZERO 14 | prizeSplit.save() 15 | } 16 | return prizeSplit as PrizeSplit 17 | } 18 | -------------------------------------------------------------------------------- /src/mappingForCompoundPrizePool.ts: -------------------------------------------------------------------------------- 1 | import { 2 | CompoundPrizePoolInitialized, 3 | } from '../generated/templates/CompoundPrizePool/CompoundPrizePool' // but any should do since its the same event for all 4 | 5 | import { loadOrCreateCompoundPrizePool } from './helpers/loadOrCreateCompoundPrizePool' 6 | 7 | // the initialised event is the same for all compound prize pools so just one handler required 8 | // called form the data source template 9 | 10 | export function handleCompoundPrizePoolInitialized(event: CompoundPrizePoolInitialized): void { 11 | const _compoundPrizePool = loadOrCreateCompoundPrizePool(event.address) 12 | _compoundPrizePool.cToken = event.params.cToken 13 | _compoundPrizePool.save() 14 | } 15 | -------------------------------------------------------------------------------- /src/mappingForSablierStreamManager.ts: -------------------------------------------------------------------------------- 1 | import { store } from "@graphprotocol/graph-ts" 2 | import { SablierStreamCreated, SablierStreamCancelled } from "../generated/SablierManager/SablierManager" 3 | import { loadOrCreateSablierStream } from "./helpers/loadOrCreateSablierStream" 4 | 5 | export function handleSablierStreamCreated(event: SablierStreamCreated): void { 6 | const stream = loadOrCreateSablierStream(event.params.streamId.toHexString()) 7 | stream.prizePool = event.params.prizePool.toHexString() 8 | stream.save() 9 | } 10 | 11 | export function handleSablierStreamCancelled(event: SablierStreamCancelled): void { 12 | const stream = loadOrCreateSablierStream(event.params.streamId.toHexString()) 13 | store.remove("SablierStream", stream.id) 14 | } 15 | 16 | -------------------------------------------------------------------------------- /src/helpers/loadOrCreatePrizePoolAccount.ts: -------------------------------------------------------------------------------- 1 | import { log, Address } from '@graphprotocol/graph-ts' 2 | import {PrizePoolAccount} from "../../generated/schema" 3 | import {generateCompositeId, ZERO} from "./common" 4 | 5 | export function loadOrCreatePrizePoolAccount( 6 | prizePool: Address, 7 | account: string 8 | ): PrizePoolAccount { 9 | let prizePoolAccount = PrizePoolAccount.load(generateCompositeId(prizePool.toHex(),account)) 10 | if(!prizePoolAccount){ // create 11 | prizePoolAccount = new PrizePoolAccount(generateCompositeId(prizePool.toHex(),account)) 12 | prizePoolAccount.prizePool = prizePool.toHex() 13 | prizePoolAccount.account = account 14 | 15 | prizePoolAccount.save() 16 | } 17 | return prizePoolAccount as PrizePoolAccount 18 | } 19 | 20 | -------------------------------------------------------------------------------- /abis/v3_1_0/abis/IERC721ReceiverUpgradeable.json: -------------------------------------------------------------------------------- 1 | [ 2 | { 3 | "inputs": [ 4 | { 5 | "internalType": "address", 6 | "name": "operator", 7 | "type": "address" 8 | }, 9 | { 10 | "internalType": "address", 11 | "name": "from", 12 | "type": "address" 13 | }, 14 | { 15 | "internalType": "uint256", 16 | "name": "tokenId", 17 | "type": "uint256" 18 | }, 19 | { 20 | "internalType": "bytes", 21 | "name": "data", 22 | "type": "bytes" 23 | } 24 | ], 25 | "name": "onERC721Received", 26 | "outputs": [ 27 | { 28 | "internalType": "bytes4", 29 | "name": "", 30 | "type": "bytes4" 31 | } 32 | ], 33 | "stateMutability": "nonpayable", 34 | "type": "function" 35 | } 36 | ] -------------------------------------------------------------------------------- /abis/v3_1_0/abis/UInt256ArrayExposed.json: -------------------------------------------------------------------------------- 1 | [ 2 | { 3 | "inputs": [ 4 | { 5 | "internalType": "uint256[]", 6 | "name": "_array", 7 | "type": "uint256[]" 8 | } 9 | ], 10 | "stateMutability": "nonpayable", 11 | "type": "constructor" 12 | }, 13 | { 14 | "inputs": [ 15 | { 16 | "internalType": "uint256", 17 | "name": "index", 18 | "type": "uint256" 19 | } 20 | ], 21 | "name": "remove", 22 | "outputs": [], 23 | "stateMutability": "nonpayable", 24 | "type": "function" 25 | }, 26 | { 27 | "inputs": [], 28 | "name": "toArray", 29 | "outputs": [ 30 | { 31 | "internalType": "uint256[]", 32 | "name": "", 33 | "type": "uint256[]" 34 | } 35 | ], 36 | "stateMutability": "view", 37 | "type": "function" 38 | } 39 | ] -------------------------------------------------------------------------------- /src/helpers/loadOrCreatePrizePoolCreditRate.ts: -------------------------------------------------------------------------------- 1 | import { Address } from '@graphprotocol/graph-ts' 2 | 3 | import { 4 | CreditRate, 5 | } from '../../generated/schema' 6 | 7 | import { 8 | creditRateId, 9 | } from './idTemplates' 10 | 11 | import { ZERO } from './common' 12 | 13 | 14 | export function loadOrCreatePrizePoolCreditRate( 15 | prizePool: Address, 16 | controlledToken: Address, 17 | ): CreditRate { 18 | const _creditRateId = creditRateId(prizePool.toHex(), controlledToken.toHex()) 19 | let _creditRate = CreditRate.load(_creditRateId) 20 | if (!_creditRate) { 21 | _creditRate = new CreditRate(_creditRateId) 22 | 23 | _creditRate.prizePool = prizePool.toHex() 24 | _creditRate.creditLimitMantissa = ZERO 25 | _creditRate.creditRateMantissa = ZERO 26 | 27 | _creditRate.save() 28 | } 29 | return _creditRate as CreditRate 30 | } 31 | -------------------------------------------------------------------------------- /abis/v3_1_0/abis/ExtendedSafeCastExposed.json: -------------------------------------------------------------------------------- 1 | [ 2 | { 3 | "inputs": [ 4 | { 5 | "internalType": "uint256", 6 | "name": "value", 7 | "type": "uint256" 8 | } 9 | ], 10 | "name": "toUint112", 11 | "outputs": [ 12 | { 13 | "internalType": "uint112", 14 | "name": "", 15 | "type": "uint112" 16 | } 17 | ], 18 | "stateMutability": "pure", 19 | "type": "function" 20 | }, 21 | { 22 | "inputs": [ 23 | { 24 | "internalType": "uint256", 25 | "name": "value", 26 | "type": "uint256" 27 | } 28 | ], 29 | "name": "toUint96", 30 | "outputs": [ 31 | { 32 | "internalType": "uint96", 33 | "name": "", 34 | "type": "uint96" 35 | } 36 | ], 37 | "stateMutability": "pure", 38 | "type": "function" 39 | } 40 | ] -------------------------------------------------------------------------------- /abis/v3_1_0/abis/ProxyFactory.json: -------------------------------------------------------------------------------- 1 | [ 2 | { 3 | "anonymous": false, 4 | "inputs": [ 5 | { 6 | "indexed": false, 7 | "internalType": "address", 8 | "name": "proxy", 9 | "type": "address" 10 | } 11 | ], 12 | "name": "ProxyCreated", 13 | "type": "event" 14 | }, 15 | { 16 | "inputs": [ 17 | { 18 | "internalType": "address", 19 | "name": "_logic", 20 | "type": "address" 21 | }, 22 | { 23 | "internalType": "bytes", 24 | "name": "_data", 25 | "type": "bytes" 26 | } 27 | ], 28 | "name": "deployMinimal", 29 | "outputs": [ 30 | { 31 | "internalType": "address", 32 | "name": "proxy", 33 | "type": "address" 34 | } 35 | ], 36 | "stateMutability": "nonpayable", 37 | "type": "function" 38 | } 39 | ] -------------------------------------------------------------------------------- /networks/bsc.json: -------------------------------------------------------------------------------- 1 | { 2 | "network": "bsc", 3 | "compoundPrizePoolProxyFactory": { 4 | "address": "0xaFcEa072BcBad91029A2bA0b37bAC8269dd4f5E6", 5 | "startBlock": "9218895" 6 | }, 7 | "controlledTokenProxyFactory": { 8 | "address": "0x317625b28Acb3C0540DB00b179D84D9b804277f7", 9 | "startBlock": "9218902" 10 | }, 11 | "multipleWinnersProxyFactory": { 12 | "address": "0x53A2E4F8BFe581bC28e0d1d30808ffB163E53A46", 13 | "startBlock": "9218912" 14 | }, 15 | "ticketProxyFactory": { 16 | "address": "0x72Edd573E230C7d68274Bf718A4C6aD82b5d5f90", 17 | "startBlock": "9218905" 18 | }, 19 | "stakePrizePoolProxyFactory": { 20 | "address": "0x5effa0823e486A5ED1D49d88A1374Fc337e1f9F4", 21 | "startBlock": "9218909" 22 | }, 23 | "yieldSourcePrizePoolProxyFactory": { 24 | "address": "0xdc488E6e8c55a11d20032997cd1fF7c4951401df", 25 | "startBlock": "9218898" 26 | } 27 | } 28 | -------------------------------------------------------------------------------- /networks/celo.json: -------------------------------------------------------------------------------- 1 | { 2 | "network": "celo", 3 | "compoundPrizePoolProxyFactory": { 4 | "address": "0x03e75AeEB92adD6f3b168412671360eB94f0dBf7", 5 | "startBlock": "8453649" 6 | }, 7 | "controlledTokenProxyFactory": { 8 | "address": "0xa6358441F68eD4707E1c4366a0D2E2233bB4841D", 9 | "startBlock": "8453653" 10 | }, 11 | "multipleWinnersProxyFactory": { 12 | "address": "0x6dc7cA9e2c19Da475B39cce7437994c1725d85C9", 13 | "startBlock": "8453656" 14 | }, 15 | "ticketProxyFactory": { 16 | "address": "0xCB876f60399897db24058b2d58D0B9f713175eeF", 17 | "startBlock": "8453654" 18 | }, 19 | "stakePrizePoolProxyFactory": { 20 | "address": "0xef3d36A282e74b5bcba8a45262687DDb31495Cd2", 21 | "startBlock": "8453655" 22 | }, 23 | "yieldSourcePrizePoolProxyFactory": { 24 | "address": "0xc79B5D46f010c88f738A00B3bed7757d04dd2a37", 25 | "startBlock": "8453651" 26 | } 27 | } 28 | -------------------------------------------------------------------------------- /networks/rinkeby.json: -------------------------------------------------------------------------------- 1 | { 2 | "network": "rinkeby", 3 | "compoundPrizePoolProxyFactory": { 4 | "address": "0x766b62E17AE78d095D3505d779741B1b5647d773", 5 | "startBlock": "8948891" 6 | }, 7 | "controlledTokenProxyFactory": { 8 | "address": "0xD477FF7Db0C75C859eA866F4986e73B6057e7590", 9 | "startBlock": "8948893" 10 | }, 11 | "multipleWinnersProxyFactory": { 12 | "address": "0x0C52e524B139d38Eb6fd50395700fc1f7b59C14E", 13 | "startBlock": "8948896" 14 | }, 15 | "ticketProxyFactory": { 16 | "address": "0x5ef5FA5A04665165753239CEdF87cb3ee0D3ab86", 17 | "startBlock": "8948894" 18 | }, 19 | "stakePrizePoolProxyFactory": { 20 | "address": "0x2318b6B9C517cb42D2efaF61195966f8Dc073758", 21 | "startBlock": "8948895" 22 | }, 23 | "yieldSourcePrizePoolProxyFactory": { 24 | "address": "0xD6073119B123859A0e390865A5630E0bB4E2670C", 25 | "startBlock": "8948892" 26 | } 27 | } 28 | -------------------------------------------------------------------------------- /abis/v3_1_0/abis/PeriodicPrizeStrategyListener.json: -------------------------------------------------------------------------------- 1 | [ 2 | { 3 | "inputs": [ 4 | { 5 | "internalType": "uint256", 6 | "name": "randomNumber", 7 | "type": "uint256" 8 | }, 9 | { 10 | "internalType": "uint256", 11 | "name": "prizePeriodStartedAt", 12 | "type": "uint256" 13 | } 14 | ], 15 | "name": "afterPrizePoolAwarded", 16 | "outputs": [], 17 | "stateMutability": "nonpayable", 18 | "type": "function" 19 | }, 20 | { 21 | "inputs": [ 22 | { 23 | "internalType": "bytes4", 24 | "name": "interfaceId", 25 | "type": "bytes4" 26 | } 27 | ], 28 | "name": "supportsInterface", 29 | "outputs": [ 30 | { 31 | "internalType": "bool", 32 | "name": "", 33 | "type": "bool" 34 | } 35 | ], 36 | "stateMutability": "view", 37 | "type": "function" 38 | } 39 | ] -------------------------------------------------------------------------------- /networks/mainnet.json: -------------------------------------------------------------------------------- 1 | { 2 | "network": "mainnet", 3 | "compoundPrizePoolProxyFactory": { 4 | "address": "0xFb92015f58B239296c9F13003b75D3B7CFB1111e", 5 | "startBlock": "12841066" 6 | }, 7 | "controlledTokenProxyFactory": { 8 | "address": "0x97CBd3708CC001a8F7D1c4bC89936207F1FC70C7", 9 | "startBlock": "12841069" 10 | }, 11 | "multipleWinnersProxyFactory": { 12 | "address": "0xb789B73ebeA500e797C068C4a3D7B1b490B58475", 13 | "startBlock": "12841075" 14 | }, 15 | "ticketProxyFactory": { 16 | "address": "0x67581cC48320d7Ab4EbA57e26D05d665a0Ff31DB", 17 | "startBlock": "12841070" 18 | }, 19 | "stakePrizePoolProxyFactory": { 20 | "address": "0x166F6240a5560a34352b054468Deb85042c85142", 21 | "startBlock": "12841072" 22 | }, 23 | "yieldSourcePrizePoolProxyFactory": { 24 | "address": "0x0835c8C4Ab282B5dBF06d59E1489eF17F1c40D96", 25 | "startBlock": "12841067" 26 | } 27 | } 28 | -------------------------------------------------------------------------------- /networks/polygon.json: -------------------------------------------------------------------------------- 1 | { 2 | "network": "matic", 3 | "compoundPrizePoolProxyFactory": { 4 | "address": "0x20b0bBDe753A85860dAe49130C33452bffBec8A0", 5 | "startBlock": "16940709" 6 | }, 7 | "controlledTokenProxyFactory": { 8 | "address": "0xAa4e28Ead244B439eB670986DdF3F084522Dc4f9", 9 | "startBlock": "16940717" 10 | }, 11 | "multipleWinnersProxyFactory": { 12 | "address": "0xF3317f7D9F6479eb8D2633c30C555Aa09Bd07cc7", 13 | "startBlock": "16940730" 14 | }, 15 | "ticketProxyFactory": { 16 | "address": "0xd08a60b0A41a1282efCCEEf13CE187F848549170", 17 | "startBlock": "16940721" 18 | }, 19 | "stakePrizePoolProxyFactory": { 20 | "address": "0x97762742Aea8CC2C54c368AACB9E1bf8aAD8F17b", 21 | "startBlock": "16940726" 22 | }, 23 | "yieldSourcePrizePoolProxyFactory": { 24 | "address": "0x447838A9A11F7190C9F7E65C43bE685CD8109962", 25 | "startBlock": "16940713" 26 | } 27 | } 28 | -------------------------------------------------------------------------------- /abis/v3_1_0/abis/PeriodicPrizeStrategyListenerInterface.json: -------------------------------------------------------------------------------- 1 | [ 2 | { 3 | "inputs": [ 4 | { 5 | "internalType": "uint256", 6 | "name": "randomNumber", 7 | "type": "uint256" 8 | }, 9 | { 10 | "internalType": "uint256", 11 | "name": "prizePeriodStartedAt", 12 | "type": "uint256" 13 | } 14 | ], 15 | "name": "afterPrizePoolAwarded", 16 | "outputs": [], 17 | "stateMutability": "nonpayable", 18 | "type": "function" 19 | }, 20 | { 21 | "inputs": [ 22 | { 23 | "internalType": "bytes4", 24 | "name": "interfaceId", 25 | "type": "bytes4" 26 | } 27 | ], 28 | "name": "supportsInterface", 29 | "outputs": [ 30 | { 31 | "internalType": "bool", 32 | "name": "", 33 | "type": "bool" 34 | } 35 | ], 36 | "stateMutability": "view", 37 | "type": "function" 38 | } 39 | ] -------------------------------------------------------------------------------- /abis/v3_1_0/abis/IERC777RecipientUpgradeable.json: -------------------------------------------------------------------------------- 1 | [ 2 | { 3 | "inputs": [ 4 | { 5 | "internalType": "address", 6 | "name": "operator", 7 | "type": "address" 8 | }, 9 | { 10 | "internalType": "address", 11 | "name": "from", 12 | "type": "address" 13 | }, 14 | { 15 | "internalType": "address", 16 | "name": "to", 17 | "type": "address" 18 | }, 19 | { 20 | "internalType": "uint256", 21 | "name": "amount", 22 | "type": "uint256" 23 | }, 24 | { 25 | "internalType": "bytes", 26 | "name": "userData", 27 | "type": "bytes" 28 | }, 29 | { 30 | "internalType": "bytes", 31 | "name": "operatorData", 32 | "type": "bytes" 33 | } 34 | ], 35 | "name": "tokensReceived", 36 | "outputs": [], 37 | "stateMutability": "nonpayable", 38 | "type": "function" 39 | } 40 | ] -------------------------------------------------------------------------------- /src/helpers/loadOrCreateStakePrizePool.ts: -------------------------------------------------------------------------------- 1 | import { log, Address } from '@graphprotocol/graph-ts' 2 | 3 | import { 4 | StakePrizePool, 5 | } from '../../generated/schema' 6 | import { ONE, ZERO } from './common' 7 | 8 | import { loadOrCreatePrizePool } from './loadOrCreatePrizePool' 9 | 10 | 11 | export function loadOrCreateStakePrizePool( 12 | prizePool: Address 13 | ): StakePrizePool { 14 | let _stakePrizePool = StakePrizePool.load(prizePool.toHex()) 15 | if (!_stakePrizePool) { 16 | log.warning("debug7623 creating stakeprizepool {} ",[prizePool.toHexString()]) 17 | _stakePrizePool = new StakePrizePool(prizePool.toHex()) 18 | 19 | const _prizePool = loadOrCreatePrizePool(prizePool) 20 | _prizePool.prizePoolType = 'Stake' 21 | 22 | _prizePool.stakePrizePool = _stakePrizePool.id 23 | _prizePool.currentPrizeId = ONE 24 | _prizePool.save() 25 | _stakePrizePool.save() 26 | 27 | } 28 | 29 | return _stakePrizePool as StakePrizePool 30 | } 31 | -------------------------------------------------------------------------------- /LICENSE: -------------------------------------------------------------------------------- 1 | Copyright 2019 PoolTogether LLC 2 | 3 | Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: 4 | 5 | The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. 6 | 7 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. 8 | -------------------------------------------------------------------------------- /src/helpers/loadOrCreateAwardedControlledToken.ts: -------------------------------------------------------------------------------- 1 | import { Address } from '@graphprotocol/graph-ts' 2 | import { AwardedControlledToken } from '../../generated/schema' 3 | import { generateAwardedControlledTokenCompositeId, ZERO } from './common' 4 | 5 | 6 | export function loadOrCreateAwardedControlledToken(prizePoolAddress: string, winner: Address, currentPrizePoolId: string, winnerIndex: string): AwardedControlledToken { 7 | let awardedControlledToken = AwardedControlledToken.load(generateAwardedControlledTokenCompositeId(prizePoolAddress, winner.toHexString(),currentPrizePoolId, winnerIndex)) 8 | if(!awardedControlledToken){ // create new 9 | awardedControlledToken = new AwardedControlledToken(generateAwardedControlledTokenCompositeId(prizePoolAddress, winner.toHexString(),currentPrizePoolId, winnerIndex)) 10 | awardedControlledToken.winner = winner 11 | // temp values 12 | awardedControlledToken.amount = ZERO 13 | awardedControlledToken.token = null 14 | } 15 | 16 | return awardedControlledToken as AwardedControlledToken 17 | } 18 | 19 | -------------------------------------------------------------------------------- /src/helpers/loadOrCreateCompoundPrizePool.ts: -------------------------------------------------------------------------------- 1 | import { log, Address } from '@graphprotocol/graph-ts' 2 | 3 | import { 4 | CompoundPrizePool, 5 | } from '../../generated/schema' 6 | 7 | import { 8 | CompoundPrizePool as CompoundPrizePoolContract, 9 | } from '../../generated/templates/CompoundPrizePool/CompoundPrizePool' 10 | 11 | import { loadOrCreatePrizePool } from './loadOrCreatePrizePool' 12 | 13 | 14 | export function loadOrCreateCompoundPrizePool( 15 | prizePool: Address 16 | ): CompoundPrizePool { 17 | let _compoundPrizePool = CompoundPrizePool.load(prizePool.toHex()) 18 | if (!_compoundPrizePool) { 19 | _compoundPrizePool = new CompoundPrizePool(prizePool.toHex()) 20 | 21 | const _prizePool = loadOrCreatePrizePool(prizePool) 22 | _prizePool.prizePoolType = 'Compound' 23 | _prizePool.compoundPrizePool = _compoundPrizePool.id 24 | _prizePool.save() 25 | 26 | const _boundCompoundPrizePool = CompoundPrizePoolContract.bind(prizePool) 27 | _compoundPrizePool.cToken = _boundCompoundPrizePool.cToken() 28 | _compoundPrizePool.save() 29 | 30 | } 31 | 32 | return _compoundPrizePool as CompoundPrizePool 33 | } 34 | -------------------------------------------------------------------------------- /src/helpers/loadOrCreateYieldSourcePrizePool.ts: -------------------------------------------------------------------------------- 1 | import { log, Address } from '@graphprotocol/graph-ts' 2 | 3 | import { 4 | YieldSourcePrizePool, 5 | } from '../../generated/schema' 6 | 7 | import { 8 | YieldSourcePrizePool as YieldSourcePrizePoolContract 9 | } from '../../generated/templates/YieldSourcePrizePool/YieldSourcePrizePool' 10 | 11 | import { loadOrCreatePrizePool } from './loadOrCreatePrizePool' 12 | 13 | 14 | export function loadOrCreateYieldSourcePrizePool( 15 | prizePool: Address 16 | ): YieldSourcePrizePool { 17 | let _yieldSourcePrizePool = YieldSourcePrizePool.load(prizePool.toHex()) 18 | if (!_yieldSourcePrizePool) { 19 | _yieldSourcePrizePool = new YieldSourcePrizePool(prizePool.toHex()) 20 | 21 | const _prizePool = loadOrCreatePrizePool(prizePool) 22 | _prizePool.prizePoolType = 'YieldSource' 23 | _prizePool.yieldSourcePrizePool = _yieldSourcePrizePool.id 24 | _prizePool.save() 25 | 26 | 27 | const _boundYieldSourcePrizePool = YieldSourcePrizePoolContract.bind(prizePool) 28 | _yieldSourcePrizePool.yieldSource = _boundYieldSourcePrizePool.yieldSource() 29 | _yieldSourcePrizePool.save() 30 | 31 | } 32 | 33 | return _yieldSourcePrizePool as YieldSourcePrizePool 34 | } 35 | -------------------------------------------------------------------------------- /abis/v3_1_0/abis/ComptrollerStorage.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 | "inputs": [], 23 | "name": "owner", 24 | "outputs": [ 25 | { 26 | "internalType": "address", 27 | "name": "", 28 | "type": "address" 29 | } 30 | ], 31 | "stateMutability": "view", 32 | "type": "function" 33 | }, 34 | { 35 | "inputs": [], 36 | "name": "renounceOwnership", 37 | "outputs": [], 38 | "stateMutability": "nonpayable", 39 | "type": "function" 40 | }, 41 | { 42 | "inputs": [ 43 | { 44 | "internalType": "address", 45 | "name": "newOwner", 46 | "type": "address" 47 | } 48 | ], 49 | "name": "transferOwnership", 50 | "outputs": [], 51 | "stateMutability": "nonpayable", 52 | "type": "function" 53 | } 54 | ] -------------------------------------------------------------------------------- /abis/v3_1_0/abis/OwnableUpgradeable.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 | "inputs": [], 23 | "name": "owner", 24 | "outputs": [ 25 | { 26 | "internalType": "address", 27 | "name": "", 28 | "type": "address" 29 | } 30 | ], 31 | "stateMutability": "view", 32 | "type": "function" 33 | }, 34 | { 35 | "inputs": [], 36 | "name": "renounceOwnership", 37 | "outputs": [], 38 | "stateMutability": "nonpayable", 39 | "type": "function" 40 | }, 41 | { 42 | "inputs": [ 43 | { 44 | "internalType": "address", 45 | "name": "newOwner", 46 | "type": "address" 47 | } 48 | ], 49 | "name": "transferOwnership", 50 | "outputs": [], 51 | "stateMutability": "nonpayable", 52 | "type": "function" 53 | } 54 | ] -------------------------------------------------------------------------------- /src/mappingForMultipleWinnersProxyFactory.ts: -------------------------------------------------------------------------------- 1 | import { BigInt, log } from '@graphprotocol/graph-ts' 2 | 3 | import { ProxyCreated } from "../generated/MultipleWinnersProxyFactory/MultipleWinnersProxyFactory" 4 | 5 | import { loadOrCreatePrizeStrategy } from './helpers/loadOrCreatePrizeStrategy' 6 | 7 | import { 8 | MultipleWinnersPrizeStrategy 9 | } from '../generated/schema' 10 | 11 | import { MultipleWinners } from "../generated/templates" 12 | 13 | export function handleMultipleWinnersCreated(event: ProxyCreated) : void{ 14 | const address = event.params.proxy.toHexString() 15 | 16 | 17 | log.info("debug771 creating a MWPrizeStrategy for {}", [address]) 18 | 19 | const multipleWinners = new MultipleWinnersPrizeStrategy(address) 20 | 21 | // set fields to blank/generic for now - Initialized event called straight after 22 | multipleWinners.prizePeriodSeconds = new BigInt(0) 23 | multipleWinners.prizePeriodStartedAt = new BigInt(0) 24 | multipleWinners.prizePeriodEndAt = new BigInt(0) 25 | 26 | multipleWinners.save() 27 | 28 | let prizeStrategy = loadOrCreatePrizeStrategy(event.params.proxy) 29 | prizeStrategy.multipleWinners = multipleWinners.id 30 | prizeStrategy.save() 31 | 32 | 33 | // creating multiple templates 34 | MultipleWinners.create(event.params.proxy) 35 | 36 | 37 | 38 | 39 | } 40 | -------------------------------------------------------------------------------- /abis/v3_1_0/abis/OpenZeppelinProxyFactoryInterface.json: -------------------------------------------------------------------------------- 1 | [ 2 | { 3 | "inputs": [ 4 | { 5 | "internalType": "uint256", 6 | "name": "_salt", 7 | "type": "uint256" 8 | }, 9 | { 10 | "internalType": "address", 11 | "name": "_logic", 12 | "type": "address" 13 | }, 14 | { 15 | "internalType": "address", 16 | "name": "_admin", 17 | "type": "address" 18 | }, 19 | { 20 | "internalType": "bytes", 21 | "name": "_data", 22 | "type": "bytes" 23 | } 24 | ], 25 | "name": "deploy", 26 | "outputs": [ 27 | { 28 | "internalType": "address", 29 | "name": "", 30 | "type": "address" 31 | } 32 | ], 33 | "stateMutability": "nonpayable", 34 | "type": "function" 35 | }, 36 | { 37 | "inputs": [ 38 | { 39 | "internalType": "uint256", 40 | "name": "_salt", 41 | "type": "uint256" 42 | }, 43 | { 44 | "internalType": "address", 45 | "name": "_sender", 46 | "type": "address" 47 | } 48 | ], 49 | "name": "getDeploymentAddress", 50 | "outputs": [ 51 | { 52 | "internalType": "address", 53 | "name": "", 54 | "type": "address" 55 | } 56 | ], 57 | "stateMutability": "view", 58 | "type": "function" 59 | } 60 | ] -------------------------------------------------------------------------------- /abis/v3_1_0/abis/TicketProxyFactory.json: -------------------------------------------------------------------------------- 1 | [ 2 | { 3 | "inputs": [], 4 | "stateMutability": "nonpayable", 5 | "type": "constructor" 6 | }, 7 | { 8 | "anonymous": false, 9 | "inputs": [ 10 | { 11 | "indexed": false, 12 | "internalType": "address", 13 | "name": "proxy", 14 | "type": "address" 15 | } 16 | ], 17 | "name": "ProxyCreated", 18 | "type": "event" 19 | }, 20 | { 21 | "inputs": [], 22 | "name": "create", 23 | "outputs": [ 24 | { 25 | "internalType": "contract Ticket", 26 | "name": "", 27 | "type": "address" 28 | } 29 | ], 30 | "stateMutability": "nonpayable", 31 | "type": "function" 32 | }, 33 | { 34 | "inputs": [ 35 | { 36 | "internalType": "address", 37 | "name": "_logic", 38 | "type": "address" 39 | }, 40 | { 41 | "internalType": "bytes", 42 | "name": "_data", 43 | "type": "bytes" 44 | } 45 | ], 46 | "name": "deployMinimal", 47 | "outputs": [ 48 | { 49 | "internalType": "address", 50 | "name": "proxy", 51 | "type": "address" 52 | } 53 | ], 54 | "stateMutability": "nonpayable", 55 | "type": "function" 56 | }, 57 | { 58 | "inputs": [], 59 | "name": "instance", 60 | "outputs": [ 61 | { 62 | "internalType": "contract Ticket", 63 | "name": "", 64 | "type": "address" 65 | } 66 | ], 67 | "stateMutability": "view", 68 | "type": "function" 69 | } 70 | ] -------------------------------------------------------------------------------- /abis/v3_1_0/abis/ControlledTokenProxyFactory.json: -------------------------------------------------------------------------------- 1 | [ 2 | { 3 | "inputs": [], 4 | "stateMutability": "nonpayable", 5 | "type": "constructor" 6 | }, 7 | { 8 | "anonymous": false, 9 | "inputs": [ 10 | { 11 | "indexed": false, 12 | "internalType": "address", 13 | "name": "proxy", 14 | "type": "address" 15 | } 16 | ], 17 | "name": "ProxyCreated", 18 | "type": "event" 19 | }, 20 | { 21 | "inputs": [], 22 | "name": "create", 23 | "outputs": [ 24 | { 25 | "internalType": "contract ControlledToken", 26 | "name": "", 27 | "type": "address" 28 | } 29 | ], 30 | "stateMutability": "nonpayable", 31 | "type": "function" 32 | }, 33 | { 34 | "inputs": [ 35 | { 36 | "internalType": "address", 37 | "name": "_logic", 38 | "type": "address" 39 | }, 40 | { 41 | "internalType": "bytes", 42 | "name": "_data", 43 | "type": "bytes" 44 | } 45 | ], 46 | "name": "deployMinimal", 47 | "outputs": [ 48 | { 49 | "internalType": "address", 50 | "name": "proxy", 51 | "type": "address" 52 | } 53 | ], 54 | "stateMutability": "nonpayable", 55 | "type": "function" 56 | }, 57 | { 58 | "inputs": [], 59 | "name": "instance", 60 | "outputs": [ 61 | { 62 | "internalType": "contract ControlledToken", 63 | "name": "", 64 | "type": "address" 65 | } 66 | ], 67 | "stateMutability": "view", 68 | "type": "function" 69 | } 70 | ] -------------------------------------------------------------------------------- /abis/v3_1_0/abis/MultipleWinnersProxyFactory.json: -------------------------------------------------------------------------------- 1 | [ 2 | { 3 | "inputs": [], 4 | "stateMutability": "nonpayable", 5 | "type": "constructor" 6 | }, 7 | { 8 | "anonymous": false, 9 | "inputs": [ 10 | { 11 | "indexed": false, 12 | "internalType": "address", 13 | "name": "proxy", 14 | "type": "address" 15 | } 16 | ], 17 | "name": "ProxyCreated", 18 | "type": "event" 19 | }, 20 | { 21 | "inputs": [], 22 | "name": "create", 23 | "outputs": [ 24 | { 25 | "internalType": "contract MultipleWinners", 26 | "name": "", 27 | "type": "address" 28 | } 29 | ], 30 | "stateMutability": "nonpayable", 31 | "type": "function" 32 | }, 33 | { 34 | "inputs": [ 35 | { 36 | "internalType": "address", 37 | "name": "_logic", 38 | "type": "address" 39 | }, 40 | { 41 | "internalType": "bytes", 42 | "name": "_data", 43 | "type": "bytes" 44 | } 45 | ], 46 | "name": "deployMinimal", 47 | "outputs": [ 48 | { 49 | "internalType": "address", 50 | "name": "proxy", 51 | "type": "address" 52 | } 53 | ], 54 | "stateMutability": "nonpayable", 55 | "type": "function" 56 | }, 57 | { 58 | "inputs": [], 59 | "name": "instance", 60 | "outputs": [ 61 | { 62 | "internalType": "contract MultipleWinners", 63 | "name": "", 64 | "type": "address" 65 | } 66 | ], 67 | "stateMutability": "view", 68 | "type": "function" 69 | } 70 | ] -------------------------------------------------------------------------------- /abis/v3_1_0/abis/StakePrizePoolProxyFactory.json: -------------------------------------------------------------------------------- 1 | [ 2 | { 3 | "inputs": [], 4 | "stateMutability": "nonpayable", 5 | "type": "constructor" 6 | }, 7 | { 8 | "anonymous": false, 9 | "inputs": [ 10 | { 11 | "indexed": false, 12 | "internalType": "address", 13 | "name": "proxy", 14 | "type": "address" 15 | } 16 | ], 17 | "name": "ProxyCreated", 18 | "type": "event" 19 | }, 20 | { 21 | "inputs": [], 22 | "name": "create", 23 | "outputs": [ 24 | { 25 | "internalType": "contract StakePrizePool", 26 | "name": "", 27 | "type": "address" 28 | } 29 | ], 30 | "stateMutability": "nonpayable", 31 | "type": "function" 32 | }, 33 | { 34 | "inputs": [ 35 | { 36 | "internalType": "address", 37 | "name": "_logic", 38 | "type": "address" 39 | }, 40 | { 41 | "internalType": "bytes", 42 | "name": "_data", 43 | "type": "bytes" 44 | } 45 | ], 46 | "name": "deployMinimal", 47 | "outputs": [ 48 | { 49 | "internalType": "address", 50 | "name": "proxy", 51 | "type": "address" 52 | } 53 | ], 54 | "stateMutability": "nonpayable", 55 | "type": "function" 56 | }, 57 | { 58 | "inputs": [], 59 | "name": "instance", 60 | "outputs": [ 61 | { 62 | "internalType": "contract StakePrizePool", 63 | "name": "", 64 | "type": "address" 65 | } 66 | ], 67 | "stateMutability": "view", 68 | "type": "function" 69 | } 70 | ] -------------------------------------------------------------------------------- /abis/v3_1_0/abis/yVaultPrizePoolProxyFactory.json: -------------------------------------------------------------------------------- 1 | [ 2 | { 3 | "inputs": [], 4 | "stateMutability": "nonpayable", 5 | "type": "constructor" 6 | }, 7 | { 8 | "anonymous": false, 9 | "inputs": [ 10 | { 11 | "indexed": false, 12 | "internalType": "address", 13 | "name": "proxy", 14 | "type": "address" 15 | } 16 | ], 17 | "name": "ProxyCreated", 18 | "type": "event" 19 | }, 20 | { 21 | "inputs": [], 22 | "name": "create", 23 | "outputs": [ 24 | { 25 | "internalType": "contract yVaultPrizePool", 26 | "name": "", 27 | "type": "address" 28 | } 29 | ], 30 | "stateMutability": "nonpayable", 31 | "type": "function" 32 | }, 33 | { 34 | "inputs": [ 35 | { 36 | "internalType": "address", 37 | "name": "_logic", 38 | "type": "address" 39 | }, 40 | { 41 | "internalType": "bytes", 42 | "name": "_data", 43 | "type": "bytes" 44 | } 45 | ], 46 | "name": "deployMinimal", 47 | "outputs": [ 48 | { 49 | "internalType": "address", 50 | "name": "proxy", 51 | "type": "address" 52 | } 53 | ], 54 | "stateMutability": "nonpayable", 55 | "type": "function" 56 | }, 57 | { 58 | "inputs": [], 59 | "name": "instance", 60 | "outputs": [ 61 | { 62 | "internalType": "contract yVaultPrizePool", 63 | "name": "", 64 | "type": "address" 65 | } 66 | ], 67 | "stateMutability": "view", 68 | "type": "function" 69 | } 70 | ] -------------------------------------------------------------------------------- /abis/v3_1_0/abis/CompoundPrizePoolProxyFactory.json: -------------------------------------------------------------------------------- 1 | [ 2 | { 3 | "inputs": [], 4 | "stateMutability": "nonpayable", 5 | "type": "constructor" 6 | }, 7 | { 8 | "anonymous": false, 9 | "inputs": [ 10 | { 11 | "indexed": false, 12 | "internalType": "address", 13 | "name": "proxy", 14 | "type": "address" 15 | } 16 | ], 17 | "name": "ProxyCreated", 18 | "type": "event" 19 | }, 20 | { 21 | "inputs": [], 22 | "name": "create", 23 | "outputs": [ 24 | { 25 | "internalType": "contract CompoundPrizePool", 26 | "name": "", 27 | "type": "address" 28 | } 29 | ], 30 | "stateMutability": "nonpayable", 31 | "type": "function" 32 | }, 33 | { 34 | "inputs": [ 35 | { 36 | "internalType": "address", 37 | "name": "_logic", 38 | "type": "address" 39 | }, 40 | { 41 | "internalType": "bytes", 42 | "name": "_data", 43 | "type": "bytes" 44 | } 45 | ], 46 | "name": "deployMinimal", 47 | "outputs": [ 48 | { 49 | "internalType": "address", 50 | "name": "proxy", 51 | "type": "address" 52 | } 53 | ], 54 | "stateMutability": "nonpayable", 55 | "type": "function" 56 | }, 57 | { 58 | "inputs": [], 59 | "name": "instance", 60 | "outputs": [ 61 | { 62 | "internalType": "contract CompoundPrizePool", 63 | "name": "", 64 | "type": "address" 65 | } 66 | ], 67 | "stateMutability": "view", 68 | "type": "function" 69 | } 70 | ] -------------------------------------------------------------------------------- /abis/v3_1_0/abis/SingleRandomWinnerProxyFactory.json: -------------------------------------------------------------------------------- 1 | [ 2 | { 3 | "inputs": [], 4 | "stateMutability": "nonpayable", 5 | "type": "constructor" 6 | }, 7 | { 8 | "anonymous": false, 9 | "inputs": [ 10 | { 11 | "indexed": false, 12 | "internalType": "address", 13 | "name": "proxy", 14 | "type": "address" 15 | } 16 | ], 17 | "name": "ProxyCreated", 18 | "type": "event" 19 | }, 20 | { 21 | "inputs": [], 22 | "name": "create", 23 | "outputs": [ 24 | { 25 | "internalType": "contract SingleRandomWinner", 26 | "name": "", 27 | "type": "address" 28 | } 29 | ], 30 | "stateMutability": "nonpayable", 31 | "type": "function" 32 | }, 33 | { 34 | "inputs": [ 35 | { 36 | "internalType": "address", 37 | "name": "_logic", 38 | "type": "address" 39 | }, 40 | { 41 | "internalType": "bytes", 42 | "name": "_data", 43 | "type": "bytes" 44 | } 45 | ], 46 | "name": "deployMinimal", 47 | "outputs": [ 48 | { 49 | "internalType": "address", 50 | "name": "proxy", 51 | "type": "address" 52 | } 53 | ], 54 | "stateMutability": "nonpayable", 55 | "type": "function" 56 | }, 57 | { 58 | "inputs": [], 59 | "name": "instance", 60 | "outputs": [ 61 | { 62 | "internalType": "contract SingleRandomWinner", 63 | "name": "", 64 | "type": "address" 65 | } 66 | ], 67 | "stateMutability": "view", 68 | "type": "function" 69 | } 70 | ] -------------------------------------------------------------------------------- /abis/v3_2_0/abis/CompoundPrizePoolProxyFactory.json: -------------------------------------------------------------------------------- 1 | [ 2 | { 3 | "inputs": [], 4 | "stateMutability": "nonpayable", 5 | "type": "constructor" 6 | }, 7 | { 8 | "anonymous": false, 9 | "inputs": [ 10 | { 11 | "indexed": false, 12 | "internalType": "address", 13 | "name": "proxy", 14 | "type": "address" 15 | } 16 | ], 17 | "name": "ProxyCreated", 18 | "type": "event" 19 | }, 20 | { 21 | "inputs": [], 22 | "name": "create", 23 | "outputs": [ 24 | { 25 | "internalType": "contract CompoundPrizePool", 26 | "name": "", 27 | "type": "address" 28 | } 29 | ], 30 | "stateMutability": "nonpayable", 31 | "type": "function" 32 | }, 33 | { 34 | "inputs": [ 35 | { 36 | "internalType": "address", 37 | "name": "_logic", 38 | "type": "address" 39 | }, 40 | { 41 | "internalType": "bytes", 42 | "name": "_data", 43 | "type": "bytes" 44 | } 45 | ], 46 | "name": "deployMinimal", 47 | "outputs": [ 48 | { 49 | "internalType": "address", 50 | "name": "proxy", 51 | "type": "address" 52 | } 53 | ], 54 | "stateMutability": "nonpayable", 55 | "type": "function" 56 | }, 57 | { 58 | "inputs": [], 59 | "name": "instance", 60 | "outputs": [ 61 | { 62 | "internalType": "contract CompoundPrizePool", 63 | "name": "", 64 | "type": "address" 65 | } 66 | ], 67 | "stateMutability": "view", 68 | "type": "function" 69 | } 70 | ] 71 | -------------------------------------------------------------------------------- /abis/v3_1_0/abis/MultipleWinnersHarnessProxyFactory.json: -------------------------------------------------------------------------------- 1 | [ 2 | { 3 | "inputs": [], 4 | "stateMutability": "nonpayable", 5 | "type": "constructor" 6 | }, 7 | { 8 | "anonymous": false, 9 | "inputs": [ 10 | { 11 | "indexed": false, 12 | "internalType": "address", 13 | "name": "proxy", 14 | "type": "address" 15 | } 16 | ], 17 | "name": "ProxyCreated", 18 | "type": "event" 19 | }, 20 | { 21 | "inputs": [], 22 | "name": "create", 23 | "outputs": [ 24 | { 25 | "internalType": "contract MultipleWinnersHarness", 26 | "name": "", 27 | "type": "address" 28 | } 29 | ], 30 | "stateMutability": "nonpayable", 31 | "type": "function" 32 | }, 33 | { 34 | "inputs": [ 35 | { 36 | "internalType": "address", 37 | "name": "_logic", 38 | "type": "address" 39 | }, 40 | { 41 | "internalType": "bytes", 42 | "name": "_data", 43 | "type": "bytes" 44 | } 45 | ], 46 | "name": "deployMinimal", 47 | "outputs": [ 48 | { 49 | "internalType": "address", 50 | "name": "proxy", 51 | "type": "address" 52 | } 53 | ], 54 | "stateMutability": "nonpayable", 55 | "type": "function" 56 | }, 57 | { 58 | "inputs": [], 59 | "name": "instance", 60 | "outputs": [ 61 | { 62 | "internalType": "contract MultipleWinnersHarness", 63 | "name": "", 64 | "type": "address" 65 | } 66 | ], 67 | "stateMutability": "view", 68 | "type": "function" 69 | } 70 | ] -------------------------------------------------------------------------------- /abis/v3_1_0/abis/yVaultPrizePoolHarnessProxyFactory.json: -------------------------------------------------------------------------------- 1 | [ 2 | { 3 | "inputs": [], 4 | "stateMutability": "nonpayable", 5 | "type": "constructor" 6 | }, 7 | { 8 | "anonymous": false, 9 | "inputs": [ 10 | { 11 | "indexed": false, 12 | "internalType": "address", 13 | "name": "proxy", 14 | "type": "address" 15 | } 16 | ], 17 | "name": "ProxyCreated", 18 | "type": "event" 19 | }, 20 | { 21 | "inputs": [], 22 | "name": "create", 23 | "outputs": [ 24 | { 25 | "internalType": "contract yVaultPrizePoolHarness", 26 | "name": "", 27 | "type": "address" 28 | } 29 | ], 30 | "stateMutability": "nonpayable", 31 | "type": "function" 32 | }, 33 | { 34 | "inputs": [ 35 | { 36 | "internalType": "address", 37 | "name": "_logic", 38 | "type": "address" 39 | }, 40 | { 41 | "internalType": "bytes", 42 | "name": "_data", 43 | "type": "bytes" 44 | } 45 | ], 46 | "name": "deployMinimal", 47 | "outputs": [ 48 | { 49 | "internalType": "address", 50 | "name": "proxy", 51 | "type": "address" 52 | } 53 | ], 54 | "stateMutability": "nonpayable", 55 | "type": "function" 56 | }, 57 | { 58 | "inputs": [], 59 | "name": "instance", 60 | "outputs": [ 61 | { 62 | "internalType": "contract yVaultPrizePoolHarness", 63 | "name": "", 64 | "type": "address" 65 | } 66 | ], 67 | "stateMutability": "view", 68 | "type": "function" 69 | } 70 | ] -------------------------------------------------------------------------------- /abis/v3_1_0/abis/CompoundPrizePoolHarnessProxyFactory.json: -------------------------------------------------------------------------------- 1 | [ 2 | { 3 | "inputs": [], 4 | "stateMutability": "nonpayable", 5 | "type": "constructor" 6 | }, 7 | { 8 | "anonymous": false, 9 | "inputs": [ 10 | { 11 | "indexed": false, 12 | "internalType": "address", 13 | "name": "proxy", 14 | "type": "address" 15 | } 16 | ], 17 | "name": "ProxyCreated", 18 | "type": "event" 19 | }, 20 | { 21 | "inputs": [], 22 | "name": "create", 23 | "outputs": [ 24 | { 25 | "internalType": "contract CompoundPrizePoolHarness", 26 | "name": "", 27 | "type": "address" 28 | } 29 | ], 30 | "stateMutability": "nonpayable", 31 | "type": "function" 32 | }, 33 | { 34 | "inputs": [ 35 | { 36 | "internalType": "address", 37 | "name": "_logic", 38 | "type": "address" 39 | }, 40 | { 41 | "internalType": "bytes", 42 | "name": "_data", 43 | "type": "bytes" 44 | } 45 | ], 46 | "name": "deployMinimal", 47 | "outputs": [ 48 | { 49 | "internalType": "address", 50 | "name": "proxy", 51 | "type": "address" 52 | } 53 | ], 54 | "stateMutability": "nonpayable", 55 | "type": "function" 56 | }, 57 | { 58 | "inputs": [], 59 | "name": "instance", 60 | "outputs": [ 61 | { 62 | "internalType": "contract CompoundPrizePoolHarness", 63 | "name": "", 64 | "type": "address" 65 | } 66 | ], 67 | "stateMutability": "view", 68 | "type": "function" 69 | } 70 | ] -------------------------------------------------------------------------------- /abis/v3_1_0/abis/ERC1820ImplementerMock.json: -------------------------------------------------------------------------------- 1 | [ 2 | { 3 | "inputs": [], 4 | "stateMutability": "nonpayable", 5 | "type": "constructor" 6 | }, 7 | { 8 | "inputs": [ 9 | { 10 | "internalType": "bytes32", 11 | "name": "", 12 | "type": "bytes32" 13 | }, 14 | { 15 | "internalType": "address", 16 | "name": "", 17 | "type": "address" 18 | } 19 | ], 20 | "name": "canImplementInterfaceForAddress", 21 | "outputs": [ 22 | { 23 | "internalType": "bytes32", 24 | "name": "", 25 | "type": "bytes32" 26 | } 27 | ], 28 | "stateMutability": "view", 29 | "type": "function" 30 | }, 31 | { 32 | "inputs": [ 33 | { 34 | "internalType": "address", 35 | "name": "operator", 36 | "type": "address" 37 | }, 38 | { 39 | "internalType": "address", 40 | "name": "from", 41 | "type": "address" 42 | }, 43 | { 44 | "internalType": "address", 45 | "name": "to", 46 | "type": "address" 47 | }, 48 | { 49 | "internalType": "uint256", 50 | "name": "amount", 51 | "type": "uint256" 52 | }, 53 | { 54 | "internalType": "bytes", 55 | "name": "userData", 56 | "type": "bytes" 57 | }, 58 | { 59 | "internalType": "bytes", 60 | "name": "operatorData", 61 | "type": "bytes" 62 | } 63 | ], 64 | "name": "tokensReceived", 65 | "outputs": [], 66 | "stateMutability": "nonpayable", 67 | "type": "function" 68 | } 69 | ] -------------------------------------------------------------------------------- /abis/v3_1_0/abis/YieldSourceStub.json: -------------------------------------------------------------------------------- 1 | [ 2 | { 3 | "inputs": [], 4 | "name": "balance", 5 | "outputs": [ 6 | { 7 | "internalType": "uint256", 8 | "name": "", 9 | "type": "uint256" 10 | } 11 | ], 12 | "stateMutability": "nonpayable", 13 | "type": "function" 14 | }, 15 | { 16 | "inputs": [ 17 | { 18 | "internalType": "address", 19 | "name": "_externalToken", 20 | "type": "address" 21 | } 22 | ], 23 | "name": "canAwardExternal", 24 | "outputs": [ 25 | { 26 | "internalType": "bool", 27 | "name": "", 28 | "type": "bool" 29 | } 30 | ], 31 | "stateMutability": "view", 32 | "type": "function" 33 | }, 34 | { 35 | "inputs": [ 36 | { 37 | "internalType": "uint256", 38 | "name": "redeemAmount", 39 | "type": "uint256" 40 | } 41 | ], 42 | "name": "redeem", 43 | "outputs": [ 44 | { 45 | "internalType": "uint256", 46 | "name": "", 47 | "type": "uint256" 48 | } 49 | ], 50 | "stateMutability": "nonpayable", 51 | "type": "function" 52 | }, 53 | { 54 | "inputs": [ 55 | { 56 | "internalType": "uint256", 57 | "name": "mintAmount", 58 | "type": "uint256" 59 | } 60 | ], 61 | "name": "supply", 62 | "outputs": [], 63 | "stateMutability": "nonpayable", 64 | "type": "function" 65 | }, 66 | { 67 | "inputs": [], 68 | "name": "token", 69 | "outputs": [ 70 | { 71 | "internalType": "contract IERC20Upgradeable", 72 | "name": "", 73 | "type": "address" 74 | } 75 | ], 76 | "stateMutability": "view", 77 | "type": "function" 78 | } 79 | ] -------------------------------------------------------------------------------- /abis/v3_1_0/abis/TokenListener.json: -------------------------------------------------------------------------------- 1 | [ 2 | { 3 | "inputs": [ 4 | { 5 | "internalType": "address", 6 | "name": "to", 7 | "type": "address" 8 | }, 9 | { 10 | "internalType": "uint256", 11 | "name": "amount", 12 | "type": "uint256" 13 | }, 14 | { 15 | "internalType": "address", 16 | "name": "controlledToken", 17 | "type": "address" 18 | }, 19 | { 20 | "internalType": "address", 21 | "name": "referrer", 22 | "type": "address" 23 | } 24 | ], 25 | "name": "beforeTokenMint", 26 | "outputs": [], 27 | "stateMutability": "nonpayable", 28 | "type": "function" 29 | }, 30 | { 31 | "inputs": [ 32 | { 33 | "internalType": "address", 34 | "name": "from", 35 | "type": "address" 36 | }, 37 | { 38 | "internalType": "address", 39 | "name": "to", 40 | "type": "address" 41 | }, 42 | { 43 | "internalType": "uint256", 44 | "name": "amount", 45 | "type": "uint256" 46 | }, 47 | { 48 | "internalType": "address", 49 | "name": "controlledToken", 50 | "type": "address" 51 | } 52 | ], 53 | "name": "beforeTokenTransfer", 54 | "outputs": [], 55 | "stateMutability": "nonpayable", 56 | "type": "function" 57 | }, 58 | { 59 | "inputs": [ 60 | { 61 | "internalType": "bytes4", 62 | "name": "interfaceId", 63 | "type": "bytes4" 64 | } 65 | ], 66 | "name": "supportsInterface", 67 | "outputs": [ 68 | { 69 | "internalType": "bool", 70 | "name": "", 71 | "type": "bool" 72 | } 73 | ], 74 | "stateMutability": "view", 75 | "type": "function" 76 | } 77 | ] -------------------------------------------------------------------------------- /abis/v3_1_0/abis/TokenListenerInterface.json: -------------------------------------------------------------------------------- 1 | [ 2 | { 3 | "inputs": [ 4 | { 5 | "internalType": "address", 6 | "name": "to", 7 | "type": "address" 8 | }, 9 | { 10 | "internalType": "uint256", 11 | "name": "amount", 12 | "type": "uint256" 13 | }, 14 | { 15 | "internalType": "address", 16 | "name": "controlledToken", 17 | "type": "address" 18 | }, 19 | { 20 | "internalType": "address", 21 | "name": "referrer", 22 | "type": "address" 23 | } 24 | ], 25 | "name": "beforeTokenMint", 26 | "outputs": [], 27 | "stateMutability": "nonpayable", 28 | "type": "function" 29 | }, 30 | { 31 | "inputs": [ 32 | { 33 | "internalType": "address", 34 | "name": "from", 35 | "type": "address" 36 | }, 37 | { 38 | "internalType": "address", 39 | "name": "to", 40 | "type": "address" 41 | }, 42 | { 43 | "internalType": "uint256", 44 | "name": "amount", 45 | "type": "uint256" 46 | }, 47 | { 48 | "internalType": "address", 49 | "name": "controlledToken", 50 | "type": "address" 51 | } 52 | ], 53 | "name": "beforeTokenTransfer", 54 | "outputs": [], 55 | "stateMutability": "nonpayable", 56 | "type": "function" 57 | }, 58 | { 59 | "inputs": [ 60 | { 61 | "internalType": "bytes4", 62 | "name": "interfaceId", 63 | "type": "bytes4" 64 | } 65 | ], 66 | "name": "supportsInterface", 67 | "outputs": [ 68 | { 69 | "internalType": "bool", 70 | "name": "", 71 | "type": "bool" 72 | } 73 | ], 74 | "stateMutability": "view", 75 | "type": "function" 76 | } 77 | ] -------------------------------------------------------------------------------- /abis/v3_1_0/abis/Constants.json: -------------------------------------------------------------------------------- 1 | [ 2 | { 3 | "inputs": [], 4 | "name": "ACCEPT_MAGIC", 5 | "outputs": [ 6 | { 7 | "internalType": "bytes32", 8 | "name": "", 9 | "type": "bytes32" 10 | } 11 | ], 12 | "stateMutability": "view", 13 | "type": "function" 14 | }, 15 | { 16 | "inputs": [], 17 | "name": "ERC165_INTERFACE_ID_ERC165", 18 | "outputs": [ 19 | { 20 | "internalType": "bytes4", 21 | "name": "", 22 | "type": "bytes4" 23 | } 24 | ], 25 | "stateMutability": "view", 26 | "type": "function" 27 | }, 28 | { 29 | "inputs": [], 30 | "name": "ERC165_INTERFACE_ID_ERC721", 31 | "outputs": [ 32 | { 33 | "internalType": "bytes4", 34 | "name": "", 35 | "type": "bytes4" 36 | } 37 | ], 38 | "stateMutability": "view", 39 | "type": "function" 40 | }, 41 | { 42 | "inputs": [], 43 | "name": "REGISTRY", 44 | "outputs": [ 45 | { 46 | "internalType": "contract IERC1820RegistryUpgradeable", 47 | "name": "", 48 | "type": "IERC1820RegistryUpgradeable" 49 | } 50 | ], 51 | "stateMutability": "view", 52 | "type": "function" 53 | }, 54 | { 55 | "inputs": [], 56 | "name": "TOKENS_RECIPIENT_INTERFACE_HASH", 57 | "outputs": [ 58 | { 59 | "internalType": "bytes32", 60 | "name": "", 61 | "type": "bytes32" 62 | } 63 | ], 64 | "stateMutability": "view", 65 | "type": "function" 66 | }, 67 | { 68 | "inputs": [], 69 | "name": "TOKENS_SENDER_INTERFACE_HASH", 70 | "outputs": [ 71 | { 72 | "internalType": "bytes32", 73 | "name": "", 74 | "type": "bytes32" 75 | } 76 | ], 77 | "stateMutability": "view", 78 | "type": "function" 79 | } 80 | ] -------------------------------------------------------------------------------- /abis/v3_1_0/abis/DoppelgangerWithExec.json: -------------------------------------------------------------------------------- 1 | [ 2 | { 3 | "stateMutability": "payable", 4 | "type": "fallback" 5 | }, 6 | { 7 | "inputs": [ 8 | { 9 | "internalType": "address", 10 | "name": "target", 11 | "type": "address" 12 | }, 13 | { 14 | "internalType": "bytes", 15 | "name": "data", 16 | "type": "bytes" 17 | } 18 | ], 19 | "name": "__waffle__call", 20 | "outputs": [ 21 | { 22 | "internalType": "bytes", 23 | "name": "", 24 | "type": "bytes" 25 | } 26 | ], 27 | "stateMutability": "nonpayable", 28 | "type": "function" 29 | }, 30 | { 31 | "inputs": [ 32 | { 33 | "internalType": "bytes", 34 | "name": "data", 35 | "type": "bytes" 36 | }, 37 | { 38 | "internalType": "bytes", 39 | "name": "value", 40 | "type": "bytes" 41 | } 42 | ], 43 | "name": "__waffle__mockReturns", 44 | "outputs": [], 45 | "stateMutability": "nonpayable", 46 | "type": "function" 47 | }, 48 | { 49 | "inputs": [ 50 | { 51 | "internalType": "bytes", 52 | "name": "data", 53 | "type": "bytes" 54 | } 55 | ], 56 | "name": "__waffle__mockReverts", 57 | "outputs": [], 58 | "stateMutability": "nonpayable", 59 | "type": "function" 60 | }, 61 | { 62 | "inputs": [ 63 | { 64 | "internalType": "address", 65 | "name": "target", 66 | "type": "address" 67 | }, 68 | { 69 | "internalType": "bytes", 70 | "name": "data", 71 | "type": "bytes" 72 | } 73 | ], 74 | "name": "__waffle__staticcall", 75 | "outputs": [ 76 | { 77 | "internalType": "bytes", 78 | "name": "", 79 | "type": "bytes" 80 | } 81 | ], 82 | "stateMutability": "view", 83 | "type": "function" 84 | } 85 | ] -------------------------------------------------------------------------------- /src/helpers/idTemplates.ts: -------------------------------------------------------------------------------- 1 | export function prizeId(prizePool: string, currentPrizeId: string): string { 2 | return prizePool + '-' + currentPrizeId 3 | } 4 | 5 | export function creditRateId(prizePoolAddress: string, tokenAddress: string): string { 6 | return prizePoolAddress + '-' + tokenAddress 7 | } 8 | 9 | export function externalAwardId(prizeStrategyAddress: string, tokenAddress: string): string { 10 | return prizeStrategyAddress + '-' + tokenAddress 11 | } 12 | 13 | export function awardedExternalErc20TokenId(prizeId: string, tokenAddress: string, winnerAddress: string, winnerIndex: string): string { 14 | return prizeId + '-' + tokenAddress + '-' + winnerAddress + '-' + winnerIndex 15 | } 16 | 17 | export function awardedExternalErc721NftId(prizeId: string, tokenAddress: string): string { 18 | return prizeId + '-' + tokenAddress 19 | } 20 | 21 | export function dripTokenId( 22 | comptrollerAddress: string, 23 | sourceAddress: string, 24 | measureTokenAddress: string, 25 | dripTokenAddress: string, 26 | isReferral: string = '0' 27 | ): string { 28 | return comptrollerAddress + '-' + sourceAddress + '-' + measureTokenAddress + '-' + dripTokenAddress + '-' + isReferral 29 | } 30 | 31 | export function dripTokenPlayerId( 32 | comptrollerAddress: string, 33 | dripTokenAddress: string, 34 | playerAddress: string 35 | ): string { 36 | return comptrollerAddress + '-' + dripTokenAddress + '-' + playerAddress 37 | } 38 | 39 | export function balanceDripPlayerId( 40 | balanceDripId: string, 41 | playerAddress: string, 42 | ): string { 43 | return balanceDripId + '-' + playerAddress 44 | } 45 | 46 | export function volumeDripPlayerId( 47 | volumeDripId: string, 48 | playerAddress: string, 49 | ): string { 50 | return volumeDripId + '-' + playerAddress 51 | } 52 | 53 | export function volumeDripPeriodId( 54 | volumeDripId: string, 55 | periodIndex: string, 56 | ): string { 57 | return volumeDripId + '-' + periodIndex 58 | } 59 | -------------------------------------------------------------------------------- /abis/v3_1_0/abis/MappedSinglyLinkedListExposed.json: -------------------------------------------------------------------------------- 1 | [ 2 | { 3 | "inputs": [ 4 | { 5 | "internalType": "address", 6 | "name": "newAddress", 7 | "type": "address" 8 | } 9 | ], 10 | "name": "addAddress", 11 | "outputs": [], 12 | "stateMutability": "nonpayable", 13 | "type": "function" 14 | }, 15 | { 16 | "inputs": [ 17 | { 18 | "internalType": "address[]", 19 | "name": "addresses", 20 | "type": "address[]" 21 | } 22 | ], 23 | "name": "addAddresses", 24 | "outputs": [], 25 | "stateMutability": "nonpayable", 26 | "type": "function" 27 | }, 28 | { 29 | "inputs": [], 30 | "name": "addressArray", 31 | "outputs": [ 32 | { 33 | "internalType": "address[]", 34 | "name": "", 35 | "type": "address[]" 36 | } 37 | ], 38 | "stateMutability": "view", 39 | "type": "function" 40 | }, 41 | { 42 | "inputs": [], 43 | "name": "clearAll", 44 | "outputs": [], 45 | "stateMutability": "nonpayable", 46 | "type": "function" 47 | }, 48 | { 49 | "inputs": [ 50 | { 51 | "internalType": "address", 52 | "name": "addr", 53 | "type": "address" 54 | } 55 | ], 56 | "name": "contains", 57 | "outputs": [ 58 | { 59 | "internalType": "bool", 60 | "name": "", 61 | "type": "bool" 62 | } 63 | ], 64 | "stateMutability": "view", 65 | "type": "function" 66 | }, 67 | { 68 | "inputs": [], 69 | "name": "initialize", 70 | "outputs": [], 71 | "stateMutability": "nonpayable", 72 | "type": "function" 73 | }, 74 | { 75 | "inputs": [ 76 | { 77 | "internalType": "address", 78 | "name": "prevAddress", 79 | "type": "address" 80 | }, 81 | { 82 | "internalType": "address", 83 | "name": "addr", 84 | "type": "address" 85 | } 86 | ], 87 | "name": "removeAddress", 88 | "outputs": [], 89 | "stateMutability": "nonpayable", 90 | "type": "function" 91 | } 92 | ] -------------------------------------------------------------------------------- /src/helpers/loadOrCreateControlledToken.ts: -------------------------------------------------------------------------------- 1 | import { Address, BigInt, log } from '@graphprotocol/graph-ts' 2 | 3 | import { 4 | ControlledToken, 5 | } from '../../generated/schema' 6 | 7 | import { 8 | ControlledToken as ControlledTokenContract 9 | } from '../../generated/templates/ControlledToken/ControlledToken' 10 | 11 | import { ZERO } from './common' 12 | 13 | 14 | export function loadOrCreateControlledToken( 15 | tokenAddress: Address 16 | ): ControlledToken { 17 | let controlledToken = ControlledToken.load(tokenAddress.toHexString()) 18 | if (!controlledToken) { 19 | log.warning("debug001 creating controleld token for {} ",[tokenAddress.toHex()]) 20 | 21 | controlledToken = new ControlledToken(tokenAddress.toHex()) 22 | const boundToken = ControlledTokenContract.bind(tokenAddress) 23 | 24 | const tryControllerCall = boundToken.try_controller() 25 | if(tryControllerCall.reverted){ 26 | log.warning("try_controller() reverted ",[]) 27 | } 28 | else{ 29 | controlledToken.controller = tryControllerCall.value.toHexString() 30 | } 31 | 32 | let controlledTokenName = boundToken.try_name() 33 | if(controlledTokenName.reverted){ 34 | log.info('ControlledToken ERC20 try_name() call reverted', []) 35 | } 36 | else{ 37 | controlledToken.name = controlledTokenName.value 38 | } 39 | 40 | 41 | let controlledTokenSymbol = boundToken.try_symbol() 42 | if(controlledTokenSymbol.reverted){ 43 | log.info('ControlledToken ERC20 try_symbol() call reverted', []) 44 | } 45 | else{ 46 | controlledToken.symbol = controlledTokenSymbol.value 47 | } 48 | 49 | let tryDecimalsCallResult = boundToken.try_decimals() 50 | if(tryDecimalsCallResult.reverted) { 51 | log.info('ControlledToken ERC20 try_decimals() call reverted', []) 52 | } 53 | else{ 54 | controlledToken.decimals = BigInt.fromI32(tryDecimalsCallResult.value) 55 | } 56 | controlledToken.numberOfHolders = ZERO 57 | controlledToken.totalSupply = ZERO 58 | 59 | controlledToken.save() 60 | } 61 | 62 | return controlledToken as ControlledToken 63 | } 64 | -------------------------------------------------------------------------------- /abis/v3_1_0/abis/Registry.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": "previousOwner", 14 | "type": "address" 15 | }, 16 | { 17 | "indexed": true, 18 | "internalType": "address", 19 | "name": "newOwner", 20 | "type": "address" 21 | } 22 | ], 23 | "name": "OwnershipTransferred", 24 | "type": "event" 25 | }, 26 | { 27 | "anonymous": false, 28 | "inputs": [ 29 | { 30 | "indexed": true, 31 | "internalType": "address", 32 | "name": "pointer", 33 | "type": "address" 34 | } 35 | ], 36 | "name": "Registered", 37 | "type": "event" 38 | }, 39 | { 40 | "inputs": [], 41 | "name": "lookup", 42 | "outputs": [ 43 | { 44 | "internalType": "address", 45 | "name": "", 46 | "type": "address" 47 | } 48 | ], 49 | "stateMutability": "view", 50 | "type": "function" 51 | }, 52 | { 53 | "inputs": [], 54 | "name": "owner", 55 | "outputs": [ 56 | { 57 | "internalType": "address", 58 | "name": "", 59 | "type": "address" 60 | } 61 | ], 62 | "stateMutability": "view", 63 | "type": "function" 64 | }, 65 | { 66 | "inputs": [ 67 | { 68 | "internalType": "address", 69 | "name": "_pointer", 70 | "type": "address" 71 | } 72 | ], 73 | "name": "register", 74 | "outputs": [], 75 | "stateMutability": "nonpayable", 76 | "type": "function" 77 | }, 78 | { 79 | "inputs": [], 80 | "name": "renounceOwnership", 81 | "outputs": [], 82 | "stateMutability": "nonpayable", 83 | "type": "function" 84 | }, 85 | { 86 | "inputs": [ 87 | { 88 | "internalType": "address", 89 | "name": "newOwner", 90 | "type": "address" 91 | } 92 | ], 93 | "name": "transferOwnership", 94 | "outputs": [], 95 | "stateMutability": "nonpayable", 96 | "type": "function" 97 | } 98 | ] -------------------------------------------------------------------------------- /src/helpers/loadOrCreateSingleRandomWinner.ts: -------------------------------------------------------------------------------- 1 | import { Address, log } from '@graphprotocol/graph-ts' 2 | 3 | import { 4 | SingleRandomWinnerPrizeStrategy, 5 | } from '../../generated/schema' 6 | 7 | import { loadOrCreatePrizeStrategy } from './loadOrCreatePrizeStrategy' 8 | 9 | import { 10 | SingleRandomWinner as SingleRandomWinnerContract, 11 | } from '../../generated/templates/SingleRandomWinner/SingleRandomWinner' 12 | 13 | import { ZERO_ADDRESS } from './common' 14 | import { loadOrCreateControlledToken } from './loadOrCreateControlledToken' 15 | 16 | export function loadOrCreateSingleRandomWinner( 17 | singleRandomWinner: Address, 18 | ): SingleRandomWinnerPrizeStrategy { 19 | const _singleRandomWinnerAddress = singleRandomWinner.toHex() 20 | let _singleRandomWinner = SingleRandomWinnerPrizeStrategy.load(_singleRandomWinnerAddress) 21 | if (!_singleRandomWinner) { 22 | 23 | // Create SingleRandomWinnerPrizeStrategy 24 | _singleRandomWinner = new SingleRandomWinnerPrizeStrategy(_singleRandomWinnerAddress) 25 | const _boundSingleRandomWinner = SingleRandomWinnerContract.bind(singleRandomWinner) 26 | 27 | _singleRandomWinner.owner = _boundSingleRandomWinner.owner() 28 | _singleRandomWinner.prizePool = _boundSingleRandomWinner.prizePool().toHex() // _prizePool.id 29 | _singleRandomWinner.rng = _boundSingleRandomWinner.rng() 30 | _singleRandomWinner.tokenListener = ZERO_ADDRESS 31 | _singleRandomWinner.ticket = ZERO_ADDRESS 32 | _singleRandomWinner.sponsorship = ZERO_ADDRESS 33 | 34 | _singleRandomWinner.prizePeriodSeconds = _boundSingleRandomWinner.prizePeriodSeconds() 35 | _singleRandomWinner.prizePeriodStartedAt = _boundSingleRandomWinner.prizePeriodStartedAt() 36 | _singleRandomWinner.prizePeriodEndAt = _singleRandomWinner.prizePeriodStartedAt.plus(_singleRandomWinner.prizePeriodSeconds) 37 | 38 | const ticket = loadOrCreateControlledToken( 39 | _boundSingleRandomWinner.ticket() 40 | ) 41 | _singleRandomWinner.ticket = ticket.id 42 | 43 | const sponsorship = loadOrCreateControlledToken( 44 | _boundSingleRandomWinner.sponsorship() 45 | ) 46 | _singleRandomWinner.sponsorship = sponsorship.id 47 | _singleRandomWinner.save() 48 | 49 | let prizeStrategy = loadOrCreatePrizeStrategy(singleRandomWinner) 50 | prizeStrategy.singleRandomWinner = _singleRandomWinner.id 51 | prizeStrategy.save() 52 | } 53 | 54 | return _singleRandomWinner as SingleRandomWinnerPrizeStrategy 55 | } 56 | -------------------------------------------------------------------------------- /src/helpers/loadOrCreateExternalAward.ts: -------------------------------------------------------------------------------- 1 | import { Address, BigInt, log } from '@graphprotocol/graph-ts' 2 | 3 | import { 4 | ERC20 as ERC20Contract, 5 | } from '../../generated/templates/PrizePool/ERC20' 6 | 7 | import { 8 | SingleRandomWinnerExternalErc20Award, 9 | SingleRandomWinnerExternalErc721Award, 10 | } from '../../generated/schema' 11 | 12 | import { externalAwardId } from './idTemplates' 13 | 14 | 15 | export function loadOrCreateExternalErc20Award(prizeStrategyAddress: string, tokenAddress: Address): SingleRandomWinnerExternalErc20Award { 16 | const awardId = externalAwardId(prizeStrategyAddress, tokenAddress.toHex()) 17 | 18 | let award = SingleRandomWinnerExternalErc20Award.load(awardId) 19 | if (!award) { 20 | log.warning("creating an externalErc20 entity ",[]) 21 | award = new SingleRandomWinnerExternalErc20Award(awardId) 22 | award.prizeStrategy = prizeStrategyAddress 23 | award.address = tokenAddress 24 | 25 | const boundToken = ERC20Contract.bind(tokenAddress) 26 | 27 | let tryNameCallResult = boundToken.try_name() 28 | if (tryNameCallResult.reverted) { 29 | log.info('ERC20 try_name() call reverted', []) 30 | } else { 31 | award.name = tryNameCallResult.value 32 | } 33 | 34 | let trySymbolCallResult = boundToken.try_symbol() 35 | if (trySymbolCallResult.reverted) { 36 | log.info('ERC20 try_symbol call reverted', []) 37 | } else { 38 | award.symbol = trySymbolCallResult.value 39 | } 40 | 41 | let tryDecimalsCallResult = boundToken.try_decimals() 42 | if (tryDecimalsCallResult.reverted) { 43 | log.info('ERC20 try_decimals() call reverted', []) 44 | } else { 45 | award.decimals = BigInt.fromI32(tryDecimalsCallResult.value) 46 | } 47 | 48 | award.save() 49 | } 50 | else{ 51 | log.warning("external erc20 already existed ",[]) 52 | } 53 | 54 | return award as SingleRandomWinnerExternalErc20Award 55 | } 56 | 57 | export function loadOrCreateExternalErc721Award(prizeStrategyAddress: string, tokenAddress: Address): SingleRandomWinnerExternalErc721Award { 58 | const awardId = externalAwardId(prizeStrategyAddress, tokenAddress.toHex()) 59 | 60 | let award = SingleRandomWinnerExternalErc721Award.load(awardId) 61 | if (!award) { 62 | award = new SingleRandomWinnerExternalErc721Award(awardId) 63 | award.prizeStrategy = prizeStrategyAddress 64 | award.address = tokenAddress 65 | award.save() 66 | } 67 | 68 | return award as SingleRandomWinnerExternalErc721Award 69 | } 70 | -------------------------------------------------------------------------------- /abis/v3_1_0/abis/StakePrizePoolBuilder.json: -------------------------------------------------------------------------------- 1 | [ 2 | { 3 | "inputs": [ 4 | { 5 | "internalType": "contract RegistryInterface", 6 | "name": "_reserveRegistry", 7 | "type": "address" 8 | }, 9 | { 10 | "internalType": "contract StakePrizePoolProxyFactory", 11 | "name": "_stakePrizePoolProxyFactory", 12 | "type": "address" 13 | } 14 | ], 15 | "stateMutability": "nonpayable", 16 | "type": "constructor" 17 | }, 18 | { 19 | "anonymous": false, 20 | "inputs": [ 21 | { 22 | "indexed": true, 23 | "internalType": "address", 24 | "name": "creator", 25 | "type": "address" 26 | }, 27 | { 28 | "indexed": true, 29 | "internalType": "address", 30 | "name": "prizePool", 31 | "type": "address" 32 | } 33 | ], 34 | "name": "PrizePoolCreated", 35 | "type": "event" 36 | }, 37 | { 38 | "inputs": [ 39 | { 40 | "components": [ 41 | { 42 | "internalType": "contract IERC20Upgradeable", 43 | "name": "token", 44 | "type": "address" 45 | }, 46 | { 47 | "internalType": "uint256", 48 | "name": "maxExitFeeMantissa", 49 | "type": "uint256" 50 | }, 51 | { 52 | "internalType": "uint256", 53 | "name": "maxTimelockDuration", 54 | "type": "uint256" 55 | } 56 | ], 57 | "internalType": "struct StakePrizePoolBuilder.StakePrizePoolConfig", 58 | "name": "config", 59 | "type": "tuple" 60 | } 61 | ], 62 | "name": "createStakePrizePool", 63 | "outputs": [ 64 | { 65 | "internalType": "contract StakePrizePool", 66 | "name": "", 67 | "type": "address" 68 | } 69 | ], 70 | "stateMutability": "nonpayable", 71 | "type": "function" 72 | }, 73 | { 74 | "inputs": [], 75 | "name": "reserveRegistry", 76 | "outputs": [ 77 | { 78 | "internalType": "contract RegistryInterface", 79 | "name": "", 80 | "type": "address" 81 | } 82 | ], 83 | "stateMutability": "view", 84 | "type": "function" 85 | }, 86 | { 87 | "inputs": [], 88 | "name": "stakePrizePoolProxyFactory", 89 | "outputs": [ 90 | { 91 | "internalType": "contract StakePrizePoolProxyFactory", 92 | "name": "", 93 | "type": "address" 94 | } 95 | ], 96 | "stateMutability": "view", 97 | "type": "function" 98 | } 99 | ] -------------------------------------------------------------------------------- /abis/v3_1_0/abis/CompoundPrizePoolBuilder.json: -------------------------------------------------------------------------------- 1 | [ 2 | { 3 | "inputs": [ 4 | { 5 | "internalType": "contract RegistryInterface", 6 | "name": "_reserveRegistry", 7 | "type": "address" 8 | }, 9 | { 10 | "internalType": "contract CompoundPrizePoolProxyFactory", 11 | "name": "_compoundPrizePoolProxyFactory", 12 | "type": "address" 13 | } 14 | ], 15 | "stateMutability": "nonpayable", 16 | "type": "constructor" 17 | }, 18 | { 19 | "anonymous": false, 20 | "inputs": [ 21 | { 22 | "indexed": true, 23 | "internalType": "address", 24 | "name": "creator", 25 | "type": "address" 26 | }, 27 | { 28 | "indexed": true, 29 | "internalType": "address", 30 | "name": "prizePool", 31 | "type": "address" 32 | } 33 | ], 34 | "name": "PrizePoolCreated", 35 | "type": "event" 36 | }, 37 | { 38 | "inputs": [], 39 | "name": "compoundPrizePoolProxyFactory", 40 | "outputs": [ 41 | { 42 | "internalType": "contract CompoundPrizePoolProxyFactory", 43 | "name": "", 44 | "type": "address" 45 | } 46 | ], 47 | "stateMutability": "view", 48 | "type": "function" 49 | }, 50 | { 51 | "inputs": [ 52 | { 53 | "components": [ 54 | { 55 | "internalType": "contract CTokenInterface", 56 | "name": "cToken", 57 | "type": "address" 58 | }, 59 | { 60 | "internalType": "uint256", 61 | "name": "maxExitFeeMantissa", 62 | "type": "uint256" 63 | }, 64 | { 65 | "internalType": "uint256", 66 | "name": "maxTimelockDuration", 67 | "type": "uint256" 68 | } 69 | ], 70 | "internalType": "struct CompoundPrizePoolBuilder.CompoundPrizePoolConfig", 71 | "name": "config", 72 | "type": "tuple" 73 | } 74 | ], 75 | "name": "createCompoundPrizePool", 76 | "outputs": [ 77 | { 78 | "internalType": "contract CompoundPrizePool", 79 | "name": "", 80 | "type": "address" 81 | } 82 | ], 83 | "stateMutability": "nonpayable", 84 | "type": "function" 85 | }, 86 | { 87 | "inputs": [], 88 | "name": "reserveRegistry", 89 | "outputs": [ 90 | { 91 | "internalType": "contract RegistryInterface", 92 | "name": "", 93 | "type": "address" 94 | } 95 | ], 96 | "stateMutability": "view", 97 | "type": "function" 98 | } 99 | ] -------------------------------------------------------------------------------- /src/helpers/loadOrCreateAccount.ts: -------------------------------------------------------------------------------- 1 | import { Address, BigInt, log } from '@graphprotocol/graph-ts' 2 | 3 | import { 4 | DripTokenPlayer, 5 | BalanceDripPlayer, 6 | VolumeDripPlayer, 7 | } from '../../generated/schema' 8 | 9 | import { 10 | dripTokenPlayerId, 11 | balanceDripPlayerId, 12 | volumeDripPlayerId, 13 | } from './idTemplates' 14 | 15 | import {Account} from "../../generated/schema" 16 | 17 | export function loadOrCreateAccount( 18 | address: Address 19 | ): Account { 20 | let account = Account.load(address.toHex()) 21 | 22 | if (!account) { 23 | account = new Account(address.toHex()) 24 | account.save() 25 | } 26 | 27 | return account as Account 28 | } 29 | 30 | export function loadOrCreateDripTokenPlayer( 31 | comptroller: Address, 32 | dripToken: Address, 33 | player: Address 34 | ): DripTokenPlayer { 35 | const _playerId = dripTokenPlayerId(comptroller.toHex(), dripToken.toHex(), player.toHex()) 36 | let _player = DripTokenPlayer.load(_playerId) 37 | 38 | if (!_player) { 39 | _player = new DripTokenPlayer(_playerId) 40 | 41 | log.warning('DripTokenPlayer {}', [player.toHex()]) 42 | _player.dripToken = dripToken 43 | _player.comptroller = comptroller.toHex() 44 | _player.address = player 45 | _player.balance = BigInt.fromI32(0) 46 | _player.save() 47 | } 48 | 49 | return _player as DripTokenPlayer 50 | } 51 | 52 | 53 | export function loadOrCreateBalanceDripPlayer( 54 | balanceDripId: string, 55 | player: Address, 56 | ): BalanceDripPlayer { 57 | const _playerId = balanceDripPlayerId(balanceDripId, player.toHex()) 58 | let _player = BalanceDripPlayer.load(_playerId) 59 | 60 | if (!_player) { 61 | _player = new BalanceDripPlayer(_playerId) 62 | 63 | // log.warning('BalanceDripPlayer {}', [player.toHex()]) 64 | _player.balanceDrip = balanceDripId 65 | _player.address = player 66 | _player.save() 67 | } 68 | 69 | return _player as BalanceDripPlayer 70 | } 71 | 72 | 73 | export function loadOrCreateVolumeDripPlayer( 74 | volumeDripId: string, 75 | player: Address, 76 | ): VolumeDripPlayer { 77 | const _playerId = volumeDripPlayerId(volumeDripId, player.toHex()) 78 | let _player = VolumeDripPlayer.load(_playerId) 79 | 80 | if (!_player) { 81 | _player = new VolumeDripPlayer(_playerId) 82 | 83 | // log.warning('VolumeDripPlayer {}', [player.toHex()]) 84 | _player.volumeDrip = volumeDripId 85 | _player.address = player 86 | _player.periodIndex = BigInt.fromI32(0) 87 | _player.balance = BigInt.fromI32(0) 88 | _player.save() 89 | } 90 | 91 | return _player as VolumeDripPlayer 92 | } 93 | -------------------------------------------------------------------------------- /src/helpers/loadOrCreateAwardedExternalErc.ts: -------------------------------------------------------------------------------- 1 | import { Address, BigInt, log } from '@graphprotocol/graph-ts' 2 | 3 | import { 4 | ERC20 as ERC20Contract, 5 | } from '../../generated/templates/PrizePool/ERC20' 6 | 7 | import { 8 | Prize, 9 | AwardedExternalErc20Token, 10 | AwardedExternalErc721Nft, 11 | PrizeStrategy, 12 | } from '../../generated/schema' 13 | 14 | import { awardedExternalErc20TokenId, awardedExternalErc721NftId } from './idTemplates' 15 | import { loadOrCreateExternalErc721Award } from './loadOrCreateExternalAward' 16 | 17 | export function loadOrCreateAwardedExternalErc20Token(prize: Prize, tokenAddress: Address, winnerAddress: Address, winnerIndex: string): AwardedExternalErc20Token { 18 | const awardId = awardedExternalErc20TokenId(prize.id, tokenAddress.toHex(), winnerAddress.toHex(), winnerIndex) 19 | 20 | let award = AwardedExternalErc20Token.load(awardId) 21 | if (!award) { 22 | award = new AwardedExternalErc20Token(awardId) 23 | award.prize = prize.id 24 | award.address = tokenAddress 25 | 26 | const boundToken = ERC20Contract.bind(tokenAddress) 27 | 28 | 29 | let tryNameCallResult = boundToken.try_name() 30 | if (tryNameCallResult.reverted) { 31 | log.info('ERC20 try_name() call reverted', []) 32 | } else { 33 | award.name = tryNameCallResult.value 34 | } 35 | 36 | let trySymbolCallResult = boundToken.try_symbol() 37 | if (trySymbolCallResult.reverted) { 38 | log.info('ERC20 try_symbol call reverted', []) 39 | } else { 40 | award.symbol = trySymbolCallResult.value 41 | } 42 | 43 | let tryDecimalsCallResult = boundToken.try_decimals() 44 | if (tryDecimalsCallResult.reverted) { 45 | log.info('ERC20 try_decimals() call reverted', []) 46 | } else { 47 | award.decimals = BigInt.fromI32(tryDecimalsCallResult.value) 48 | } 49 | 50 | award.save() 51 | } 52 | 53 | return award as AwardedExternalErc20Token 54 | } 55 | 56 | export function loadOrCreateAwardedExternalErc721Nft(prize: Prize, prizeStrategy: PrizeStrategy, tokenAddress: Address): AwardedExternalErc721Nft { 57 | const awardId = awardedExternalErc721NftId(prize.id, tokenAddress.toHex()) 58 | 59 | let award = AwardedExternalErc721Nft.load(awardId) 60 | if (!award) { 61 | award = new AwardedExternalErc721Nft(awardId) 62 | 63 | let externalErc721Award = loadOrCreateExternalErc721Award( 64 | prizeStrategy.id.toString(), 65 | tokenAddress 66 | ) 67 | 68 | award.address = externalErc721Award.address 69 | award.prize = prize.id 70 | award.tokenIds = externalErc721Award.tokenIds 71 | 72 | award.save() 73 | } 74 | 75 | return award as AwardedExternalErc721Nft 76 | } 77 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 |

2 | 3 | PoolTogether Brand 4 | 5 |

6 | 7 |
8 | 9 | ## PoolTogether v3 Subgraph 10 | 11 | The official PoolTogether v3 subgraph. 12 | 13 | #### Quick-use: 14 | 15 | ```sh 16 | $ yarn clean && yarn prepare:local && graph gen:local && yarn create:local && yarn deploy:local 17 | ``` 18 | 19 | ###### For Kovan: 20 | ```sh 21 | $ yarn clean && yarn prepare:kovan && yarn gen:kovan && yarn deploy:kovan 22 | ``` 23 | 24 | ###### For Rinkeby: 25 | ```sh 26 | $ yarn clean && yarn prepare:rinkeby && yarn gen:rinkeby && yarn deploy:rinkeby 27 | ``` 28 | 29 | #### Local Setup 30 | 31 | First you'll need to setup a graph node, then you can deploy the project to it. 32 | 33 | ###### Local Graph Node 34 | 35 | 1. Clone the Graph Node repo: 36 | 37 | ```bash 38 | $ git clone https://github.com/graphprotocol/graph-node/ 39 | ``` 40 | 41 | 2. Enter the dir 42 | 43 | ```bash 44 | $ cd graph-node/docker 45 | ``` 46 | 47 | 3. If using Linux, fix the local IP address: 48 | 49 | ```bash 50 | $ ./setup.sh 51 | ``` 52 | 53 | 4. Spin up the node 54 | 55 | ```bash 56 | $ sudo docker-compose up 57 | ``` 58 | 59 | ###### Deploying the PoolTogether Contracts Locally 60 | 61 | Make sure you've already deployed the PoolTogether contracts. If you haven't done so, check out the [contracts repo](https://github.com/pooltogether/pooltogether-contracts-v3). 62 | 63 | 1. Change the `localhost` target url to 0.0.0.0:8545 in `builder.network.js` 64 | 65 | 2. Run `yarn` to install the contract repo dependencies. 66 | 67 | 3. Start a local ganache-cli instance using `ganache-cli -h 0.0.0.0 --chainId 31337`. This facilates the local subgraph docker node to observe the local blockchain instance. 68 | 69 | 4. In a different terminal window, run `yarn deploy localhost` to compile and deploy the smart contracts to the local ganache-cli blockchain instance. 70 | 71 | 5. In a different terminal window, run `yarn console localhost` to interact with the contracts. 72 | 73 | 74 | 75 | ###### Deploying the Subgraph Locally 76 | 77 | Once the contracts are deployed, you can now set up the subgraph: 78 | 79 | 1. In this subgraph repo, install deps 80 | 81 | ```bash 82 | $ yarn 83 | ``` 84 | 85 | 2. Ensure generated code is up-to-date: 86 | 87 | ```bash 88 | $ yarn codegen 89 | ``` 90 | 91 | 3. Update `networks/local.json` to the correct contract addresses deployed locally 92 | 93 | 4. Run `yarn clean && yarn prepare:local && graph gen:local && yarn create:local && yarn deploy:local` 94 | -------------------------------------------------------------------------------- /src/helpers/loadOrCreateMultipleWinnersExternalAward.ts: -------------------------------------------------------------------------------- 1 | import { Address, BigInt, log } from '@graphprotocol/graph-ts' 2 | 3 | import { 4 | ERC20 as ERC20Contract, 5 | } from '../../generated/templates/PrizePool/ERC20' 6 | 7 | import { 8 | MultipleWinnersExternalErc20Award, 9 | MultipleWinnersExternalErc721Award, 10 | } from '../../generated/schema' 11 | 12 | import { externalAwardId } from './idTemplates' 13 | 14 | 15 | export function loadOrCreateMultipleWinnersExternalErc20Award(prizeStrategyAddress: string, tokenAddress: Address): MultipleWinnersExternalErc20Award { 16 | const awardId = externalAwardId(prizeStrategyAddress, tokenAddress.toHex()) 17 | 18 | let award = MultipleWinnersExternalErc20Award.load(awardId) 19 | if (!award) { 20 | log.warning("creating an multiple winners externalErc20 entity ",[]) 21 | award = new MultipleWinnersExternalErc20Award(awardId) 22 | award.prizeStrategy = prizeStrategyAddress 23 | award.address = tokenAddress 24 | 25 | const boundToken = ERC20Contract.bind(tokenAddress) 26 | 27 | let tryNameCallResult = boundToken.try_name() 28 | if (tryNameCallResult.reverted) { 29 | log.info('ERC20 try_name() call reverted', []) 30 | } else { 31 | award.name = tryNameCallResult.value 32 | } 33 | 34 | let trySymbolCallResult = boundToken.try_symbol() 35 | if (trySymbolCallResult.reverted) { 36 | log.info('ERC20 try_symbol call reverted', []) 37 | } else { 38 | award.symbol = trySymbolCallResult.value 39 | } 40 | 41 | let tryDecimalsCallResult = boundToken.try_decimals() 42 | if (tryDecimalsCallResult.reverted) { 43 | log.info('ERC20 try_decimals() call reverted', []) 44 | } else { 45 | award.decimals = BigInt.fromI32(tryDecimalsCallResult.value) 46 | } 47 | 48 | award.save() 49 | } 50 | else{ 51 | log.warning("external multiple winners external erc20 already existed ",[]) 52 | } 53 | 54 | return award as MultipleWinnersExternalErc20Award 55 | } 56 | 57 | export function loadOrCreateMultipleWinnersExternalErc721Award(prizeStrategyAddress: string, tokenAddress: Address): MultipleWinnersExternalErc721Award { 58 | const awardId = externalAwardId(prizeStrategyAddress, tokenAddress.toHex()) 59 | 60 | let award = MultipleWinnersExternalErc721Award.load(awardId) 61 | if (!award) { 62 | log.warning("creating an multiple winners externalErc721 entity ",[]) 63 | award = new MultipleWinnersExternalErc721Award(awardId) 64 | award.prizeStrategy = prizeStrategyAddress 65 | award.address = tokenAddress 66 | award.save() 67 | } 68 | else{ 69 | log.warning("external multiple winners external erc721 already existed ",[]) 70 | } 71 | 72 | return award as MultipleWinnersExternalErc721Award 73 | } 74 | -------------------------------------------------------------------------------- /abis/v3_1_0/abis/VaultPrizePoolBuilder.json: -------------------------------------------------------------------------------- 1 | [ 2 | { 3 | "inputs": [ 4 | { 5 | "internalType": "contract RegistryInterface", 6 | "name": "_reserveRegistry", 7 | "type": "address" 8 | }, 9 | { 10 | "internalType": "contract yVaultPrizePoolProxyFactory", 11 | "name": "_vaultPrizePoolProxyFactory", 12 | "type": "address" 13 | } 14 | ], 15 | "stateMutability": "nonpayable", 16 | "type": "constructor" 17 | }, 18 | { 19 | "anonymous": false, 20 | "inputs": [ 21 | { 22 | "indexed": true, 23 | "internalType": "address", 24 | "name": "creator", 25 | "type": "address" 26 | }, 27 | { 28 | "indexed": true, 29 | "internalType": "address", 30 | "name": "prizePool", 31 | "type": "address" 32 | } 33 | ], 34 | "name": "PrizePoolCreated", 35 | "type": "event" 36 | }, 37 | { 38 | "inputs": [ 39 | { 40 | "components": [ 41 | { 42 | "internalType": "contract yVaultInterface", 43 | "name": "vault", 44 | "type": "address" 45 | }, 46 | { 47 | "internalType": "uint256", 48 | "name": "reserveRateMantissa", 49 | "type": "uint256" 50 | }, 51 | { 52 | "internalType": "uint256", 53 | "name": "maxExitFeeMantissa", 54 | "type": "uint256" 55 | }, 56 | { 57 | "internalType": "uint256", 58 | "name": "maxTimelockDuration", 59 | "type": "uint256" 60 | } 61 | ], 62 | "internalType": "struct VaultPrizePoolBuilder.VaultPrizePoolConfig", 63 | "name": "config", 64 | "type": "tuple" 65 | } 66 | ], 67 | "name": "createVaultPrizePool", 68 | "outputs": [ 69 | { 70 | "internalType": "contract yVaultPrizePool", 71 | "name": "", 72 | "type": "address" 73 | } 74 | ], 75 | "stateMutability": "nonpayable", 76 | "type": "function" 77 | }, 78 | { 79 | "inputs": [], 80 | "name": "reserveRegistry", 81 | "outputs": [ 82 | { 83 | "internalType": "contract RegistryInterface", 84 | "name": "", 85 | "type": "address" 86 | } 87 | ], 88 | "stateMutability": "view", 89 | "type": "function" 90 | }, 91 | { 92 | "inputs": [], 93 | "name": "vaultPrizePoolProxyFactory", 94 | "outputs": [ 95 | { 96 | "internalType": "contract yVaultPrizePoolProxyFactory", 97 | "name": "", 98 | "type": "address" 99 | } 100 | ], 101 | "stateMutability": "view", 102 | "type": "function" 103 | } 104 | ] -------------------------------------------------------------------------------- /testquery.gql: -------------------------------------------------------------------------------- 1 | { 2 | comptrollers { 3 | id 4 | owner 5 | 6 | balanceDrips { 7 | id 8 | measureToken 9 | dripToken 10 | 11 | dripRatePerSecond 12 | exchangeRateMantissa 13 | timestamp 14 | 15 | players { 16 | address 17 | } 18 | } 19 | volumeDrips { 20 | id 21 | measureToken 22 | dripToken 23 | dripAmount 24 | 25 | deactivated 26 | referral 27 | 28 | periodSeconds 29 | periodCount 30 | periods { 31 | id 32 | periodIndex 33 | totalSupply 34 | dripAmount 35 | endTime 36 | isDripping 37 | } 38 | deposits { 39 | id 40 | address 41 | periodIndex 42 | balance 43 | } 44 | } 45 | } 46 | 47 | prizePools { 48 | id 49 | deactivated 50 | owner 51 | 52 | prizePoolType 53 | compoundPrizePool { 54 | id 55 | cToken 56 | } 57 | 58 | reserveFeeControlledToken 59 | 60 | underlyingCollateralToken 61 | underlyingCollateralName 62 | underlyingCollateralSymbol 63 | underlyingCollateralDecimals 64 | 65 | maxExitFeeMantissa 66 | maxTimelockDuration 67 | timelockTotalSupply 68 | liquidityCap 69 | 70 | currentPrizeId 71 | currentState 72 | 73 | cumulativePrizeNet 74 | cumulativePrizeGross 75 | cumulativePrizeReserveFee 76 | 77 | prizeStrategy { 78 | singleRandomWinner { 79 | id 80 | owner 81 | rng 82 | 83 | ticket { 84 | id 85 | type 86 | name 87 | symbol 88 | decimals 89 | totalSupply 90 | } 91 | sponsorship { 92 | id 93 | type 94 | name 95 | symbol 96 | decimals 97 | totalSupply 98 | } 99 | 100 | prizePeriodSeconds 101 | prizePeriodStartedAt 102 | prizePeriodEndAt 103 | 104 | externalErc20Awards { 105 | address 106 | } 107 | externalErc721Awards { 108 | address 109 | tokenIds 110 | } 111 | } 112 | } 113 | 114 | totalSupply 115 | totalSponsorship 116 | 117 | playerCount 118 | players { 119 | id 120 | address 121 | balance 122 | timelockedBalance 123 | unlockTimestamp 124 | cumulativeWinnings 125 | } 126 | 127 | prizes { 128 | id 129 | awardedBlock 130 | randomNumber 131 | amount 132 | totalTicketSupply 133 | winners 134 | } 135 | 136 | tokenCreditRates { 137 | creditRateMantissa 138 | creditLimitMantissa 139 | } 140 | 141 | tokenCreditBalances { 142 | balance 143 | timestamp 144 | initialized 145 | } 146 | 147 | sponsors { 148 | id 149 | address 150 | balance 151 | } 152 | } 153 | } 154 | -------------------------------------------------------------------------------- /abis/v3_1_0/abis/RNGInterface.json: -------------------------------------------------------------------------------- 1 | [ 2 | { 3 | "anonymous": false, 4 | "inputs": [ 5 | { 6 | "indexed": true, 7 | "internalType": "uint32", 8 | "name": "requestId", 9 | "type": "uint32" 10 | }, 11 | { 12 | "indexed": false, 13 | "internalType": "uint256", 14 | "name": "randomNumber", 15 | "type": "uint256" 16 | } 17 | ], 18 | "name": "RandomNumberCompleted", 19 | "type": "event" 20 | }, 21 | { 22 | "anonymous": false, 23 | "inputs": [ 24 | { 25 | "indexed": true, 26 | "internalType": "uint32", 27 | "name": "requestId", 28 | "type": "uint32" 29 | }, 30 | { 31 | "indexed": true, 32 | "internalType": "address", 33 | "name": "sender", 34 | "type": "address" 35 | } 36 | ], 37 | "name": "RandomNumberRequested", 38 | "type": "event" 39 | }, 40 | { 41 | "inputs": [], 42 | "name": "getLastRequestId", 43 | "outputs": [ 44 | { 45 | "internalType": "uint32", 46 | "name": "requestId", 47 | "type": "uint32" 48 | } 49 | ], 50 | "stateMutability": "view", 51 | "type": "function" 52 | }, 53 | { 54 | "inputs": [], 55 | "name": "getRequestFee", 56 | "outputs": [ 57 | { 58 | "internalType": "address", 59 | "name": "feeToken", 60 | "type": "address" 61 | }, 62 | { 63 | "internalType": "uint256", 64 | "name": "requestFee", 65 | "type": "uint256" 66 | } 67 | ], 68 | "stateMutability": "view", 69 | "type": "function" 70 | }, 71 | { 72 | "inputs": [ 73 | { 74 | "internalType": "uint32", 75 | "name": "requestId", 76 | "type": "uint32" 77 | } 78 | ], 79 | "name": "isRequestComplete", 80 | "outputs": [ 81 | { 82 | "internalType": "bool", 83 | "name": "isCompleted", 84 | "type": "bool" 85 | } 86 | ], 87 | "stateMutability": "view", 88 | "type": "function" 89 | }, 90 | { 91 | "inputs": [ 92 | { 93 | "internalType": "uint32", 94 | "name": "requestId", 95 | "type": "uint32" 96 | } 97 | ], 98 | "name": "randomNumber", 99 | "outputs": [ 100 | { 101 | "internalType": "uint256", 102 | "name": "randomNum", 103 | "type": "uint256" 104 | } 105 | ], 106 | "stateMutability": "nonpayable", 107 | "type": "function" 108 | }, 109 | { 110 | "inputs": [], 111 | "name": "requestRandomNumber", 112 | "outputs": [ 113 | { 114 | "internalType": "uint32", 115 | "name": "requestId", 116 | "type": "uint32" 117 | }, 118 | { 119 | "internalType": "uint32", 120 | "name": "lockBlock", 121 | "type": "uint32" 122 | } 123 | ], 124 | "stateMutability": "nonpayable", 125 | "type": "function" 126 | } 127 | ] -------------------------------------------------------------------------------- /abis/v3_1_0/abis/Reserve.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": "previousOwner", 14 | "type": "address" 15 | }, 16 | { 17 | "indexed": true, 18 | "internalType": "address", 19 | "name": "newOwner", 20 | "type": "address" 21 | } 22 | ], 23 | "name": "OwnershipTransferred", 24 | "type": "event" 25 | }, 26 | { 27 | "anonymous": false, 28 | "inputs": [ 29 | { 30 | "indexed": false, 31 | "internalType": "uint256", 32 | "name": "rateMantissa", 33 | "type": "uint256" 34 | } 35 | ], 36 | "name": "ReserveRateMantissaSet", 37 | "type": "event" 38 | }, 39 | { 40 | "inputs": [], 41 | "name": "owner", 42 | "outputs": [ 43 | { 44 | "internalType": "address", 45 | "name": "", 46 | "type": "address" 47 | } 48 | ], 49 | "stateMutability": "view", 50 | "type": "function" 51 | }, 52 | { 53 | "inputs": [], 54 | "name": "rateMantissa", 55 | "outputs": [ 56 | { 57 | "internalType": "uint256", 58 | "name": "", 59 | "type": "uint256" 60 | } 61 | ], 62 | "stateMutability": "view", 63 | "type": "function" 64 | }, 65 | { 66 | "inputs": [], 67 | "name": "renounceOwnership", 68 | "outputs": [], 69 | "stateMutability": "nonpayable", 70 | "type": "function" 71 | }, 72 | { 73 | "inputs": [ 74 | { 75 | "internalType": "address", 76 | "name": "", 77 | "type": "address" 78 | } 79 | ], 80 | "name": "reserveRateMantissa", 81 | "outputs": [ 82 | { 83 | "internalType": "uint256", 84 | "name": "", 85 | "type": "uint256" 86 | } 87 | ], 88 | "stateMutability": "view", 89 | "type": "function" 90 | }, 91 | { 92 | "inputs": [ 93 | { 94 | "internalType": "uint256", 95 | "name": "_rateMantissa", 96 | "type": "uint256" 97 | } 98 | ], 99 | "name": "setRateMantissa", 100 | "outputs": [], 101 | "stateMutability": "nonpayable", 102 | "type": "function" 103 | }, 104 | { 105 | "inputs": [ 106 | { 107 | "internalType": "address", 108 | "name": "newOwner", 109 | "type": "address" 110 | } 111 | ], 112 | "name": "transferOwnership", 113 | "outputs": [], 114 | "stateMutability": "nonpayable", 115 | "type": "function" 116 | }, 117 | { 118 | "inputs": [ 119 | { 120 | "internalType": "address", 121 | "name": "prizePool", 122 | "type": "address" 123 | }, 124 | { 125 | "internalType": "address", 126 | "name": "to", 127 | "type": "address" 128 | } 129 | ], 130 | "name": "withdrawReserve", 131 | "outputs": [ 132 | { 133 | "internalType": "uint256", 134 | "name": "", 135 | "type": "uint256" 136 | } 137 | ], 138 | "stateMutability": "nonpayable", 139 | "type": "function" 140 | } 141 | ] -------------------------------------------------------------------------------- /src/mappingForControlledToken.ts: -------------------------------------------------------------------------------- 1 | import { Address, log, store } from '@graphprotocol/graph-ts' 2 | import {generateCompositeId, ONE, ZERO, ZERO_ADDRESS} from "./helpers/common" 3 | import { 4 | Transfer, 5 | } from '../generated/templates/ControlledToken/ControlledToken' 6 | 7 | import { 8 | ControlledTokenBalance, 9 | } from '../generated/schema' 10 | import { loadOrCreateAccount } from './helpers/loadOrCreateAccount' 11 | import { loadOrCreateControlledToken } from './helpers/loadOrCreateControlledToken' 12 | 13 | export function handleTransfer(event: Transfer): void { 14 | 15 | if(event.params.to.equals(event.params.from)){ 16 | log.warning("transfer to self at txId {} from {} ",[event.transaction.hash.toString(), event.params.from.toHexString()]) 17 | return 18 | } 19 | 20 | const controlledToken = loadOrCreateControlledToken(event.address) 21 | 22 | const isBurning = event.params.to.equals(Address.fromString(ZERO_ADDRESS)) 23 | if(isBurning) { 24 | controlledToken.totalSupply = controlledToken.totalSupply.minus(event.params.value) // decrease total supply 25 | } 26 | else{ 27 | let toBalance = ControlledTokenBalance.load(generateCompositeId (event.params.to.toHexString(), event.address.toHexString())) // controlledtokenbalance id = (address, controlledToken) 28 | 29 | if(toBalance == null) {// create case 30 | toBalance = new ControlledTokenBalance(generateCompositeId (event.params.to.toHexString(), event.address.toHexString())) 31 | toBalance.balance = ZERO 32 | toBalance.controlledToken = controlledToken.id // or event.address 33 | toBalance.account = loadOrCreateAccount(event.params.to).id 34 | } 35 | 36 | // if a balance is going from zero to non-zero 37 | if (toBalance.balance.equals(ZERO) && event.params.value.gt(ZERO)) { 38 | controlledToken.numberOfHolders = controlledToken.numberOfHolders.plus(ONE) 39 | } 40 | 41 | toBalance.balance = toBalance.balance.plus(event.params.value) 42 | toBalance.save() 43 | } 44 | 45 | const isMinting = event.params.from.equals(Address.fromString(ZERO_ADDRESS)) 46 | if (isMinting) { 47 | controlledToken.totalSupply = controlledToken.totalSupply.plus(event.params.value) 48 | } 49 | else { 50 | let fromBalance = ControlledTokenBalance.load(generateCompositeId (event.params.from.toHexString(), event.address.toHexString())) // must always exist 51 | 52 | if(fromBalance == null) {// create case 53 | fromBalance = new ControlledTokenBalance(generateCompositeId (event.params.from.toHexString(), event.address.toHexString())) 54 | fromBalance.balance = ZERO 55 | fromBalance.controlledToken = controlledToken.id // or event.address 56 | fromBalance.account = loadOrCreateAccount(event.params.from).id 57 | } 58 | 59 | if (fromBalance.balance.gt(event.params.value)) { 60 | fromBalance.balance = fromBalance.balance.minus(event.params.value) 61 | } else { 62 | fromBalance.balance = ZERO 63 | } 64 | 65 | fromBalance.save() 66 | 67 | // if the balance of the sending account is zero then remove it 68 | if(fromBalance.balance.equals(ZERO)) { 69 | controlledToken.numberOfHolders = controlledToken.numberOfHolders.minus(ONE) // if account balance depleted decrement player count 70 | store.remove("ControlledTokenBalance", fromBalance.id) 71 | } 72 | } 73 | 74 | controlledToken.save() 75 | } 76 | -------------------------------------------------------------------------------- /src/helpers/loadOrCreatePrizePool.ts: -------------------------------------------------------------------------------- 1 | import { Address, BigInt, log } from '@graphprotocol/graph-ts' 2 | 3 | import { 4 | PrizePool, 5 | } from '../../generated/schema' 6 | 7 | import { 8 | PrizePool as PrizePoolContract, 9 | } from '../../generated/templates/PrizePool/PrizePool' 10 | 11 | import { 12 | ControlledToken as ControlledTokenContract, 13 | } from '../../generated/templates/ControlledToken/ControlledToken' 14 | 15 | import { ZERO, ONE, ZERO_ADDRESS } from './common' 16 | 17 | 18 | export function loadOrCreatePrizePool( 19 | prizePool: Address 20 | ): PrizePool { 21 | 22 | log.warning("loadOrCreatePrizePool called for {} ",[prizePool.toHexString()]) 23 | 24 | let _prizePool = PrizePool.load(prizePool.toHex()) 25 | 26 | if (!_prizePool) { 27 | log.warning("loadOrCreatePrizePool creating a prizePool {} ", [prizePool.toHexString()]) 28 | _prizePool = new PrizePool(prizePool.toHex()) 29 | 30 | const boundPrizePool = PrizePoolContract.bind(prizePool) 31 | 32 | const tryTokenCall = boundPrizePool.try_token() 33 | let poolTokenAddress : Address 34 | if(tryTokenCall.reverted){ 35 | log.warning("try_token reverted on {} ", [prizePool.toHexString()]) 36 | } 37 | else{ 38 | poolTokenAddress = tryTokenCall.value 39 | } 40 | 41 | if(poolTokenAddress){ 42 | const boundToken = ControlledTokenContract.bind(poolTokenAddress) 43 | 44 | const tryOwnerCall = boundPrizePool.try_owner() 45 | if(tryOwnerCall.reverted){ 46 | log.warning("try_owner for {} reverted ", [prizePool.toHexString()]) 47 | _prizePool.owner = null 48 | } 49 | else{ 50 | _prizePool.owner = tryOwnerCall.value 51 | } 52 | 53 | _prizePool.underlyingCollateralToken = poolTokenAddress 54 | 55 | const tryNameCall = boundToken.try_name() 56 | if(tryNameCall.reverted){ 57 | log.warning("try_name for {} reverted ", [prizePool.toHexString()]) 58 | _prizePool.underlyingCollateralName = null 59 | } 60 | else{ 61 | _prizePool.underlyingCollateralName = tryNameCall.value 62 | } 63 | 64 | const trySymbolCall = boundToken.try_symbol() 65 | if(trySymbolCall.reverted){ 66 | log.warning("try_symbol for {} reverted ", [prizePool.toHexString()]) 67 | _prizePool.underlyingCollateralSymbol = null 68 | } 69 | else{ 70 | _prizePool.underlyingCollateralSymbol = trySymbolCall.value 71 | } 72 | 73 | const tryDecimalsCall = boundToken.try_decimals() 74 | if(tryDecimalsCall.reverted){ 75 | log.warning("try_symbol for {} reverted ", [prizePool.toHexString()]) 76 | _prizePool.underlyingCollateralDecimals = null 77 | } 78 | else{ 79 | _prizePool.underlyingCollateralDecimals = BigInt.fromI32(tryDecimalsCall.value) 80 | } 81 | } 82 | else{ 83 | log.error("PrizePool {} does not have a token ", [prizePool.toHex()]) 84 | } 85 | 86 | _prizePool.reserveRegistry = Address.fromString(ZERO_ADDRESS) 87 | _prizePool.reserveFeeControlledToken = Address.fromString(ZERO_ADDRESS) 88 | _prizePool.deactivated = false 89 | 90 | 91 | _prizePool.maxExitFeeMantissa = ZERO 92 | _prizePool.liquidityCap = ZERO 93 | 94 | _prizePool.currentState = 'Opened' 95 | _prizePool.currentPrizeId = ONE 96 | 97 | _prizePool.cumulativePrizeGross = ZERO 98 | _prizePool.cumulativePrizeReserveFee = ZERO 99 | _prizePool.cumulativePrizeNet = ZERO 100 | 101 | _prizePool.save() 102 | } 103 | return _prizePool as PrizePool 104 | } 105 | -------------------------------------------------------------------------------- /abis/v3_1_0/abis/RNGServiceMock.json: -------------------------------------------------------------------------------- 1 | [ 2 | { 3 | "anonymous": false, 4 | "inputs": [ 5 | { 6 | "indexed": true, 7 | "internalType": "uint32", 8 | "name": "requestId", 9 | "type": "uint32" 10 | }, 11 | { 12 | "indexed": false, 13 | "internalType": "uint256", 14 | "name": "randomNumber", 15 | "type": "uint256" 16 | } 17 | ], 18 | "name": "RandomNumberCompleted", 19 | "type": "event" 20 | }, 21 | { 22 | "anonymous": false, 23 | "inputs": [ 24 | { 25 | "indexed": true, 26 | "internalType": "uint32", 27 | "name": "requestId", 28 | "type": "uint32" 29 | }, 30 | { 31 | "indexed": true, 32 | "internalType": "address", 33 | "name": "sender", 34 | "type": "address" 35 | } 36 | ], 37 | "name": "RandomNumberRequested", 38 | "type": "event" 39 | }, 40 | { 41 | "inputs": [], 42 | "name": "getLastRequestId", 43 | "outputs": [ 44 | { 45 | "internalType": "uint32", 46 | "name": "requestId", 47 | "type": "uint32" 48 | } 49 | ], 50 | "stateMutability": "view", 51 | "type": "function" 52 | }, 53 | { 54 | "inputs": [], 55 | "name": "getRequestFee", 56 | "outputs": [ 57 | { 58 | "internalType": "address", 59 | "name": "_feeToken", 60 | "type": "address" 61 | }, 62 | { 63 | "internalType": "uint256", 64 | "name": "_requestFee", 65 | "type": "uint256" 66 | } 67 | ], 68 | "stateMutability": "view", 69 | "type": "function" 70 | }, 71 | { 72 | "inputs": [ 73 | { 74 | "internalType": "uint32", 75 | "name": "", 76 | "type": "uint32" 77 | } 78 | ], 79 | "name": "isRequestComplete", 80 | "outputs": [ 81 | { 82 | "internalType": "bool", 83 | "name": "", 84 | "type": "bool" 85 | } 86 | ], 87 | "stateMutability": "view", 88 | "type": "function" 89 | }, 90 | { 91 | "inputs": [ 92 | { 93 | "internalType": "uint32", 94 | "name": "", 95 | "type": "uint32" 96 | } 97 | ], 98 | "name": "randomNumber", 99 | "outputs": [ 100 | { 101 | "internalType": "uint256", 102 | "name": "", 103 | "type": "uint256" 104 | } 105 | ], 106 | "stateMutability": "nonpayable", 107 | "type": "function" 108 | }, 109 | { 110 | "inputs": [], 111 | "name": "requestRandomNumber", 112 | "outputs": [ 113 | { 114 | "internalType": "uint32", 115 | "name": "", 116 | "type": "uint32" 117 | }, 118 | { 119 | "internalType": "uint32", 120 | "name": "", 121 | "type": "uint32" 122 | } 123 | ], 124 | "stateMutability": "nonpayable", 125 | "type": "function" 126 | }, 127 | { 128 | "inputs": [ 129 | { 130 | "internalType": "uint256", 131 | "name": "_random", 132 | "type": "uint256" 133 | } 134 | ], 135 | "name": "setRandomNumber", 136 | "outputs": [], 137 | "stateMutability": "nonpayable", 138 | "type": "function" 139 | }, 140 | { 141 | "inputs": [ 142 | { 143 | "internalType": "address", 144 | "name": "_feeToken", 145 | "type": "address" 146 | }, 147 | { 148 | "internalType": "uint256", 149 | "name": "_requestFee", 150 | "type": "uint256" 151 | } 152 | ], 153 | "name": "setRequestFee", 154 | "outputs": [], 155 | "stateMutability": "nonpayable", 156 | "type": "function" 157 | } 158 | ] -------------------------------------------------------------------------------- /abis/v3_1_0/abis/BalanceDripExposed.json: -------------------------------------------------------------------------------- 1 | [ 2 | { 3 | "anonymous": false, 4 | "inputs": [ 5 | { 6 | "indexed": true, 7 | "internalType": "address", 8 | "name": "user", 9 | "type": "address" 10 | }, 11 | { 12 | "indexed": false, 13 | "internalType": "uint256", 14 | "name": "newTokens", 15 | "type": "uint256" 16 | } 17 | ], 18 | "name": "Dripped", 19 | "type": "event" 20 | }, 21 | { 22 | "anonymous": false, 23 | "inputs": [ 24 | { 25 | "indexed": false, 26 | "internalType": "uint256", 27 | "name": "newTokens", 28 | "type": "uint256" 29 | } 30 | ], 31 | "name": "DrippedTotalSupply", 32 | "type": "event" 33 | }, 34 | { 35 | "inputs": [ 36 | { 37 | "internalType": "address", 38 | "name": "user", 39 | "type": "address" 40 | }, 41 | { 42 | "internalType": "uint256", 43 | "name": "userMeasureBalance", 44 | "type": "uint256" 45 | } 46 | ], 47 | "name": "captureNewTokensForUser", 48 | "outputs": [ 49 | { 50 | "internalType": "uint128", 51 | "name": "", 52 | "type": "uint128" 53 | } 54 | ], 55 | "stateMutability": "nonpayable", 56 | "type": "function" 57 | }, 58 | { 59 | "inputs": [ 60 | { 61 | "internalType": "uint256", 62 | "name": "measureTotalSupply", 63 | "type": "uint256" 64 | }, 65 | { 66 | "internalType": "uint256", 67 | "name": "currentTime", 68 | "type": "uint256" 69 | }, 70 | { 71 | "internalType": "uint256", 72 | "name": "maxNewTokens", 73 | "type": "uint256" 74 | } 75 | ], 76 | "name": "drip", 77 | "outputs": [ 78 | { 79 | "internalType": "uint256", 80 | "name": "", 81 | "type": "uint256" 82 | } 83 | ], 84 | "stateMutability": "nonpayable", 85 | "type": "function" 86 | }, 87 | { 88 | "inputs": [ 89 | { 90 | "internalType": "uint256", 91 | "name": "measureTotalSupply", 92 | "type": "uint256" 93 | }, 94 | { 95 | "internalType": "uint256", 96 | "name": "currentTime", 97 | "type": "uint256" 98 | }, 99 | { 100 | "internalType": "uint256", 101 | "name": "maxNewTokens", 102 | "type": "uint256" 103 | } 104 | ], 105 | "name": "dripTwice", 106 | "outputs": [ 107 | { 108 | "internalType": "uint256", 109 | "name": "", 110 | "type": "uint256" 111 | } 112 | ], 113 | "stateMutability": "nonpayable", 114 | "type": "function" 115 | }, 116 | { 117 | "inputs": [], 118 | "name": "exchangeRateMantissa", 119 | "outputs": [ 120 | { 121 | "internalType": "uint256", 122 | "name": "", 123 | "type": "uint256" 124 | } 125 | ], 126 | "stateMutability": "view", 127 | "type": "function" 128 | }, 129 | { 130 | "inputs": [], 131 | "name": "resetTotalDripped", 132 | "outputs": [], 133 | "stateMutability": "nonpayable", 134 | "type": "function" 135 | }, 136 | { 137 | "inputs": [ 138 | { 139 | "internalType": "uint256", 140 | "name": "dripRatePerSecond", 141 | "type": "uint256" 142 | } 143 | ], 144 | "name": "setDripRate", 145 | "outputs": [], 146 | "stateMutability": "nonpayable", 147 | "type": "function" 148 | }, 149 | { 150 | "inputs": [], 151 | "name": "totalDripped", 152 | "outputs": [ 153 | { 154 | "internalType": "uint256", 155 | "name": "", 156 | "type": "uint256" 157 | } 158 | ], 159 | "stateMutability": "view", 160 | "type": "function" 161 | } 162 | ] -------------------------------------------------------------------------------- /abis/v3_1_0/abis/ControlledTokenBuilder.json: -------------------------------------------------------------------------------- 1 | [ 2 | { 3 | "inputs": [ 4 | { 5 | "internalType": "contract ControlledTokenProxyFactory", 6 | "name": "_controlledTokenProxyFactory", 7 | "type": "address" 8 | }, 9 | { 10 | "internalType": "contract TicketProxyFactory", 11 | "name": "_ticketProxyFactory", 12 | "type": "address" 13 | } 14 | ], 15 | "stateMutability": "nonpayable", 16 | "type": "constructor" 17 | }, 18 | { 19 | "anonymous": false, 20 | "inputs": [ 21 | { 22 | "indexed": true, 23 | "internalType": "address", 24 | "name": "token", 25 | "type": "address" 26 | } 27 | ], 28 | "name": "CreatedControlledToken", 29 | "type": "event" 30 | }, 31 | { 32 | "anonymous": false, 33 | "inputs": [ 34 | { 35 | "indexed": true, 36 | "internalType": "address", 37 | "name": "token", 38 | "type": "address" 39 | } 40 | ], 41 | "name": "CreatedTicket", 42 | "type": "event" 43 | }, 44 | { 45 | "inputs": [], 46 | "name": "controlledTokenProxyFactory", 47 | "outputs": [ 48 | { 49 | "internalType": "contract ControlledTokenProxyFactory", 50 | "name": "", 51 | "type": "address" 52 | } 53 | ], 54 | "stateMutability": "view", 55 | "type": "function" 56 | }, 57 | { 58 | "inputs": [ 59 | { 60 | "components": [ 61 | { 62 | "internalType": "string", 63 | "name": "name", 64 | "type": "string" 65 | }, 66 | { 67 | "internalType": "string", 68 | "name": "symbol", 69 | "type": "string" 70 | }, 71 | { 72 | "internalType": "uint8", 73 | "name": "decimals", 74 | "type": "uint8" 75 | }, 76 | { 77 | "internalType": "contract TokenControllerInterface", 78 | "name": "controller", 79 | "type": "address" 80 | } 81 | ], 82 | "internalType": "struct ControlledTokenBuilder.ControlledTokenConfig", 83 | "name": "config", 84 | "type": "tuple" 85 | } 86 | ], 87 | "name": "createControlledToken", 88 | "outputs": [ 89 | { 90 | "internalType": "contract ControlledToken", 91 | "name": "", 92 | "type": "address" 93 | } 94 | ], 95 | "stateMutability": "nonpayable", 96 | "type": "function" 97 | }, 98 | { 99 | "inputs": [ 100 | { 101 | "components": [ 102 | { 103 | "internalType": "string", 104 | "name": "name", 105 | "type": "string" 106 | }, 107 | { 108 | "internalType": "string", 109 | "name": "symbol", 110 | "type": "string" 111 | }, 112 | { 113 | "internalType": "uint8", 114 | "name": "decimals", 115 | "type": "uint8" 116 | }, 117 | { 118 | "internalType": "contract TokenControllerInterface", 119 | "name": "controller", 120 | "type": "address" 121 | } 122 | ], 123 | "internalType": "struct ControlledTokenBuilder.ControlledTokenConfig", 124 | "name": "config", 125 | "type": "tuple" 126 | } 127 | ], 128 | "name": "createTicket", 129 | "outputs": [ 130 | { 131 | "internalType": "contract Ticket", 132 | "name": "", 133 | "type": "address" 134 | } 135 | ], 136 | "stateMutability": "nonpayable", 137 | "type": "function" 138 | }, 139 | { 140 | "inputs": [], 141 | "name": "ticketProxyFactory", 142 | "outputs": [ 143 | { 144 | "internalType": "contract TicketProxyFactory", 145 | "name": "", 146 | "type": "address" 147 | } 148 | ], 149 | "stateMutability": "view", 150 | "type": "function" 151 | } 152 | ] -------------------------------------------------------------------------------- /abis/v3_1_0/abis/PermitAndDepositDai.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 | "inputs": [ 23 | { 24 | "internalType": "address", 25 | "name": "dai", 26 | "type": "address" 27 | }, 28 | { 29 | "internalType": "address", 30 | "name": "prizePool", 31 | "type": "address" 32 | }, 33 | { 34 | "internalType": "address", 35 | "name": "to", 36 | "type": "address" 37 | }, 38 | { 39 | "internalType": "uint256", 40 | "name": "amount", 41 | "type": "uint256" 42 | }, 43 | { 44 | "internalType": "address", 45 | "name": "controlledToken", 46 | "type": "address" 47 | }, 48 | { 49 | "internalType": "address", 50 | "name": "referrer", 51 | "type": "address" 52 | } 53 | ], 54 | "name": "depositTo", 55 | "outputs": [], 56 | "stateMutability": "nonpayable", 57 | "type": "function" 58 | }, 59 | { 60 | "inputs": [], 61 | "name": "owner", 62 | "outputs": [ 63 | { 64 | "internalType": "address", 65 | "name": "", 66 | "type": "address" 67 | } 68 | ], 69 | "stateMutability": "view", 70 | "type": "function" 71 | }, 72 | { 73 | "inputs": [ 74 | { 75 | "internalType": "address", 76 | "name": "dai", 77 | "type": "address" 78 | }, 79 | { 80 | "internalType": "address", 81 | "name": "holder", 82 | "type": "address" 83 | }, 84 | { 85 | "internalType": "uint256", 86 | "name": "nonce", 87 | "type": "uint256" 88 | }, 89 | { 90 | "internalType": "uint256", 91 | "name": "expiry", 92 | "type": "uint256" 93 | }, 94 | { 95 | "internalType": "bool", 96 | "name": "allowed", 97 | "type": "bool" 98 | }, 99 | { 100 | "internalType": "uint8", 101 | "name": "v", 102 | "type": "uint8" 103 | }, 104 | { 105 | "internalType": "bytes32", 106 | "name": "r", 107 | "type": "bytes32" 108 | }, 109 | { 110 | "internalType": "bytes32", 111 | "name": "s", 112 | "type": "bytes32" 113 | }, 114 | { 115 | "internalType": "address", 116 | "name": "prizePool", 117 | "type": "address" 118 | }, 119 | { 120 | "internalType": "address", 121 | "name": "to", 122 | "type": "address" 123 | }, 124 | { 125 | "internalType": "uint256", 126 | "name": "amount", 127 | "type": "uint256" 128 | }, 129 | { 130 | "internalType": "address", 131 | "name": "controlledToken", 132 | "type": "address" 133 | }, 134 | { 135 | "internalType": "address", 136 | "name": "referrer", 137 | "type": "address" 138 | } 139 | ], 140 | "name": "permitAndDepositTo", 141 | "outputs": [], 142 | "stateMutability": "nonpayable", 143 | "type": "function" 144 | }, 145 | { 146 | "inputs": [], 147 | "name": "renounceOwnership", 148 | "outputs": [], 149 | "stateMutability": "nonpayable", 150 | "type": "function" 151 | }, 152 | { 153 | "inputs": [ 154 | { 155 | "internalType": "address", 156 | "name": "newOwner", 157 | "type": "address" 158 | } 159 | ], 160 | "name": "transferOwnership", 161 | "outputs": [], 162 | "stateMutability": "nonpayable", 163 | "type": "function" 164 | } 165 | ] -------------------------------------------------------------------------------- /abis/v3_1_0/abis/BalanceDripManagerExposed.json: -------------------------------------------------------------------------------- 1 | [ 2 | { 3 | "inputs": [ 4 | { 5 | "internalType": "address", 6 | "name": "measure", 7 | "type": "address" 8 | }, 9 | { 10 | "internalType": "address", 11 | "name": "dripToken", 12 | "type": "address" 13 | }, 14 | { 15 | "internalType": "uint256", 16 | "name": "dripRatePerSecond", 17 | "type": "uint256" 18 | } 19 | ], 20 | "name": "activateDrip", 21 | "outputs": [], 22 | "stateMutability": "nonpayable", 23 | "type": "function" 24 | }, 25 | { 26 | "inputs": [ 27 | { 28 | "internalType": "address", 29 | "name": "measure", 30 | "type": "address" 31 | }, 32 | { 33 | "internalType": "address", 34 | "name": "prevDripToken", 35 | "type": "address" 36 | }, 37 | { 38 | "internalType": "address", 39 | "name": "dripToken", 40 | "type": "address" 41 | }, 42 | { 43 | "internalType": "uint32", 44 | "name": "currentTime", 45 | "type": "uint32" 46 | }, 47 | { 48 | "internalType": "uint256", 49 | "name": "maxNewTokens", 50 | "type": "uint256" 51 | } 52 | ], 53 | "name": "deactivateDrip", 54 | "outputs": [], 55 | "stateMutability": "nonpayable", 56 | "type": "function" 57 | }, 58 | { 59 | "inputs": [ 60 | { 61 | "internalType": "address", 62 | "name": "measure", 63 | "type": "address" 64 | } 65 | ], 66 | "name": "getActiveBalanceDrips", 67 | "outputs": [ 68 | { 69 | "internalType": "address[]", 70 | "name": "", 71 | "type": "address[]" 72 | } 73 | ], 74 | "stateMutability": "view", 75 | "type": "function" 76 | }, 77 | { 78 | "inputs": [ 79 | { 80 | "internalType": "address", 81 | "name": "measure", 82 | "type": "address" 83 | }, 84 | { 85 | "internalType": "address", 86 | "name": "dripToken", 87 | "type": "address" 88 | } 89 | ], 90 | "name": "getDrip", 91 | "outputs": [ 92 | { 93 | "internalType": "uint256", 94 | "name": "dripRatePerSecond", 95 | "type": "uint256" 96 | }, 97 | { 98 | "internalType": "uint128", 99 | "name": "exchangeRateMantissa", 100 | "type": "uint128" 101 | }, 102 | { 103 | "internalType": "uint32", 104 | "name": "timestamp", 105 | "type": "uint32" 106 | } 107 | ], 108 | "stateMutability": "view", 109 | "type": "function" 110 | }, 111 | { 112 | "inputs": [ 113 | { 114 | "internalType": "address", 115 | "name": "measure", 116 | "type": "address" 117 | }, 118 | { 119 | "internalType": "address", 120 | "name": "dripToken", 121 | "type": "address" 122 | } 123 | ], 124 | "name": "isDripActive", 125 | "outputs": [ 126 | { 127 | "internalType": "bool", 128 | "name": "", 129 | "type": "bool" 130 | } 131 | ], 132 | "stateMutability": "view", 133 | "type": "function" 134 | }, 135 | { 136 | "inputs": [ 137 | { 138 | "internalType": "address", 139 | "name": "measure", 140 | "type": "address" 141 | }, 142 | { 143 | "internalType": "address", 144 | "name": "dripToken", 145 | "type": "address" 146 | }, 147 | { 148 | "internalType": "uint256", 149 | "name": "dripRatePerSecond", 150 | "type": "uint256" 151 | }, 152 | { 153 | "internalType": "uint32", 154 | "name": "currentTime", 155 | "type": "uint32" 156 | }, 157 | { 158 | "internalType": "uint256", 159 | "name": "maxNewTokens", 160 | "type": "uint256" 161 | } 162 | ], 163 | "name": "setDripRate", 164 | "outputs": [], 165 | "stateMutability": "nonpayable", 166 | "type": "function" 167 | } 168 | ] -------------------------------------------------------------------------------- /abis/v3_1_0/abis/IERC20Upgradeable.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": "from", 34 | "type": "address" 35 | }, 36 | { 37 | "indexed": true, 38 | "internalType": "address", 39 | "name": "to", 40 | "type": "address" 41 | }, 42 | { 43 | "indexed": false, 44 | "internalType": "uint256", 45 | "name": "value", 46 | "type": "uint256" 47 | } 48 | ], 49 | "name": "Transfer", 50 | "type": "event" 51 | }, 52 | { 53 | "inputs": [ 54 | { 55 | "internalType": "address", 56 | "name": "owner", 57 | "type": "address" 58 | }, 59 | { 60 | "internalType": "address", 61 | "name": "spender", 62 | "type": "address" 63 | } 64 | ], 65 | "name": "allowance", 66 | "outputs": [ 67 | { 68 | "internalType": "uint256", 69 | "name": "", 70 | "type": "uint256" 71 | } 72 | ], 73 | "stateMutability": "view", 74 | "type": "function" 75 | }, 76 | { 77 | "inputs": [ 78 | { 79 | "internalType": "address", 80 | "name": "spender", 81 | "type": "address" 82 | }, 83 | { 84 | "internalType": "uint256", 85 | "name": "amount", 86 | "type": "uint256" 87 | } 88 | ], 89 | "name": "approve", 90 | "outputs": [ 91 | { 92 | "internalType": "bool", 93 | "name": "", 94 | "type": "bool" 95 | } 96 | ], 97 | "stateMutability": "nonpayable", 98 | "type": "function" 99 | }, 100 | { 101 | "inputs": [ 102 | { 103 | "internalType": "address", 104 | "name": "account", 105 | "type": "address" 106 | } 107 | ], 108 | "name": "balanceOf", 109 | "outputs": [ 110 | { 111 | "internalType": "uint256", 112 | "name": "", 113 | "type": "uint256" 114 | } 115 | ], 116 | "stateMutability": "view", 117 | "type": "function" 118 | }, 119 | { 120 | "inputs": [], 121 | "name": "totalSupply", 122 | "outputs": [ 123 | { 124 | "internalType": "uint256", 125 | "name": "", 126 | "type": "uint256" 127 | } 128 | ], 129 | "stateMutability": "view", 130 | "type": "function" 131 | }, 132 | { 133 | "inputs": [ 134 | { 135 | "internalType": "address", 136 | "name": "recipient", 137 | "type": "address" 138 | }, 139 | { 140 | "internalType": "uint256", 141 | "name": "amount", 142 | "type": "uint256" 143 | } 144 | ], 145 | "name": "transfer", 146 | "outputs": [ 147 | { 148 | "internalType": "bool", 149 | "name": "", 150 | "type": "bool" 151 | } 152 | ], 153 | "stateMutability": "nonpayable", 154 | "type": "function" 155 | }, 156 | { 157 | "inputs": [ 158 | { 159 | "internalType": "address", 160 | "name": "sender", 161 | "type": "address" 162 | }, 163 | { 164 | "internalType": "address", 165 | "name": "recipient", 166 | "type": "address" 167 | }, 168 | { 169 | "internalType": "uint256", 170 | "name": "amount", 171 | "type": "uint256" 172 | } 173 | ], 174 | "name": "transferFrom", 175 | "outputs": [ 176 | { 177 | "internalType": "bool", 178 | "name": "", 179 | "type": "bool" 180 | } 181 | ], 182 | "stateMutability": "nonpayable", 183 | "type": "function" 184 | } 185 | ] -------------------------------------------------------------------------------- /abis/v3_1_0/abis/VolumeDripManagerExposed.json: -------------------------------------------------------------------------------- 1 | [ 2 | { 3 | "inputs": [ 4 | { 5 | "internalType": "address", 6 | "name": "measure", 7 | "type": "address" 8 | }, 9 | { 10 | "internalType": "address", 11 | "name": "dripToken", 12 | "type": "address" 13 | }, 14 | { 15 | "internalType": "uint32", 16 | "name": "periodSeconds", 17 | "type": "uint32" 18 | }, 19 | { 20 | "internalType": "uint112", 21 | "name": "dripAmount", 22 | "type": "uint112" 23 | }, 24 | { 25 | "internalType": "uint32", 26 | "name": "endTime", 27 | "type": "uint32" 28 | } 29 | ], 30 | "name": "activate", 31 | "outputs": [], 32 | "stateMutability": "nonpayable", 33 | "type": "function" 34 | }, 35 | { 36 | "inputs": [ 37 | { 38 | "internalType": "address", 39 | "name": "measure", 40 | "type": "address" 41 | }, 42 | { 43 | "internalType": "address", 44 | "name": "dripToken", 45 | "type": "address" 46 | }, 47 | { 48 | "internalType": "address", 49 | "name": "prevDripToken", 50 | "type": "address" 51 | } 52 | ], 53 | "name": "deactivate", 54 | "outputs": [], 55 | "stateMutability": "nonpayable", 56 | "type": "function" 57 | }, 58 | { 59 | "inputs": [ 60 | { 61 | "internalType": "address", 62 | "name": "measure", 63 | "type": "address" 64 | } 65 | ], 66 | "name": "getActiveVolumeDrips", 67 | "outputs": [ 68 | { 69 | "internalType": "address[]", 70 | "name": "", 71 | "type": "address[]" 72 | } 73 | ], 74 | "stateMutability": "view", 75 | "type": "function" 76 | }, 77 | { 78 | "inputs": [ 79 | { 80 | "internalType": "address", 81 | "name": "measure", 82 | "type": "address" 83 | }, 84 | { 85 | "internalType": "address", 86 | "name": "dripToken", 87 | "type": "address" 88 | } 89 | ], 90 | "name": "getDrip", 91 | "outputs": [ 92 | { 93 | "internalType": "uint32", 94 | "name": "periodSeconds", 95 | "type": "uint32" 96 | }, 97 | { 98 | "internalType": "uint112", 99 | "name": "dripAmount", 100 | "type": "uint112" 101 | } 102 | ], 103 | "stateMutability": "view", 104 | "type": "function" 105 | }, 106 | { 107 | "inputs": [ 108 | { 109 | "internalType": "address", 110 | "name": "measure", 111 | "type": "address" 112 | }, 113 | { 114 | "internalType": "address", 115 | "name": "dripToken", 116 | "type": "address" 117 | }, 118 | { 119 | "internalType": "uint32", 120 | "name": "period", 121 | "type": "uint32" 122 | } 123 | ], 124 | "name": "getPeriod", 125 | "outputs": [ 126 | { 127 | "internalType": "uint112", 128 | "name": "totalSupply", 129 | "type": "uint112" 130 | }, 131 | { 132 | "internalType": "uint112", 133 | "name": "dripAmount", 134 | "type": "uint112" 135 | }, 136 | { 137 | "internalType": "uint32", 138 | "name": "endTime", 139 | "type": "uint32" 140 | } 141 | ], 142 | "stateMutability": "view", 143 | "type": "function" 144 | }, 145 | { 146 | "inputs": [ 147 | { 148 | "internalType": "address", 149 | "name": "measure", 150 | "type": "address" 151 | }, 152 | { 153 | "internalType": "address", 154 | "name": "dripToken", 155 | "type": "address" 156 | } 157 | ], 158 | "name": "isActive", 159 | "outputs": [ 160 | { 161 | "internalType": "bool", 162 | "name": "", 163 | "type": "bool" 164 | } 165 | ], 166 | "stateMutability": "view", 167 | "type": "function" 168 | }, 169 | { 170 | "inputs": [ 171 | { 172 | "internalType": "address", 173 | "name": "measure", 174 | "type": "address" 175 | }, 176 | { 177 | "internalType": "address", 178 | "name": "dripToken", 179 | "type": "address" 180 | }, 181 | { 182 | "internalType": "uint32", 183 | "name": "periodSeconds", 184 | "type": "uint32" 185 | }, 186 | { 187 | "internalType": "uint112", 188 | "name": "dripAmount", 189 | "type": "uint112" 190 | } 191 | ], 192 | "name": "set", 193 | "outputs": [], 194 | "stateMutability": "nonpayable", 195 | "type": "function" 196 | } 197 | ] -------------------------------------------------------------------------------- /abis/v3_1_0/abis/MultipleWinnersBuilder.json: -------------------------------------------------------------------------------- 1 | [ 2 | { 3 | "inputs": [ 4 | { 5 | "internalType": "contract MultipleWinnersProxyFactory", 6 | "name": "_multipleWinnersProxyFactory", 7 | "type": "address" 8 | }, 9 | { 10 | "internalType": "contract ControlledTokenBuilder", 11 | "name": "_controlledTokenBuilder", 12 | "type": "address" 13 | } 14 | ], 15 | "stateMutability": "nonpayable", 16 | "type": "constructor" 17 | }, 18 | { 19 | "anonymous": false, 20 | "inputs": [ 21 | { 22 | "indexed": true, 23 | "internalType": "address", 24 | "name": "prizeStrategy", 25 | "type": "address" 26 | } 27 | ], 28 | "name": "MultipleWinnersCreated", 29 | "type": "event" 30 | }, 31 | { 32 | "inputs": [], 33 | "name": "controlledTokenBuilder", 34 | "outputs": [ 35 | { 36 | "internalType": "contract ControlledTokenBuilder", 37 | "name": "", 38 | "type": "address" 39 | } 40 | ], 41 | "stateMutability": "view", 42 | "type": "function" 43 | }, 44 | { 45 | "inputs": [ 46 | { 47 | "internalType": "contract PrizePool", 48 | "name": "prizePool", 49 | "type": "address" 50 | }, 51 | { 52 | "components": [ 53 | { 54 | "internalType": "contract RNGInterface", 55 | "name": "rngService", 56 | "type": "address" 57 | }, 58 | { 59 | "internalType": "uint256", 60 | "name": "prizePeriodStart", 61 | "type": "uint256" 62 | }, 63 | { 64 | "internalType": "uint256", 65 | "name": "prizePeriodSeconds", 66 | "type": "uint256" 67 | }, 68 | { 69 | "internalType": "string", 70 | "name": "ticketName", 71 | "type": "string" 72 | }, 73 | { 74 | "internalType": "string", 75 | "name": "ticketSymbol", 76 | "type": "string" 77 | }, 78 | { 79 | "internalType": "string", 80 | "name": "sponsorshipName", 81 | "type": "string" 82 | }, 83 | { 84 | "internalType": "string", 85 | "name": "sponsorshipSymbol", 86 | "type": "string" 87 | }, 88 | { 89 | "internalType": "uint256", 90 | "name": "ticketCreditLimitMantissa", 91 | "type": "uint256" 92 | }, 93 | { 94 | "internalType": "uint256", 95 | "name": "ticketCreditRateMantissa", 96 | "type": "uint256" 97 | }, 98 | { 99 | "internalType": "uint256", 100 | "name": "numberOfWinners", 101 | "type": "uint256" 102 | }, 103 | { 104 | "internalType": "bool", 105 | "name": "splitExternalErc20Awards", 106 | "type": "bool" 107 | } 108 | ], 109 | "internalType": "struct MultipleWinnersBuilder.MultipleWinnersConfig", 110 | "name": "prizeStrategyConfig", 111 | "type": "tuple" 112 | }, 113 | { 114 | "internalType": "uint8", 115 | "name": "decimals", 116 | "type": "uint8" 117 | }, 118 | { 119 | "internalType": "address", 120 | "name": "owner", 121 | "type": "address" 122 | } 123 | ], 124 | "name": "createMultipleWinners", 125 | "outputs": [ 126 | { 127 | "internalType": "contract MultipleWinners", 128 | "name": "", 129 | "type": "address" 130 | } 131 | ], 132 | "stateMutability": "nonpayable", 133 | "type": "function" 134 | }, 135 | { 136 | "inputs": [ 137 | { 138 | "internalType": "contract PeriodicPrizeStrategy", 139 | "name": "prizeStrategy", 140 | "type": "address" 141 | }, 142 | { 143 | "internalType": "uint256", 144 | "name": "numberOfWinners", 145 | "type": "uint256" 146 | } 147 | ], 148 | "name": "createMultipleWinnersFromExistingPrizeStrategy", 149 | "outputs": [ 150 | { 151 | "internalType": "contract MultipleWinners", 152 | "name": "", 153 | "type": "address" 154 | } 155 | ], 156 | "stateMutability": "nonpayable", 157 | "type": "function" 158 | }, 159 | { 160 | "inputs": [], 161 | "name": "multipleWinnersProxyFactory", 162 | "outputs": [ 163 | { 164 | "internalType": "contract MultipleWinnersProxyFactory", 165 | "name": "", 166 | "type": "address" 167 | } 168 | ], 169 | "stateMutability": "view", 170 | "type": "function" 171 | } 172 | ] -------------------------------------------------------------------------------- /abis/v3_1_0/abis/VolumeDripExposed.json: -------------------------------------------------------------------------------- 1 | [ 2 | { 3 | "anonymous": false, 4 | "inputs": [ 5 | { 6 | "indexed": false, 7 | "internalType": "address", 8 | "name": "user", 9 | "type": "address" 10 | }, 11 | { 12 | "indexed": false, 13 | "internalType": "uint256", 14 | "name": "amount", 15 | "type": "uint256" 16 | } 17 | ], 18 | "name": "DripTokensBurned", 19 | "type": "event" 20 | }, 21 | { 22 | "anonymous": false, 23 | "inputs": [ 24 | { 25 | "indexed": false, 26 | "internalType": "uint256", 27 | "name": "amount", 28 | "type": "uint256" 29 | } 30 | ], 31 | "name": "Minted", 32 | "type": "event" 33 | }, 34 | { 35 | "anonymous": false, 36 | "inputs": [ 37 | { 38 | "indexed": false, 39 | "internalType": "uint256", 40 | "name": "amount", 41 | "type": "uint256" 42 | } 43 | ], 44 | "name": "MintedTotalSupply", 45 | "type": "event" 46 | }, 47 | { 48 | "inputs": [ 49 | { 50 | "internalType": "uint256", 51 | "name": "currentTime", 52 | "type": "uint256" 53 | }, 54 | { 55 | "internalType": "uint256", 56 | "name": "maxNewTokens", 57 | "type": "uint256" 58 | } 59 | ], 60 | "name": "drip", 61 | "outputs": [ 62 | { 63 | "internalType": "uint256", 64 | "name": "", 65 | "type": "uint256" 66 | } 67 | ], 68 | "stateMutability": "nonpayable", 69 | "type": "function" 70 | }, 71 | { 72 | "inputs": [ 73 | { 74 | "internalType": "address", 75 | "name": "user", 76 | "type": "address" 77 | } 78 | ], 79 | "name": "getDeposit", 80 | "outputs": [ 81 | { 82 | "internalType": "uint112", 83 | "name": "balance", 84 | "type": "uint112" 85 | }, 86 | { 87 | "internalType": "uint32", 88 | "name": "period", 89 | "type": "uint32" 90 | } 91 | ], 92 | "stateMutability": "view", 93 | "type": "function" 94 | }, 95 | { 96 | "inputs": [], 97 | "name": "getDrip", 98 | "outputs": [ 99 | { 100 | "internalType": "uint32", 101 | "name": "periodSeconds", 102 | "type": "uint32" 103 | }, 104 | { 105 | "internalType": "uint128", 106 | "name": "dripAmount", 107 | "type": "uint128" 108 | } 109 | ], 110 | "stateMutability": "view", 111 | "type": "function" 112 | }, 113 | { 114 | "inputs": [ 115 | { 116 | "internalType": "uint32", 117 | "name": "period", 118 | "type": "uint32" 119 | } 120 | ], 121 | "name": "getPeriod", 122 | "outputs": [ 123 | { 124 | "internalType": "uint112", 125 | "name": "totalSupply", 126 | "type": "uint112" 127 | }, 128 | { 129 | "internalType": "uint112", 130 | "name": "dripAmount", 131 | "type": "uint112" 132 | }, 133 | { 134 | "internalType": "uint32", 135 | "name": "endTime", 136 | "type": "uint32" 137 | } 138 | ], 139 | "stateMutability": "view", 140 | "type": "function" 141 | }, 142 | { 143 | "inputs": [ 144 | { 145 | "internalType": "address", 146 | "name": "user", 147 | "type": "address" 148 | }, 149 | { 150 | "internalType": "uint256", 151 | "name": "amount", 152 | "type": "uint256" 153 | } 154 | ], 155 | "name": "mint", 156 | "outputs": [ 157 | { 158 | "internalType": "uint256", 159 | "name": "", 160 | "type": "uint256" 161 | } 162 | ], 163 | "stateMutability": "nonpayable", 164 | "type": "function" 165 | }, 166 | { 167 | "inputs": [ 168 | { 169 | "internalType": "uint32", 170 | "name": "periodSeconds", 171 | "type": "uint32" 172 | }, 173 | { 174 | "internalType": "uint112", 175 | "name": "dripAmount", 176 | "type": "uint112" 177 | }, 178 | { 179 | "internalType": "uint32", 180 | "name": "endTime", 181 | "type": "uint32" 182 | } 183 | ], 184 | "name": "setNewPeriod", 185 | "outputs": [], 186 | "stateMutability": "nonpayable", 187 | "type": "function" 188 | }, 189 | { 190 | "inputs": [ 191 | { 192 | "internalType": "uint32", 193 | "name": "periodSeconds", 194 | "type": "uint32" 195 | }, 196 | { 197 | "internalType": "uint112", 198 | "name": "dripAmount", 199 | "type": "uint112" 200 | } 201 | ], 202 | "name": "setNextPeriod", 203 | "outputs": [], 204 | "stateMutability": "nonpayable", 205 | "type": "function" 206 | } 207 | ] -------------------------------------------------------------------------------- /abis/v3_1_0/abis/IERC1820RegistryUpgradeable.json: -------------------------------------------------------------------------------- 1 | [ 2 | { 3 | "anonymous": false, 4 | "inputs": [ 5 | { 6 | "indexed": true, 7 | "internalType": "address", 8 | "name": "account", 9 | "type": "address" 10 | }, 11 | { 12 | "indexed": true, 13 | "internalType": "bytes32", 14 | "name": "interfaceHash", 15 | "type": "bytes32" 16 | }, 17 | { 18 | "indexed": true, 19 | "internalType": "address", 20 | "name": "implementer", 21 | "type": "address" 22 | } 23 | ], 24 | "name": "InterfaceImplementerSet", 25 | "type": "event" 26 | }, 27 | { 28 | "anonymous": false, 29 | "inputs": [ 30 | { 31 | "indexed": true, 32 | "internalType": "address", 33 | "name": "account", 34 | "type": "address" 35 | }, 36 | { 37 | "indexed": true, 38 | "internalType": "address", 39 | "name": "newManager", 40 | "type": "address" 41 | } 42 | ], 43 | "name": "ManagerChanged", 44 | "type": "event" 45 | }, 46 | { 47 | "inputs": [ 48 | { 49 | "internalType": "address", 50 | "name": "account", 51 | "type": "address" 52 | }, 53 | { 54 | "internalType": "bytes32", 55 | "name": "_interfaceHash", 56 | "type": "bytes32" 57 | } 58 | ], 59 | "name": "getInterfaceImplementer", 60 | "outputs": [ 61 | { 62 | "internalType": "address", 63 | "name": "", 64 | "type": "address" 65 | } 66 | ], 67 | "stateMutability": "view", 68 | "type": "function" 69 | }, 70 | { 71 | "inputs": [ 72 | { 73 | "internalType": "address", 74 | "name": "account", 75 | "type": "address" 76 | } 77 | ], 78 | "name": "getManager", 79 | "outputs": [ 80 | { 81 | "internalType": "address", 82 | "name": "", 83 | "type": "address" 84 | } 85 | ], 86 | "stateMutability": "view", 87 | "type": "function" 88 | }, 89 | { 90 | "inputs": [ 91 | { 92 | "internalType": "address", 93 | "name": "account", 94 | "type": "address" 95 | }, 96 | { 97 | "internalType": "bytes4", 98 | "name": "interfaceId", 99 | "type": "bytes4" 100 | } 101 | ], 102 | "name": "implementsERC165Interface", 103 | "outputs": [ 104 | { 105 | "internalType": "bool", 106 | "name": "", 107 | "type": "bool" 108 | } 109 | ], 110 | "stateMutability": "view", 111 | "type": "function" 112 | }, 113 | { 114 | "inputs": [ 115 | { 116 | "internalType": "address", 117 | "name": "account", 118 | "type": "address" 119 | }, 120 | { 121 | "internalType": "bytes4", 122 | "name": "interfaceId", 123 | "type": "bytes4" 124 | } 125 | ], 126 | "name": "implementsERC165InterfaceNoCache", 127 | "outputs": [ 128 | { 129 | "internalType": "bool", 130 | "name": "", 131 | "type": "bool" 132 | } 133 | ], 134 | "stateMutability": "view", 135 | "type": "function" 136 | }, 137 | { 138 | "inputs": [ 139 | { 140 | "internalType": "string", 141 | "name": "interfaceName", 142 | "type": "string" 143 | } 144 | ], 145 | "name": "interfaceHash", 146 | "outputs": [ 147 | { 148 | "internalType": "bytes32", 149 | "name": "", 150 | "type": "bytes32" 151 | } 152 | ], 153 | "stateMutability": "pure", 154 | "type": "function" 155 | }, 156 | { 157 | "inputs": [ 158 | { 159 | "internalType": "address", 160 | "name": "account", 161 | "type": "address" 162 | }, 163 | { 164 | "internalType": "bytes32", 165 | "name": "_interfaceHash", 166 | "type": "bytes32" 167 | }, 168 | { 169 | "internalType": "address", 170 | "name": "implementer", 171 | "type": "address" 172 | } 173 | ], 174 | "name": "setInterfaceImplementer", 175 | "outputs": [], 176 | "stateMutability": "nonpayable", 177 | "type": "function" 178 | }, 179 | { 180 | "inputs": [ 181 | { 182 | "internalType": "address", 183 | "name": "account", 184 | "type": "address" 185 | }, 186 | { 187 | "internalType": "address", 188 | "name": "newManager", 189 | "type": "address" 190 | } 191 | ], 192 | "name": "setManager", 193 | "outputs": [], 194 | "stateMutability": "nonpayable", 195 | "type": "function" 196 | }, 197 | { 198 | "inputs": [ 199 | { 200 | "internalType": "address", 201 | "name": "account", 202 | "type": "address" 203 | }, 204 | { 205 | "internalType": "bytes4", 206 | "name": "interfaceId", 207 | "type": "bytes4" 208 | } 209 | ], 210 | "name": "updateERC165Cache", 211 | "outputs": [], 212 | "stateMutability": "nonpayable", 213 | "type": "function" 214 | } 215 | ] -------------------------------------------------------------------------------- /package.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "pooltogether", 3 | "license": "MIT", 4 | "version": "3.4.5", 5 | "scripts": { 6 | "reinstall": "rm -rf node_modules/ && yarn", 7 | "clean": "rm -rf build/ generated/", 8 | 9 | "prepare:local": "mustache networks/local.json subgraph.template.yaml subgraph.local.yaml", 10 | "create:local": "graph create --node http://127.0.0.1:8020 pooltogether/ptv3-subgraph subgraph.local.yaml", 11 | "remove:local": "graph remove --node http://127.0.0.1:8020 pooltogether/ptv3-subgraph subgraph.local.yaml", 12 | "create:rinkeby-stg": "graph create --node https://api.thegraph.com/deploy/ --ipfs https://api.thegraph.com/ipfs/ pooltogether/rinkeby-staging-v3 subgraph.local.yaml", 13 | 14 | "prepare:mainnet": "mustache networks/mainnet.json subgraph.template.yaml subgraph.mainnet.yaml", 15 | "prepare:rinkeby": "mustache networks/rinkeby.json subgraph.template.yaml subgraph.rinkeby.yaml", 16 | "prepare:polygon": "mustache networks/polygon.json subgraph.template.yaml subgraph.polygon.yaml", 17 | "prepare:celo": "mustache networks/celo.json subgraph.template.yaml subgraph.celo.yaml", 18 | "prepare:bsc": "mustache networks/bsc.json subgraph.template.yaml subgraph.bsc.yaml", 19 | 20 | "gen:mainnet": "graph codegen subgraph.mainnet.yaml", 21 | "gen:celo": "graph codegen subgraph.celo.yaml", 22 | "gen:rinkeby": "graph codegen subgraph.rinkeby.yaml", 23 | "gen:polygon": "graph codegen subgraph.polygon.yaml", 24 | "gen:bsc": "graph codegen subgraph.bsc.yaml", 25 | "gen:local": "graph codegen subgraph.local.yaml", 26 | 27 | "deploy:celo": "graph deploy --node https://api.thegraph.com/deploy/ --ipfs https://api.thegraph.com/ipfs/ pooltogether/celo-v3_4_5 subgraph.celo.yaml", 28 | "deploy:celo-stg": "graph deploy --node https://api.thegraph.com/deploy/ --ipfs https://api.thegraph.com/ipfs/ pooltogether/celo-staging-v3_4_5 subgraph.celo.yaml", 29 | 30 | "deploy:mainnet": "graph deploy --node https://api.thegraph.com/deploy/ --ipfs https://api.thegraph.com/ipfs/ pooltogether/pooltogether-v3_4_3 subgraph.mainnet.yaml", 31 | "deploy:mainnet-stg": "graph deploy --node https://api.thegraph.com/deploy/ --ipfs https://api.thegraph.com/ipfs/ pooltogether/pooltogether-staging-v3_4_3 subgraph.mainnet.yaml", 32 | 33 | "deploy:rinkeby": "graph deploy --node https://api.thegraph.com/deploy/ --ipfs https://api.thegraph.com/ipfs/ pooltogether/rinkeby-v3_4_3 subgraph.rinkeby.yaml", 34 | "deploy:rinkeby-stg": "graph deploy --node https://api.thegraph.com/deploy/ --ipfs https://api.thegraph.com/ipfs/ pooltogether/rinkeby-staging-v3_3_8 subgraph.rinkeby.yaml", 35 | 36 | "deploy:polygon": "graph deploy --node https://api.thegraph.com/deploy/ --ipfs https://api.thegraph.com/ipfs/ pooltogether/polygon-v3_4_3 subgraph.polygon.yaml", 37 | "deploy:polygon-stg": "graph deploy --node https://api.thegraph.com/deploy/ --ipfs https://api.thegraph.com/ipfs/ pooltogether/polygon-staging-v3_4_3 subgraph.polygon.yaml", 38 | 39 | "deploy:bsc": "graph deploy --node https://api.thegraph.com/deploy/ --ipfs https://api.thegraph.com/ipfs/ pooltogether/bsc-v3_4_3 subgraph.bsc.yaml", 40 | "deploy:bsc-stg": "graph deploy --node https://api.thegraph.com/deploy/ --ipfs https://api.thegraph.com/ipfs/ pooltogether/bsc-staging-v3_4_3 subgraph.bsc.yaml", 41 | 42 | "deploy:local": "graph deploy --node http://127.0.0.1:8020 --ipfs http://localhost:5001 pooltogether/ptv3-subgraph subgraph.local.yaml", 43 | 44 | "all-local": "yarn clean && yarn prepare:local && yarn gen:local && yarn deploy:local", 45 | 46 | "all-rinkeby": "yarn clean && yarn prepare:rinkeby && yarn gen:rinkeby && yarn deploy:rinkeby", 47 | "all-rinkeby-stg": "yarn clean && yarn prepare:rinkeby && yarn gen:rinkeby && yarn deploy:rinkeby-stg", 48 | 49 | "all-polygon": "yarn clean && yarn prepare:polygon && yarn gen:polygon && yarn deploy:polygon", 50 | "all-polygon-stg": "yarn clean && yarn prepare:polygon && yarn gen:polygon && yarn deploy:polygon-stg", 51 | 52 | "all-mainnet": "yarn clean && yarn prepare:mainnet && yarn gen:mainnet && yarn deploy:mainnet", 53 | "all-mainnet-stg": "yarn clean && yarn prepare:mainnet && yarn gen:mainnet && yarn deploy:mainnet-stg", 54 | 55 | "all-bsc": "yarn clean && yarn prepare:bsc && yarn gen:bsc && yarn deploy:bsc", 56 | "all-bsc-stg": "yarn clean && yarn prepare:bsc && yarn gen:bsc && yarn deploy:bsc-stg", 57 | 58 | "all-celo": "yarn clean && yarn prepare:celo && yarn gen:celo && yarn deploy:celo", 59 | "all-celo-stg": "yarn clean && yarn prepare:celo && yarn gen:celo && yarn deploy:celo-stg", 60 | 61 | "codegen": "graph codegen", 62 | "build:mainnet": "graph build subgraph.mainnet.yaml", 63 | "build:rinkeby": "graph build subgraph.rinkeby.yaml", 64 | "build:polygon": "graph build subgraph.polygon.yaml", 65 | "build:bsc": "graph build subgraph.bsc.yaml", 66 | "auth": "graph auth https://api.thegraph.com/deploy/", 67 | "tag-release": "PACKAGE_VERSION=$(./scripts/package-version.sh) && git tag -ae v$PACKAGE_VERSION && git push --tags" 68 | }, 69 | "dependencies": { 70 | "@graphprotocol/graph-cli": "^0.19.0", 71 | "@graphprotocol/graph-ts": "^0.20.1", 72 | "@pooltogether/pooltogether-contracts": "3.4.1-alpha.6", 73 | "mustache": "^4.0.1" 74 | } 75 | } 76 | -------------------------------------------------------------------------------- /abis/v3_1_0/abis/DaiInterface.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": "from", 34 | "type": "address" 35 | }, 36 | { 37 | "indexed": true, 38 | "internalType": "address", 39 | "name": "to", 40 | "type": "address" 41 | }, 42 | { 43 | "indexed": false, 44 | "internalType": "uint256", 45 | "name": "value", 46 | "type": "uint256" 47 | } 48 | ], 49 | "name": "Transfer", 50 | "type": "event" 51 | }, 52 | { 53 | "inputs": [ 54 | { 55 | "internalType": "address", 56 | "name": "owner", 57 | "type": "address" 58 | }, 59 | { 60 | "internalType": "address", 61 | "name": "spender", 62 | "type": "address" 63 | } 64 | ], 65 | "name": "allowance", 66 | "outputs": [ 67 | { 68 | "internalType": "uint256", 69 | "name": "", 70 | "type": "uint256" 71 | } 72 | ], 73 | "stateMutability": "view", 74 | "type": "function" 75 | }, 76 | { 77 | "inputs": [ 78 | { 79 | "internalType": "address", 80 | "name": "spender", 81 | "type": "address" 82 | }, 83 | { 84 | "internalType": "uint256", 85 | "name": "amount", 86 | "type": "uint256" 87 | } 88 | ], 89 | "name": "approve", 90 | "outputs": [ 91 | { 92 | "internalType": "bool", 93 | "name": "", 94 | "type": "bool" 95 | } 96 | ], 97 | "stateMutability": "nonpayable", 98 | "type": "function" 99 | }, 100 | { 101 | "inputs": [ 102 | { 103 | "internalType": "address", 104 | "name": "account", 105 | "type": "address" 106 | } 107 | ], 108 | "name": "balanceOf", 109 | "outputs": [ 110 | { 111 | "internalType": "uint256", 112 | "name": "", 113 | "type": "uint256" 114 | } 115 | ], 116 | "stateMutability": "view", 117 | "type": "function" 118 | }, 119 | { 120 | "inputs": [ 121 | { 122 | "internalType": "address", 123 | "name": "holder", 124 | "type": "address" 125 | }, 126 | { 127 | "internalType": "address", 128 | "name": "spender", 129 | "type": "address" 130 | }, 131 | { 132 | "internalType": "uint256", 133 | "name": "nonce", 134 | "type": "uint256" 135 | }, 136 | { 137 | "internalType": "uint256", 138 | "name": "expiry", 139 | "type": "uint256" 140 | }, 141 | { 142 | "internalType": "bool", 143 | "name": "allowed", 144 | "type": "bool" 145 | }, 146 | { 147 | "internalType": "uint8", 148 | "name": "v", 149 | "type": "uint8" 150 | }, 151 | { 152 | "internalType": "bytes32", 153 | "name": "r", 154 | "type": "bytes32" 155 | }, 156 | { 157 | "internalType": "bytes32", 158 | "name": "s", 159 | "type": "bytes32" 160 | } 161 | ], 162 | "name": "permit", 163 | "outputs": [], 164 | "stateMutability": "nonpayable", 165 | "type": "function" 166 | }, 167 | { 168 | "inputs": [], 169 | "name": "totalSupply", 170 | "outputs": [ 171 | { 172 | "internalType": "uint256", 173 | "name": "", 174 | "type": "uint256" 175 | } 176 | ], 177 | "stateMutability": "view", 178 | "type": "function" 179 | }, 180 | { 181 | "inputs": [ 182 | { 183 | "internalType": "address", 184 | "name": "recipient", 185 | "type": "address" 186 | }, 187 | { 188 | "internalType": "uint256", 189 | "name": "amount", 190 | "type": "uint256" 191 | } 192 | ], 193 | "name": "transfer", 194 | "outputs": [ 195 | { 196 | "internalType": "bool", 197 | "name": "", 198 | "type": "bool" 199 | } 200 | ], 201 | "stateMutability": "nonpayable", 202 | "type": "function" 203 | }, 204 | { 205 | "inputs": [ 206 | { 207 | "internalType": "address", 208 | "name": "src", 209 | "type": "address" 210 | }, 211 | { 212 | "internalType": "address", 213 | "name": "dst", 214 | "type": "address" 215 | }, 216 | { 217 | "internalType": "uint256", 218 | "name": "wad", 219 | "type": "uint256" 220 | } 221 | ], 222 | "name": "transferFrom", 223 | "outputs": [ 224 | { 225 | "internalType": "bool", 226 | "name": "", 227 | "type": "bool" 228 | } 229 | ], 230 | "stateMutability": "nonpayable", 231 | "type": "function" 232 | } 233 | ] -------------------------------------------------------------------------------- /abis/v3_1_0/abis/yVaultInterface.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": "from", 34 | "type": "address" 35 | }, 36 | { 37 | "indexed": true, 38 | "internalType": "address", 39 | "name": "to", 40 | "type": "address" 41 | }, 42 | { 43 | "indexed": false, 44 | "internalType": "uint256", 45 | "name": "value", 46 | "type": "uint256" 47 | } 48 | ], 49 | "name": "Transfer", 50 | "type": "event" 51 | }, 52 | { 53 | "inputs": [ 54 | { 55 | "internalType": "address", 56 | "name": "owner", 57 | "type": "address" 58 | }, 59 | { 60 | "internalType": "address", 61 | "name": "spender", 62 | "type": "address" 63 | } 64 | ], 65 | "name": "allowance", 66 | "outputs": [ 67 | { 68 | "internalType": "uint256", 69 | "name": "", 70 | "type": "uint256" 71 | } 72 | ], 73 | "stateMutability": "view", 74 | "type": "function" 75 | }, 76 | { 77 | "inputs": [ 78 | { 79 | "internalType": "address", 80 | "name": "spender", 81 | "type": "address" 82 | }, 83 | { 84 | "internalType": "uint256", 85 | "name": "amount", 86 | "type": "uint256" 87 | } 88 | ], 89 | "name": "approve", 90 | "outputs": [ 91 | { 92 | "internalType": "bool", 93 | "name": "", 94 | "type": "bool" 95 | } 96 | ], 97 | "stateMutability": "nonpayable", 98 | "type": "function" 99 | }, 100 | { 101 | "inputs": [], 102 | "name": "balance", 103 | "outputs": [ 104 | { 105 | "internalType": "uint256", 106 | "name": "", 107 | "type": "uint256" 108 | } 109 | ], 110 | "stateMutability": "view", 111 | "type": "function" 112 | }, 113 | { 114 | "inputs": [ 115 | { 116 | "internalType": "address", 117 | "name": "account", 118 | "type": "address" 119 | } 120 | ], 121 | "name": "balanceOf", 122 | "outputs": [ 123 | { 124 | "internalType": "uint256", 125 | "name": "", 126 | "type": "uint256" 127 | } 128 | ], 129 | "stateMutability": "view", 130 | "type": "function" 131 | }, 132 | { 133 | "inputs": [ 134 | { 135 | "internalType": "uint256", 136 | "name": "_amount", 137 | "type": "uint256" 138 | } 139 | ], 140 | "name": "deposit", 141 | "outputs": [], 142 | "stateMutability": "nonpayable", 143 | "type": "function" 144 | }, 145 | { 146 | "inputs": [], 147 | "name": "getPricePerFullShare", 148 | "outputs": [ 149 | { 150 | "internalType": "uint256", 151 | "name": "", 152 | "type": "uint256" 153 | } 154 | ], 155 | "stateMutability": "view", 156 | "type": "function" 157 | }, 158 | { 159 | "inputs": [], 160 | "name": "token", 161 | "outputs": [ 162 | { 163 | "internalType": "contract IERC20Upgradeable", 164 | "name": "", 165 | "type": "address" 166 | } 167 | ], 168 | "stateMutability": "view", 169 | "type": "function" 170 | }, 171 | { 172 | "inputs": [], 173 | "name": "totalSupply", 174 | "outputs": [ 175 | { 176 | "internalType": "uint256", 177 | "name": "", 178 | "type": "uint256" 179 | } 180 | ], 181 | "stateMutability": "view", 182 | "type": "function" 183 | }, 184 | { 185 | "inputs": [ 186 | { 187 | "internalType": "address", 188 | "name": "recipient", 189 | "type": "address" 190 | }, 191 | { 192 | "internalType": "uint256", 193 | "name": "amount", 194 | "type": "uint256" 195 | } 196 | ], 197 | "name": "transfer", 198 | "outputs": [ 199 | { 200 | "internalType": "bool", 201 | "name": "", 202 | "type": "bool" 203 | } 204 | ], 205 | "stateMutability": "nonpayable", 206 | "type": "function" 207 | }, 208 | { 209 | "inputs": [ 210 | { 211 | "internalType": "address", 212 | "name": "sender", 213 | "type": "address" 214 | }, 215 | { 216 | "internalType": "address", 217 | "name": "recipient", 218 | "type": "address" 219 | }, 220 | { 221 | "internalType": "uint256", 222 | "name": "amount", 223 | "type": "uint256" 224 | } 225 | ], 226 | "name": "transferFrom", 227 | "outputs": [ 228 | { 229 | "internalType": "bool", 230 | "name": "", 231 | "type": "bool" 232 | } 233 | ], 234 | "stateMutability": "nonpayable", 235 | "type": "function" 236 | }, 237 | { 238 | "inputs": [ 239 | { 240 | "internalType": "uint256", 241 | "name": "_shares", 242 | "type": "uint256" 243 | } 244 | ], 245 | "name": "withdraw", 246 | "outputs": [], 247 | "stateMutability": "nonpayable", 248 | "type": "function" 249 | } 250 | ] -------------------------------------------------------------------------------- /abis/v3_1_0/abis/ControlledTokenInterface.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": "from", 34 | "type": "address" 35 | }, 36 | { 37 | "indexed": true, 38 | "internalType": "address", 39 | "name": "to", 40 | "type": "address" 41 | }, 42 | { 43 | "indexed": false, 44 | "internalType": "uint256", 45 | "name": "value", 46 | "type": "uint256" 47 | } 48 | ], 49 | "name": "Transfer", 50 | "type": "event" 51 | }, 52 | { 53 | "inputs": [ 54 | { 55 | "internalType": "address", 56 | "name": "owner", 57 | "type": "address" 58 | }, 59 | { 60 | "internalType": "address", 61 | "name": "spender", 62 | "type": "address" 63 | } 64 | ], 65 | "name": "allowance", 66 | "outputs": [ 67 | { 68 | "internalType": "uint256", 69 | "name": "", 70 | "type": "uint256" 71 | } 72 | ], 73 | "stateMutability": "view", 74 | "type": "function" 75 | }, 76 | { 77 | "inputs": [ 78 | { 79 | "internalType": "address", 80 | "name": "spender", 81 | "type": "address" 82 | }, 83 | { 84 | "internalType": "uint256", 85 | "name": "amount", 86 | "type": "uint256" 87 | } 88 | ], 89 | "name": "approve", 90 | "outputs": [ 91 | { 92 | "internalType": "bool", 93 | "name": "", 94 | "type": "bool" 95 | } 96 | ], 97 | "stateMutability": "nonpayable", 98 | "type": "function" 99 | }, 100 | { 101 | "inputs": [ 102 | { 103 | "internalType": "address", 104 | "name": "account", 105 | "type": "address" 106 | } 107 | ], 108 | "name": "balanceOf", 109 | "outputs": [ 110 | { 111 | "internalType": "uint256", 112 | "name": "", 113 | "type": "uint256" 114 | } 115 | ], 116 | "stateMutability": "view", 117 | "type": "function" 118 | }, 119 | { 120 | "inputs": [], 121 | "name": "controller", 122 | "outputs": [ 123 | { 124 | "internalType": "contract TokenControllerInterface", 125 | "name": "", 126 | "type": "address" 127 | } 128 | ], 129 | "stateMutability": "view", 130 | "type": "function" 131 | }, 132 | { 133 | "inputs": [ 134 | { 135 | "internalType": "address", 136 | "name": "_user", 137 | "type": "address" 138 | }, 139 | { 140 | "internalType": "uint256", 141 | "name": "_amount", 142 | "type": "uint256" 143 | } 144 | ], 145 | "name": "controllerBurn", 146 | "outputs": [], 147 | "stateMutability": "nonpayable", 148 | "type": "function" 149 | }, 150 | { 151 | "inputs": [ 152 | { 153 | "internalType": "address", 154 | "name": "_operator", 155 | "type": "address" 156 | }, 157 | { 158 | "internalType": "address", 159 | "name": "_user", 160 | "type": "address" 161 | }, 162 | { 163 | "internalType": "uint256", 164 | "name": "_amount", 165 | "type": "uint256" 166 | } 167 | ], 168 | "name": "controllerBurnFrom", 169 | "outputs": [], 170 | "stateMutability": "nonpayable", 171 | "type": "function" 172 | }, 173 | { 174 | "inputs": [ 175 | { 176 | "internalType": "address", 177 | "name": "_user", 178 | "type": "address" 179 | }, 180 | { 181 | "internalType": "uint256", 182 | "name": "_amount", 183 | "type": "uint256" 184 | } 185 | ], 186 | "name": "controllerMint", 187 | "outputs": [], 188 | "stateMutability": "nonpayable", 189 | "type": "function" 190 | }, 191 | { 192 | "inputs": [], 193 | "name": "totalSupply", 194 | "outputs": [ 195 | { 196 | "internalType": "uint256", 197 | "name": "", 198 | "type": "uint256" 199 | } 200 | ], 201 | "stateMutability": "view", 202 | "type": "function" 203 | }, 204 | { 205 | "inputs": [ 206 | { 207 | "internalType": "address", 208 | "name": "recipient", 209 | "type": "address" 210 | }, 211 | { 212 | "internalType": "uint256", 213 | "name": "amount", 214 | "type": "uint256" 215 | } 216 | ], 217 | "name": "transfer", 218 | "outputs": [ 219 | { 220 | "internalType": "bool", 221 | "name": "", 222 | "type": "bool" 223 | } 224 | ], 225 | "stateMutability": "nonpayable", 226 | "type": "function" 227 | }, 228 | { 229 | "inputs": [ 230 | { 231 | "internalType": "address", 232 | "name": "sender", 233 | "type": "address" 234 | }, 235 | { 236 | "internalType": "address", 237 | "name": "recipient", 238 | "type": "address" 239 | }, 240 | { 241 | "internalType": "uint256", 242 | "name": "amount", 243 | "type": "uint256" 244 | } 245 | ], 246 | "name": "transferFrom", 247 | "outputs": [ 248 | { 249 | "internalType": "bool", 250 | "name": "", 251 | "type": "bool" 252 | } 253 | ], 254 | "stateMutability": "nonpayable", 255 | "type": "function" 256 | } 257 | ] -------------------------------------------------------------------------------- /abis/v3_1_0/abis/ERC20Upgradeable.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": "from", 34 | "type": "address" 35 | }, 36 | { 37 | "indexed": true, 38 | "internalType": "address", 39 | "name": "to", 40 | "type": "address" 41 | }, 42 | { 43 | "indexed": false, 44 | "internalType": "uint256", 45 | "name": "value", 46 | "type": "uint256" 47 | } 48 | ], 49 | "name": "Transfer", 50 | "type": "event" 51 | }, 52 | { 53 | "inputs": [ 54 | { 55 | "internalType": "address", 56 | "name": "owner", 57 | "type": "address" 58 | }, 59 | { 60 | "internalType": "address", 61 | "name": "spender", 62 | "type": "address" 63 | } 64 | ], 65 | "name": "allowance", 66 | "outputs": [ 67 | { 68 | "internalType": "uint256", 69 | "name": "", 70 | "type": "uint256" 71 | } 72 | ], 73 | "stateMutability": "view", 74 | "type": "function" 75 | }, 76 | { 77 | "inputs": [ 78 | { 79 | "internalType": "address", 80 | "name": "spender", 81 | "type": "address" 82 | }, 83 | { 84 | "internalType": "uint256", 85 | "name": "amount", 86 | "type": "uint256" 87 | } 88 | ], 89 | "name": "approve", 90 | "outputs": [ 91 | { 92 | "internalType": "bool", 93 | "name": "", 94 | "type": "bool" 95 | } 96 | ], 97 | "stateMutability": "nonpayable", 98 | "type": "function" 99 | }, 100 | { 101 | "inputs": [ 102 | { 103 | "internalType": "address", 104 | "name": "account", 105 | "type": "address" 106 | } 107 | ], 108 | "name": "balanceOf", 109 | "outputs": [ 110 | { 111 | "internalType": "uint256", 112 | "name": "", 113 | "type": "uint256" 114 | } 115 | ], 116 | "stateMutability": "view", 117 | "type": "function" 118 | }, 119 | { 120 | "inputs": [], 121 | "name": "decimals", 122 | "outputs": [ 123 | { 124 | "internalType": "uint8", 125 | "name": "", 126 | "type": "uint8" 127 | } 128 | ], 129 | "stateMutability": "view", 130 | "type": "function" 131 | }, 132 | { 133 | "inputs": [ 134 | { 135 | "internalType": "address", 136 | "name": "spender", 137 | "type": "address" 138 | }, 139 | { 140 | "internalType": "uint256", 141 | "name": "subtractedValue", 142 | "type": "uint256" 143 | } 144 | ], 145 | "name": "decreaseAllowance", 146 | "outputs": [ 147 | { 148 | "internalType": "bool", 149 | "name": "", 150 | "type": "bool" 151 | } 152 | ], 153 | "stateMutability": "nonpayable", 154 | "type": "function" 155 | }, 156 | { 157 | "inputs": [ 158 | { 159 | "internalType": "address", 160 | "name": "spender", 161 | "type": "address" 162 | }, 163 | { 164 | "internalType": "uint256", 165 | "name": "addedValue", 166 | "type": "uint256" 167 | } 168 | ], 169 | "name": "increaseAllowance", 170 | "outputs": [ 171 | { 172 | "internalType": "bool", 173 | "name": "", 174 | "type": "bool" 175 | } 176 | ], 177 | "stateMutability": "nonpayable", 178 | "type": "function" 179 | }, 180 | { 181 | "inputs": [], 182 | "name": "name", 183 | "outputs": [ 184 | { 185 | "internalType": "string", 186 | "name": "", 187 | "type": "string" 188 | } 189 | ], 190 | "stateMutability": "view", 191 | "type": "function" 192 | }, 193 | { 194 | "inputs": [], 195 | "name": "symbol", 196 | "outputs": [ 197 | { 198 | "internalType": "string", 199 | "name": "", 200 | "type": "string" 201 | } 202 | ], 203 | "stateMutability": "view", 204 | "type": "function" 205 | }, 206 | { 207 | "inputs": [], 208 | "name": "totalSupply", 209 | "outputs": [ 210 | { 211 | "internalType": "uint256", 212 | "name": "", 213 | "type": "uint256" 214 | } 215 | ], 216 | "stateMutability": "view", 217 | "type": "function" 218 | }, 219 | { 220 | "inputs": [ 221 | { 222 | "internalType": "address", 223 | "name": "recipient", 224 | "type": "address" 225 | }, 226 | { 227 | "internalType": "uint256", 228 | "name": "amount", 229 | "type": "uint256" 230 | } 231 | ], 232 | "name": "transfer", 233 | "outputs": [ 234 | { 235 | "internalType": "bool", 236 | "name": "", 237 | "type": "bool" 238 | } 239 | ], 240 | "stateMutability": "nonpayable", 241 | "type": "function" 242 | }, 243 | { 244 | "inputs": [ 245 | { 246 | "internalType": "address", 247 | "name": "sender", 248 | "type": "address" 249 | }, 250 | { 251 | "internalType": "address", 252 | "name": "recipient", 253 | "type": "address" 254 | }, 255 | { 256 | "internalType": "uint256", 257 | "name": "amount", 258 | "type": "uint256" 259 | } 260 | ], 261 | "name": "transferFrom", 262 | "outputs": [ 263 | { 264 | "internalType": "bool", 265 | "name": "", 266 | "type": "bool" 267 | } 268 | ], 269 | "stateMutability": "nonpayable", 270 | "type": "function" 271 | } 272 | ] -------------------------------------------------------------------------------- /abis/v3_1_0/abis/IERC721Upgradeable.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": "approved", 15 | "type": "address" 16 | }, 17 | { 18 | "indexed": true, 19 | "internalType": "uint256", 20 | "name": "tokenId", 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": "owner", 34 | "type": "address" 35 | }, 36 | { 37 | "indexed": true, 38 | "internalType": "address", 39 | "name": "operator", 40 | "type": "address" 41 | }, 42 | { 43 | "indexed": false, 44 | "internalType": "bool", 45 | "name": "approved", 46 | "type": "bool" 47 | } 48 | ], 49 | "name": "ApprovalForAll", 50 | "type": "event" 51 | }, 52 | { 53 | "anonymous": false, 54 | "inputs": [ 55 | { 56 | "indexed": true, 57 | "internalType": "address", 58 | "name": "from", 59 | "type": "address" 60 | }, 61 | { 62 | "indexed": true, 63 | "internalType": "address", 64 | "name": "to", 65 | "type": "address" 66 | }, 67 | { 68 | "indexed": true, 69 | "internalType": "uint256", 70 | "name": "tokenId", 71 | "type": "uint256" 72 | } 73 | ], 74 | "name": "Transfer", 75 | "type": "event" 76 | }, 77 | { 78 | "inputs": [ 79 | { 80 | "internalType": "address", 81 | "name": "to", 82 | "type": "address" 83 | }, 84 | { 85 | "internalType": "uint256", 86 | "name": "tokenId", 87 | "type": "uint256" 88 | } 89 | ], 90 | "name": "approve", 91 | "outputs": [], 92 | "stateMutability": "nonpayable", 93 | "type": "function" 94 | }, 95 | { 96 | "inputs": [ 97 | { 98 | "internalType": "address", 99 | "name": "owner", 100 | "type": "address" 101 | } 102 | ], 103 | "name": "balanceOf", 104 | "outputs": [ 105 | { 106 | "internalType": "uint256", 107 | "name": "balance", 108 | "type": "uint256" 109 | } 110 | ], 111 | "stateMutability": "view", 112 | "type": "function" 113 | }, 114 | { 115 | "inputs": [ 116 | { 117 | "internalType": "uint256", 118 | "name": "tokenId", 119 | "type": "uint256" 120 | } 121 | ], 122 | "name": "getApproved", 123 | "outputs": [ 124 | { 125 | "internalType": "address", 126 | "name": "operator", 127 | "type": "address" 128 | } 129 | ], 130 | "stateMutability": "view", 131 | "type": "function" 132 | }, 133 | { 134 | "inputs": [ 135 | { 136 | "internalType": "address", 137 | "name": "owner", 138 | "type": "address" 139 | }, 140 | { 141 | "internalType": "address", 142 | "name": "operator", 143 | "type": "address" 144 | } 145 | ], 146 | "name": "isApprovedForAll", 147 | "outputs": [ 148 | { 149 | "internalType": "bool", 150 | "name": "", 151 | "type": "bool" 152 | } 153 | ], 154 | "stateMutability": "view", 155 | "type": "function" 156 | }, 157 | { 158 | "inputs": [ 159 | { 160 | "internalType": "uint256", 161 | "name": "tokenId", 162 | "type": "uint256" 163 | } 164 | ], 165 | "name": "ownerOf", 166 | "outputs": [ 167 | { 168 | "internalType": "address", 169 | "name": "owner", 170 | "type": "address" 171 | } 172 | ], 173 | "stateMutability": "view", 174 | "type": "function" 175 | }, 176 | { 177 | "inputs": [ 178 | { 179 | "internalType": "address", 180 | "name": "from", 181 | "type": "address" 182 | }, 183 | { 184 | "internalType": "address", 185 | "name": "to", 186 | "type": "address" 187 | }, 188 | { 189 | "internalType": "uint256", 190 | "name": "tokenId", 191 | "type": "uint256" 192 | } 193 | ], 194 | "name": "safeTransferFrom", 195 | "outputs": [], 196 | "stateMutability": "nonpayable", 197 | "type": "function" 198 | }, 199 | { 200 | "inputs": [ 201 | { 202 | "internalType": "address", 203 | "name": "from", 204 | "type": "address" 205 | }, 206 | { 207 | "internalType": "address", 208 | "name": "to", 209 | "type": "address" 210 | }, 211 | { 212 | "internalType": "uint256", 213 | "name": "tokenId", 214 | "type": "uint256" 215 | }, 216 | { 217 | "internalType": "bytes", 218 | "name": "data", 219 | "type": "bytes" 220 | } 221 | ], 222 | "name": "safeTransferFrom", 223 | "outputs": [], 224 | "stateMutability": "nonpayable", 225 | "type": "function" 226 | }, 227 | { 228 | "inputs": [ 229 | { 230 | "internalType": "address", 231 | "name": "operator", 232 | "type": "address" 233 | }, 234 | { 235 | "internalType": "bool", 236 | "name": "_approved", 237 | "type": "bool" 238 | } 239 | ], 240 | "name": "setApprovalForAll", 241 | "outputs": [], 242 | "stateMutability": "nonpayable", 243 | "type": "function" 244 | }, 245 | { 246 | "inputs": [ 247 | { 248 | "internalType": "bytes4", 249 | "name": "interfaceId", 250 | "type": "bytes4" 251 | } 252 | ], 253 | "name": "supportsInterface", 254 | "outputs": [ 255 | { 256 | "internalType": "bool", 257 | "name": "", 258 | "type": "bool" 259 | } 260 | ], 261 | "stateMutability": "view", 262 | "type": "function" 263 | }, 264 | { 265 | "inputs": [ 266 | { 267 | "internalType": "address", 268 | "name": "from", 269 | "type": "address" 270 | }, 271 | { 272 | "internalType": "address", 273 | "name": "to", 274 | "type": "address" 275 | }, 276 | { 277 | "internalType": "uint256", 278 | "name": "tokenId", 279 | "type": "uint256" 280 | } 281 | ], 282 | "name": "transferFrom", 283 | "outputs": [], 284 | "stateMutability": "nonpayable", 285 | "type": "function" 286 | } 287 | ] -------------------------------------------------------------------------------- /abis/v3_1_0/abis/CTokenInterface.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": "from", 34 | "type": "address" 35 | }, 36 | { 37 | "indexed": true, 38 | "internalType": "address", 39 | "name": "to", 40 | "type": "address" 41 | }, 42 | { 43 | "indexed": false, 44 | "internalType": "uint256", 45 | "name": "value", 46 | "type": "uint256" 47 | } 48 | ], 49 | "name": "Transfer", 50 | "type": "event" 51 | }, 52 | { 53 | "inputs": [ 54 | { 55 | "internalType": "address", 56 | "name": "owner", 57 | "type": "address" 58 | }, 59 | { 60 | "internalType": "address", 61 | "name": "spender", 62 | "type": "address" 63 | } 64 | ], 65 | "name": "allowance", 66 | "outputs": [ 67 | { 68 | "internalType": "uint256", 69 | "name": "", 70 | "type": "uint256" 71 | } 72 | ], 73 | "stateMutability": "view", 74 | "type": "function" 75 | }, 76 | { 77 | "inputs": [ 78 | { 79 | "internalType": "address", 80 | "name": "spender", 81 | "type": "address" 82 | }, 83 | { 84 | "internalType": "uint256", 85 | "name": "amount", 86 | "type": "uint256" 87 | } 88 | ], 89 | "name": "approve", 90 | "outputs": [ 91 | { 92 | "internalType": "bool", 93 | "name": "", 94 | "type": "bool" 95 | } 96 | ], 97 | "stateMutability": "nonpayable", 98 | "type": "function" 99 | }, 100 | { 101 | "inputs": [ 102 | { 103 | "internalType": "address", 104 | "name": "user", 105 | "type": "address" 106 | } 107 | ], 108 | "name": "balanceOf", 109 | "outputs": [ 110 | { 111 | "internalType": "uint256", 112 | "name": "", 113 | "type": "uint256" 114 | } 115 | ], 116 | "stateMutability": "view", 117 | "type": "function" 118 | }, 119 | { 120 | "inputs": [ 121 | { 122 | "internalType": "address", 123 | "name": "owner", 124 | "type": "address" 125 | } 126 | ], 127 | "name": "balanceOfUnderlying", 128 | "outputs": [ 129 | { 130 | "internalType": "uint256", 131 | "name": "", 132 | "type": "uint256" 133 | } 134 | ], 135 | "stateMutability": "nonpayable", 136 | "type": "function" 137 | }, 138 | { 139 | "inputs": [], 140 | "name": "decimals", 141 | "outputs": [ 142 | { 143 | "internalType": "uint8", 144 | "name": "", 145 | "type": "uint8" 146 | } 147 | ], 148 | "stateMutability": "view", 149 | "type": "function" 150 | }, 151 | { 152 | "inputs": [], 153 | "name": "exchangeRateCurrent", 154 | "outputs": [ 155 | { 156 | "internalType": "uint256", 157 | "name": "", 158 | "type": "uint256" 159 | } 160 | ], 161 | "stateMutability": "nonpayable", 162 | "type": "function" 163 | }, 164 | { 165 | "inputs": [ 166 | { 167 | "internalType": "uint256", 168 | "name": "mintAmount", 169 | "type": "uint256" 170 | } 171 | ], 172 | "name": "mint", 173 | "outputs": [ 174 | { 175 | "internalType": "uint256", 176 | "name": "", 177 | "type": "uint256" 178 | } 179 | ], 180 | "stateMutability": "nonpayable", 181 | "type": "function" 182 | }, 183 | { 184 | "inputs": [ 185 | { 186 | "internalType": "uint256", 187 | "name": "redeemAmount", 188 | "type": "uint256" 189 | } 190 | ], 191 | "name": "redeemUnderlying", 192 | "outputs": [ 193 | { 194 | "internalType": "uint256", 195 | "name": "", 196 | "type": "uint256" 197 | } 198 | ], 199 | "stateMutability": "nonpayable", 200 | "type": "function" 201 | }, 202 | { 203 | "inputs": [], 204 | "name": "supplyRatePerBlock", 205 | "outputs": [ 206 | { 207 | "internalType": "uint256", 208 | "name": "", 209 | "type": "uint256" 210 | } 211 | ], 212 | "stateMutability": "nonpayable", 213 | "type": "function" 214 | }, 215 | { 216 | "inputs": [], 217 | "name": "totalSupply", 218 | "outputs": [ 219 | { 220 | "internalType": "uint256", 221 | "name": "", 222 | "type": "uint256" 223 | } 224 | ], 225 | "stateMutability": "view", 226 | "type": "function" 227 | }, 228 | { 229 | "inputs": [ 230 | { 231 | "internalType": "address", 232 | "name": "recipient", 233 | "type": "address" 234 | }, 235 | { 236 | "internalType": "uint256", 237 | "name": "amount", 238 | "type": "uint256" 239 | } 240 | ], 241 | "name": "transfer", 242 | "outputs": [ 243 | { 244 | "internalType": "bool", 245 | "name": "", 246 | "type": "bool" 247 | } 248 | ], 249 | "stateMutability": "nonpayable", 250 | "type": "function" 251 | }, 252 | { 253 | "inputs": [ 254 | { 255 | "internalType": "address", 256 | "name": "sender", 257 | "type": "address" 258 | }, 259 | { 260 | "internalType": "address", 261 | "name": "recipient", 262 | "type": "address" 263 | }, 264 | { 265 | "internalType": "uint256", 266 | "name": "amount", 267 | "type": "uint256" 268 | } 269 | ], 270 | "name": "transferFrom", 271 | "outputs": [ 272 | { 273 | "internalType": "bool", 274 | "name": "", 275 | "type": "bool" 276 | } 277 | ], 278 | "stateMutability": "nonpayable", 279 | "type": "function" 280 | }, 281 | { 282 | "inputs": [], 283 | "name": "underlying", 284 | "outputs": [ 285 | { 286 | "internalType": "address", 287 | "name": "", 288 | "type": "address" 289 | } 290 | ], 291 | "stateMutability": "view", 292 | "type": "function" 293 | } 294 | ] -------------------------------------------------------------------------------- /src/mappingForPrizePool.ts: -------------------------------------------------------------------------------- 1 | import { Address, log, store } from '@graphprotocol/graph-ts' 2 | import { 3 | PrizeStrategy, 4 | PrizePool 5 | } from '../generated/schema' 6 | 7 | import { 8 | ControlledTokenAdded, 9 | ReserveFeeCaptured, 10 | LiquidityCapSet, 11 | Awarded, 12 | AwardedExternalERC20, 13 | AwardedExternalERC721, 14 | CreditPlanSet, 15 | PrizeStrategySet, 16 | OwnershipTransferred, 17 | Initialized 18 | } from '../generated/templates/PrizePool/PrizePool' 19 | 20 | import {externalAwardId} from "./helpers/idTemplates" 21 | 22 | import { loadOrCreatePrize } from './helpers/loadOrCreatePrize' 23 | 24 | import { loadOrCreatePrizePool } from './helpers/loadOrCreatePrizePool' 25 | import { loadOrCreatePrizeStrategy } from './helpers/loadOrCreatePrizeStrategy' 26 | import { loadOrCreatePrizePoolCreditRate } from './helpers/loadOrCreatePrizePoolCreditRate' 27 | import { loadOrCreateAwardedExternalErc20Token, loadOrCreateAwardedExternalErc721Nft } from './helpers/loadOrCreateAwardedExternalErc' 28 | 29 | 30 | import { ONE, ZERO } from './helpers/common' 31 | import { Deposited } from '../generated/templates/CompoundPrizePool/CompoundPrizePool' 32 | import { loadOrCreatePrizePoolAccount } from './helpers/loadOrCreatePrizePoolAccount' 33 | import { loadOrCreateAwardedControlledToken } from './helpers/loadOrCreateAwardedControlledToken' 34 | import { loadOrCreateControlledToken } from './helpers/loadOrCreateControlledToken' 35 | 36 | export function handleOwnershipTransferred(event: OwnershipTransferred): void { 37 | const _prizePool = loadOrCreatePrizePool(event.address) 38 | _prizePool.owner = event.params.newOwner 39 | _prizePool.save() 40 | } 41 | 42 | export function handleControlledTokenAdded(event: ControlledTokenAdded): void { 43 | const controlledToken = loadOrCreateControlledToken(event.params.token) 44 | } 45 | 46 | export function handleLiquidityCapSet(event: LiquidityCapSet): void { 47 | const _prizePool = loadOrCreatePrizePool(event.address) 48 | _prizePool.liquidityCap = event.params.liquidityCap 49 | _prizePool.save() 50 | } 51 | 52 | export function handleCreditPlanSet(event: CreditPlanSet): void { 53 | const _creditRate = loadOrCreatePrizePoolCreditRate(event.address, event.params.token) 54 | _creditRate.creditLimitMantissa = event.params.creditLimitMantissa 55 | _creditRate.creditRateMantissa = event.params.creditRateMantissa 56 | _creditRate.save() 57 | } 58 | 59 | export function handlePrizeStrategySet(event: PrizeStrategySet): void { 60 | 61 | log.warning("debugps handlePrizeStrategySet for {} as {} ",[event.address.toHexString(), event.params.prizeStrategy.toHexString()]) 62 | 63 | const _prizePoolAddress = event.address 64 | const _prizeStrategyAddress = event.params.prizeStrategy 65 | 66 | const _prizePool = loadOrCreatePrizePool(_prizePoolAddress) 67 | _prizePool.prizeStrategy = loadOrCreatePrizeStrategy(_prizeStrategyAddress).id 68 | _prizePool.save() 69 | } 70 | 71 | export function handleReserveFeeCaptured(event: ReserveFeeCaptured): void { 72 | const _prizePool = loadOrCreatePrizePool(event.address) 73 | _prizePool.cumulativePrizeReserveFee = _prizePool.cumulativePrizeReserveFee.plus(event.params.amount) 74 | _prizePool.save() 75 | 76 | } 77 | 78 | // this is called BEFORE PrizePoolAwarded - MW strat and SRW 79 | export function handleAwarded(event: Awarded): void { 80 | const _prizePool = loadOrCreatePrizePool(event.address) 81 | // Record prize history 82 | const _prize = loadOrCreatePrize( 83 | event.address.toHex(), 84 | _prizePool.currentPrizeId.toString() 85 | ) 86 | 87 | const winner : Address = event.params.winner 88 | 89 | let length = _prize.numberOfSubWinners 90 | _prize.numberOfSubWinners = _prize.numberOfSubWinners.plus(ONE) 91 | _prize.save() 92 | 93 | log.warning("awardedControlled length is {} ",[length.toString()]) 94 | 95 | const winnerIndex = length.toString() 96 | const awardedControlledToken = loadOrCreateAwardedControlledToken(event.address.toHexString(), winner, _prizePool.currentPrizeId.toString(), winnerIndex) 97 | 98 | 99 | 100 | awardedControlledToken.amount = event.params.amount 101 | awardedControlledToken.prize = _prize.id 102 | awardedControlledToken.token = event.params.token.toHexString() 103 | awardedControlledToken.save() 104 | 105 | // Update Pool (Reserve Fee updated in handleReserveFeeCaptured) 106 | _prizePool.cumulativePrizeNet = _prizePool.cumulativePrizeNet.plus(event.params.amount) 107 | _prizePool.cumulativePrizeGross = _prizePool.cumulativePrizeNet.plus(_prizePool.cumulativePrizeReserveFee) 108 | _prizePool.save() 109 | 110 | } 111 | 112 | // called after all the Tickets have been awarded 113 | export function handleAwardedExternalERC20(event: AwardedExternalERC20): void { 114 | const _prizePool = loadOrCreatePrizePool(event.address) 115 | 116 | const _prize = loadOrCreatePrize( 117 | event.address.toHex(), 118 | _prizePool.currentPrizeId.toString() 119 | ) 120 | 121 | 122 | const awardedErc20Token = loadOrCreateAwardedExternalErc20Token( 123 | _prize, 124 | event.params.token, 125 | event.params.winner, 126 | _prize.numberOfExternalAwardedErc20Winners.toHexString() 127 | ) 128 | 129 | _prize.numberOfExternalAwardedErc20Winners = _prize.numberOfExternalAwardedErc20Winners.plus(ONE) 130 | _prize.save() 131 | 132 | awardedErc20Token.winner = event.params.winner 133 | awardedErc20Token.balanceAwarded = awardedErc20Token.balanceAwarded.plus(event.params.amount) 134 | 135 | awardedErc20Token.save() 136 | } 137 | 138 | // This is emitted when external rewards (nfts, etc) are awarded 139 | export function handleAwardedExternalERC721(event: AwardedExternalERC721): void { 140 | const _prizePool = loadOrCreatePrizePool(event.address) 141 | 142 | const _prize = loadOrCreatePrize( 143 | event.address.toHex(), 144 | _prizePool.currentPrizeId.toString() 145 | ) 146 | log.warning("handleAwardedExternalERC721 prizePool id {} prize {} ",[_prizePool.id, _prize.id]) 147 | 148 | const _prizeStrategyId = _prizePool.prizeStrategy 149 | const _prizeStrategy = PrizeStrategy.load(_prizeStrategyId) 150 | 151 | const awardedExternalErc721Nft = loadOrCreateAwardedExternalErc721Nft( 152 | _prize, 153 | _prizeStrategy as PrizeStrategy, 154 | event.params.token 155 | ) 156 | awardedExternalErc721Nft.winner = event.params.winner 157 | awardedExternalErc721Nft.save() 158 | 159 | // delete ID: `${prizeStrategy.address}-${token.address}` 160 | const deleteId = externalAwardId(_prizeStrategy.id, event.params.token.toHex()) 161 | store.remove("MultipleWinnersExternalErc721Award", deleteId) // is this a noop if doesnt exist?? 162 | store.remove("SingleRandomWinnerExternalErc721Award", deleteId ) 163 | 164 | } 165 | 166 | export function handleDeposited(event: Deposited):void { 167 | loadOrCreatePrizePoolAccount(event.address, event.params.to.toHex()) 168 | } 169 | 170 | // inserted from 3_3_2 171 | export function handleInitialized(event: Initialized): void { 172 | 173 | log.warning("PrizePool Initialized called for {} ",[event.address.toHexString()]) 174 | 175 | const _prizePool = loadOrCreatePrizePool(event.address) 176 | _prizePool.reserveRegistry = event.params.reserveRegistry 177 | _prizePool.maxExitFeeMantissa = event.params.maxExitFeeMantissa 178 | _prizePool.save() 179 | } 180 | --------------------------------------------------------------------------------