Skip to content

Commit

Permalink
monster autobalance
Browse files Browse the repository at this point in the history
  • Loading branch information
CAPtheorem committed Apr 15, 2022
1 parent 09f110f commit af76dab
Show file tree
Hide file tree
Showing 3 changed files with 57 additions and 14 deletions.
14 changes: 13 additions & 1 deletion packages/boba/gateway/src/services/networkService.js
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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
Expand Down
6 changes: 3 additions & 3 deletions packages/boba/subgraph/L2/subgraph.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,7 @@ dataSources:
name: GovernorBravoDelegate
network: boba
source:
address: '0x472e5C097C790c6a44366a89a987Ec996A4d83e0'
address: '0x2CC555B5B1a4Cf7fA5401B29ab46fc5ba2e205b0'
abi: GovernorBravoDelegate
mapping:
kind: ethereum/events
Expand Down Expand Up @@ -102,7 +102,7 @@ dataSources:
name: Boba_GasPriceOracle
network: boba
source:
address: '0x7F974A09a251dEA6b75af3e0A0e29D1133DaCf4b'
address: '0xeE06ee2F239d2ab11792D77f3C347d919ddA0d51'
abi: Boba_GasPriceOracle
mapping:
kind: ethereum/events
Expand All @@ -127,7 +127,7 @@ dataSources:
name: TuringMonsters
network: boba
source:
address: '0x757b8E819d91659844E44F2141402831B60Fa4EE'
address: '0xce458FC7cfC322cDd65eC77Cf7B6410002E2D793'
abi: TuringMonsters
mapping:
kind: ethereum/events
Expand Down
51 changes: 41 additions & 10 deletions packages/boba/subgraph/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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 <ACCESS_TOKEN>
# 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 <ACCESS_TOKEN>
# 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** |
| -------- | ----------------------------------------- | ----------------------- | ------------------------------------------------------------ | -------------- |
Expand Down

0 comments on commit af76dab

Please sign in to comment.