Last active
January 10, 2021 16:29
-
-
Save JTraversa/caf911c929c4290ff4d9b2c1b99c7df6 to your computer and use it in GitHub Desktop.
taking demo
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import { ethers } from "ethers"; | |
const provider = new ethers.providers.Web3Provider(window.ethereum) | |
const signer = provider.getSigner() | |
const zeroExAddress = '0x61935cbdd02287b511119ddb11aeb42f1593b7ef' | |
const zeroExContract = new ethers.Contract(zeroExAddress, exchangeABI, provider); | |
function takeOrder() { | |
const order = { | |
makerAddress: ORDER PARAMS HERE, | |
takerAddress: etc., | |
} | |
zeroExContract.fillOrder( | |
[order.makerAddress, | |
order.takerAddress, | |
order.feeRecipientAddress, | |
order.senderAddress, | |
order.makerAssetAmount, | |
order.takerAssetAmount, | |
order.makerFee, | |
order.takerFee, | |
order.expirationTimeSeconds, | |
order.salt, | |
order.makerAssetData | |
order.takerAssetData | |
order.makerFeeAssetData | |
order.takerFeeAssetData], | |
takerAmount, | |
makerSignature | |
).then(function(result,error){ | |
if(!error) | |
console.log(result); | |
else | |
console.error(error); | |
}); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment