From 53e93861bccba5cdabdbbfc8258b1db63a185e7b Mon Sep 17 00:00:00 2001 From: mihaisc Date: Fri, 12 Nov 2021 15:22:21 +0200 Subject: [PATCH] another update --- src/helpers.ts | 42 ------------------------------------------ 1 file changed, 42 deletions(-) diff --git a/src/helpers.ts b/src/helpers.ts index 22011b3..c404399 100644 --- a/src/helpers.ts +++ b/src/helpers.ts @@ -1,39 +1,4 @@ -import { BigDecimal, BigInt, dataSource } from '@graphprotocol/graph-ts' -export const ZERO_BD = BigDecimal.fromString('0.0') -export const MINUS_1_BD = BigDecimal.fromString('-1.0') -export const ONE_BD = BigDecimal.fromString('1.0') - -export const ONE_BASE_18 = BigInt.fromI32(10).pow(18 as u8) -export const BONE = BigDecimal.fromString('1000000000000000000') - -export const ENABLE_DEBUG = true - -const network = dataSource.network() - -export function getOceanAddress(): string { - // switch is not working for some reason - if (network == 'ropsten') return '0x5e8dcb2afa23844bcc311b00ad1a0c30025aade9' - if (network == 'rinkeby') return '0x8967bcf84170c91b0d24d4302c2376283b0b3a07' - if (network == 'polygon') return '0x282d8efce846a88b159800bd4130ad77443fa1a1' - if (network == 'moonbeamalpha') - return '0xf6410bf5d773c7a41ebff972f38e7463fa242477' - if (network == 'gaiaxtestnet') - return '0x80e63f73cac60c1662f27d2dfd2ea834acddbaa8' - if (network == 'catenaxtestnet') - return '0x80e63f73cac60c1662f27d2dfd2ea834acddbaa8' - if (network == 'mumbai') return '0xd8992ed72c445c35cb4a2be468568ed1079357c8' - if (network == 'bsc') return '0xdce07662ca8ebc241316a15b611c89711414dd1a' - if (network == 'celoalfajores') - return '0xd8992ed72c445c35cb4a2be468568ed1079357c8' - if (network == 'energyweb') - return '0x593122aae80a6fc3183b2ac0c4ab3336debee528' - if (network == 'moonriver') - return '0x99c409e5f62e4bd2ac142f17cafb6810b8f0baae' - return '0x967da4048cd07ab37855c090aaf366e4ce1b9f48' -} - -export const OCEAN: string = getOceanAddress() // export function getGlobalStats(): Global { // let gStats: Global | null = Global.load('1') @@ -66,13 +31,6 @@ export const OCEAN: string = getOceanAddress() // return amount.toBigDecimal().div(scale) // } -export function tokenToDecimal(amount: BigDecimal, decimals: i32): BigDecimal { - const scale = BigInt.fromI32(10) - .pow(decimals as u8) - .toBigDecimal() - return amount.div(scale) -} - // export function decimalToBigInt(value: BigDecimal): BigInt { // value.truncate(18) // const scale = BigInt.fromI32(10).pow((value.exp.toI32() + 18) as u8)