SHARE
TWEET

Untitled

a guest Jan 17th, 2019 65 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. pragma solidity ^0.4.24;
  2.  
  3. contract AssetRegistry{
  4.    
  5.     // Vairables
  6.     struct oneasset{
  7.         string  name;
  8.         uint  timestamp;    
  9.     }
  10.    
  11.     mapping (string => oneasset) all_assets;
  12.    
  13.     event oneasset_event(
  14.         string name,
  15.         string url,
  16.         uint timestamp
  17.     );
  18.    
  19.     function setAsset(string _url,string _name,uint) public {
  20.        
  21.         require ( bytes(_url).length !=0 );
  22.         require ( bytes(_name).length !=0 );
  23.         require ( all_assets[_url].timestamp == 0 );
  24.        
  25.         all_assets[_url] = oneasset(_name, now);
  26.         emit oneasset_event(_name,_url,now);
  27.     }
  28.    
  29.     function getAsset(string _url) public view returns (string, uint) {
  30.         return ( all_assets[_url].name , all_assets[_url].timestamp );
  31.     }
  32.    
  33. }
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand
 
Top