Created
January 16, 2019 22:07
-
-
Save nandiraju/af90a74f48a9172bd6adf4f24ff665a1 to your computer and use it in GitHub Desktop.
Created using remix-ide: Realtime Ethereum Contract Compiler and Runtime. Load this file by pasting this gists URL or ID at https://remix.ethereum.org/#version=soljson-v0.4.24+commit.e67f0147.js&optimize=false&gist=
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| pragma solidity ^0.4.24; | |
| contract AssetRegistry{ | |
| // Vairables | |
| struct oneasset{ | |
| string name; | |
| uint timestamp; | |
| } | |
| mapping (string => oneasset) all_assets; | |
| event oneasset_event( | |
| string name, | |
| string url, | |
| uint timestamp | |
| ); | |
| function setAsset(string _url,string _name,uint) public { | |
| require ( bytes(_url).length !=0 ); | |
| require ( bytes(_name).length !=0 ); | |
| require ( all_assets[_url].timestamp == 0 ); | |
| all_assets[_url] = oneasset(_name, now); | |
| emit oneasset_event(_name,_url,now); | |
| } | |
| function getAsset(string _url) public view returns (string, uint) { | |
| return ( all_assets[_url].name , all_assets[_url].timestamp ); | |
| } | |
| } |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment