Skip to content

Instantly share code, notes, and snippets.

@yuyasugano
yuyasugano / IERC721
Created Jan 9, 2019
ERC721 basic interface
View IERC721
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 / CowOwnership
Created Jan 9, 2019
Cow ownership smart contract
View CowOwnership
pragma solidity ^0.4.23;
import "./CowBreeding.sol";
import "openzeppelin-solidity/contracts/token/ERC721/ERC721.sol";
/**
* @title ERC721 compatible Cow Standard Basic Implementation
* @dev Implements Cow transfer with inherited OpenZeppelin ERC721
*/
contract CowOwnership is CowBreeding, ERC721 {
@yuyasugano
yuyasugano / ERC721 Burnable
Created Jan 9, 2019
ERC721 Burnable implementation
View ERC721 Burnable
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 Jan 11, 2019
Cow Breeding frontend sample
View CowBreeding
<!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 / CowBreeding Solidity
Created Jan 11, 2019
Cow breeding smart contract
View CowBreeding Solidity
pragma solidity ^0.4.23;
import "./ownable.sol";
import "openzeppelin-solidity/contracts/token/ERC721/ERC721.sol";
/**
* @title CowBreeding
* @dev Cow Basic Implementation to breed them and provides basic functions.
*/
contract CowBreeding is Ownable {
@yuyasugano
yuyasugano / ERC721XTokenNFT
Created Feb 9, 2019
ERC721XTokenNFT.sol modification for tokenType mapping
View ERC721XTokenNFT
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 Feb 10, 2019
CardGame Implementation with multi-fungible token ERC721x
View CardGame Implementation
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 Feb 16, 2019
Sample code deploy on loom_dapp_chain
View 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 Mar 2, 2019
ERC721 Metadata implementation
View ERC721 Metadata
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 Apr 19, 2019
Blockstack application React User Status
View 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">