Code Monkey home page Code Monkey logo

slp-dividend-contract's Introduction

SLP-Dividend-Contract - successfully tested on testnet

Use Case

  • X number of users currently hold a particular SLP token
  • The corresponding BCH deposited to a crowdsale address are to be distributed to holders of the SLP token
  • The amount of BCH to be distributed for each token holder will be calculated based on the amount of tokens in each holder's SLP address

Functions Overview

  1. Takes a snapshot of all CCDC token holders and retrieves the amount of tokens they hold in their SLP addresses
  2. Calls on a CashScript contract to validate the token ID being used aginst the official token ID stored onchain via blockpress
  3. A distribution rate is calculated by dividing the total BCH deposited by the total amount of token supply
  4. Builds a Pay2Many transaction output and sends BCH to each token holder based on their distribution rate

STATUS: Successfully tested on Testnet

22nd Jan: 
Successfully working on testnet. Ready for independent testing and code audit.

Pre-Mainnet runsheet:
- publish CCDC token ID from mainnet onto memo via blockpress
- change CCDCTOKENID in js to mainnet token ID
- set decodeTx to OP RETURN 653 + new token ID
- change network constant to mainnet
- change totalBCHForDistribution to desired airdrop amount
- set crowdFundAddress, crowdFundAddressWIF, smartContractMnemonic parameters
- send some sats to the mainnet CashScript contract for validation transaction
- TEST1: comment out body of sendBCH() and do a read only mainnet snapshot as a test
- TEST2: uncomment sendBCH() and set totalBCHForDistribution to 0.1 as mainnet test
- PROD RUN: run full distribution logic

Getting started

  1. Install Bixbox SDK
  2. Install SLP SDK
  3. Install Cashscript SDK 0.3.1 or above
  4. Install Memopress
  5. Fund a crowdfunding cashaddress and set the initialisation parameters in CCDC_Dividend.js
  6. Clone the repo and run the client logic in CCDC_Dividend.js
git clone https://github.com/fifikobayashi/SLP-Dividend-Contract
cd SLP-Dividend-Contract
node CCDC_Dividend.js

Current output from SLPDividend.js

Test Tx: https://explorer.bitcoin.com/tbch/tx/0b1f2d29b75eb6e1e3718c9851e3eca8533115d5f4e3b85824983598f6540928

slp-dividend-contract's People

Contributors

fifikobayashi avatar

Watchers

James Cloos avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.