Skip to content
This repository has been archived by the owner on Oct 11, 2024. It is now read-only.

Affiliate Forwarder config not work for values different than zero #568

Open
JoaoCampos89 opened this issue Oct 3, 2019 · 0 comments
Open

Comments

@JoaoCampos89
Copy link

JoaoCampos89 commented Oct 3, 2019

Set the Affiliate Fee percentage to a value different than zero results in zero value for the affiliate config:

image

image

Changing the implementation to this one below works as intended:
image

But then we can not complete the market buy orders because the computation to get the eth amount required does not take in account the additional eth value needed for the fees, this implementation under src/store/relayer/actions solves the issue:

    const ethBalance = getEthBalance(state) as BigNumber;
            let ethAmountRequired = amounts.reduce((total: BigNumber, currentValue: BigNumber) => {
                return total.plus(currentValue);
            }, new BigNumber(0));

            ethAmountRequired = ethAmountRequired.plus(
                ethAmountRequired.times(new BigNumber(AFFILIATE_FEE_PERCENTAGE)),
            );

            const isEthBalanceEnough = ethBalance.isGreaterThan(ethAmountRequired);
            const isMarketBuyForwarder = isBuy && isWeth(quoteToken.symbol) && isEthBalanceEnough;

Using Asset buyer solves this issue also.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant