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
Note: CEO, CTO and Bob each get a third of 0.1 ETH, in other words, 0.0333 ETH based on the contract.
Ropsten Transaction for Level-Two Contract: Tiered Distribution
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.
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
Note: Three member addresses (the first three) followed by HR address (the fourth).
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
- Confirm on MetaMask Notification
Step 3: Deposit
- Change the VALUE to 12 ether
- Click on the red
deposit
button under Deployed Contracts and confirm MetaMask notification
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-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
Step 2: Compile
- Choose
Injected Web3
for ENVIRONMENT- Route to local network as Ganache
- Keep 0 for VALUE
- Enter the three member addresses
- Confirm on MetaMask Notification
Step 3: Deposit
-
Ganache View pre-distribution
-
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
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
- CEO: 60% * 10 = 6 ETH
-
HR Account, fourth from the top, has its balance dropped by 10 ether
- from 74.86 to 64.85 ether
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!
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.
To view transactions on Kovan EtherScan
Switch MetaMask from Localhost 8545 to Kovan and Ropsten Test Network
Option 1: Kovan or Ropsten Testnet
See screenshots at the beginning for confirmations
Need to fund HR account at the following address
HR: 0x8EaaBB9Fc753df2C50F0b01E99b4e0F1f2d970A6
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.
- Columbia University Fintech Gitlab Repository
- http://remix.ethereum.org/
- https://www.trufflesuite.com/ganache
- https://mycrypto.com/
- https://metamask.io/