Giter Site home page Giter Site logo

cmt_smart_contract's Introduction

GitHub license Solidity version Blockchain

CustomMintToken Smart Contract

Token emission based on MintableToken

Using CustomMintTokenCrowdSale Smart Contract (using work through Mist as an example)

  1. To work and receive funds in the main blockchain, the contract needs to be uploaded to the Ethereum blockchain.

  2. The contract defines several auxiliary contract classes. You need to run CustomMintTokenCrowdsale.

  3. You need to pass the value “rate” as a parameter. Since smart contracts don’t support fractional numbers, the rate must be an integer from 1 to 999. Rate is the CMT token “rate”. That means “how much Ether you need to pay for 1000 BETC”. It can be calculated using the following formula: rate = 1000 * (CMT rate in USD) / (ETH rate in USD). For example, if today’s Ether rate is 450 USD, and we’re going to sell CMT for 10 USD, then the rate will be calculated as follows = 1000 * 10/450 = 22.22... (approx. 22).

  4. After the contract is uploaded to the network, it will get an address to that investors have to send you Ether.

  5. After the contract is sent to the network, it will get the CMT token address in its parameters. Anyone who wants information about this token (for example, account balance) to be displayed in Mist should add this address in the following section: Contracts -> Custom Tokens -> Watch Token.

  6. The current contract parameters will be available in its interface:

  • Rate is a rate for calculation of token costs.
  • EndTime is a date and time when crowSale ended. In this modification the contract will not be changed.
  • WeiRaised shows how much Ether investors have sent to the contract. The amount is displayed in Wei. Wei is the smallest denomination of Ether, such that one Ether is ten to the eighteenth power of Wei. There is an unusually large zeros number, but these are features of smart contracts that don’t support fractional numbers.
  • TokensMinted shows how many tokens have been issued in total. The number is also multiplied by 100 to correctly display fractional shares of tokens.
  • StartTime is a token sale start time. It coincides with the time the contract was uploaded to the network.
  • isPaused is a variable that shows whether the token sale has been suspended.
  • MinimumSupply is a minimum number of tokens that can be sold in one transaction.
  • SaleStatus is a contract status and token sale (Running or Paused).
  • Token is a CMT token address required to track investor balances.
  1. There are also a number of functions:
  • SetRate is used to set rate.
  • BuyTokens is used to buy tokens. When sending Ether to the contract address, it’s called automatically.
  • IssueTokens. With this function, the contract Owner can transfer any token number to the address set as a parameter.
  • PauseCrowdSale is used to pause the token sale.
  • StartCrowdSale is used to resume sales in CrowdSale.
  • TransferOwnership. Initially the contract Owner becomes the one who uploaded the contract to the network. It’s possible to call the SetRate, StartCrowdSale, PauseCrowdSale, TransferOwnership, IssueTokens functions only from the same wallet. However, the Owner can transfer his rights to another address using this function.
  1. In the contract interface you can track the events generated by the contract. To do this, you need to check the “Watch contract events” box. Events will display who and when made the transfer to the contract address, the Ether amount (in Wei), how many tokens were received (also must be divided by ten to the eighteenth power) and how many tokens have been issued by that time. The auxiliary fields “integer_value” (this is the collected Ether amount rounded down to the nearest integer) as well as the “integer_amount” field (the amount of issued tokens rounded down to the nearest integer) have been added. Also, the events will display information about the tokens transferred by the Owner through IssueTokens function.

  2. All funds received on the contract account are automatically transferred to the contract Owner’s wallet.

License

Contract is MIT licensed.

cmt_smart_contract's People

Contributors

boomyjee avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.