Skip to content

add fees for 0x #222

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 2 additions & 1 deletion src/components/Aggregator/adapters/0x.ts
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@ export function approvalAddress() {
}

const nativeToken = '0xEeeeeEeeeEeEeeEeEeEeeEEEeeeeEeeeeeeeEEeE';
const feeCollectorAddress = '0x9Ab6164976514F1178E2BB4219DA8700c9D96E9A';

export async function getQuote(chain: string, from: string, to: string, amount: string, extra) {
// amount should include decimals
Expand All @@ -39,7 +40,7 @@ export async function getQuote(chain: string, from: string, to: string, amount:
extra.slippage / 100
}&affiliateAddress=${defillamaReferrerAddress}&enableSlippageProtection=false&intentOnFilling=true&takerAddress=${
extra.userAddress
}&skipValidation=true`,
}&skipValidation=true&feeRecipientTradeSurplus=${feeCollectorAddress}&buyTokenPercentageFee=0.0015&feeRecipient=${feeCollectorAddress}`,
{
headers: {
'0x-api-key': process.env.OX_API_KEY
Expand Down
20 changes: 13 additions & 7 deletions src/components/FAQs/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ export default function FaqWrapper() {
</AccordionButton>
</h2>
<AccordionPanel pb={4}>
DefiLlama takes 0 fee on swaps.
DefiLlama takes 0 fee on swaps (except for 0x).
<br />
<br /> You'll get the exact same price swapping through DefiLlama as what you'd get swapping through the
chosen aggregator directly.
Expand All @@ -42,6 +42,10 @@ export default function FaqWrapper() {
of the fee they earn. This is not an extra fee, you'd be charged the same fee anyway, but now a small part
of it is shared with DefiLlama. We also integrate aggregators with no fee sharing the best price, and in
those cases we don't make any money.
<br />
<br />
For 0x we charge a 15bps fee, which is the same that matcha charges, we do this since 0x is charging us to
use their API.
</AccordionPanel>
</AccordionItem>
<AccordionItem>
Expand All @@ -68,12 +72,14 @@ export default function FaqWrapper() {
</AccordionButton>
</h2>
<AccordionPanel pb={4}>
We inflate gas limit of txs on MetaMask by +40% to ensure that there's nothing unexpected that could trigger out-of-gas reverts. This stacks
on top of any increase your RPC might apply on gas estimations, along with possible different gas prices between your metamask and our estimation.
We inflate gas limit of txs on MetaMask by +40% to ensure that there's nothing unexpected that could trigger
out-of-gas reverts. This stacks on top of any increase your RPC might apply on gas estimations, along with
possible different gas prices between your metamask and our estimation.
<br />
<br />
All this together means that gas number you see on metamask will always be inflated, while in our UI we display the actual gas that the tx will consume.
The extra gas that is not used is just refunded to the user when tx executes.
All this together means that gas number you see on metamask will always be inflated, while in our UI we
display the actual gas that the tx will consume. The extra gas that is not used is just refunded to the user
when tx executes.
</AccordionPanel>
</AccordionItem>
<AccordionItem>
Expand Down Expand Up @@ -104,8 +110,8 @@ export default function FaqWrapper() {
</AccordionButton>
</h2>
<AccordionPanel pb={4}>
Some ETH orders on CowSwap might not get filled because price moves against you too quickly,
in those cases the ETH just sits in a contract until it is refunded 30 minutes after your tx.
Some ETH orders on CowSwap might not get filled because price moves against you too quickly, in those cases
the ETH just sits in a contract until it is refunded 30 minutes after your tx.
</AccordionPanel>
</AccordionItem>
</Accordion>
Expand Down