Decentralized Exchange Application
PiperSwap is a Decentralized Exchange Application where we have created a Platform which would accept Tokens from the User and in return will provide some PToken (Piper Token).
Technologies Used:
- Blockchain: Ethereum
- Smart Contract Language: Solidity
- Limit Order Protocol: 1inch Limit Order Protocol
- FrontEnd: JavaScript and Css
- Frameworks: Web3, React.js and Moralis.
Working of the Application:
- Connect your Metamask Wallet with the Application.
- Enter the amount of Dai Token you need to invest.
- You will recive some PiperToken in return of the Dai Token
Internal Working of the System:
- The Dai Token recived from the user will be used to set Limit Orders using 1inch Limit-Order-Protocol
- This Limit Order will be set Automatically at an interval.
- MakerAsset: '0x4F96Fe3b7A6Cf9725f59d353F723c1bDb64CA6Aa' (Dai) TakerAsset: '0xd0a1e359811322d97991e03f863a0c30c2cf029c' (WEth)
Commands to Run Project:
- Clone the Repo
- run npm install
- React App: npm run start
- Limit-order App: truffle --network kovan limit.js
Some Important Address: Token Address:
- '0x4F96Fe3b7A6Cf9725f59d353F723c1bDb64CA6Aa' (Dai)
- '0xd0a1e359811322d97991e03f863a0c30c2cf029c' (WEth)
- Contract Address: '0x2BC7E7123CDFdA75722E1E745098FA8016731602'
- 1inch Limit Order Address: '0x94Bc2a1C732BcAd7343B25af48385Fe76E08734f'
1inch Protocol Examples:
-
Build Limit Order:
const limitOrder = await limitOrderBuilder.buildLimitOrder({ makerAssetAddress: '0x4F96Fe3b7A6Cf9725f59d353F723c1bDb64CA6Aa', takerAssetAddress: '0xd0a1e359811322d97991e03f863a0c30c2cf029c', makerAddress: walletAddress, makerAmount: '100', takerAmount: '0', predicate: simplePredicate,
});
-
Limit Order Typed Data:
const limitOrderTypedData = await limitOrderBuilder.buildLimitOrderTypedData( limitOrder );
-
Sign Limit Order:
const limitOrderSignature = await privateKeyProviderConnector.signTypedData( walletAddress, limitOrderTypedData );
-
Fill Limit Order:
const callData = await limitOrderProtocolFacade.fillLimitOrder( order, signature, makerAmount, takerAmount, thresholdAmount );
-
Send Limit Order:
const res = await contract.methods.fillOrder(order, signature, makerAmount, takerAmount, thresholdAmount).send({ from: walletAddress, // gas: 2100000, // Set your gas limit // gasPrice: 40000, // Set your gas price to: contractAddress, data: callData }); return res;