-
Notifications
You must be signed in to change notification settings - Fork 4
Test task for cc developers
Goal:
Implement a simple stablecoin in komodo assets chain.
How to start:
Make a fork from https://github.com/komodoplatform.com/komodo.git and build it on linux or macos.
Allocate a new evalcode and add custom consensus code for this eval code and implement needed rpc to create transactions - for the stable coin contract.
The stablecoin contract description:
This contract shold allow to create stablecoin treasury pool and issue coins in exchange for normal (mineble) coins and buyback stablecoins for normal coins. The consensus code should check that only valid user (public key) could issue stablecoins.
The contract should not convert existing coins but just store the stablecoin amount in the OP_RETURN as CAmount number. There should be rpc to transfer stablecoin from a user to user (from the current node pubkey to a destnation pubkey) Total issued stablecoin balance should be preserved and ensured by consensus code when stablecoin is transferred to other users (think about any rpc being changed by a malicious user to try to steal or add stablecoins).
Hints:
- Installation instructions and how to run a komodo assets chain: https://developers.komodoplatform.com/basic-docs/smart-chains/smart-chain-setup/installing-from-source.html
- Cryptoconditions Documentation: https://github.com/KomodoPlatform/Mastering_CryptoConditions
- Use the existing in the code CC Faucet as an example how to add new evalcode, develop consensus code and add new rpcs, add and parse data in the opreturn.
- use -pubkey to set current public key on a node
- use -ac_cc=2 to enable cryptoconditions support in your assets chain
- use -testnode=1 chain param to run a test chain of a single node, but ensure your chain could synchronise to another node
- use myGetTransaction function to get spent transactions and validate the stablecoin balance