Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- pragma solidity ^0.4.24;
- contract SmartTrading{
- constant address traderId; //Адресс трейдера
- constant uint startSum; //Начальный капитал, с которого мы начинаем трейдинг
- constant uint lifeTime; //Время действия контракта
- constant uint finam_percent; //Процент Финама
- constant uint trader_percent; //Процент трейдера
- uint currentSum; //Текущая сумма
- address owner; //Адрес трейдера
- uint numberOfInvestors=0;//Число инвесторов
- function SmartTrading() public {
- traderId = msg.sender;
- }
- modifier onlyOwner() {
- require(msg.sender == owner);
- _;
- }
- struct investor {
- address id;
- uint placedSum;
- bool insurance;
- uint insurance_sum;
- }
- function investor(address id, uint placedSum, bool insurance, uint insurance_sum) public{
- //конструктор инвестора
- }
- investor[] arrayOfInvestors = new investor[](10);
- function invest(uint amount, bool insurance, uint insurance_sum) public{
- arrayOfInvestors[numberOfInvestors] = new investor(address msg.sender, uint amount, bool insurance, uint insurance_sum);//Добавляет инвестора в список инвесторов;
- numberOfInvestors++;
- }
- function moneyCollected() public constant returns (bool) {
- //Пробегает по массиву инвесторов и складывает вложенные суммы
- //Если сумма инвесторов больше или равна, чем startSum тогда return true;
- //Иначе return false;
- }
- function trade(string tokenA, string tokenB, uint amount) public {
- //Конвертирует amount токена A в токен B
- }
- function saleToken(string tokenA) public{
- //Продает весь запас токена А, если его курс резко падает
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement