Skip to content
This repository has been archived by the owner on Jan 3, 2023. It is now read-only.

Latest commit

 

History

History
308 lines (198 loc) · 5.8 KB

0012.md

File metadata and controls

308 lines (198 loc) · 5.8 KB
  DSP: 0012
  Title: Marketplace v1 contract
  Author: Ignacio Mazzara 
  Status: Final
  Type: Standards
  Created: 2019-03-28

Marketplace v1 contract

Table of Contents

Introduction

Every LAND in Decentraland can be exchanged for MANA by a smart contract which provides the ability to do a trustless and transparent atomic swap.

Abstract

Decentraland's most important digital asset is its LAND token. To increase the Decentraland economy, we designed a secure way for the users to trade them.

Within this marketplace, new users will be part of the Decentraland ecosystem and can use their MANA to buy LAND...

The Marketplace v1 contract exists within an EVM blockchain (currently Ethereum).

This document describes the structure and the expected behavior and functionality of interacting components provided by the Marketplace v1 contract also known as LegacyMarketplace contract.

The key words "MUST", "MUST NOT", "REQUIRED", "SHALL", "SHALL NOT", "SHOULD", "SHOULD NOT", "RECOMMENDED", "NOT RECOMMENDED", "MAY", and "OPTIONAL" in this document are to be interpreted as described in RFC 8174 when, and only when, they appear in all capitals, as shown here.

Compatibility

The Marketplace v1 contract is only compatible with the LAND token and MANA token.

Its implementation can be find here.

Terminology

Order: LAND listing. Every order has its unique id generated by the block timestamp, LAND owner, LAND id and the price.

LAND: a brand name for parcels.

Account: an Ethereum address

Design

Contract

This contract is not upgradable, but ownable and pausable. It accepts only tokens from the LAND Registry contract for listing and the MANA token for buying. Both are variables of the contract defined in the creation.

Ownable

The contract has an owner called contract owner which play as an admin. He can transfer its ownership, pause and unpause the contract.

Pausable

The contract can stop accepting, cancelling and executing orders. The pause functionality can be actionable only by the contract owner.

Roles

Contract owner

The account owner of the Marketplace v1 contract.

Specification

Events

AuctionCreated

Emitted when a LAND was listed for sale.

AuctionCreated(
  bytes32 id,
  uint256 assetId,
  address seller,
  uint256 priceInWei,
  uint256 expiresAt
)

AuctionCancelled

Emitted when a LAND listing was cancelled

AuctionCancelled(bytes32 id, uint256 assetId, address seller)

AuctionSuccessful

Emitted when a LAND was successfully bought.

AuctionSuccessful(
  bytes32 id,
  uint256 assetId,
  address seller,
  uint256 totalPrice,
  address winner
)

ChangedPublicationFee

Emitted when the fee for listing was changed

ChangedPublicationFee(uint256 publicationFee)

ChangedOwnerCut

Emitted when the fee for selling was changed

ChangedOwnerCut(uint256 ownerCut)

Pause

Emitted when the contract was paused

Pause

Unpause

Emitted when the contract was unpaused

Unpause

OwnershipTransferred

Emitted when the contract owner was changed

OwnershipTransferred( address previousOwner, address newOwner)

Functions

Listing

createOrder

Listing a LAND with a desired price and expiration (Unix time).

createOrder(uint256 assetId, uint256 priceInWei, uint256 expiresAt)

executeOrder

Buy a listing for a specific LAND. The price should match with the listed price and also the buyer should have at least that balance in MANA.

executeOrder(uint256 assetId, uint256 price)

cancelOrder

Cancel a LAND listing.

cancelOrder(int256 assetId)

Utils

auctionByAssetId

Get the order by the asset id.

auctionByAssetId(uint256)

publicationFeeInWei

Get the publication fee.

publicationFeeInWei()

nonFungibleRegistry

Get the non-fungible address.

nonFungibleRegistry()

acceptedToken

Get the accepted token address.

acceptedToken()

paused

Get whether the contract is paused or not.

paused()

ownerCutPercentage

ownerCutPercentage()

owner

Get the contract owner address.

owner()

Admin

setOwnerCut

Set the fee for listing a LAND.

setOwnerCut(uint8 ownerCut)

setPublicationFee

Set the fee for buying a LAND listed

setPublicationFee(uint256 publicationFee)

pause

Pause the contract

pause()

unpause

Unpause contract.

unpause()

destroy

Destroy the contract.

destroy()

transferOwnership

Transfer the ownership of the contract to another account.

transferOwnership(address _newOwner)

destroyAndSend

destroyAndSend(address _recipient)

Limitations

This contract only accepts LANDs to be exchanged for MANA.

At Decentraland we wanted to support multiple NFTs. Therefore, we created a new version of the marketplace which supports the exchange of multiple NFTs.