Wyvern exchange contract что это
Project Wyvern Ethereum Smart Contracts
Synopsis
Autonomously governed decentralized digital asset exchange.
These are the Ethereum smart contracts for the Wyvern Protocol, the Wyvern ERC20 token (WYV), and the Wyvern DAO. For general information on the Wyvern project, please see the website.
Deployed Contracts
Please note: correct deployed contract addresses will always be in config.json. If you wish to import this repository directly, please use that file. The addresses in Truffle build output are not necessarily accurate.
Mainnet
Rinkeby Testnet
Development Information
Setup
Before any development, install the required NPM dependencies:
Testing
Start Ethereum’s testrpc tool to provide a Web3 interface (leave this running):
Compile the latest smart contracts:
Run the testsuite against the simulated network:
Make sure to lint the Solidity files once you’re done:
Generating Documentation
Install the dependencies:
Autogenerate documentation from Ethereum Natspec using Doxity:
Final output will be written to docs, which will be automatically published on push to GitHub Pages at docs.projectwyvern.com.
Run automated smart contract analysis (requires Oyente and Mythril):
Flatten contract source (for e.g. Etherscan verification, requires solidity-flattener to be installed):
Contributing
Contributions welcome! Please use GitHub issues for suggestions/concerns — if you prefer to express your intentions in code, feel free to submit a pull request.
Powering decentralized crypto commerce
Trade any kind of digital asset — from rare virtual kittens to ENS names, land rights, or even smart contracts themselves.
Trade digital assets on an open protocol
Wyvern Protocol powers the peer-to-peer exchange of digital assets.
Exchange anything
Trade any kind of nonfungible asset — from rare virtual kittens to ENS names, land rights, or even smart contracts.
Exchange anywhere
Wyvern can be deployed on any EVM-based blockchain, allowing developers to power their asset exchange.
Fully open-source
The Wyvern Protocol codebase is open source, permissively licensed, and third-party audited.
Automate your crypto-commerce
Pick whichever method of sale you prefer: fixed price, Dutch auction, or something more exotic. Interface with the Exchange through a website, a mobile application, or a custom script.
Auction any kind of item
Trade any kind of nonfungible asset — from rare virtual kittens to ENS names, land rights, or even smart contracts.
Buy & sell in any configuration
Trade ERC20 tokens, ERC721 NFTs, or custom assets in any combination.
Trade mixed set of assets
Trade three Cryptokitties for a pack of Gods Unchained trading cards, and perhaps add in a few DAI to sweeten the deal.
Plug into a growing liquidity pool for the decentralized web
With more marketplaces leveraging the protocol and more orders created everyday, the Wyvern ecosystem is growing rapidly. Time to plug your app in.
Leverage existing orderooks
Don’t want to deploy your own exchange backend? Leverage an existing relayer.
. or deploy your own
Create your own orderbook to maintain full control over your marketplace infrastructure.
Join others & start building
Trusted by leading marketplaces
Wyvern is an incredibly generic protocol, which makes it flexible enough to support a diverse set of trading functionality — from bartering, bundle sales, to auctions.
Token
Moonpay
15M+ users trust MoonPay. Checkout with your preferred payment method.
Opt-in, make your first trade on Exchange Plus & receive random crypto rewards from 10,000 SHIB, to 0.01 BTC.
Сoins.game
Everyday giveaways up to 100 ETH, Lucky Spins. Deposit BONUS 300% and Cashbacks!
MegaDice.com
Play all your favorite Slots & Live Games, including Plinko, Aviator and Crash! Truly anonymous casino.
BC.GAME
5000+ Slots & Live Casino Games, 50+cryptos. Register with Etherscan and get 760% deposit bonus. Win Big$, withdraw it fast.
BC.GAME
5000+ Slots & Live Casino Games, 50+cryptos. Register with Etherscan and get 760% deposit bonus. Win Big$, withdraw it fast.
CryptoSlots
Anonymous play on awesome games — sign up now for 25 free jackpot spins — worth $100s!
1xBit
Wyvern Protocol in Opensea NFT Marketplace
Today we look at Wyvern protocol, and how it is used in NFT marketplace. Wyvern protocol is an decentralized exchange protocol. Opensea is an example of NFT marketplace that utilises Wyvern protocol.
To be specific, we are looking at Wyvern v3 which supersedes Wyvern v2. We will also touch on Wyvern v2 when it is necessary to do so. The http link to Wyvern git repo code is added for easy reference.
Referring to the diagram above, seller and buyer can create sell order and buy order on Opensea. The orders are stored on a centralized database. When there is a match of buy order and sell order, the orders are sent to smart contracts for on chain settlement. The set of smart contracts are implemented according to Wyvern protocol.
In Wyvern protocol, the smart contract that implements the trade is Exchange smart contract. It verifies the signature is indeed signed by the order maker.
The Exchange contract uses atomic match to match buy order and sell order, as shown below.
The Order structure is in ExchangeCore.sol. The first order is probably order made by maker, the second order is order made by counterparty.
To illustrate the point, when buyer pays ether to buy NFT from seller, the following scenario (ERC20-NFT trade) occurs.
- Order offers to call the transfer (or transferFrom ) function on a particular NFT contract with a particular NFT identifier, asserts that the counterparty's (the buyer) call is a transfer call to the desired ERC20 contract, and asserts the desired amount of tokens. Basically it means buyer sends WETH (an ERC20 token) to the seller , in exchange for NFT token. This is on chain settlement.
Every user has a Proxy smart contract. Each item which is traded on Opensea is owned by a Proxy smart contract of a user. This Proxy smart contract is controlled by the owner or the exchange smart contract. In this way, users do not have to approve each trade on the Opensea, so that savings of gas fee can be achieved.
The Proxy contract registers AuthenticatedProxy contract. AuthenticatedProxy is used in Exchange contract to execute order on matching order, which is called from atomic matching.
In AuthenticatedProxy, the proxy function executes the call from proxy contact using call or delegate call , depending on HowToCall enum.
In Wyvern v2, there is DAO smart contract, it decides which smart contract can control the proxy smart contract of each user. But DAO smart contract is no longer in Wyvern v3 git repo.