Skip to content

Instantly share code, notes, and snippets.

View jamesmorgan's full-sized avatar

James Morgan jamesmorgan

View GitHub Profile
@jamesmorgan
jamesmorgan / erc-721-enhanced-metadata.json
Last active March 12, 2024 09:14
erc-721-enhanced-metadata.json
{
"title": "Asset Metadata",
"type": "object",
"properties": {
"name": {
"type": "string",
"description": "Identifies the asset to which this NFT represents",
},
"description": {
"type": "string",
contract Structs {
struct Shipment {
// Slot 1: 20 bytes packed with bool (1 byte)
address receiver;
bool delivered;
// Slot 2: uint 8 + uint128 = 1 slot
uint8 typeCode;
uint128 price; (Max size: 170141183460469231731687303715884105727)
contract Structs {
struct Shipment {
address receiver;
uint price;
bool delivered;
string package;
uint8 typeCode;
}
contract Sample {
uint256 a; // storage position 0
uint256[2] b; // storage position 1 & 2
// This is just declaration
struct TestStruct {
uint256 id;
uint256 value;
}
{
"title": "Asset Metadata",
"type": "object",
"properties": {
"name": {
"type": "string",
"description": "Identifies the asset to which this NFT represents",
},
"description": {
"type": "string",
pragma solidity ^0.6.0;
interface IERC2981 {
/// @notice Called with the sale price to determine how much royalty
// is owed and to whom.
/// @param _tokenId - the NFT asset queried for royalty information
/// @param _salePrice - the sale price of the NFT asset specified by _tokenId
/// @return receiver - address of who should be sent the royalty payment
/// @return royaltyAmount - the royalty payment amount for _salePrice
@jamesmorgan
jamesmorgan / transaction-handling.js
Last active September 29, 2019 11:02
transaction-handling.js
contract
.purchase(edition.edition, {
from: account,
value: priceInWei
})
.on('transactionHash', hash => {
console.log('Purchase transaction submitted', hash);
})
.on('receipt', receipt => {
console.log('Purchase successful - Ive been mined', receipt);
@jamesmorgan
jamesmorgan / metadata.json
Last active September 29, 2019 11:00
metadata example
{
"name": "Buzz",
"description": "Paper collage, using salvaged and original watercolour papers",
"image": "https://ipfs.infura.io/ipfs/QmWc6YHE815F8kExchG9kd2uSsv7ZF1iQNn23bt5iKC6K3/image",
"meta": "https://ipfs.infura.io/ipfs/QmWc6YHE815F8kExchG9kd2uSsv7ZF1iQNn23bt5iKC6K3/other"
}

Keybase proof

I hereby claim:

  • I am jamesmorgan on github.
  • I am jimbobbins (https://keybase.io/jimbobbins) on keybase.
  • I have a public key ASDJX-FTTS6FHG0_HJcGRAdgzch4rm2N1q_boL8en4HdGQo

To claim this, I am signing this object:

did:muport:QmYNX951337ofvFM8k5HSF9vg51H363bRpDtXvqJPSfRU5