AirSwap @ ETHNewYork

The AirSwap team is a sponsor of the ETHNewYork hackathon at New Lab in Brooklyn this weekend. Come say hello, grab some AirSwap swag, and jump into the fray with some of the finest minds hacking on the decentralized future.

AirSwap is a decentralized trading network for Ethereum tokens. Try out AirSwap Instant for quick trades and AirSwap Spaces for over-the-counter trades. Also popular is DexIndex, an open source tool to compare prices across DEXs. To learn more, check out our website at www.airswap.io.

Things you can build

AirSwap is the home of the Ethereum atomic swap, the easiest way to transact trustlessly between two peers on a decentralized trading network. Whether buying or selling ERC20 tokens, or swapping ERC721 NFTs, the Swap protocol is the simplest way to trade.

🎉 Check out some examples here!

Domain Name (ENS NFT) Marketplace

Now that ENS domain names can be tokenized as NFTs, trading domain names peer-to-peer is now a reality. Swapping NFTs in exchange for stablecoins like DAI and other tokens are a natural fit.

Stablecoin Arbitrage Bot

Buying and selling DAI in amounts small and large is commonplace on the AirSwap network. With our new developer toolkit, build a bot to automatically trade DAI as prices fluctuate across trading venues.

Decentralized Finance (DeFi) Integrations

For both on-chain and off-chain decentralized finance applications, the atomic swap is a fundamental primitive. Integrate the Swap Protocol into your smart contracts and dApps to trade between both ERC20 and ERC721 tokens.

Useful developer modules

Adding the AirSwap.js developer modules to your dApp is easy. Source code can be found at https://github.com/airswap/AirSwap.js.

yarn add airswap.js

DexIndex Prices

The DexIndex backend is an open source tool that aggregates prices across DEXs, running at a public endpoint and simple to integrate.

import { fetchDexIndexPrices } from 'airswap.js/src/dexIndex'
const prices = await fetchDexIndexPrices({ side, amount, symbol })

Token Metadata and Balances

Add images and descriptions for ERC20 tokens to any dApp, and quickly fetch many balances for many addresses in an efficient way.

import { fetchTokens } from 'airswap.js/src/tokens'
const tokens = await fetchTokens()

Atomic Swaps

Sign, send, and settle peer-to-peer trades using our new developer modules with simple ways to implement the Swap Protocol with ERC20 and ERC721s.

import { swapSimple } from 'airswap.js/src/swap'
await swapSimple({
id, // A unique identifier for the order
makerWallet, // The wallet of the maker who sets the price
makerParam, // An ERC20 amount or ERC721 identifier
makerToken, // The address of the token the maker will send
takerWallet, // The wallet of the taker who settles the trade
takerParam, // An ERC20 amount or ERC721 identifier
takerToken, // The address of the token the maker will send
expiry, // Expiration times in seconds since unix epoch
v, r, s }, // The v, r, and s components of ECDSA signature
signer)

To perform a swap, both sides of each trade need to approve the Swap Contract for each token transferred on their behalf. Because the approval is for a smart contract, in many cases traders are comfortable doing a one-time approval for a large amount.

import { approveToken } from 'airswap.js/src/erc20'
await approveToken(TOKEN_ADDRESS, SWAP_CONTRACT_ADDRESS, signer)

Signatures can be generated by passing order parameters to signSimple.

import { signSimple } from 'airswap.js/src/swap'
const signedOrder = await signSimple(order, signer)

The signer parameter is an Ethers signer.

Swap Contract Addresses

Rinkeby: 0x4E25e972AF14942d119275453CD2DB93B320607c
Kovan: 0x909Af82a14e78d1e8a187D88E6BBA8874f657ef5

Learn more about the Swap Protocol and Swap Contract.

Workshop and prizes

From 10:30PM to 11:00PM we’re hosting a “Working with AirSwap Developer APIs” workshop led by Graham Perich to walk through some of the ways to use AirSwap developer tools and the Swap Protocol to participate in the AirSwap trading network.

AirSwap will award $1000 to each of the top three teams that incorporate the Swap Protocol into their application. Feel free to use the provided open-sourced developer tools or the swap-contract in the project.

See you there

ETHNewYork is being held at New Lab in Brooklyn. See more information about the schedule, speakers, and sponsors on the official website.

More about AirSwap