Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Arthera testnet #3

Draft
wants to merge 14 commits into
base: arthera-testnet
Choose a base branch
from
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
39 changes: 38 additions & 1 deletion Algebra/README.md
Original file line number Diff line number Diff line change
@@ -1,2 +1,39 @@
# Algebra Subgraph
# Algebra subgraph

## Configure

Before build you need to make a few changes:

* Update FACTORY_ADDRESS in Algebra/src/utils/constants.ts
* Update USDC_WAA_03_POOL, WHITELIST_TOKENS and STABLE_COINS in Algebra/src/utils/pricing.ts, through which the price in usd will be calculated.
* Depending on the order of the tokens in the pool, you must set the required price( token0Price/token1Price) in Algebra/src/utils/pricing.ts#L41
* You can also set the required number of native tokens in the pool to include it when calculating prices by changing MINIMUM_Matic_LOCKED in Algebra/src/utils/pricing.ts
* Update network, startBlock and addresses in subgraph.yaml

## Install

To install dependencies you need to run:
```
yarn
```
## Build

To build you need to run:
```
yarn codegen
yarn build
```

## Create

To create you need to run:
```
yarn run create
```

## Deploy

To deploy you need to run:
```
yarn run deploy
```
7 changes: 2 additions & 5 deletions Algebra/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -7,11 +7,8 @@
"scripts": {
"codegen": "graph codegen --output-dir src/types/",
"build": "graph build",
"create-local": "graph create cryptoalgebra/algebra --node http://127.0.0.1:8020",
"deploy-local": "graph deploy cryptoalgebra/algebra --debug --ipfs http://localhost:5001 --node http://127.0.0.1:8020",
"deploy": "graph deploy --node https://api.thegraph.com/deploy/ --ipfs https://api.thegraph.com/ipfs/ --access-token iliaazhel/integral-core subgraph.yaml",
"deploy-dev": "graph deploy --node https://api.thegraph.com/deploy/ --ipfs https://api.thegraph.com/ipfs/ --access-token a3f47169869d4585a475d0d1d10a4062 iliaazhel/fuzzyswap subgraph.yaml",
"create": "graph create cryptoalgebra/info --node https://api.thegraph.com/create/"
"create": "graph create cryptoalgebra/algebra --node http://127.0.0.1:8020",
"deploy": "graph deploy cryptoalgebra/algebra --ipfs http://127.0.0.1:5001 --node http://127.0.0.1:8020"
},
"devDependencies": {
"@graphprotocol/graph-cli": "0.64.0",
Expand Down
19 changes: 9 additions & 10 deletions Algebra/src/utils/pricing.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,25 +4,24 @@ import { Bundle, Pool, Token } from './../types/schema'
import { BigDecimal, BigInt } from '@graphprotocol/graph-ts'
import { exponentToBigDecimal, safeDiv } from '../utils/index'

const WMatic_ADDRESS = '0x5a1750f9cb8a7e98e1fd618922af276493318710'
const USDC_WMatic_03_POOL = '0xb104f0535a35a69880dab51008756c31d47dbf0f'
const WAA_ADDRESS = '0x5a1750f9cb8a7e98e1fd618922af276493318710'
const USDC_WAA_03_POOL = '0x57c94b6e3b15d0f4028f51b98f7a3a85f3acac71'

// token where amounts should contribute to tracked volume and liquidity
// usually tokens that many tokens are paired with s
export let WHITELIST_TOKENS: string[] = [
'0x5a1750f9cb8a7e98e1fd618922af276493318710', // WMATIC
'0xf2a0bc44debd394076c67962bb4869fd43c78018', // USDC
'0x5aefba317baba46eaf98fd6f381d07673bca6467', // USDT
'0x49a390a3dfd2d01389f799965f3af5961f87d228'
'0x5a1750f9cb8a7e98e1fd618922af276493318710', // WAA
'0x0a552ed9d121783fbbb291299fd09663ee02aee9', // USDC
'0x185fd3ef4eb1c013a6e8eb2e76f8c451adfb4745' // USDT
]

let MINIMUM_Matic_LOCKED = BigDecimal.fromString('0')

let Q192 = Math.pow(2, 192)

let STABLE_COINS: string[] = [
'0xf2a0bc44debd394076c67962bb4869fd43c78018', // USDC
'0x5aefba317baba46eaf98fd6f381d07673bca6467' // SUDT
'0x0a552ed9d121783fbbb291299fd09663ee02aee9', // USDC
'0x185fd3ef4eb1c013a6e8eb2e76f8c451adfb4745' // USDT
]


Expand All @@ -39,7 +38,7 @@ export function priceToTokenPrices(price: BigInt, token0: Token, token1: Token):
}

