Skip to content

Commit b531347

Browse files
smart-exSerg
authored andcommitted
Basic types definition for torn-token package
1 parent 456beaa commit b531347

File tree

5 files changed

+146
-2
lines changed

5 files changed

+146
-2
lines changed

.eslintrc

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,5 +22,6 @@
2222
"object-curly-spacing": ["error", "always"],
2323
"comma-dangle": ["error", "always-multiline"],
2424
"require-await": "error"
25-
}
25+
},
26+
"ignorePatterns": ["*.d.ts"]
2627
}

.prettierignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,3 +2,4 @@
22
build
33
scripts
44
contracts/ECDSA.sol
5+
*.d.ts

index.d.ts

Lines changed: 109 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,109 @@
1+
export const torn: Torn
2+
export const governance: Address
3+
export const governanceImpl: Address
4+
export const voucher: Voucher
5+
export const miningV2: Mining
6+
export const rewardSwap: RewardSwap
7+
export const tornadoTrees: TornadoTrees
8+
export const tornadoProxy: Address
9+
export const tornadoProxyLight: Address
10+
export const rewardVerifier: Address
11+
export const treeUpdateVerifier: Address
12+
export const withdrawVerifier: Address
13+
export const poseidonHasher2: Address
14+
export const poseidonHasher3: Address
15+
export const feeManager: Address
16+
export const tornadoStakingRewards: Address
17+
export const relayerRegistry: Address
18+
export const tornadoRouter: Address
19+
export const instanceRegistry: Address
20+
export const deployer: Address
21+
export const vesting: Vesting
22+
export const instances: Instances
23+
24+
25+
export type availableIds = 1 | 5 | 10 | 56 | 100 | 137 | 42161 | 43114
26+
export type availableTokens = 'eth' | 'dai' | 'cdai' | 'usdc' | 'usdt' | 'wbtc' | 'xdai' | 'matic' | 'avax' | 'bnb'
27+
export type netIds = `netId${availableIds}`
28+
29+
export type Address = {
30+
address: string
31+
}
32+
33+
export type Instances = {
34+
[p in netIds]: NetInstances;
35+
};
36+
37+
export type NetInstances = {
38+
[p in availableTokens]?: TInstance;
39+
}
40+
41+
export type TInstance = {
42+
instanceAddress: InstanceAddress
43+
tokenAddress?: string
44+
symbol: string
45+
decimals: number
46+
}
47+
48+
export type InstanceAddress = {
49+
'0.1'?: string
50+
'1'?: string
51+
'10'?: string
52+
'100'?: string
53+
'500'?: string
54+
'1000'?: string
55+
'5000'?: string
56+
'10000'?: string
57+
'50000'?: string
58+
'100000'?: string
59+
'500000'?: string
60+
'5000000'?: string
61+
}
62+
63+
export type Mining = Address & {
64+
initialBalance: string
65+
rates: Rate[]
66+
}
67+
68+
export type Rate = {
69+
instance: string
70+
value: string
71+
}
72+
73+
export type RewardSwap = Address & {
74+
poolWeight: number
75+
}
76+
77+
export type Torn = Address & {
78+
cap: string
79+
pausePeriod: number
80+
distribution: { [key: string]: Distribution }
81+
}
82+
83+
export type Distribution = {
84+
to: string
85+
amount: string
86+
}
87+
88+
export type TornadoTrees = Address & {
89+
levels: number
90+
}
91+
92+
export interface Vesting {
93+
team1: Governance;
94+
team2: Governance;
95+
team3: Governance;
96+
team4: Governance;
97+
team5: Governance;
98+
governance: Governance;
99+
}
100+
101+
export type Governance = Address & {
102+
cliff: number
103+
duration: number
104+
beneficiary?: string
105+
}
106+
107+
export type Voucher = Address & {
108+
duration: number
109+
}

