Rawrshak Documentation
  • Rawrshak
  • Rawrshak Platform
    • What is the Rawrshak Platform?
    • Platform Overview
    • Rawrshak Ecosystem
    • Networks
    • Litepapers
    • Community Channels
    • Partnerships & Integrations
  • Tutorials
    • Gamer
      • Setup
        • Metamask Wallet
        • Adding Optimism Kovan Network
        • Funding Testnet Wallet
      • Demo
    • Developer
      • Setup
        • Arweave Wallet
          • ArDrive Account
        • Pinata
        • Unity
      • Demo
      • Unity
        • Loading the Rawrshak Tools
        • Loading the Rawrshak SDK
        • 3D Static Object In-game Framework
        • Packaging an Asset
          • Static 3D Object Asset
          • Audio Asset
        • Custom Subgraph Query
        • Prefabs
          • Wallet
          • Subgraph
          • Ethereum Blockchain Query
          • Rawrshak Asset
      • Rawrshak Dapp
        • Deploy a Content Contract
        • Upload Data to Arweave
        • Deploying a Meta Asset
          • Image Meta Asset
          • Audio Meta Asset
          • Static 3D Object Meta Asset
        • Updating a Meta Asset's Metadata
        • Minting a Meta Asset
        • Selling a Meta Asset
      • 🚧Custom Subgraphs
    • Unity Asset Viewer
  • Gamers
    • Gamer Decentralized Applications
    • Gaming Marketplace
    • Meta Assets
    • Supported Wallets
  • Developers
    • Smart Contracts
      • Content Contracts
        • Content
        • Content Manager
        • Content Storage
        • Content Factory
      • Exchange Contracts
        • Exchange
        • Orderbook
        • Execution Manager
        • Royalty Manager
        • Erc20Escrow
        • NftEscrow
      • Libraries
        • LibAsset
        • LibOrder
      • Utilities
        • Address Resolver
    • Meta Asset Framework
      • Asset Metadata
      • Asset Types
        • Text Assets
        • Image Assets
        • Audio Assets
        • Static 3D Objects
    • Game Engines
      • Unity Game Engine
        • Unity SDK
        • Unity Tools
      • Unreal Game Engine
      • Godot Game Engine
    • Developer Decentralized Applications
    • Rawrshak Subgraphs
      • Entities
        • Content Subgraph
        • Exchange Subgraph
  • Governance
    • RAWR Token
      • Tokenomics
      • Contract Addresses
    • Rawrshak DAO
Powered by GitBook
On this page
  1. Developers
  2. Smart Contracts
  3. Exchange Contracts

Exchange

EVENTS

OrderPlaced(from, orderId, order)

OrdersFilled(from, orderIds, amounts, asset, token, totalAssetsAmount, volume)

OrdersDeleted(owner, orderIds)

OrdersClaimed(owner, orderIds)

OrderPlaced(address from, uint256 orderId, LibOrder.OrderInput order)

Event emitted when the placeOrder function is called.

OrdersFilled(address from, uint256[] orderIds, uint256[] amounts, LibOrder.AssetData asset, address token, uint256 totalAssetsAmount, uint256 volume)

Event emitted when the functions fillBuyOrder or fillSellOrder are called.

OrdersDeleted(address owner, uint256 orderIds)

Event emitted when the cancelOrders function is called by owner.

OrdersClaimed(address owner, uint256[] orderIds)

Event emitted when the claimOrders function is called by owner.

FUNCTIONS

getOrder(id)

tokenEscrow()

nftsEscrow()

claimableRoyalties()

placeOrder(_order)

fillBuyOrder(_orderIds, amountToSell, maxSpend)

fillSellOrder(_orderIds, anountToBuy, maxSpend)

cancelOrders(_orderIds)

claimOrders(_orderIds)

claimRoyalties()

addSupportedToken(_token)

getOrder(uint256 id) -> LibOrder.Order

Retrieves id's order information.

visibility: external

state mutability: view

tokenEscrow() -> address

Retrieves a token's contract address.

visibility: external

state mutability: view

nftsEscrow() -> address

Retrieves a non-fungible token's contract address.

visibility: external

state mutability: view

claimableRoyalties() -> address[], uint256[]

Retrieves the contract address and amount of each token available for the caller to claim.

visibility: external

state mutability: view

placeOrder(LibOrder.OrderInput _order)

Places a buy or sell order with the information _order on the exchange and transfers the tokens to escrow.

emits an OrderPlaced event.

visibility: external

state mutability:

fillBuyOrder(uint256[] _orderIds, uint256 amountToSell, uint256 maxSpend)

Fills buy orders, transferring the sold assets to escrow, and withdrawing token payments from escrow.

Emits an OrdersFilled event.

Requirements:

  • Length of _orderIds must be greater than 0.

  • _orderIds must exist.

  • _orderIds must be of the same asset and token payment.

visibility: external

state mutability:

fillSellOrder(uint256[] _orderIds, uint256 amountToBuy, uint256 maxSpend)

Fills sell orders, sending token payments to escrow, and withdrawing the purchased assets from escrow.

Emits an OrdersFilled event.

Requirements:

  • Length of _orderIds must be greater than 0.

  • _orderIds must exist.

  • _orderIds must be of the same asset and token payment.

visibility: external

state mutability:

cancelOrders(uint256[] _orderIds)

Cancels unfilled or partially filled orders and withdraws the unused tokens.

Emits an OrdersDeleted event.

Requirements:

  • _orderIds must exist.

  • _orderIds must be owned by caller.

  • Filled and cancelled orders cannot be canceled.

visibility: external

state mutability:

claimOrders(uint256[] _orderIds)

Withdraws tokens from filled buy or sell orders.

Emits an OrdersClaimed event.

Requirements:

  • _orderIds must exist.

  • _orderIds must be owned by caller.

visibility: external

state mutability:

claimRoyalties()

Withdraws royalties available to claim from purchases of their asset made on the exchange.

Emits a ClaimedRoyalties event.

visibility: external

state mutability:

addSupportedToken(address _token)

Adds _token to the list of supported ERC20 tokens on Rawrshak.

Emits an AddedTokenSupport event.

visibility: external

state mutability:

PreviousExchange ContractsNextOrderbook

Last updated 3 years ago

_order OrderInput structure object. See .

Passes through .

Passes through .

LibOrder.sol
RoyaltyManager.sol
Erc20Escrow.sol