diff --git a/package.json b/package.json index daba09c..5961cfa 100644 --- a/package.json +++ b/package.json @@ -12,9 +12,9 @@ "auth": "graph auth --studio", "deploy": "graph deploy --studio", "version": "changeset version && npm install --package-lock-only && git commit --all --amend --no-edit", - "prepare:mainnet": "cross-env NETWORK=mainnet mustache views/protocol.js subgraph.template.yaml > subgraph.yaml", + "prepare:ethereum": "cross-env NETWORK=ethereum mustache views/protocol.js subgraph.template.yaml > subgraph.yaml", "prepare:optimism": "cross-env NETWORK=optimism mustache views/protocol.js subgraph.template.yaml > subgraph.yaml", - "prepare:optimism-sepolia": "cross-env NETWORK=optimism-sepolia mustache views/protocol.js subgraph.template.yaml > subgraph.yaml", + "prepare:op-sepolia": "cross-env NETWORK=op-sepolia mustache views/protocol.js subgraph.template.yaml > subgraph.yaml", "postinstall": "run-s prepare:op-sepolia codegen" }, "engines": { diff --git a/src/utils/loadMarket.ts b/src/utils/loadMarket.ts index 75d64c0..3efd091 100644 --- a/src/utils/loadMarket.ts +++ b/src/utils/loadMarket.ts @@ -45,8 +45,12 @@ export default function loadMarket(market: Bytes, event: ethereum.Event): Market entity.assetSymbol = asset.symbol(); const irm = InterestRateModel.bind(mkt.interestRateModel()); - entity.fixedCurveA = irm.fixedCurveA(); - entity.fixedCurveB = irm.fixedCurveB(); + entity.fixedCurveA = orZero(irm.try_fixedCurveA()); + entity.fixedCurveB = orZero(irm.try_fixedCurveB()); + console.log('********************'); + console.log('fixedCurveB'); + console.log(entity.fixedCurveB.toString()); + console.log('********************'); entity.fixedMaxUtilization = irm.fixedMaxUtilization(); entity.floatingCurveA = irm.floatingCurveA(); entity.floatingCurveB = irm.floatingCurveB(); diff --git a/subgraph.template.yaml b/subgraph.template.yaml index c2eaabc..b94e8bc 100644 --- a/subgraph.template.yaml +++ b/subgraph.template.yaml @@ -5,7 +5,7 @@ dataSources: {{# Auditor }} - kind: ethereum/contract name: Auditor - network: {{ network }} + network: {{ graphNetwork }} source: address: '{{ address }}' startBlock: {{ startBlock }} @@ -49,7 +49,7 @@ dataSources: {{# Market }} - kind: ethereum/contract name: {{ name }} - network: {{ network }} + network: {{ graphNetwork }} source: address: '{{ address }}' startBlock: {{ startBlock }} @@ -147,7 +147,7 @@ dataSources: {{# RewardsController }} - kind: ethereum/contract name: RewardsController - network: {{ network }} + network: {{ graphNetwork }} source: address: '{{ address }}' startBlock: {{ startBlock }} @@ -175,7 +175,7 @@ dataSources: {{# TimelockController }} - kind: ethereum/contract name: TimelockController - network: {{ network }} + network: {{ graphNetwork }} source: address: '{{ address }}' startBlock: {{ startBlock }} diff --git a/views/protocol.js b/views/protocol.js index 7df6e62..f4c435d 100644 --- a/views/protocol.js +++ b/views/protocol.js @@ -4,10 +4,8 @@ const { existsSync, readdirSync, readFileSync } = require('fs'); const { NETWORK: network } = process.env; if (!network) throw new Error('network not set'); -const dir = `node_modules/@exactly/protocol/deployments/${{ - mainnet: 'ethereum', - 'optimism-sepolia': 'op-sepolia', -}[network] ?? network}/`; +const dir = `node_modules/@exactly/protocol/deployments/${network}/`; + const deployments = readdirSync(dir).filter((file) => extname(file) === '.json'); /** @type {function(string): Deployment} */ @@ -18,6 +16,10 @@ const from = ({ address, receipt }, name) => ({ name, address, startBlock: recei module.exports = { network, + graphNetwork: { + 'op-sepolia': 'optimism-sepolia', + ethereum: 'mainnet', + }[network] ?? network, Auditor: from(get('Auditor'), 'Auditor'), RewardsController: existsSync(join(dir, 'RewardsController.json')) ? from(get('RewardsController'), 'RewardsController') : undefined, Market: deployments.map((file) => {