-
Notifications
You must be signed in to change notification settings - Fork 15
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
ERC20BridgeProxy (Generalized on-chain liquidity buyer) #47
Comments
Updated to reflect new name and behavior ( |
Merged in PR 0xProject/0x-monorepo/pull/2220 |
This looks wrong to me:
Shouldn't it be:
OR
For the common == case, this is fine, I'm thinking about a bridge for the Synthetix Arb Rewarder contract that turns the SNX rewards into toTokenAddress with another trade. That would lead to |
It looks like the actual contract at https://github.com/0xProject/0x-monorepo/pull/2220/files#diff-df420069bb651f1e27afa327e0e9fa43R87 is correct |
@wysenynja |
Simple Summary
A pluggable asset proxy for transferring ERC20 maker assets to a taker.
Abstract
Introduce a new asset proxy that allows for a custom contract to be called that transfers ERC20 maker tokens to the taker. The asset proxy simply calls this contract and asserts that the taker's balance has increased by the required
amount
.Motivation
Liquidity is a primary concern for the 0x ecosystem. One potentially impactful way to supplement liquidity is to source liquidity from other on-chain exchanges and networks. By introducing a new asset proxy that is able to exchange taker tokens for maker tokens in an arbitrary manner, we can tap into these other liquidity sources.
Specification
A custom "bridge" contract is specified in the asset data for this asset proxy. This bridge contract is called, converting ERC20 taker tokens into maker tokens. The asset proxy then confirms that the taker's balance has increased by the
amount
required.Asset data
The
bridgeContract
does the heavy lifting of actually swapping tokens and implements theIERC20Bridge
interface:IERC20Bridge interface
Flow
makerAddress
as theIERC20Bridge
contract, with aWallet
signature type.fillOrder()
on this order.IERC20Bridge
).ERC20BridgeProxy.transferFrom()
is invoked to transferamount
of maker tokens to the taker.ERC20BridgeProxy
usesIERC20(makerToken).balanceOf()
to get the maker token balance of the taker.ERC20BridgeProxy
callsbridgeContract.bridgeTransferFrom()
.IERC20Bridge
interacts with on-chain liquidity sources to swap taker tokens for maker tokens and sending them to the taker.bridgeContract.bridgeTransferFrom()
does not return the magic value0xb5d40d78
, revert.amount
, revert.Pros and Cons
PROS
Implementation
The
ERC20BridgeProxy
would look like:A
bridgeContract
for Eth2Dai would look like:The text was updated successfully, but these errors were encountered: