No description, website, or topics provided.
Branch: master
Clone or download
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Type Name Latest commit message Commit time
Failed to load latest commit information.

Sansara smart contract

Check contract working

Before you start, you need to install required packages.

$ npm install ganache-cli truffle -g
$ npm install

Launch private blockchain using ganache.

$ ganache-cli


First of all, to ensure that everything works properly you should run tests.

$ truffle test test/sansara.js

If everything was great you will see smth like this:

Compiling ./contracts/Sansara.sol...
Compiling ./contracts/Theft.sol...

  Contract: Sansara
    ✓ Has an owner
    ✓ Contract can accept incoming transactions (225ms)
    ✓ Reinvest is correct (219ms)
    ✓ Provision addresses receives correct fee (974ms)
    ✓ Referrer commission works properly (720ms)
    ✓ Referrer: incorrectly specified referrer has no effect (455ms)
    ✓ Referrer: cash-back works properly (850ms)
    ✓ Check minimum invest (49ms)
    ✓ Payout: check function getInvestorDividendsAmount (148ms)
    ✓ Payout: check not payout after 400 days (384ms)
    ✓ Payout: check function self payout (648ms)
    ✓ Check getDepositAmount & getInvestorCount functions (161ms)
    ✓ Payout: check payouts work properly (889ms)
    ✓ Check ownershipTransfer (108ms)
    ✓ Check revert on another contract (317ms)
    ✓ Check rounds (644ms)

  16 passing (9s)

To ensure that smart-contact can be used by tones of investors, you should run `load-test.js

Before testing you should start ganache-cli with key -a 500 (investors count).

$ ganache-cli -a 500

Warning! This test took a lot of time!

$ truffle test test/sansara-loadtest.js

If everything was great you will see smth like this:

Compiling ./contracts/Sansara.sol...

  Contract: Sansara
    ✓ Loadtesting: Create a many investors (700ms)
    ✓ Loadtesting: Check payout for a large number of investors (2716ms)
    ✓ Loadtesting: Check next round on a lot investors (851ms)

  3 passing (4s)