mirror of
https://github.com/tornadocash/tornado-relayer.git
synced 2025-08-15 09:35:59 -04:00
bit of refactor, add RelayerError class
This commit is contained in:
parent
76209e11c0
commit
50054e0516
16 changed files with 164 additions and 114 deletions
16
src/utils.js
16
src/utils.js
|
@ -1,6 +1,6 @@
|
|||
const { instances, netId } = require('./config')
|
||||
const { poseidon } = require('circomlib')
|
||||
const { toBN, toChecksumAddress, BN } = require('web3-utils')
|
||||
const { toBN, toChecksumAddress, BN, fromWei, isAddress, toWei } = require('web3-utils')
|
||||
|
||||
const TOKENS = {
|
||||
torn: {
|
||||
|
@ -118,6 +118,13 @@ function fromDecimals(value, decimals) {
|
|||
return new BN(wei.toString(10), 10)
|
||||
}
|
||||
|
||||
class RelayerError extends Error {
|
||||
constructor(message, score = 0) {
|
||||
super(message)
|
||||
this.score = score
|
||||
}
|
||||
}
|
||||
|
||||
module.exports = {
|
||||
getInstance,
|
||||
setSafeInterval,
|
||||
|
@ -126,4 +133,11 @@ module.exports = {
|
|||
when,
|
||||
getArgsForOracle,
|
||||
fromDecimals,
|
||||
toBN,
|
||||
toChecksumAddress,
|
||||
fromWei,
|
||||
toWei,
|
||||
BN,
|
||||
isAddress,
|
||||
RelayerError,
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue