Skip to content

Commit

Permalink
debugging fixes and build fix
Browse files Browse the repository at this point in the history
  • Loading branch information
dbeal-eth committed Jun 8, 2022
1 parent 07cb0a8 commit 1b5c0fc
Show file tree
Hide file tree
Showing 3 changed files with 70 additions and 60 deletions.
11 changes: 8 additions & 3 deletions scripts/deploy.js
Original file line number Diff line number Diff line change
Expand Up @@ -50,6 +50,7 @@ program
.option('-d, --deploy-decentralized [value]', 'Deploy to the decentralized network', parseBoolean)
.option('-v, --version-label [value]', 'Version label for the deployment to the decentralized network')
.option('--build-only', 'Skip deploy')
.option('--debug', 'Print out extra debugging information')
.option(
'--graft-base <id>',
'ID of subgraph to graft. If unspecified, will attempt to read existing from the graph API',
Expand Down Expand Up @@ -157,14 +158,18 @@ program.action(async () => {
console.log(cyan('Creating contracts...'));
await exec('node ./scripts/helpers/create-contracts');

let prefixArgs = `DEBUG_MANIFEST=true SNX_START_BLOCK=${process.env.SNX_START_BLOCK || 0} SNX_NETWORK=${
settings.network
} SUBGRAPH=${settings.subgraph}`;
let prefixArgs = `SNX_START_BLOCK=${process.env.SNX_START_BLOCK || 0} SNX_NETWORK=${settings.network} SUBGRAPH=${
settings.subgraph
}`;

if (settings.graftBlock) {
prefixArgs += ` GRAFT_BASE=${prevDeployId} GRAFT_BLOCK=${settings.graftBlock}`;
}

if (settings.debug) {
prefixArgs += ' DEBUG_MANIFEST=true';
}

if (settings.network !== 'None') {
if (settings.network == 'All') {
for (let i = 0; i < NETWORK_CHOICES.length; i++) {
Expand Down
78 changes: 38 additions & 40 deletions subgraphs/exchanges.js
Original file line number Diff line number Diff line change
Expand Up @@ -211,47 +211,45 @@ getContractDeployments('SystemSettings').forEach((a, i) => {
});
});

if (getCurrentNetwork() == 'optimism') {
getContractDeployments('FuturesMarketManager').forEach((a, i) => {
manifest.push({
kind: 'ethereum/contract',
name: `exchanges_FuturesMarketManager_${i}`,
network: getCurrentNetwork(),
source: {
address: a.address,
startBlock: a.startBlock,
abi: 'FuturesMarketManager',
},
mapping: {
kind: 'ethereum/events',
apiVersion: '0.0.5',
language: 'wasm/assemblyscript',
file: '../src/exchanges.ts',
entities: ['FuturesMarket'],
abis: [
{
name: 'FuturesMarket',
file: '../abis/FuturesMarket.json',
},
{
name: 'FuturesMarketManager',
file: '../abis/FuturesMarketManager.json',
},
],
eventHandlers: [
{
event: 'MarketAdded(address,indexed bytes32,indexed bytes32)',
handler: 'handleMarketAdded',
},
{
event: 'MarketRemoved(address,indexed bytes32,indexed bytes32)',
handler: 'handleMarketRemoved',
},
],
},
});
getContractDeployments('FuturesMarketManager').forEach((a, i) => {
manifest.push({
kind: 'ethereum/contract',
name: `exchanges_FuturesMarketManager_${i}`,
network: getCurrentNetwork(),
source: {
address: a.address,
startBlock: a.startBlock,
abi: 'FuturesMarketManager',
},
mapping: {
kind: 'ethereum/events',
apiVersion: '0.0.5',
language: 'wasm/assemblyscript',
file: '../src/exchanges.ts',
entities: ['FuturesMarket'],
abis: [
{
name: 'FuturesMarket',
file: '../abis/FuturesMarket.json',
},
{
name: 'FuturesMarketManager',
file: '../abis/FuturesMarketManager.json',
},
],
eventHandlers: [
{
event: 'MarketAdded(address,indexed bytes32,indexed bytes32)',
handler: 'handleMarketAdded',
},
{
event: 'MarketRemoved(address,indexed bytes32,indexed bytes32)',
handler: 'handleMarketRemoved',
},
],
},
});
}
});

let futuresMarketTemplate = {
kind: 'ethereum/contract',
Expand Down
41 changes: 24 additions & 17 deletions subgraphs/main.graphql
Original file line number Diff line number Diff line change
Expand Up @@ -240,6 +240,8 @@ type Total @entity {
id: ID!
" timestamp of the beginning of the time period this represents "
timestamp: BigInt!
" which product the volume came from. Ex 'futures' or 'exchange' "
product: String!
" number of seconds the data covers after `timestamp` "
period: BigInt!
" minimum power of 10 (in from USD value) the trade must be. ex, 2 means $100 or higher) "
Expand Down Expand Up @@ -293,6 +295,28 @@ type ExchangeFee @entity {
fee: BigDecimal!
}

type Candle @entity {
" synth-period-periodId (periodId is timestamp / period) "
id: ID!
" Ticker for synth (e.g. 'sUSD') or 'SNX'"
synth: String!
open: BigDecimal!
high: BigDecimal!
low: BigDecimal!
close: BigDecimal!
average: BigDecimal!
timestamp: BigInt!
" Duration this candle captures in seconds. Year, quarter, month, week, day, hour, and 15 minutes available. "
period: BigInt!
" Number of RateUpdates aggregated into this candle, mostly useful for the indexer to calculate averages "
aggregatedPrices: BigInt!
}

type FuturesMarket @entity {
" Address of the market "
id: ID!
}

" Synthentix is an aggregation entity "
type Synthetix @entity {
id: ID!
Expand Down Expand Up @@ -437,23 +461,6 @@ type ActiveStaker @entity {
id: ID!
}

type Candle @entity {
" synth-period-periodId (periodId is timestamp / period) "
id: ID!
" Ticker for synth (e.g. 'sUSD') or 'SNX'"
synth: String!
open: BigDecimal!
high: BigDecimal!
low: BigDecimal!
close: BigDecimal!
average: BigDecimal!
timestamp: BigInt!
" Duration this candle captures in seconds. Year, quarter, month, week, day, hour, and 15 minutes available. "
period: BigInt!
" Number of RateUpdates aggregated into this candle, mostly useful for the indexer to calculate averages "
aggregatedPrices: BigInt!
}

type AccountFlaggedForLiquidation @entity {
" the deadline plus the staker address "
id: ID!
Expand Down

0 comments on commit 1b5c0fc

Please sign in to comment.