Skip to content

Instantly share code, notes, and snippets.

@yuyasugano
yuyasugano / IERC721
Created January 9, 2019 23:45
ERC721 basic interface
pragma solidity ^0.4.23;
import "../../introspection/IERC165.sol";
/**
* @title ERC721 Non-Fungible Token Standard basic interface
* @dev see https://github.com/ethereum/EIPs/blob/master/EIPS/eip-721.md
*/
contract IERC721 is IERC165 {
event Transfer(address indexed from, address indexed to, uint256 indexed tokenId);
@yuyasugano
yuyasugano / ERC721 Burnable
Created January 9, 2019 23:56
ERC721 Burnable implementation
pragma solidity ^0.4.23;
import "./ERC721.sol";
/**
* @title ERC721 Burnable Token
* @dev ERC721 Token that can be irreversibly burned (destroyed).
*/
contract ERC721Burnable is ERC721 {
/**
@yuyasugano
yuyasugano / CowBreeding
Created January 11, 2019 03:26
Cow Breeding frontend sample
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<title>Cow Breeding Front-end</title>
<script language="javascript" type="text/javascript" src="https://cdnjs.cloudflare.com/ajax/libs/jquery/3.3.1/jquery.min.js"></script>
<script src="https://cdn.jsdelivr.net/gh/ethereum/web3.js@1.0.0-beta.36/dist/web3.min.js" integrity="sha256-nWBTbvxhJgjslRyuAKJHK+XcZPlCnmIAAMixz6EefVk=" crossorigin="anonymous"></script>
<script language="javascript" type="text/javascript" src="cowbreeding_abi.js"></script>
</head>
<body>
@yuyasugano
yuyasugano / ERC721XTokenNFT
Created February 9, 2019 07:01
ERC721XTokenNFT.sol modification for tokenType mapping
mapping(uint256 => uint256) tokenType;
uint256 constant NFT = 1;
uint256 constant FT = 2;
/**
* @dev Returns whether the specified token exists
* @param _tokenId uint256 ID of the token to query the existence of
* @return whether the token exists
*/
@yuyasugano
yuyasugano / CardGame Implementation
Last active February 10, 2019 04:28
CardGame Implementation with multi-fungible token ERC721x
pragma solidity ^0.4.25;
import "erc721x/contracts/Core/ERC721X/ERC721XToken.sol";
import "./Ownable.sol";
contract CardGame is ERC721XToken, Ownable {
mapping(uint => uint) internal tokenIdToIndividualSupply;
mapping(uint => uint) internal nftTokenIdToMouldId;
uint nftTokenIdIndex = 1000000;
@yuyasugano
yuyasugano / Loom_dapp_chain
Created February 16, 2019 10:19
Sample code deploy on loom_dapp_chain
yarn run v1.12.3
$ truffle deploy --network loom_dapp_chain
Compiling ./contracts/Migrations.sol...
Compiling ./contracts/MyCoin.sol...
Compiling ./contracts/MyRinkebyCoin.sol...
Compiling ./contracts/MyRinkebyToken.sol...
Compiling ./contracts/MyToken.sol...
Compiling ./contracts/SimpleStore.sol...
Compiling openzeppelin-solidity/contracts/AddressUtils.sol...
Compiling openzeppelin-solidity/contracts/introspection/ERC165.sol...
@yuyasugano
yuyasugano / ERC721 Metadata
Created March 2, 2019 06:43
ERC721 Metadata implementation
pragma solidity ^0.4.23;
import "./ERC721.sol";
import "./IERC721Metadata.sol";
import "../../introspection/ERC165.sol";
contract ERC721Metadata is ERC165, ERC721, IERC721Metadata {
// Token name
string private _name;
@yuyasugano
yuyasugano / React User Status
Last active April 19, 2019 11:20
Blockstack application React User Status
render() {
const { handleSignOut } = this.props;
const { person } = this.state;
const { username } = this.state;
return (
!isSignInPending() && person ?
<div className="container">
<div className="row">
<div className="col-md-offset-3 col-md-6">
@yuyasugano
yuyasugano / React Post Style
Last active April 20, 2019 05:43
Blockstack application React Post Style
/* Globals */
a,a:focus,a:hover{color:#fff;}
html,body{height:100%;text-align:center;background-color:#191b22;}
body{color:#fff}
.hide{display:none;}
.landing-heading{font-family:'Lato',Sans-Serif;font-weight:400;}
/* Buttons */
.btn{font-family:'Lato',Sans-Serif;padding:0.5625rem 2.5rem;font-size:0.8125rem;font-weight:400;line-height:1.75rem;border-radius:0!important;-webkit-transition:all .2s ease-in-out;-moz-transition:all .2s ease-in-out;-ms-transition:all .2s ease-in-out;-o-transition:all .2s ease-in-out;transition:all .2s ease-in-out;-webkit-user-select:none;-moz-user-select:none;-ms-user-select:none;user-select:none;}
.btn-lg{font-size:1.5rem;padding:0.6875rem 3.4375rem;line-height:2.5rem;}
@yuyasugano
yuyasugano / React Final Status
Last active April 20, 2019 08:00
Blockstack application React Final Status
render() {
const { handleSignOut } = this.props;
const { person } = this.state;
const { username } = this.state;
return (
!isSignInPending() && person ?
<div className="container">
<div className="row">
<div className="col-md-offset-3 col-md-6">