Skip to content
Permalink
Branch: master
Find file Copy path
Find file Copy path
Fetching contributors…
Cannot retrieve contributors at this time
204 lines (180 sloc) 4.75 KB
description
路印协议基础数据结构

JSON Schema

content:

1) order structure

2) trade structure

3) ring structure

4) how order hash (id) is calculated

5) how order should be signed by the owner

6) how a ring's hash is calculated

7) how a ring is signed by all dual authoring keys

8) how soft cancel order request is signed.

Order structure

order: {
  owner: Address,
  version: HexString,
  tokenS: Address,
  tokenB: Address,
  amountS: HexString,
  amountB: HexString,
  validSince: HexString,  
  params: {
    broker: Address,
    dualAuthAddr: Address,
    dualAuthPrivateKey: HexString,
    validUntil: HexString,
    allOrNone:HexString,
    wallet: Address,
    orderInterceptor: Address,
    dualAuthSig: HexString,
    sig: HexString
  },
  feeParams: {
    tokenRecipient: Address,
    amountFee:HexString,
    tokenFee:Address,
    waiveFeePercentaget: HexString,
    tokenSFeePercentage: HexString,
    tokenBFeePercentage: HexString,
    walletSplitPercentage: HexString
  },
  ERC1400Params: {
    tokenStandardS: HexString,
    tokenStandardB: HexString,
    tokenStandardFee: HexString,
    trancheS: HexString,
    trancheS: HexString,
    transferDataS: HexString
  },
  signType: HexString
}
  • validSince: 订单生效时间,seconds
  • broker: 订单代理地址(可选,当下单人与订单owner不同时,broker即为下单人地址。需要预先注册)
  • dualAuthAddr: 双重签名地址
  • dualAuthPrivateKey: 双重签名地址私钥,
  • validUntil : seconds,可选,不设置时代表该订单永远有效
  • _allOrNone:_是否要求一次定完全成交,默认为false
  • wallet : 前端钱包地址,参与手续费分成
  • orderInterceptor: 订单回调合约地址,暂时不支持,不需要设置
  • dualAuthSig: 双重签名
  • tokenRecipient: token 收款地址,一般为owner
  • waiveFeePercentage : miner设置,前端不需要设置,费率折扣设置
  • tokenSFeePercentage : p2p 订单使用,tokenS收费比例
  • tokenBFeePercentage: p2p 订单使用,tokenB收费比例
  • walletSplitPercentage: 钱包分成比例
  • tokenStandardS : "0x0" 代表 ERC20 ,"0x1"代表ERC1400
  • tokenStandardB: "0x0" 代表 ERC20 ,"0x1"代表ERC1400
  • tokenStandardFee : "0x0" 代表 ERC20 ,"0x1"代表ERC1400
  • trancheS : erc1400 token 转账需要的参数
  • trancheS: erc1400 token 转账需要的参数
  • transferDataS : erc1400 token 转账需要的参数
  • signType: 0 代表Ethereum Sign ,1 代表EIP712签名方式

Trade Structure

trade: {
  owner: Address,
  orderHash: HexString,
  ringHash: HexString,
  ringIndex: HexString,
  fillIndex: HexString,
  txHash: HexString,
  amountS: HexString,
  amountB: HexString,
  tokenS: Address,
  tokenB: Address,
  marketKey: HexString,
  split: HexString,
  fee: {
    tokenFee: Address,
    amountFee: HexString,
    feeAmountS: HexString,
    feeAmountB: HexString,
    feeRecipient: Address,
    waiveFeePercentage: HexString,
    walletSplitPercentage: HexString
  },
  wallet: Address,
  miner: Address,
  blockHeight: HexString,
  blockTimestamp: HexString
}
  • split : 交易时,矿工获得的价差
  • tokenFee:当交易费的token地址
  • amountFee:该撮合中该笔成交付的手续费
  • feeAmountS: P2P交易中付出的tokens作为手续费,
  • feeAmountB:P2P交易中付出的tokenB作为手续费
  • feeRecipient: 接收手续费的地址
  • waiveFeePercentage:矿工设置,免除手续费的比例
  • walletSplitPercentage: DE设置,DEX要收取的交易费比例
  • wallet:DEX收取交易费的地址
  • miner:撮合订单的矿工地址

Ring Structure

ring: {
  ringHash: HexString,
  ringIndex: HexString,
  fillsAmount: HexString,
  miner: HexString,
  txHash: HexString,
  fees: [
    {
      tokenFee: Address,
      amountFee: HexString,
      feeAmountS: HexString,
      feeAmountB: HexString,
      feeRecipient: Address,
      waiveFeePercentage: HexString,
      walletSplitPercentage: HexString
    }
  ],
  blockHeight: HexString,
  blockTimestamp: HexString
}
  • fillsAmount: the fills amount in this ring
  • fees :a list of Trade Fee

Cancel Orders EIP 712 Schema

{
  "types": {
    "EIP712Domain": [
      {
        "name": "name",
        "type": "string"
      },
      {
        "name": "version",
        "type": "string"
      }
    ],
    "CancelRequest": [
      {
        "name": "id",
        "type": "bytes32"
      },
      {
        "name": "owner",
        "type": "address"
      },
      {
        "name": "market",
        "type": "address"
      },
      {
        "name": "time",
        "type": "uint"
      }
    ],
    
  },
  "primaryType": "CancelRequest",
  "domain": {
    "name": "Loopring Protocol",
    "version": "2"
  }
}
You can’t perform that action at this time.