|
1 |
| -import { BigDecimal, BigInt, dataSource } from '@graphprotocol/graph-ts' |
2 |
| - |
3 |
| -export const ZERO_BD = BigDecimal.fromString('0.0') |
4 |
| -export const MINUS_1_BD = BigDecimal.fromString('-1.0') |
5 |
| -export const ONE_BD = BigDecimal.fromString('1.0') |
6 |
| - |
7 |
| -export const ONE_BASE_18 = BigInt.fromI32(10).pow(18 as u8) |
8 |
| -export const BONE = BigDecimal.fromString('1000000000000000000') |
9 |
| - |
10 |
| -export const ENABLE_DEBUG = true |
11 |
| - |
12 |
| -const network = dataSource.network() |
13 |
| - |
14 |
| -export function getOceanAddress(): string { |
15 |
| - // switch is not working for some reason |
16 |
| - if (network == 'ropsten') return '0x5e8dcb2afa23844bcc311b00ad1a0c30025aade9' |
17 |
| - if (network == 'rinkeby') return '0x8967bcf84170c91b0d24d4302c2376283b0b3a07' |
18 |
| - if (network == 'polygon') return '0x282d8efce846a88b159800bd4130ad77443fa1a1' |
19 |
| - if (network == 'moonbeamalpha') |
20 |
| - return '0xf6410bf5d773c7a41ebff972f38e7463fa242477' |
21 |
| - if (network == 'gaiaxtestnet') |
22 |
| - return '0x80e63f73cac60c1662f27d2dfd2ea834acddbaa8' |
23 |
| - if (network == 'catenaxtestnet') |
24 |
| - return '0x80e63f73cac60c1662f27d2dfd2ea834acddbaa8' |
25 |
| - if (network == 'mumbai') return '0xd8992ed72c445c35cb4a2be468568ed1079357c8' |
26 |
| - if (network == 'bsc') return '0xdce07662ca8ebc241316a15b611c89711414dd1a' |
27 |
| - if (network == 'celoalfajores') |
28 |
| - return '0xd8992ed72c445c35cb4a2be468568ed1079357c8' |
29 |
| - if (network == 'energyweb') |
30 |
| - return '0x593122aae80a6fc3183b2ac0c4ab3336debee528' |
31 |
| - if (network == 'moonriver') |
32 |
| - return '0x99c409e5f62e4bd2ac142f17cafb6810b8f0baae' |
33 |
| - return '0x967da4048cd07ab37855c090aaf366e4ce1b9f48' |
34 |
| -} |
35 |
| - |
36 |
| -export const OCEAN: string = getOceanAddress() |
| 1 | + |
37 | 2 |
|
38 | 3 | // export function getGlobalStats(): Global {
|
39 | 4 | // let gStats: Global | null = Global.load('1')
|
@@ -66,13 +31,6 @@ export const OCEAN: string = getOceanAddress()
|
66 | 31 | // return amount.toBigDecimal().div(scale)
|
67 | 32 | // }
|
68 | 33 |
|
69 |
| -export function tokenToDecimal(amount: BigDecimal, decimals: i32): BigDecimal { |
70 |
| - const scale = BigInt.fromI32(10) |
71 |
| - .pow(decimals as u8) |
72 |
| - .toBigDecimal() |
73 |
| - return amount.div(scale) |
74 |
| -} |
75 |
| - |
76 | 34 | // export function decimalToBigInt(value: BigDecimal): BigInt {
|
77 | 35 | // value.truncate(18)
|
78 | 36 | // const scale = BigInt.fromI32(10).pow((value.exp.toI32() + 18) as u8)
|
|
0 commit comments