Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- pragma solidity >=0.5.0 <0.5.12;
- pragma experimental ABIEncoderV2;
- contract Drugs{
- uint24 private cost;
- uint24 private num_of_drugs;
- string private type_of_drug;
- uint8 private priority;
- string private name;
- constructor (uint24 en_cost, uint24 en_num, string memory en_type, uint8 en_priority, string memory en_name) public{
- cost = en_cost;
- num_of_drugs = en_num;
- type_of_drug = en_type;
- priority = en_priority;
- name = en_name;
- }
- function getCost() public view returns(uint24){
- return cost;
- }
- function getName() public view returns(string memory){
- return name;
- }
- }
- contract Apteka{
- address[] private listOfDrugs;
- constructor() public{
- listOfDrugs.push(address(new Drugs(420, 100, "MindBoost", 50, "Fenotropil")));
- listOfDrugs.push(address(new Drugs(56, 30000, "Зыгср0", 100, "Glycin")));
- listOfDrugs.push(address(new Drugs(218, 300, "PainKiller", 255, "Nurofen")));
- }
- function getProducts() public view returns(address[] memory){
- return listOfDrugs;
- }
- function decodeAdd(address _prod) public view returns(string memory, uint24){
- Drugs tmp = Drugs(_prod);
- return (tmp.getName(), tmp.getCost());
- }
- function getAllInfo() public view returns(string[] memory, uint24[] memory){
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement