airswap-web icon indicating copy to clipboard operation
airswap-web copied to clipboard

Fetch `protocolFee` from SwapContract and use instead of hard coded values

Open gpxl-dev opened this issue 3 years ago • 2 comments

Currently 1.0007 is used in a few places for last look calculations, and text around the interface says 0.07%. We should use the onchain value for future proofing.

gpxl-dev avatar Nov 11 '21 09:11 gpxl-dev

Hi @gpxl-dev, regarding this issue, do I fetch the signerFee from the SwapContract instance, ie.

const contract = ethers.Contract(swapContractAddress, swapContractAbi, provider);
const signerFee = contract.protocolFee();

Please advise if I'm going in the right direction?

francisldn avatar Jan 02 '22 17:01 francisldn

@francisldn correct, this is the right direction. Note that AFAIK current deployments still use signerFee instead of protocolFee. Also note that contract.protocolFee() would return a promise, so you would need to assign signerFee to the value it resolves to rather than the promise itself.

gpxl-dev avatar Jan 06 '22 09:01 gpxl-dev