Skip to content
Open
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
4 changes: 2 additions & 2 deletions Algebra/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -13,8 +13,8 @@
"create": "graph create cryptoalgebra/info --node https://api.thegraph.com/create/"
},
"devDependencies": {
"@graphprotocol/graph-cli": "0.22.1",
"@graphprotocol/graph-ts": "^0.35.1",
"@graphprotocol/graph-cli": "^0.94.0",
"@graphprotocol/graph-ts": "0.35.1",
"@typescript-eslint/eslint-plugin": "^2.0.0",
"@typescript-eslint/parser": "^2.0.0",
"eslint": "^6.2.2",
Expand Down
3 changes: 3 additions & 0 deletions Algebra/src/mappings/factory.ts
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,7 @@ export function handlePoolCreated(event: PoolEvent): void {
factory.totalValueLockedMaticUntracked = ZERO_BD
factory.txCount = ZERO_BI
factory.owner = ADDRESS_ZERO
factory.defaultCommunityFee = ZERO_BI

// create new bundle for tracking matic price
let bundle = new Bundle('1')
Expand Down Expand Up @@ -147,6 +148,8 @@ export function handlePoolCreated(event: PoolEvent): void {
pool.feesToken0 = ZERO_BD
pool.feesToken1 = ZERO_BD
pool.untrackedVolumeUSD = ZERO_BD
pool.tick = ZERO_BI
pool.untrackedFeesUSD = ZERO_BD

pool.collectedFeesToken0 = ZERO_BD
pool.collectedFeesToken1 = ZERO_BD
Expand Down
14 changes: 10 additions & 4 deletions Algebra/src/mappings/position-manager.ts
Original file line number Diff line number Diff line change
Expand Up @@ -127,15 +127,21 @@ export function handleIncreaseLiquidity(event: IncreaseLiquidity): void {
let amount1 = ZERO_BD
let amount0 = ZERO_BD

let token0Decimals = ZERO_BI
let token1Decimals = ZERO_BI

if(token0) token0Decimals = token0.decimals
if(token1) token1Decimals = token1.decimals

if(pools_list.includes(position.pool))
amount0 = convertTokenToDecimal(event.params.amount1, token0!.decimals)
amount0 = convertTokenToDecimal(event.params.amount1, token0Decimals)
else
amount0 = convertTokenToDecimal(event.params.amount0, token0!.decimals)
amount0 = convertTokenToDecimal(event.params.amount0, token0Decimals)

if(pools_list.includes(position.pool))
amount1 = convertTokenToDecimal(event.params.amount0, token1!.decimals)
amount1 = convertTokenToDecimal(event.params.amount0, token1Decimals)
else
amount1 = convertTokenToDecimal(event.params.amount1, token1!.decimals)
amount1 = convertTokenToDecimal(event.params.amount1, token1Decimals)

position.liquidity = position.liquidity.plus(event.params.liquidity)
position.depositedToken0 = position.depositedToken0.plus(amount0)
Expand Down
3 changes: 3 additions & 0 deletions Algebra/src/utils/intervalUpdates.ts
Original file line number Diff line number Diff line change
Expand Up @@ -70,6 +70,9 @@ export function updatePoolDayData(event: ethereum.Event): PoolDayData {
poolDayData.high = pool.token0Price
poolDayData.low = pool.token0Price
poolDayData.close = pool.token0Price

poolDayData.feesToken0 = ZERO_BD
poolDayData.feesToken1 = ZERO_BD
}

if (pool.token0Price.gt(poolDayData.high)) {
Expand Down
1 change: 1 addition & 0 deletions Algebra/src/utils/pricing.ts
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@ export let WHITELIST_TOKENS: string[] = [
'0x4d18815d14fe5c3304e87b3fa18318baa5c23820', // SAFE
'0xcb444e90d8198415266c6a2724b7900fb12fc56e', // EURE
'0x4b1e2c2762667331bc91648052f646d1b0d35984', // EURA (prev. agEUR)
"0x1e2c4fb7ede391d116e6b41cd0608260e8801d59", // bCSPX
]

let MINIMUM_Matic_LOCKED = BigDecimal.fromString('0')
Expand Down
2 changes: 1 addition & 1 deletion Algebra/subgraph.yaml
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
specVersion: 0.0.4
description: Algebra is a decentralized protocol for automated token exchange on Polygon.
description: Swapr is a decentralized protocol for automated token exchange on Gnosis chain.
schema:
file: ./schema.graphql
dataSources:
Expand Down
Loading