From f49233860ba3ab4f40372d7a8999eca0dc3b633a Mon Sep 17 00:00:00 2001 From: karan Date: Wed, 3 Apr 2019 11:20:10 +0530 Subject: [PATCH] attestation change --- contracts/Attestation.sol | 67 +++++++++++++++++++++++++++++++++++++-- 1 file changed, 65 insertions(+), 2 deletions(-) diff --git a/contracts/Attestation.sol b/contracts/Attestation.sol index 0ed2bd3..3430f68 100644 --- a/contracts/Attestation.sol +++ b/contracts/Attestation.sol @@ -1,11 +1,74 @@ pragma solidity ^0.4.24; -contract Attestation { +/** +* Contract for Vanity URL on SpringRole +* Go to beta.springrole.com to try this out! +*/ - event Attest(address _address,string _type,string _data); +/** + * @title Ownable + * @dev The Ownable contract has an owner address, and provides basic authorization control + * functions, this simplifies the implementation of “user permissions”. + */ + +contract Ownable { + address public owner; + + + event OwnershipTransferred(address indexed previousOwner, address indexed newOwner); + + /** + * @dev The Ownable constructor sets the original `owner` of the contract to the sender + * account. + */ + constructor() public { + owner = msg.sender; + } + + + /** + * @dev Throws if called by any account other than the owner. + */ + modifier onlyOwner() { + require(msg.sender == owner); + _; + } + + + /** + * @dev Allows the current owner to transfer control of the contract to a newOwner. + * @param newOwner The address to transfer ownership to. + */ + function transferOwnership(address newOwner) onlyOwner public { + require(newOwner != address(0)); + emit OwnershipTransferred(owner, newOwner); + owner = newOwner; + } +} + +/* +Attestatuion contract to enter event data for all attestations +*/ +contract Attestation is Ownable { + + /* + Attest by user + */ + event Attest(address _address,string _type,string _data); function write(string _type,string _data) public returns (bool) { emit Attest(msg.sender,_type,_data); return true; } + + + event AttestByOwner(string _address,string _type,string _data); + /* + Write by owner to be committed in case of data migration + */ + function writeByOwner(string _type, string _data, string _address) onlyOwner public returns (bool) { + emit AttestByOwner(_address,_type,_data); + return true; + } + }