export function getEthPriceInUSD(): BigDecimal {
let usdcPool = Pool.load(USDC_WMatic_03_POOL) // dai is token0
let usdcPool = Pool.load(USDC_WAA_03_POOL) // dai is token0
if (usdcPool !== null) {
return usdcPool.token0Price
} else {
Expand All @@ -53,7 +52,7 @@ export function getEthPriceInUSD(): BigDecimal {
* @todo update to be derived Matic (add stablecoin estimates)
**/
export function findEthPerToken(token: Token): BigDecimal {
if (token.id == WMatic_ADDRESS) {
if (token.id == WAA_ADDRESS) {
return ONE_BD
}
let whiteList = token.whitelistPools
Expand Down
4 changes: 2 additions & 2 deletions Algebra/subgraph.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ dataSources:
source:
address: '0x13fcE0acbe6Fb11641ab753212550574CaD31415'
abi: Factory
startBlock: 8000
startBlock: 8843
mapping:
kind: ethereum/events
apiVersion: 0.0.6
Expand Down Expand Up @@ -40,7 +40,7 @@ dataSources:
source:
address: '0x83D4a9Ea77a4dbA073cD90b30410Ac9F95F93E7C'
abi: NonfungiblePositionManager
startBlock: 8000
startBlock: 8864
mapping:
kind: ethereum/events
apiVersion: 0.0.6
Expand Down
36 changes: 35 additions & 1 deletion AlgebraFarming/README.md
Original file line number Diff line number Diff line change
@@ -1,2 +1,36 @@
# Algebra Farming Subgraph
# AlgebraFarming subgraph

## Configure

Before build you need to make a few changes:

* Update FarmingCenterAddress in AlgebraFarming/src/utils/constants.ts
* Update network, startBlock and addresses in subgraph.yaml

## Install

To install dependencies you need to run:
```
yarn
```
## Build

To build you need to run:
```
yarn codegen
yarn build
```

## Create

To create you need to run:
```
yarn run create
```

## Deploy

To deploy you need to run:
```
yarn run deploy
```
8 changes: 2 additions & 6 deletions AlgebraFarming/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -7,12 +7,8 @@
"scripts": {
"codegen": "graph codegen --output-dir src/types/",
"build": "graph build",
"create-local": "graph create iliaazhel/karasb --node http://127.0.0.1:8020",
"create-pulse": "graph create cryptoalgebra/algebra-farming --node http://3.16.122.80:8120/",
"deploy-pulse": "graph deploy cryptoalgebra/algebra-farming --debug --ipfs http://3.16.122.80:5101 --node http://3.16.122.80:8120/",
"deploy-local": "graph deploy iliaazhel/karasb --debug --ipfs http://localhost:5001 --node http://127.0.0.1:8020",
"deploy": "graph deploy --node https://api.thegraph.com/deploy/ --ipfs https://api.thegraph.com/ipfs/ --access-token iliaazhel/zyberswap-farming subgraph.yaml",
"deploy-dev": "graph deploy --node https://api.thegraph.com/deploy/ --ipfs https://api.thegraph.com/ipfs/ iliaazhel/algebra-dev-staker subgraph.yaml"
"create": "graph create cryptoalgebra/algebra-farming --node http://127.0.0.1:8020",
"deploy": "graph deploy cryptoalgebra/algebra-farming --ipfs http://127.0.0.1:5001 --node http://127.0.0.1:8020"
},
"devDependencies": {
"@graphprotocol/graph-cli": "0.64.0",
Expand Down
4 changes: 2 additions & 2 deletions AlgebraFarming/subgraph.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ dataSources:
source:
address: '0x83D4a9Ea77a4dbA073cD90b30410Ac9F95F93E7C'
abi: NonfungiblePositionManager
startBlock: 8000
startBlock: 8864
mapping:
kind: ethereum/events
apiVersion: 0.0.6
Expand Down Expand Up @@ -40,7 +40,7 @@ dataSources:
source:
address: '0x34D6F4f7D27B94C157aE3DB2D17C1beCB1bBF89C'
abi: EternalFarming
startBlock: 8000
startBlock: 8868
mapping:
kind: ethereum/events
apiVersion: 0.0.6
Expand Down
45 changes: 5 additions & 40 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,48 +1,13 @@
# Algebra_Subgraph
# Algebra Subgraphs

## Algebra

### Build

Before build you need to make a few changes:

* Update FACTORY_ADDRESS in Algebra/src/utils/constants.ts
* Update USDC_WMatic_03_POOL, WHITELIST_TOKENS and STABLE_COINS in Algebra/src/utils/pricing.ts, through which the price in usd will be calculated.
* Depending on the order of the tokens in the pool, you must set the requred price( token0Price/token1Price) in Algebra/src/utils/pricing.ts#L41
* You can also set the required number of native tokens in the pool to include it when calculating prices by changing MINIMUM_Matic_LOCKED in Algebra/src/utils/pricing.ts
* Update network, startBlock and addresses in subgraph.yaml

After that you need to run:
```
$ yarn
$ yarn codegen
$ yarn build
```

### Deploy

For deploy you need to run:
```
$ yarn graph deploy --node https://api.thegraph.com/deploy/ --ipfs https://api.thegraph.com/ipfs/ --access-token <access-token> <graph-name> subgraph.yaml
```
[Algebra](Algebra/README.md)

## AlgebraFarming

Before build you need to make a few changes:

Update FarmingCenterAddress in AlgebraFarming/src/utils/constants.ts
Update network, startBlock and addresses in subgraph.yaml

After that you need to run:
```
$ yarn
$ yarn codegen
$ yarn build
```
[AlgebraFarming](AlgebraFarming/README.md)

### Deploy
## Blocklytics

For deploy you need to run:
```
$ yarn graph deploy --node https://api.thegraph.com/deploy/ --ipfs https://api.thegraph.com/ipfs/ --access-token <access-token> <graph-name> subgraph.yaml
```
[blocklytics](blocklytics/README.md)
35 changes: 35 additions & 0 deletions blocklytics/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
# Blocklytics subgraph

## Configure

Before build you need to make a few changes:

* Update network, startBlock and address in subgraph.yaml

## Install

To install dependencies you need to run:
```
yarn
```
## Build

To build you need to run:
```
yarn codegen
yarn build
```

## Create

To create you need to run:
```
yarn run create
```

## Deploy

To deploy you need to run:
```
yarn run deploy
```
Loading