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
|
||||
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
|
||||
data directories for IPFS and Postgres in `./data/ipfs` and `./data/postgres`. You
|
||||
|
@ -231,13 +231,13 @@ type PoolTransaction @entity {
|
||||
"base tokens transfered"
|
||||
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
|
||||
|
||||
"datatokens transfered"
|
||||
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
|
||||
}
|
||||
|
||||
|
@ -87,12 +87,12 @@ export function handleExit(event: LOG_EXIT): void {
|
||||
)
|
||||
if (token.isDatatoken) {
|
||||
poolTx.datatoken = token.id
|
||||
poolTx.datatokenValue = ammount.neg()
|
||||
poolTx.datatokenValue = ammount
|
||||
|
||||
pool.datatokenLiquidity = pool.datatokenLiquidity.minus(ammount)
|
||||
} else {
|
||||
poolTx.baseToken = token.id
|
||||
poolTx.baseTokenValue = ammount.neg()
|
||||
poolTx.baseTokenValue = ammount
|
||||
|
||||
pool.baseTokenLiquidity = pool.baseTokenLiquidity.minus(ammount)
|
||||
removeLiquidity(token.id, ammount)
|
||||
|
@ -17,16 +17,27 @@ export function getPoolShareId(
|
||||
return `${poolAddress}-${userAddress}`
|
||||
}
|
||||
|
||||
export function getPoolTransactionId(
|
||||
txHash: string,
|
||||
userAddress: string
|
||||
): string {
|
||||
return `${txHash}-${userAddress}`
|
||||
}
|
||||
|
||||
export function getPoolTransaction(
|
||||
event: ethereum.Event,
|
||||
userAddress: string,
|
||||
type: string
|
||||
): 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
|
||||
if (poolTx === null) {
|
||||
poolTx = new PoolTransaction(event.transaction.hash.toHex())
|
||||
poolTx = new PoolTransaction(txId)
|
||||
|
||||
poolTx.user = userAddress
|
||||
poolTx.pool = event.address.toHex()
|
||||
|
Loading…
Reference in New Issue
Block a user