Advertisement
Guest User

smart1.sol

a guest
Apr 21st, 2018
77
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 2.28 KB | None | 0 0
  1. pragma solidity ^0.4.24;
  2.  
  3. contract SmartTrading{
  4.  
  5. constant address traderId; //Адресс трейдера
  6. constant uint startSum; //Начальный капитал, с которого мы начинаем трейдинг
  7. constant uint lifeTime; //Время действия контракта
  8. constant uint finam_percent; //Процент Финама
  9. constant uint trader_percent; //Процент трейдера
  10.  
  11. uint currentSum; //Текущая сумма
  12. address owner; //Адрес трейдера
  13.  
  14. uint numberOfInvestors=0;//Число инвесторов
  15.  
  16. function SmartTrading() public {
  17. traderId = msg.sender;
  18. }
  19.  
  20. modifier onlyOwner() {
  21. require(msg.sender == owner);
  22. _;
  23. }
  24.  
  25. struct investor {
  26. address id; //Адрес инвестора
  27. uint placedSum; //Инвестируемая сумма
  28. bool insurance; //Нужна ли страховка
  29. uint insurance_sum; //Сумма страховки
  30. }
  31.  
  32. function investor(address id, uint placedSum, bool insurance, uint insurance_sum) public{
  33. //конструктор инвестора
  34. }
  35.  
  36. investor[] arrayOfInvestors = new investor[](10);
  37.  
  38. function invest(uint amount, bool insurance, uint insurance_sum) public{
  39. arrayOfInvestors[numberOfInvestors] = new investor(address msg.sender, uint amount, bool insurance, uint insurance_sum);//Добавляет инвестора в список инвесторов;
  40. numberOfInvestors++;
  41. }
  42.  
  43. function moneyCollected() public constant returns (bool) {
  44. //Пробегает по массиву инвесторов и складывает вложенные суммы
  45. //Если сумма инвесторов больше или равна, чем startSum тогда return true;
  46. //Иначе return false;
  47. }
  48.  
  49. function trade(string tokenA, string tokenB, uint amount) public {
  50. //Конвертирует amount токена A в токен B
  51. }
  52. function saleToken(string tokenA) public{
  53. //Продает весь запас токена А, если его курс резко падает
  54. }
  55.  
  56. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement