2021-11-10 13:47:44 +01:00
|
|
|
import { FixedRateExchange } from '../../@types/schema'
|
|
|
|
|
|
|
|
export function getFixedRateExchange(exchangeId: string): FixedRateExchange {
|
|
|
|
let fixedRateExhange = FixedRateExchange.load(exchangeId)
|
|
|
|
if (fixedRateExhange === null) {
|
|
|
|
fixedRateExhange = new FixedRateExchange(exchangeId)
|
2022-02-15 17:13:55 +01:00
|
|
|
// TODO: get data from contract and fill in new fixed rate exchange, this is just a worst case scenario. We shouldn't reach this code
|
2021-11-10 13:47:44 +01:00
|
|
|
fixedRateExhange.save()
|
|
|
|
}
|
|
|
|
|
|
|
|
return fixedRateExhange
|
|
|
|
}
|
|
|
|
|
|
|
|
export function getUpdateOrSwapId(
|
|
|
|
txAddress: string,
|
|
|
|
exchangeId: string
|
|
|
|
): string {
|
|
|
|
return `${txAddress}-${exchangeId}`
|
|
|
|
}
|