Skip to content

Latest commit

 

History

History
77 lines (63 loc) · 2.56 KB

Airdrops-Contract.md

File metadata and controls

77 lines (63 loc) · 2.56 KB

Documentation written by ali-h

Note: this smart contract is only available on Hive Engine, there is no Steem Engine equivalent.

Table of Contents

Introduction

The airdrops contract allows any user to airdrop hive-engine tokens. User can set up an airdrop with a custom list to send tokens or stake tokens without having to manually transact.

Actions available:

newAirdrop:

Initiate a new airdrop. A fee of 0.1 BEE for each account in the airdrop list is required (i.e 100 BEE/1000 accounts). Note that there must be enough tokens in the sender's accounts to initiate the airdrop. If distribution type is stake, Token must have enabled staking.

  • requires active key: yes

  • can be called by: anyone (holding tokens)

  • parameters:

    • symbol (string): token to airdrop
    • type (string 'transfer' || 'stake'): distribution type, either stake or transfer
    • list (array): array of [account, quantity], quantity will be transfered/staked to account.
  • examples:

{
    "contractName": "airdrops",
    "contractAction": "newAirdrop",
    "contractPayload": {
        "symbol": "TKN",
        "type": "stake",
        "list": [
          ["ali-h", "100"],
          ["aggroed", "71.5"],
          ["satoshi.real", "0.555223"]
        ]
    }
}

A successful action will emit a "newAirdrop" event, e.g.

{
    "contract": "airdrops",
    "event": "newAirdrop",
    "data": {
        "airdropId": "9a21888421bb6520fc6e5e33bec966af72212a11"
    }
}

After being initialized, distribution will automatically start from the next block.

Tables available:

Note: all tables below have an implicit _id field that provides a unique numeric identifier for each particular object in the database. Most of the time the _id field is not important, so we have omitted it from table descriptions.

params:

contains contract parameters such as the current fees

  • fields
    • feePerTransaction = the cost in BEE per transaction
    • transactionPerBlock = number of maximum transaction in each block per airdrop
    • maxAirdropsPerBlock = number of maximum airdrops in each block

pendingAirdrops:

contains information about pending airdrops

  • fields
    • airdropId = id of airdrop (unique)
    • symbol = symbol of token to airdrop
    • type = distribution type
    • list = list of accounts to transact
    • blockNumber = block number in which airdrop was initiated