Skip to content

ConcourseOpen/DEXAG-Contract-Liquidity

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

13 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

DEXAG-Contract-Liquidity

This repo is an example of a smart contract utilizing the DEX.AG API and Proxy Contract for Contract Fillable Liquidity. The main contract is BuyAndSend.sol which is a contract that allows a user to send any ERC20 token to another ethereum address without having to hold that token or store them in the contract. To deploy the contract using this repo, the only thing you'll need is truffle installed on your system. Inside the migrations folder in the 2_deploy_contracts.js file, set the proxy variable to the address of your DEX.AG proxy contract and then run truffle migrate from the root of the directory. You'll also need to have modified the truffle-config.js file to include the mnemonic for the account you are deploying the contract under and Infura node endpoint if you choose to use Infura.

In the examples folder you will see an example of a function that calls the BuyAndSend contract to send 1 DAI to a receiving address. You can try this out by replacing the relevant variables with your own values after deploying the contract, the relevant variables being BuyAndSendAddress, proxyAddress, and receiver with those variables being the address of the BuyAndSend contract, the address of a DEX.AG Proxy Contract and the address you wish to send the DAI to respectively. You'll see that the function first calls the DEX.AG api to find the best trade for ETH -> DAI then sends the resulting data into the buyAndSend function along with the DAI address and the address of the receiver. This purchases the DAI from a DEX or multiple DEXES if needed and then sends the tokens to the receiver all in one transaction.

About

No description, website, or topics provided.

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published