mirror of
https://github.com/oceanprotocol/ocean-subgraph.git
synced 2024-06-28 16:57:43 +02:00
20 lines
550 B
TypeScript
20 lines
550 B
TypeScript
|
import { FixedRateExchange } from '../../@types/schema'
|
||
|
|
||
|
export function getFixedRateExchange(exchangeId: string): FixedRateExchange {
|
||
|
let fixedRateExhange = FixedRateExchange.load(exchangeId)
|
||
|
if (fixedRateExhange === null) {
|
||
|
fixedRateExhange = new FixedRateExchange(exchangeId)
|
||
|
// TODO: get data from contract and fill in new fixed rate exchange
|
||
|
fixedRateExhange.save()
|
||
|
}
|
||
|
|
||
|
return fixedRateExhange
|
||
|
}
|
||
|
|
||
|
export function getUpdateOrSwapId(
|
||
|
txAddress: string,
|
||
|
exchangeId: string
|
||
|
): string {
|
||
|
return `${txAddress}-${exchangeId}`
|
||
|
}
|