Ethereum Tutorials

ShareHolder Factory Contract

Deploying contracts manually is a boring and error-prone task, especially if more than one contract needs to be created. Consider an example: a musical band using ShareHolder Contract to do a fund rising for each of their songs: one song - one contract. Then as song brings some profit, part of the profit is being distributed (again, by ShareHolder contract) among owners of shares.

As we know, a musical band can easily have hundreds of songs...

To automate the task of creating multiple contracts, a ShareHolder Factory contract was created.

The only purpose of a ShareHolder Factory contract is to simplify creation of ShareHolder contracts:

ShareHolder Factory is therefore a code in an Ethereum block chain that takes some initial parameters, such as number of shares your new ShareHolder contract should manage, initial price of a share and so on. Then it creates a contract and deploys it in a block chain for you.

Here "for you" means that your wallet's address becomes an owner of a newly deployed contract, so WE have no control over it: you do.

Users Guide

Use your Web browser (currently, Chrome is supported, other browsers may or may not work correctly) to navigate to ShareHolder Factory Web page. As ShareHolder Factory is an Ethereum contract, you need to have access to the block chain in order to work with it. If you don't, a warning message is displayed:

To have access to the Ethereum network, install and enable (it is enabled by default) a MetaMask plug-in for Chrome Browser.

Wallet Info.

The combo box lists all your accounts (wallets). There is, however, an important point to keep in mind.

First, this combo box is for Geth and some other low-level tools for block chain access. If you use MetaMask, you will have this combo box disabled; instead you will have to switch accounts in MetaMask itself (it has a similar combo box).

For our tutorial, we'll use 3 accounts (1, 2, 3 positions in a combo box above). "1" is there in case someone wants to follow our tutorial using Geth instead of a MetaMask; if you use MetaMask, you will only need 2 and 3. Create them in your MetaMask.

Wallet Info.

The Web site presents you with the form to fine-tune ShareHolder properties.

Contract Name. This name will be shown to the users.

Contract URL. When shown in a list (see "ShareHolder Contracts" section of a page), the Contract Name is wrapped in a hyper link, clicking it will take the visitor to the Web page (presumably, Web page presenting this contract). For example, if a musical band creates a ShareHolder contract managing profits for "One Happy Song", the link will take the visitor to the song's page.

Allow Buy back feature. When a share holder sells shares back to the contract, shares may or may not become available for sale to the next client. If "buy back" is checked, the contract "buys shares back", not releasing them to the pool of "sellable" shares.

Trade Commission. Whenever share owners buy shares from the contract or sell shares back, they are charged the fee (in percents) in favor of the contract owner.

Profit Commission. Whenever profit is distributed to the contract, the commission is withdrawn (in percents) in favor of the contract owner.

Total Num. of Shares. Amount of shares contract manages. Initially all shares belong to owner of a contract.

Max Tradable Shares. The owner might want to prevent the contract from selling ALL available shares. For example, having 10,000 shares, the contract only sells up to 6,000; the rest belongs to contract owner.

Max Distributable Shares. In addition to selling, shares can be distributed, free of charge. For example, they can be issued as a reward to developers of a contract. Max. number of shares is limited by this field. Note that as initially all shares belong to contract owner, distributing shares will not compromise finances of other share holders: contract owner distributes owner's shares only.

Init. Shares Available and Shares Daily Supply. To extend the sale event, it is possible to limit daily supply of shares. For example, initially (at day 1) there can be 1000 shares available for sale, then every day 500 shares is added, until Max Tradable Shares is reached.

Share Init. Price. Initial price is price shares are sold at day 1. Then, as profit is sent to the contract, price of shares will increase.

Price-on-Demand Increase. If at a particular day all shares are sold, the next day's price will be increases (in percent). If not and there was an increase before, price will decrease till it reaches the "fare" price (init. price plus profit).
Note that the extra money are distributed to contract owner, not to share holders.

List of Contracts.

The following section of the Web page contains a table with contracts created to that moment.

Number of Contracts Created.

A simple chart showing daily contracts created.

Deploying a new contract.

If you have MetaMask installed in your Chrome browser, and you are logged into your MetaMask account (in Ethereum world, Wallet and Account are synonyms, refering to a pair of keys: private and public), then launching a new ShareHolder contract is easy.

Enter the name of your contract, check values in all fields, and click the "Create" button. MetaMask will display a transaction info, asking for a confirmation and maybe you will have to reduce amount of gas it will send (don't worry about setting exact amount, as unused gas will be returned to your account).

The transaction will show up in MetaMask's list, the Web page will show a confirmation of its own, and some time later when you reload the page you will see your transaction in a list.







Visibility is very important for this site. If you like it please link from your page to this URL or share info using Social Buttons below.
(C) snowcron.com, all rights reserved

Please read the disclaimer