fix fee handling

This commit is contained in:
Roman Storm 2020-10-14 16:46:01 -07:00
parent ca1eb0d6cf
commit 09367f76a8
No known key found for this signature in database
GPG Key ID: 522F2A785F34E71F
4 changed files with 9 additions and 9 deletions

View File

@ -26,7 +26,7 @@
"gas-price-oracle": "^0.1.5",
"ioredis": "^4.14.1",
"node-fetch": "^2.6.0",
"tornado-cash-anonymity-mining": "git+ssh://github.com/tornadocash/tornado-anonymity-mining.git#dd4b996b89580fad986604e507a7e56ad64a3f71",
"tornado-cash-anonymity-mining": "git+ssh://github.com/tornadocash/tornado-anonymity-mining.git#02ff4c9061eef94617b3c1b91a02c0d25bb1c410",
"tx-manager": "git+ssh://github.com/tornadocash/tx-manager.git#df118be318b007e597e157504d105dfa3e6322a1",
"torn-token": "git+ssh://github.com/tornadocash/torn-token.git#b90fc5adccbf9a87c3bdac6175a0e038a9ed3dd8",
"uuid": "^8.3.0",

View File

@ -9,8 +9,8 @@ module.exports = {
wsRpcUrl: process.env.WS_RPC_URL,
oracleRpcUrl: process.env.ORACLE_RPC_URL || 'https://mainnet.infura.io/',
oracleAddress: '0xA2b8E7ee7c8a18ea561A5CF7C9C365592026E374',
minerAddress: '0xB28038Cd60777aF2264F46C0009dC57975239B11', // each network has its own instance
swapAddress: '0xec236719BEbfC1D303739FbE11Bf3a42aF1A41f4',
minerAddress: '0x3E0a9C6Cf76136862De28ce25a56cDBF38EF9D37', // each network has its own instance
swapAddress: '0x1E73e0a484a595B692f3d212642AE4B3BF30E7e3',
minerMerkleTreeHeight: 20,
privateKey: process.env.PRIVATE_KEY,
instances: require('torn-token').instances,

View File

@ -129,17 +129,17 @@ const miningWithdrawSchema = {
type: 'object',
properties: {
amount: bytes32Type,
fee: bytes32Type,
extDataHash: bytes32Type,
extData: {
type: 'object',
properties: {
fee: bytes32Type,
recipient: addressType,
relayer: relayerType,
encryptedAccount: encryptedAccountType,
},
additionalProperties: false,
required: ['relayer', 'encryptedAccount', 'recipient'],
required: ['fee', 'relayer', 'encryptedAccount', 'recipient'],
},
account: {
type: 'object',
@ -161,7 +161,7 @@ const miningWithdrawSchema = {
},
},
additionalProperties: false,
required: ['amount', 'fee', 'extDataHash', 'extData', 'account'],
required: ['amount', 'extDataHash', 'extData', 'account'],
},
},
additionalProperties: false,

View File

@ -154,14 +154,14 @@ async function checkMiningFee({ args }) {
.div(toBN(1e10 * 100))
/* eslint-enable */
const desiredFee = expenseInPoints.add(serviceFeePercent) // in points
const providedFee = currentJob.data.type === jobType.MINING_REWARD ? args.fee : args.extData.fee
console.log(
'sent fee, desired fee, serviceFeePercent',
toBN(args.fee).toString(),
toBN(providedFee).toString(),
desiredFee.toString(),
serviceFeePercent.toString(),
)
if (toBN(args.fee).lt(desiredFee)) {
if (toBN(providedFee).lt(desiredFee)) {
throw new Error('Provided fee is not enough. Probably it is a Gas Price spike, try to resubmit.')
}
}