//Write your own contracts here. Currently compiles using solc v0.4.15+commit.bbb8e64f. pragma solidity ^0.4.22; import "./safemath.sol"; contract DemoCertify { using SafeMath for uint256; address public owner; uint256 public regcost; uint256 public totalGlobalCerts; mapping(address => uint256) public AccessLevel; mapping(address => uint256) public TotalCerts; mapping(address => mapping(uint256 => certificate)) public UserCertIndex; struct certificate { string Title; string Description; address Accreditor; uint256 dateObtained; } certificate[] public certificates; modifier aboveLevel(uint256 level) { require(AccessLevel[msg.sender] > level); _; } constructor () public { owner = msg.sender; regcost = 0.1 ether; AccessLevel[owner] = 9;//admin totalGlobalCerts = 1; UserCertIndex[owner][TotalCerts-1] = certificate("test title", "test desc", msg.sender ); } function addCertificate(certificate info) public aboveLevel(4) payable { //add info of cert to users profile require(msg.value >= regcost); certificates.push(info.Title, info.Description, info.Accreditor, info.dateObtained); totalGlobalCerts = totalGlobalCerts.add(1); } function addUserCertificate(){ } function kill() public { selfdestruct(owner); } }
0.4.23