From af76daba82e1ea35a29a67fd8a291a8ab1325724 Mon Sep 17 00:00:00 2001 From: CAPtheorem <79423264+CAPtheorem@users.noreply.github.com> Date: Fri, 15 Apr 2022 15:43:04 -0700 Subject: [PATCH] monster autobalance --- .../gateway/src/services/networkService.js | 14 ++++- packages/boba/subgraph/L2/subgraph.yaml | 6 +-- packages/boba/subgraph/README.md | 51 +++++++++++++++---- 3 files changed, 57 insertions(+), 14 deletions(-) diff --git a/packages/boba/gateway/src/services/networkService.js b/packages/boba/gateway/src/services/networkService.js index 80ae27a387..86c8ce5004 100644 --- a/packages/boba/gateway/src/services/networkService.js +++ b/packages/boba/gateway/src/services/networkService.js @@ -1218,10 +1218,21 @@ class NetworkService { let monsterList = await GraphQLService.queryMonsterTransfer(this.account) console.log("monsterList:", monsterList) + + let monsters = [] + + if(monsterList.hasOwnProperty('data')) { + monsters = monsterList.data.turingMonstersTransferEvents + } + console.log("length:",monsters.length) + + + // we can overwrite legacy local entries if people already have entered them // also need to compute the "best" monster - // for (let i = 0; i < totalProposals; i++) { + //for (let i = 0; i < totalProposals; i++) { + // const proposalRaw = descriptionList.data.governorProposalCreateds[i] // if(typeof(proposalRaw) === 'undefined') continue // let proposalID = proposalRaw.proposalId @@ -1243,6 +1254,7 @@ class NetworkService { ) const monsterBalance = await contract.balanceOf(this.account) + console.log("you have", monsterBalance, "monsters") let topMagic = 0 let topTop = 0 diff --git a/packages/boba/subgraph/L2/subgraph.yaml b/packages/boba/subgraph/L2/subgraph.yaml index 45edb70669..af327e6d9a 100644 --- a/packages/boba/subgraph/L2/subgraph.yaml +++ b/packages/boba/subgraph/L2/subgraph.yaml @@ -62,7 +62,7 @@ dataSources: name: GovernorBravoDelegate network: boba source: - address: '0x472e5C097C790c6a44366a89a987Ec996A4d83e0' + address: '0x2CC555B5B1a4Cf7fA5401B29ab46fc5ba2e205b0' abi: GovernorBravoDelegate mapping: kind: ethereum/events @@ -102,7 +102,7 @@ dataSources: name: Boba_GasPriceOracle network: boba source: - address: '0x7F974A09a251dEA6b75af3e0A0e29D1133DaCf4b' + address: '0xeE06ee2F239d2ab11792D77f3C347d919ddA0d51' abi: Boba_GasPriceOracle mapping: kind: ethereum/events @@ -127,7 +127,7 @@ dataSources: name: TuringMonsters network: boba source: - address: '0x757b8E819d91659844E44F2141402831B60Fa4EE' + address: '0xce458FC7cfC322cDd65eC77Cf7B6410002E2D793' abi: TuringMonsters mapping: kind: ethereum/events diff --git a/packages/boba/subgraph/README.md b/packages/boba/subgraph/README.md index 74b711bc03..c7bf9038e3 100644 --- a/packages/boba/subgraph/README.md +++ b/packages/boba/subgraph/README.md @@ -4,7 +4,7 @@ These subgraphs index the **StandardBridge**, the **LiquidityPool**, the **Boba ## Requirements -The global graph is required to deploy to **The Graph Node**. Make sure that you have various packages installed. +The global `graph` is required to deploy to **The Graph**. Make sure that you have various packages installed. ```bash yarn global add @graphprotocol/graph-cli @@ -13,42 +13,73 @@ yarn global add --dev @graphprotocol/graph-ts ## Building & Running -First, `cd` to either the **L1** or the **L2** folders, depending on where you will be deploying your subgraphs to. +First, `cd` to either the **L1** or the **L2** folders, depending on where you will be deploying your subgraphs to. There are four subgraphs: Ethereum, Boba, Rinkeby, and Boba-Rinkeby. A deploy key or access token is required to deploy subgraphs. Depending on which chain you are indexing, provide either `mainnet` or `rinkeby` as a setting to `yarn prepare:`. ### L1 Subgraphs -The deploy key is required to deploy subgraphs to **The Graph Node**. Depending on which chain you are indexing, provide either `mainnet` or `rinkeby` as a setting to `yarn prepare:`. +(below command untested) ```bash -graph auth --studio $DEPLOY_KEY +graph auth --product hosted-service +# or, graph auth --studio $DEPLOY_KEY +cd L1 yarn install yarn prepare:mainnet -#or, yarn prepare:rinkeby +# or, yarn prepare:rinkeby yarn codegen yarn build -graph deploy --studio boba-network +graph deploy --product hosted-service BOBANETWORK/boba-l2-subgraph # or, graph deploy --studio boba-network-rinkeby ``` ### L2 Subgraphs -The admin port for rinkeby is not public. +(Below commands tested for deploy to Boba mainnet) ```bash +graph auth --product hosted-service +# or, graph auth --studio $DEPLOY_KEY +cd L2 yarn install yarn prepare:mainnet -#or, yarn prepare:rinkeby +# or, yarn prepare:rinkeby yarn codegen yarn build graph deploy --product hosted-service BOBANETWORK/boba-l2-subgraph # or, yarn deploy:subgraph:rinkeby ``` +*NOTE: When you log into https://thegraph.com/hosted-service/dashboard, you may have more than one account. Make sure that you are using the ACCESS_TOKEN associated with the correct account, otherwise your depoyment will fail. You can cycle through your multiple accounts by clicking on your GitHub user ID or whatever other account is displayed next to your user Avatar.* + +## Example + +Here is some example queries to get you started: + +```bash +# L2 Boba Mainnet Query + + curl -g -X POST \ + -H "Content-Type: application/json" \ + -d '{"query":"{ governorProposalCreateds {proposalId values description proposer}}"}' \ + https://api.thegraph.com/subgraphs/name/bobanetwork/boba-l2-subgraph + +``` + +```bash +# L2 Boba Rinkeby Query + + curl -g -X POST \ + -H "Content-Type: application/json" \ + -d '{"query":"{ governorProposalCreateds {proposalId values description proposer}}"}' \ + https://graph.rinkeby.boba.network/subgraphs/name/boba/Bridges + +``` + ## Querying -* The Mainnet Graph Node is hosted by **The Graph** team. Visit https://thegraph.com/hosted-service/ to deploy your subgraphs. You can experiment here: [ bobanetwork/boba-l2-subgraph](https://thegraph.com/hosted-service/subgraph/bobanetwork/boba-l2-subgraph?query=Example%20query). +* The Mainnet Graph Node is hosted by **The Graph**. Visit https://thegraph.com/hosted-service/ to deploy your subgraphs. You can experiment here: [ bobanetwork/boba-l2-subgraph](https://thegraph.com/hosted-service/subgraph/bobanetwork/boba-l2-subgraph?query=Example%20query). -* Rinkeby endpoint: https://graph.rinkeby.boba.network. you can experiment here: [boba/Bridges/graphql](https://graph.rinkeby.boba.network/subgraphs/name/boba/Bridges/graphql) +* Rinkeby endpoint: https://graph.rinkeby.boba.network. You can experiment here: [boba/Bridges/graphql](https://graph.rinkeby.boba.network/subgraphs/name/boba/Bridges/graphql) | **Port** | **Purpose** | **Routes** | URL | **Permission** | | -------- | ----------------------------------------- | ----------------------- | ------------------------------------------------------------ | -------------- |