Skip to content

Commit

Permalink
🚧
Browse files Browse the repository at this point in the history
  • Loading branch information
itofarina committed Feb 2, 2024
1 parent a785f40 commit 6948a1e
Show file tree
Hide file tree
Showing 4 changed files with 18 additions and 12 deletions.
4 changes: 2 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -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": {
Expand Down
8 changes: 6 additions & 2 deletions src/utils/loadMarket.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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();
Expand Down
8 changes: 4 additions & 4 deletions subgraph.template.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ dataSources:
{{# Auditor }}
- kind: ethereum/contract
name: Auditor
network: {{ network }}
network: {{ graphNetwork }}
source:
address: '{{ address }}'
startBlock: {{ startBlock }}
Expand Down Expand Up @@ -49,7 +49,7 @@ dataSources:
{{# Market }}
- kind: ethereum/contract
name: {{ name }}
network: {{ network }}
network: {{ graphNetwork }}
source:
address: '{{ address }}'
startBlock: {{ startBlock }}
Expand Down Expand Up @@ -147,7 +147,7 @@ dataSources:
{{# RewardsController }}
- kind: ethereum/contract
name: RewardsController
network: {{ network }}
network: {{ graphNetwork }}
source:
address: '{{ address }}'
startBlock: {{ startBlock }}
Expand Down Expand Up @@ -175,7 +175,7 @@ dataSources:
{{# TimelockController }}
- kind: ethereum/contract
name: TimelockController
network: {{ network }}
network: {{ graphNetwork }}
source:
address: '{{ address }}'
startBlock: {{ startBlock }}
Expand Down
10 changes: 6 additions & 4 deletions views/protocol.js
Original file line number Diff line number Diff line change
Expand Up @@ -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} */
Expand All @@ -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) => {
Expand Down

0 comments on commit 6948a1e

Please sign in to comment.