BlockCAT Token Sale Contract Overview

BlockCAT
BlockCAT
Published in
3 min readJul 10, 2017

The BlockCAT token sale is happening on July 15th. To facilitate the sale, the BlockCAT development team has written smart contracts in Solidity, which will run on the Ethereum blockchain in order to manage the sale in a trustless and autonomous manner. We are releasing the contract source code in order to be transparent and open about the functionality that’s encoded within the contracts.

CATToken.sol— Core Token Sale Contract

The code for this contract can be found here.

This contract manages our token sale and provides all of the core ERC20 token functionality, such as transfers and balance queries. We intercept the calls to transfer() and transferFrom() in order to lock the transfer of tokens until we’ve hit the minimum cap.

The implementation of the ERC20 standard is provided by OpenZeppelin’s templates. Zeppelin has some fantastic, well documented smart contracts that serve as an excellent base to build on.

During the sale, the main function that users will interact with will be createTokens(), which accepts ether in exchange for CAT. The CAT is allocated to the address of the sender. The exchange rate of CAT is determined by how far along the sale is. In the first 24 hours, the exchange rate is 330 CAT to 1 ETH. In the following 48 hours, the exchange rate is 315 CAT to 1 ETH. For the rest of the sale, the exchange rate is 300 CAT to 1 ETH. These early bird periods are controlled by the variables saleFirstEarlyBirdEndBlock and saleSecondEarlyBirdEndBlock, which denote the end times of each period in block numbers.

Internally within our team, the two functions we will be using are triggerMinCap() and endSale(). Once the minimum cap has been triggered, the sale is considered successful and the refund feature will be locked. When endSale() is called, the sale is finalized and concluded. This will only be called upon reaching our hidden hard cap, or after the sale duration has concluded. As part of finalizing the sale, all ether contained by the contract is sent out and two CAT allocations (a 20% dev share and 1% reserve pool) are distributed to their destination addresses. The 20% dev share is sent directly into a time locked vault, called the CAT Freezer.

When the minimum cap has been signaled, the ether can be withdrawn to the BlockCAT multi-sig wallet using withdrawFunds() function. The intention of this is to minimize the value stored within the contract at all times in order to reduce risk.

In the event of an unsuccessful sale where the minimum cap has not been reached by the end of the sale period, then refunds will be made available. Anyone who contributed ether can withdraw their funds by calling the refund() function.

CATFreezer.sol — Time Locked Token Vault

The code for this contract can be found here.

The Cat Freezer implements a time locked vault, in which the developer share of the tokens are stored. The CAT will be automatically sent to this contract once the sale has concluded. After one year (365 days), unlockFirst() will allow the withdraw of half of the developer CAT. One year after that (two years total), the rest of the developer CAT can be withdrawn using unlockSecond().

Both of these contracts were written using the Truffle framework as the supporting infrastructure. The contracts were comprehensively tested both manually and with an automated unit test suite. The entire token sale was run as a simulation on the Kovan testnet in order to iron out any issues that could arise throughout the process.

Any vulnerabilities, bugs, or other issues can be responsibly disclosed by submitting a issue on the GitHub repository. Questions and comments about our contracts can be asked directly to our development team on our Slack channel.

--

--

BlockCAT
BlockCAT

BlockCAT lets anyone create, manage, and deploy smart contracts on the Ethereum blockchain — no programming required. http://blockcat.io