Skip to content

Commit

Permalink
Feature/add_optimism & use graph-node 0.33.0 (#742)
Browse files Browse the repository at this point in the history
* bump contracts

* remove ss contracts

* add optimism

* fix

* use upcoming barge

* move deactivateMint and delete sell test

* add withMint=True and delete sell test

* fix lint

* more fixes

* more fixes
  • Loading branch information
alexcos20 authored Nov 22, 2023
1 parent fc07962 commit 8bc4dab
Show file tree
Hide file tree
Showing 9 changed files with 370 additions and 635 deletions.
4 changes: 1 addition & 3 deletions .github/workflows/tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ jobs:
with:
repository: 'oceanprotocol/barge'
path: 'barge'
ref: main
ref: feature/bump_contracts_and_subgraph

- name: Login to Docker Hub
if: ${{ env.DOCKERHUB_PASSWORD && env.DOCKERHUB_USERNAME }}
Expand All @@ -51,8 +51,6 @@ jobs:
working-directory: ${{ github.workspace }}/barge
run: |
bash -x start_ocean.sh --with-thegraph --skip-subgraph-deploy --no-dashboard 2>&1 > start_ocean.log &
env:
CONTRACTS_VERSION: predictoor3
- run: npm ci

Expand Down
651 changes: 244 additions & 407 deletions package-lock.json

Large diffs are not rendered by default.

4 changes: 3 additions & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,8 @@
"quickstart:bsc": "node ./scripts/generatenetworkssubgraphs.js bsc && npm run codegen && npm run create:local && npm run deploy:local",
"quickstart:oasis_saphire_testnet": "node ./scripts/generatenetworkssubgraphs.js oasis_saphire_testnet && npm run codegen && npm run create:local && npm run deploy:local",
"quickstart:oasis_saphire": "node ./scripts/generatenetworkssubgraphs.js oasis_saphire && npm run codegen && npm run create:local && npm run deploy:local",
"quickstart:optimism": "node ./scripts/generatenetworkssubgraphs.js optimism && npm run codegen && npm run create:local && npm run deploy:local",
"quickstart:optimism_sepolia": "node ./scripts/generatenetworkssubgraphs.js optimism_sepolia && npm run codegen && npm run create:local && npm run deploy:local",
"create:thegraph": "graph create oceanprotocol/ocean-subgraph --node https://api.thegraph.com/deploy/",
"create:local": "graph create oceanprotocol/ocean-subgraph --node http://127.0.0.1:8020",
"create:local-barge": "graph create oceanprotocol/ocean-subgraph --node http://172.15.0.15:8020",
Expand Down Expand Up @@ -79,7 +81,7 @@
"typescript": "^5.2.2"
},
"dependencies": {
"@oceanprotocol/contracts": "^2.0.2",
"@oceanprotocol/contracts": "^2.0.3",
"@oceanprotocol/lib": "^2.7.0",
"cross-fetch": "^3.1.6",
"ethereumjs-util": "^7.1.5"
Expand Down
1 change: 0 additions & 1 deletion schema.graphql
Original file line number Diff line number Diff line change
Expand Up @@ -403,7 +403,6 @@ type Template @entity{
id: ID!
fixedRateTemplates: [String!]
dispenserTemplates: [String!]
ssTemplates: [String!]
}

# Not tracking allocationToId or idToAllocation
Expand Down
28 changes: 0 additions & 28 deletions src/mappings/factoryRouter.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,6 @@ import {
TokenRemoved,
OPCFeeChanged,
FactoryRouter,
SSContractAdded,
SSContractRemoved,
FixedRateContractAdded,
FixedRateContractRemoved,
DispenserContractAdded,
Expand Down Expand Up @@ -91,32 +89,6 @@ export function handleTokenRemoved(event: TokenRemoved): void {
opc.approvedTokens = newList
opc.save()
}
export function handleSSContractAdded(event: SSContractAdded): void {
// add token to approvedTokens
const templates = getTemplates()
let existingContracts: string[]
if (!templates.ssTemplates) existingContracts = []
else existingContracts = templates.ssTemplates as string[]
if (!existingContracts.includes(event.params.contractAddress.toHexString()))
existingContracts.push(event.params.contractAddress.toHexString())
templates.ssTemplates = existingContracts
templates.save()
}
export function handleSSContractRemoved(event: SSContractRemoved): void {
const templates = getTemplates()
const newList: string[] = []
let existingContracts: string[]
if (!templates.ssTemplates) existingContracts = []
else existingContracts = templates.ssTemplates as string[]
if (!existingContracts || existingContracts.length < 1) return
while (existingContracts.length > 0) {
const role = existingContracts.shift().toString()
if (!role) break
if (role != event.params.contractAddress.toHexString()) newList.push(role)
}
templates.ssTemplates = newList
templates.save()
}

export function handleFixedRateContractAdded(
event: FixedRateContractAdded
Expand Down
5 changes: 5 additions & 0 deletions src/mappings/utils/fixedRateUtils.ts
Original file line number Diff line number Diff line change
Expand Up @@ -52,6 +52,11 @@ export function updateFixedRateExchangeSupply(
fixedRateDetails.value.value8.toBigDecimal(),
baseToken.decimals
)
// update withMint state
fixedRateExchange.withMint = fixedRateDetails.value.value11

// update active state
fixedRateExchange.active = fixedRateDetails.value.value6
fixedRateExchange.save()
}

Expand Down
4 changes: 0 additions & 4 deletions subgraph.template.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -268,10 +268,6 @@ dataSources:
handler: handleTokenRemoved
- event: OPCFeeChanged(indexed address,uint256,uint256,uint256,uint256)
handler: handleOPCFeeChanged
- event: SSContractAdded(indexed address,indexed address)
handler: handleSSContractAdded
- event: SSContractRemoved(indexed address,indexed address)
handler: handleSSContractRemoved
- event: FixedRateContractAdded(indexed address,indexed address)
handler: handleFixedRateContractAdded
- event: FixedRateContractRemoved(indexed address,indexed address)
Expand Down
Loading

0 comments on commit 8bc4dab

Please sign in to comment.