mirror of
https://github.com/oceanprotocol/ocean-subgraph.git
synced 2024-12-02 05:57:29 +01:00
parent
9837a71a27
commit
17821115f9
@ -60,6 +60,11 @@ clone this repository and run
|
|||||||
```sh
|
```sh
|
||||||
docker-compose up
|
docker-compose up
|
||||||
```
|
```
|
||||||
|
OR
|
||||||
|
|
||||||
|
```sh
|
||||||
|
docker-compose --env-file .env up | grep -a -E --color 'WARN.*|$'
|
||||||
|
```
|
||||||
|
|
||||||
This will start IPFS, Postgres and Graph Node in Docker and create persistent
|
This will start IPFS, Postgres and Graph Node in Docker and create persistent
|
||||||
data directories for IPFS and Postgres in `./data/ipfs` and `./data/postgres`. You
|
data directories for IPFS and Postgres in `./data/ipfs` and `./data/postgres`. You
|
||||||
|
@ -231,13 +231,13 @@ type PoolTransaction @entity {
|
|||||||
"base tokens transfered"
|
"base tokens transfered"
|
||||||
baseToken: Token
|
baseToken: Token
|
||||||
|
|
||||||
"number of base tokens transfered, if value is negative it means it was removed"
|
"number of base tokens transfered, for type SWAP if value is negative it means it was removed"
|
||||||
baseTokenValue: BigDecimal
|
baseTokenValue: BigDecimal
|
||||||
|
|
||||||
"datatokens transfered"
|
"datatokens transfered"
|
||||||
datatoken: Token
|
datatoken: Token
|
||||||
|
|
||||||
"number of datatokens transfered, if value is negative it means it was removed"
|
"number of datatokens transfered, for type SWAP if value is negative it means it was removed"
|
||||||
datatokenValue: BigDecimal
|
datatokenValue: BigDecimal
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -87,12 +87,12 @@ export function handleExit(event: LOG_EXIT): void {
|
|||||||
)
|
)
|
||||||
if (token.isDatatoken) {
|
if (token.isDatatoken) {
|
||||||
poolTx.datatoken = token.id
|
poolTx.datatoken = token.id
|
||||||
poolTx.datatokenValue = ammount.neg()
|
poolTx.datatokenValue = ammount
|
||||||
|
|
||||||
pool.datatokenLiquidity = pool.datatokenLiquidity.minus(ammount)
|
pool.datatokenLiquidity = pool.datatokenLiquidity.minus(ammount)
|
||||||
} else {
|
} else {
|
||||||
poolTx.baseToken = token.id
|
poolTx.baseToken = token.id
|
||||||
poolTx.baseTokenValue = ammount.neg()
|
poolTx.baseTokenValue = ammount
|
||||||
|
|
||||||
pool.baseTokenLiquidity = pool.baseTokenLiquidity.minus(ammount)
|
pool.baseTokenLiquidity = pool.baseTokenLiquidity.minus(ammount)
|
||||||
removeLiquidity(token.id, ammount)
|
removeLiquidity(token.id, ammount)
|
||||||
|
@ -17,16 +17,27 @@ export function getPoolShareId(
|
|||||||
return `${poolAddress}-${userAddress}`
|
return `${poolAddress}-${userAddress}`
|
||||||
}
|
}
|
||||||
|
|
||||||
|
export function getPoolTransactionId(
|
||||||
|
txHash: string,
|
||||||
|
userAddress: string
|
||||||
|
): string {
|
||||||
|
return `${txHash}-${userAddress}`
|
||||||
|
}
|
||||||
|
|
||||||
export function getPoolTransaction(
|
export function getPoolTransaction(
|
||||||
event: ethereum.Event,
|
event: ethereum.Event,
|
||||||
userAddress: string,
|
userAddress: string,
|
||||||
type: string
|
type: string
|
||||||
): PoolTransaction {
|
): PoolTransaction {
|
||||||
let poolTx = PoolTransaction.load(event.transaction.hash.toHex())
|
const txId = getPoolTransactionId(
|
||||||
|
event.transaction.hash.toHexString(),
|
||||||
|
userAddress
|
||||||
|
)
|
||||||
|
let poolTx = PoolTransaction.load(txId)
|
||||||
|
|
||||||
// create pool transaction and fill basic fields
|
// create pool transaction and fill basic fields
|
||||||
if (poolTx === null) {
|
if (poolTx === null) {
|
||||||
poolTx = new PoolTransaction(event.transaction.hash.toHex())
|
poolTx = new PoolTransaction(txId)
|
||||||
|
|
||||||
poolTx.user = userAddress
|
poolTx.user = userAddress
|
||||||
poolTx.pool = event.address.toHex()
|
poolTx.pool = event.address.toHex()
|
||||||
|
Loading…
Reference in New Issue
Block a user