info_tfgrid/collections/projectinca/specs_blockchain/oracle_contract.md
2024-08-17 13:22:25 +02:00

3.2 KiB

Oracle Contracts

An oracle can get information from the world as well as from other blockchains e.g. price of a token

  • name e.g. TFT_PRICE
  • description
  • address, the address of this oracle contract
  • link (link to more info about the oracle)
  • multisig_accounts e.g. 9 accounts need to sign
  • multisig_min_signature e.g. 6 need to sign, this is for releasing the generated token INCA
  • smart_contract_addr: address of the smart contract
  • period_measure: period in seconds we will measure
  • period_calc: period in seconds over which we will calculate min, max and avg (is rolling window)

default methods

  • get(name:string) -> fl64
    • will return minimum, maximum, average over the specified period _calc

Example record in Blockchain DB

{
  "oracle_contract": {
    "name": "TFT_PRICE",
    "description": "Oracle contract for retrieving TFT token price",
    "address": "0xFEDCBA9876543210FEDCBA9876543210FEDCBA98",
    "link": "https://example.com/tft_price_oracle_info",
    "multisig_accounts": [
      "0x1111111111111111111111111111111111111111",
      "0x2222222222222222222222222222222222222222",
      "0x3333333333333333333333333333333333333333",
      "0x4444444444444444444444444444444444444444",
      "0x5555555555555555555555555555555555555555",
      "0x6666666666666666666666666666666666666666",
      "0x7777777777777777777777777777777777777777",
      "0x8888888888888888888888888888888888888888",
      "0x9999999999999999999999999999999999999999"
    ],
    "multisig_min_signature": 6,
    "smart_contract_addr": "0xABCDEF1234567890ABCDEF1234567890ABCDEF12",
    "period_measure": 3600,
    "period_calc": 86400
  }
}

Implementation