Skip to content

Instantly share code, notes, and snippets.

@RobertoC27
Created September 22, 2018 03:46
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save RobertoC27/5c066d59c49e3d74f20c4209dd889fc5 to your computer and use it in GitHub Desktop.
Save RobertoC27/5c066d59c49e3d74f20c4209dd889fc5 to your computer and use it in GitHub Desktop.
contratos token educacion
pragma solidity ^0.4.20;
import "./AccessControl.sol";
import "../node_modules/openzeppelin-solidity/contracts/ownership/Ownable.sol";
contract EducationToken is Ownable{
string public name;
string public description;
struct TokenInfo{
uint256 date;
}
constructor(string _name, string _description) public {
name = _name;
description = _description;
}
mapping(uint256 => address) private tokenIdtoOwner;
mapping(address => uint256) private ownershipCount;
TokenInfo[] tokens;
function createToken(string _description) onlyOwner public {
TokenInfo memory tok = TokenInfo({
date: block.timestamp
});
uint256 newTokenId = tokens.push(tok) - 1;
_transfer(address(0), _to, newTokenId);
}
function tranfer(address _to, uint256 _tokenId) public {
_transfer(msg.sender, _to, _tokenId);
}
function _transfer(address _from, address _to, uint256 _tokenId) private {
ownershipCount[_from]--;
ownershipCount[_to]++;
tokenIdtoOwner[_tokenId] = _to;
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment