A sample CoW protocol smart order contract.
CoW protocol supports EIP-1271 signatures. While this is typically thought of as a way for Smart Contract wallets to sign things, we can leverage this standard for creating spcial order types on CoW with custom validation logic.
Node.js
: Recommended version 16.x or 18.xnpm
: Must be version 8 or newer
npx hardhat test
In order to run the scripts and place a sample order, first make sure you have an Infura access key and a private key setup:
export INFURA_PROJECT_ID="..."
export PRIVATE_KEY="0x..."
Then you can create orders:
npx hardhat run scripts/placeOrder.js
You can also cancel created orders:
ORDER_ADDRESS="0x..." npx hardhat run scripts/cancelOrder.js