This boilerplate smart contract template introduces the core ideas and implementations for tickets management. It showcases key opportunities that immutable distributed ledgers and Solidity smart contracts offer: profit sharing between all participants of the value creation and resales chain.
DISCLAIMER: THIS SMART CONTRACT SUITE WAS DESIGNED FOR DEMO PURPOSES; UNLESS EXPLICITLY INDICATED OTHERWISE, THESE SMART CONTRACTS HAVE NOT BEEN AUDITED FOR PRODUCTION USAGE.
dThankYou Smart Contract Description
dThankYou smart contract components are:
Management/Management.sol is a base smart contract, which is established in each of the contracts supporting the platform operation or activities. This smart contract includes the following functions:
- registerContract(uint256 _key, address _target) (register the _target contract to the specified _key)
- setPermission(address _address, uint256 _permission, bool _value) (set or unset the _permission to make some actions for the _address)
It also comprises the basic functions that allow to manage and check state variables.
Management/Managed.sol is a parent contract for the platform-related smart contracts, except the Management contract. It is designed to keep the actual Management contract address and interact with all other contracts through the Management contract.
Management/Constants.sol is a contract designed for storing constants, to specify contracts for their registration in the system, and constants to indicate permission for performing certain actions.
Thank-you-token/CompanyThankYouToken.sol is the ERC-20-based mintable-token smart contract. It is the basic smart contract responsible for:
- handling recognitions (transfers between holders) and rewards exchange
- controlling company token state for each recognizing period (token balances and total supply are automatically settable for each period)
CompanyToken.sol is a smart contract which extends the basic CompanyThankYouToken contract. It is created to store initial holder balance and spent tokens for each recognition period. In addition, it is responsible for the calculation and distribution of tokens for whitelisted users. Calculations for each recognizing period are based on the token balance of the initial holder and spent tokens for a previous period.
CompanyFabric.sol is a smart contract which stores all the created CompanyTokens and provides the ability to create a new CompanyToken contract (ThankYouCoin) for the permitted account.
Use Flow and Roles
There are four main roles that interact with smart contract:
- platform-related Ethereum address for signing token transactions and deploying token contracts
- owner address of the ThankYoutoken contract which can manage contracts and state variables
- platform-related Ethereum address to suspend/resume recognizing periods and change initial holder balance value
- platform reward exchange address responsible for exchanging tokens with rewards.
Screenshots of interaction with SC
In order to get tokens, every team member should claim them with a hash generated by the platform.
The hash data contains claimTokens functions with signed sender address (a team member which will receive tokens) and current timestamp by the specific platform-related ethereum address.
After receiving tokens, a user can utilize them to send recognition to another team member.
After receiving recognition, a team member can claim a reward by sending tokens to the platform reward exchange address.
At the end of recognizing period, all tokens will be burned and users should claim tokens for the next recognizing period. Tokens amount for the new period depends on the initial balance and spent tokens for the previous period (prev period initial balance * 2 * percentage of prev period spent tokens).