Skip to content

Latest commit

 

History

History
265 lines (173 loc) · 7.17 KB

README.md

File metadata and controls

265 lines (173 loc) · 7.17 KB

Roulette or Carosel?

Join us today! Get paid by "Remixed" blockchain smart contract xoxo

Are we rewarded based on merits at work?

Story: Our company is recently founded with three members. We are creating ethereum smart contract to democratize payment system, increase transparency and automate tax filing procedures.

Profits are distributed following a "trilogy" schedule as described below:

Level 1: equally among employees

Level 2: based on tiers

Level 3: how long members hanging with us


Kovan Transaction for Level-One Contract: EQUAL SPLIT

tx_kovan_0 Note: CEO, CTO and Bob each get a third of 0.1 ETH, in other words, 0.0333 ETH based on the contract.

See Tiered Transaction on Kovan of 0.3 ETH from HR (click me)

tx_kovan_tiered

Kovan Transaction Records

Ropsten Transaction for Level-Two Contract: Tiered Distribution

tx_ropsten_tiered Note: CEO gets 60% of 0.15 ETH, i.e. 0.09 ETH; CTO gets 25% of 0.15 ETH, thus 0.0375 ETH; and Bob gets 15% of 0.15 ETH, or 0.0225 ETH.

See Equal-Split Transaction on Ropsten of 0.03 ETH from HR (click me)

tx_ropsten_tiered

Ropsten Transaction Records


Initial Balances on Ganache

Human Resources Account Address
HR: 0x8EaaBB9Fc753df2C50F0b01E99b4e0F1f2d970A6
Account Addresses for Members
CEO: 0x0616d31438078849D3bf66591855B3D3239a9E5c

CTO: 0x5DBaBe19DD1fedba1B20047059DCd755D8221BF7

Bob: 0x3e9D41Ec700b98C773f2599052a3590931bEa98c

Lauch Ganache on Localhost: 8545

Balances View on Ganache

Ganache Initial Balance Note: Three member addresses (the first three) followed by HR address (the fourth).


TYPES OF CONTRACTS


Level-One: EQUAL SPLIT

Goal: Distribute profits evenly among members.

AssociateProfitSplitter

Step 1: Deploy

  • A green check mark should appear should the process be successful

Step 2: Compile

  • Choose Injected Web3 for ENVIRONMENT
    • Route to local network as Ganache
  • Keep 0 for VALUE
  • Enter the three member addresses level_1_deploy
  • Confirm on MetaMask Notification
    • Make sure MetaMask is hooked onto Localhost 8545 level_1_compile

Step 3: Deposit

  • Change the VALUE to 12 ether level_1_deposit
  • Click on the red deposit button under Deployed Contracts and confirm MetaMask notification level_1_deposit_confirm

View Transactions: Relaunch Ganache

  • Balance on each of the three accounts increased by approximately 4 ether, which is provided by 12 ETH divided by 3
  • HR Account, fourth from the top, has its balance dropped by approximately 12 ETH
    • adjusted by gas fees

level_1_post


Level-Two: RANK-BASED SHARING

There is always another door! Let's climb. Shall we?

Goal: Distribute profits to different tiers of employees.

TieredProfitSplitter

Step 1: Deploy

  • A green check mark accompanies a successful deployment level_2_deploy
    • Confirmation on Remix level_2_deploy_confirm

Step 2: Compile

  • Choose Injected Web3 for ENVIRONMENT
    • Route to local network as Ganache
  • Keep 0 for VALUE
  • Enter the three member addresses level_2_compile
  • Confirm on MetaMask Notification
    • Make sure MetaMask is hooked onto Localhost 8545 level_2_compile_confirm

Step 3: Deposit

  • Ganache View pre-distribution

    • A drop of 0.01 ETH from prior balance of 97.99 ETH for HR Account due to gas fee on deployment level_2_pre
  • Change the VALUE to 10 ether, click on the deposit button under the second Deployed Contracts for tiered distribution schedule and confirm the notification on MetaMask level_2_deposit

View Tiered Distributions: Relaunch Ganache

  • Based on the 60-25-15 plus remainder schedule, balances on the three accounts increased by approximately

    • CEO: 60% * 10 = 6 ETH
      • from 128.42 to 134.42 ether
    • CTO: 25% * 10 = 2.5 ETH
      • from 130.66 to 133.16 ether
    • Bob: 15% * 10 = 1.5 ETH
      • from 65.63 to 67.13 ether
  • HR Account, fourth from the top, has its balance dropped by 10 ether

    • from 74.86 to 64.85 ether

level_2_post


Level-Three: VESTED SHARES

THANK YOU for Hanging with Us!

Goal: Distribute company shares for employees in a "deferred equity incentive plan" automatically.

DeferredEquityPlan

Deploy and Compile!

level_3_deposit

For a 100-day fastforward test contract: fakenow variable and fastforward function are created.

   /* @TODO: Test contract via fakenow variable
    uint fakenow = now;
    
       @TODO: Add this function to "fast forward" time by 100 days
    function fastforward() public {
    fakenow += 100 days;
}
*/

View Functions: Relaunch Ganache

The balance on HR Account decreased by 0.01 ether for gas fee on deployment. level_3_post

Next Steps

To view transactions on Kovan EtherScan

Switch MetaMask from Localhost 8545 to Kovan and Ropsten Test Network MetaMask

Option 1: Kovan or Ropsten Testnet

See screenshots at the beginning for confirmations

Need to fund HR account at the following address

HR: 0x8EaaBB9Fc753df2C50F0b01E99b4e0F1f2d970A6
Sample testcoin funding on Kovan

kovan_funding

Then, follow the same process as on localhost:8545 to distribute to three different addresses for CEO, CTO and Bob.

Option 2 Coming up: Customized Ethereum Testnet

Again, need to run nodes to fund crypto account by connecting to customized network on MyCrypto Wallet.


Files


References