package.json

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@
99
"config.js",
1010
"contracts/*"
1111
],
12+
"types": "index.d.ts",
1213
"scripts": {
1314
"compile": "truffle compile",
1415
"coverage": "yarn compile && truffle run coverage",
@@ -41,6 +42,7 @@
4142
"@openzeppelin/contracts": "^3.1.0",
4243
"eth-sig-util": "^2.5.3",
4344
"ethereumjs-util": "^7.0.3",
44-
"web3": "^1.2.11"
45+
"web3": "^1.2.11",
46+
"web3-utils": "^1.7.3"
4547
}
4648
}

yarn.lock

Lines changed: 31 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -357,6 +357,13 @@
357357
dependencies:
358358
"@types/node" "*"
359359

360+
"@types/bn.js@^5.1.0":
361+
version "5.1.0"
362+
resolved "https://registry.yarnpkg.com/@types/bn.js/-/bn.js-5.1.0.tgz#32c5d271503a12653c62cf4d2b45e6eab8cebc68"
363+
integrity sha512-QSSVYj7pYFN49kW77o2s9xTCwZ8F2xLbjLLSEVh8D2F4JUhZtPAGOFLTD+ffqksBx/u4cE/KImFjyhqCjn/LIA==
364+
dependencies:
365+
"@types/node" "*"
366+
360367
"@types/color-name@^1.1.1":
361368
version "1.1.1"
362369
resolved "https://registry.yarnpkg.com/@types/color-name/-/color-name-1.1.1.tgz#1c1261bbeaa10a8055bbc5d8ab84b7b2afc846a0"
@@ -1945,6 +1952,17 @@ ethereumjs-util@^7.0.3:
19451952
ethjs-util "0.1.6"
19461953
rlp "^2.2.4"
19471954

1955+
ethereumjs-util@^7.1.0:
1956+
version "7.1.4"
1957+
resolved "https://registry.yarnpkg.com/ethereumjs-util/-/ethereumjs-util-7.1.4.tgz#a6885bcdd92045b06f596c7626c3e89ab3312458"
1958+
integrity sha512-p6KmuPCX4mZIqsQzXfmSx9Y0l2hqf+VkAiwSisW3UKUFdk8ZkAt+AYaor83z2nSi6CU2zSsXMlD80hAbNEGM0A==
1959+
dependencies:
1960+
"@types/bn.js" "^5.1.0"
1961+
bn.js "^5.1.2"
1962+
create-hash "^1.1.2"
1963+
ethereum-cryptography "^0.1.3"
1964+
rlp "^2.2.4"
1965+
19481966
19491967
version "4.0.0-beta.3"
19501968
resolved "https://registry.yarnpkg.com/ethers/-/ethers-4.0.0-beta.3.tgz#15bef14e57e94ecbeb7f9b39dd0a4bd435bc9066"
@@ -5828,6 +5846,19 @@ [email protected]:
58285846
underscore "1.9.1"
58295847
utf8 "3.0.0"
58305848

5849+
web3-utils@^1.7.3:
5850+
version "1.7.3"
5851+
resolved "https://registry.yarnpkg.com/web3-utils/-/web3-utils-1.7.3.tgz#b214d05f124530d8694ad364509ac454d05f207c"
5852+
integrity sha512-g6nQgvb/bUpVUIxJE+ezVN+rYwYmlFyMvMIRSuqpi1dk6ApDD00YNArrk7sPcZnjvxOJ76813Xs2vIN2rgh4lg==
5853+
dependencies:
5854+
bn.js "^4.11.9"
5855+
ethereum-bloom-filters "^1.0.6"
5856+
ethereumjs-util "^7.1.0"
5857+
ethjs-unit "0.1.6"
5858+
number-to-bn "1.7.0"
5859+
randombytes "^2.1.0"
5860+
utf8 "3.0.0"
5861+
58315862
58325863
version "1.2.1"
58335864
resolved "https://registry.yarnpkg.com/web3/-/web3-1.2.1.tgz#5d8158bcca47838ab8c2b784a2dee4c3ceb4179b"

0 commit comments

Comments
 (0)