CryptoKitties is composed of 4 public facing contracts. Below we'll provide an overview on these contracts:
Also referred as the main contract, is where Kitties and their ownership are stored. This also mediates all the main operations, such as breeding, exchange, and part of auctions.
For this release, the actual bytecode released for the contract is KittyCoreRinkeby.sol
, explained below.
Where users are expected to acquire their gen0 kitten. It is also a marketplace where anyone can post their kitten for auction. See Dutch/Clock auction - note we also accept an increasing price. ps: CK auctions take an initial time and duration, and after duration is over they are not closed. Instead they hold the final price indefinitely
A marketplace where any user can offer their Kitty as a potential sire for any takers.
It's a mystery! Not public for this release.
- 2 Kitties can breed, except with their siblings or parents.
- They must also be either owned by the same user, or one user offers a Kitty siring to another user.
- If you have 2 Kitties that fits this condition, you can use one as sire (father) and the other as matron (mother).
- Kitties do not have fixed genders.
- After breeding, the assigned matron will be pregnant and under cooldown, the father will also be under cooldown.
- Cooldown stands for the period of time the kitty cannot perform any breeding actions, a Kitty's cooldown increases each time it breeds.
- After the matron cooldown is complete, it can give birth, and engage in breeding again right away.
- As kitties breed their cooldowns increase. For the bounty program, the table can be found in
KittyCoreRinkeby.sol
. Production values will be inKittyBase.sol
.
The cooldown time table that will be used for CryptoKitties in production can be found under KittyBase.sol
.
For the Rinkeby release we made cooldowns much shorter, consult current values in KittyCoreRinkeby.sol
.
In this case you provide the matron, and have a permissioned sire. There are 2 practical cases this can happen:
- The owner of a Kitten can allow siring to another ethereum address.
- The owner of another Kitten can submit their Kitten into a siring clock auction, and the bidder must supply their matron.
There are 2 main ways to trade: direct transfer, or auctions:
- A owner of a kitten can put their kitty to a clock sales auction.
- Either transfer to another Ethereum address, or approve to another address.
Here's what we expect to be the most usual flow, and what function are to be called.
- COO will periodically put a kitten to gen0 auction (Main
createGen0Auction()
) - user go an buy gen0 kittens (Sale Auction
bid()
) - user can get kitty data (Main
getKitty()
) - user can breed their own kittens (Main
breedWith()
orbreedWithAuto()
) - after cooldown is passed, any user can have a pregnant kitty giving birth (Main
giveBirth()
) - user can offer one of their kitties as sire via auction (Main
createSiringAuction()
) - user can offer their kitty as sire to another user (Main
approveSiring()
) - user can bid on an active siring auction (Main
createSiringAuction()
) - user can put their kitty for sale on auction (Main
createSaleAuction()
) - user can buy a kitty that is on auction from another user (Sale Auction
bid()
) - user can check info of a kitty that is to auction (Sale/Siring Auction
getAuction()
) - user can cancel an auction they started (Sale/Siring Auction
cancelAuction()
) - user can transfer a kitty they own to another user (Main
transfer()
) - user can allow another user to take ownership of a kitty they own (Main
approve()
) - once an user has a kitty ownership approved, they can claim a kitty (Main
transferFrom()
) - CEO is the only one that may replace COO or CTO (Main
setCEO()
setCFO()
setCOO()
) - COO can mint and distribute promotional kittens (Main
createPromoKitty()
) - COO can transfer the balance from auctions (Main
withdrawAuctionBalances()
) - CFO can drain funds from main contract (Main
withdrawBalance()
)
Please see complete the explanation of roles in KittyAccessControl.sol
There are more rules and comments on the source code, please refer to the code and tests in case things don't work as first expected.
The only pre-dependency is Node 8.9.0 - the best way to install node is via nvm
We are using Truffle 4 framework to develop, all dependencies are installed via npm install
Run the the test suite: npm test
You can make tests more verbose by setting export DEBUG=ck
We added a convenience script to make it easier to see the state of some of the most important stats
- Make sure your geth is running in sync with rinkeby. (alternatively you may wanna try a public web3 compatible API, like Infura).
node scripts/list-kitties-auctions.js
- configure geth rpc port here.