End to end example
In this session we will cover in detail the execution of function fundCoffee()
of our "hello world" application which outputs the final result in the terminal console.
Add operator and start crowdsale
setOperator () returns (operatorID)
Pass as addOperator with operatorAddress, operatorURI, platformOnwer and get back the address of the operator.
startCrowdsale() returns (object)
Function used with createAsset() to start a crowdsale to fund a new asset you must pass this function and object that contains as parameters assetURI, operatorID, fundingLength, amountToRaise, brokerPercent, operatorAddress
The function returns an object that contains in our case _assetID and _tokenAddress.
dividendTokenETH( tokenAddress ) returns ( contract instance )
This function takes a contract address for an already deployed DividenToken.sol contract, instantiates the contract, and exposes all of its public functions.
Get functions
getFundingTimeLeft( assetID ) returns ( uint )
Pass an assetID and get back the time in seconds until the crowdsale finishes. If the crowdsale is already finished, you'll receive 0.
getFundingGoal( assetID ) returns ( uint )
Pass an assetID and get back the funding goal for the asset. If the asset is funded, you'll get back the total supply of tokens.
getFundingProgress( assetID ) returns ( uint )
Pass an assetID and get back the current amount that the asset has been funded.
getAssetOperator( assetID ) returns ( address )
Pass an assetID and get back the address of the operator.
getAssetManager( assetID ) returns ( address )
Pass an assetID and get back the address of the asset manager.
getAssetInvestors( assetID ) returns ( array )
Pass an assetID and get back an array of all the addresses that have funded it.
getOpenCrowdsales() returns ( array )
Get an array of all assetIDs that are currently seeking funding.
getAssetsByOperator( address ) returns ( array )
Pass an address and get back an array of assetIDs operated by that operator.
getAssetsByInvestor( address ) returns ( array )
Pass an address and get back an array of assetIDs owned by that investor.
getAssetsByManager( address ) returns ( array )
Pass an address and get back an array of assetIDs managed by that asset manager.
getBalance (address) returns (uint)
Pass the operatorAddress and get back the current balance of the operatorAdress at a given block.
Asset funding
contribute(account, amount) returns (string, amount)
Pass the investor addresses and the asset investment amont. getFundingProgress on asset (see above) after each investor contribution.
getOpenCrowdsales() returns ( array )
Get an array of all assetIDs that are currently seeking funding. After checking between funding goal and funding progress, returns array of open crowdsales.
getBalance (address) returns (uint)
Pass the operatorAddress and get back the current balance of the operatorAdress after investors' contribution.
balanceof (address) returns (uint)
Pass operator and investors address and get back the number conversion of the balance of the addresses.
Dividends issuance
getBalance (address) returns (uint)
Pass the investorAddress and get back the current balance of each investorAdress before dividend.
issueDividends( assetID, account, amount ) returns ( bool )
To pay out dividends to investors, the operator can call this function. Pass the assetID, the account from which you want to pay, and the amount you'd like to pay. The function determines if the asset takes Ether or an ERC-20 token. If the account does not have a sufficient balance in the required payment method, the function will fail.
withdraw(assetID) returns (bool)
Investors can call withdraw function to decide to retrieve dividend tokens received on the asset.
getBalance (address) returns (uint)
Pass the investorAddress and get back the current balance of each investorAdress after dividend.
Output on terminal
The final result of our "hello world" to fund our coffee machine should look like this:
Last updated