秒合约交易所系统开发实现技术案例及详情丨秒合约交易所开发源码程序

简介:   区块链是什么?一句话,它是一种特殊的分布式数据库。首先,区块链的主要作用是储存信息。Any information that needs to be saved can be written to or read from the blockchain,so it is a database.

 
  区块链是什么?一句话,它是一种特殊的分布式数据库。首先,区块链的主要作用是储存信息。Any information that needs to be saved can be written to or read from the blockchain,so it is a database.

  Secondly,anyone can set up a server,join the blockchain network,and become a node.区块链的世界里面,没有中心节点,每个节点都是平等的,都保存着整个数据库。你可以向任何一个节点,写入/读取数据,因为所有节点最后都会同步,保证区块链一致。

  struct TokenInfo{

  string symbol;//e.g.,"ETH","ADX"

  address tokenAddr;//ERC20 token address

  uint64 scaleFactor;//<original token amount>=<scaleFactor>x<DEx amountE8>/1e8

  uint minDeposit;//mininum deposit(original token amount)allowed for this token

  }

  struct TraderInfo{

  address withdrawAddr;

  uint8 feeRebatePercent;//range:[0,100]

  }

  struct TokenAccount{

  uint64 balanceE8;//available amount for trading

  uint64 pendingWithdrawE8;//the amount to be transferred out from this contract to the trader

  }

  struct Order{

  uint32 pairId;//<cashId>(16)<stockId>(16)

  uint8 action;//0 means BUY;1 means SELL

  uint8 ioc;//0 means a regular order;1 means an immediate-or-cancel(IOC)order

  uint64 priceE8;

  uint64 amountE8;

  uint64 expireTimeSec;

  }

  struct Deposit{

  address traderAddr;

  uint16 tokenCode;

  uint64 pendingAmountE8;//amount to be confirmed for trading purpose

  }

  struct DealInfo{

  uint16 stockCode;//stock token code

  uint16 cashCode;//cash token code

  uint64 stockDealAmountE8;

  uint64 cashDealAmountE8;

  }

  struct ExeStatus{

  uint64 logicTimeSec;//logic timestamp for checking order expiration

  uint64 lastOperationIndex;//index of the last executed operation

  }

  uint constant MAX_UINT256=2**256-1;

  uint16 constant MAX_FEE_RATE_E4=60;//upper limit of fee rate is 0.6%(60/1e4)

  //<original ETH amount in Wei>=<DEx amountE8>*<ETH_SCALE_FACTOR>/1e8

  uint64 constant ETH_SCALE_FACTOR=10**18;

  uint8 constant ACTIVE=0;

  uint8 constant CLOSED=2;

  bytes32 constant HASHTYPES=

  keccak256('string title','address market_address','uint64 nonce','uint64 expire_time_sec',

  'uint64 amount_e8','uint64 price_e8','uint8 immediate_or_cancel','uint8 action',

  'uint16 cash_token_code','uint16 stock_token_code');

  address public admin;//admin address,and it cannot be changed

  mapping(uint16=>TokenInfo)public tokens;//mapping of token code to token information

  uint8 public marketStatus;//market status:0-Active;1-Suspended;2-Closed

  uint16 public makerFeeRateE4;//maker fee rate(10*4)

  uint16 public takerFeeRateE4;//taker fee rate(10*4)

  uint16 public withdrawFeeRateE4;//withdraw fee rate(10*4)

  uint64 public lastDepositIndex;//index of the last deposit operation

  ExeStatus public exeStatus;//status of operation execution

  mapping(address=>TraderInfo)public traders;//mapping of trade address to trader information

  mapping(uint176=>TokenAccount)public accounts;//mapping of trader token key to its account information

  mapping(uint224=>Order)public orders;//mapping of order key to order information

  mapping(uint64=>Deposit)public deposits;//mapping of deposit index to deposit information

相关文章
|
6月前
|
安全
dapp链上合约代币质押项目分红系统开发稳定版/案例详情/功能步骤/源码版
In addition, the development of blockchain based DApp smart contracts also needs to consider the following requirements
|
区块链
币币交易所合约源码定制详情开发部署示例
# 获取合约对象 contract = web3.eth.contract(address=web3.toChecksumAddress(CONTRACT_ADDRESS), abi=ABI) # 存款函数 def deposit(): contract.transact().deposit() print('Deposit successful')
|
6月前
|
安全
dapp发行代币合约质押模式系统开发案例项目/详细功能/教程步骤/源码程序
The development of a DApp (decentralized application) based token issuance and contract pledge mode system involves multiple aspects, including token issuance, smart contract development, and pledge function design. The following is an overview of the logic development process
|
安全 API Python
OKEx交易所合约交易系统开发部署源码规则解析
OKEx交易所合约交易系统开发部署源码规则解析
合约交易所系统开发(开发模板)丨合约交易所系统开发稳定版及成熟案例源码
最先运行的 _beforeTokenTransfers 和最后运行的 _afterTokenTransfers 都是由用户自定义的函数,用于实现白名单等功能
量化合约交易系统开发详情(合约做市开发)丨DAPP交易所秒合约模式源码搭建
量化合约交易系统开发详情(合约做市开发)丨DAPP交易所秒合约模式源码搭建
|
自然语言处理 安全 区块链
秒合约系统开发(多语言)丨交易所秒合约系统开发(海外版)丨秒合约交易所开发源码搭建
秒合约系统开发(多语言)丨交易所秒合约系统开发(海外版)丨秒合约交易所开发源码搭建
|
存储 大数据 Linux
秒合约交易系统开发部署源码|秒合约详情方案
区块链技术,通过网络中所有节点共同参与计算,互相验证其信息的真伪以达成全网共识
|
消息中间件 缓存 运维
永续合约丨秒合约丨交易所系统开发正式版/方案详情/开发功能
永续合约开发技术是指开发和实现永续合约交易的技术。永续合约是一种无固定到期日的合约,与传统的期货合约不同,它没有到期日,可以一直持有。永续合约的交易方式类似于现货交易,但是具有杠杆交易的特点。
|
存储 区块链 数据安全/隐私保护
合约跟单丨合约交易丨秒合约项目系统开发(源码案例)
去中心化:在一个系统中任意节点的权利和义务都是均等的