1

Let's say I have the following decoded transaction input data:

[
  "0x0000000000000000000000000000000000000000",
  "690000000000000000",
  "0xac709fcb44a43c35f0da4e3163b117a17f3770f5",
  "69000000000000000000",
  "3157593",
  "3268274872",
  "0x7d7a96a720396bb22681578545c56899f23f58e3",
  "27",
  "bdc6f8d14ade98f529d06fa1b1e85a9deb19df7a1621cc561a5167286d143885",
  "74e1206d9bdd7e39fad74991ad630fc424af1e34bf3c788aa22ac505804b9bd5",
  "100000000000000000"
]

that's used in trade method of this smart contract.

In this invoke the sender is willing to buy ARC (0xac709fcb44a43c35f0da4e3163b117a17f3770f5) token by selling ETH.

What I'm trying to calculate is how much ETH will be send to feeAccount; This line of code:

tokens[tokenGet][feeAccount] = safeAdd(tokens[tokenGet][feeAccount], safeSub(safeAdd(feeMakeXfer, feeTakeXfer), feeRebateXfer));

My calculations are:

const web3 = require('web3');

const feeMake = '0';
const feeTake = '3000000000000000';

let feeMakeXfer = (100000000000000000 * feeMake) / web3.utils.toWei('1', 'ether'); // 0
let feeTakeXfer = (100000000000000000 * feeTake) / web3.utils.toWei('1', 'ether')); // 300000000000000
let feeRebateXfer = 0;

let accountFee = feeMakeXfer + feeTakeXfer - feeRebateXfer; // 0.0003 ETH

So based on my calculations account fee for this trade is 0.0003 ETH.

Is it correct?

1 Answer 1

1

Yes, your calculations look correct again.

0

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.