Skip to content

Instantly share code, notes, and snippets.

@zh
zh / marketplace.sol
Created March 4, 2022 15:38 — forked from dabit3/marketplace.sol
NFT Marketplace Smart Contract (V2)
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.4;
import "@openzeppelin/contracts/utils/Counters.sol";
import "@openzeppelin/contracts/token/ERC721/extensions/ERC721URIStorage.sol";
import "@openzeppelin/contracts/token/ERC721/ERC721.sol";
import "hardhat/console.sol";
contract NFTMarketplace is ERC721URIStorage {
@zh
zh / refresh.js
Created February 20, 2022 12:49
refresh with events
const setEventHandlers = () => {
if (!contract || !currentAccount) {
return;
}
console.log('add event contract handlers');
try {
contract.on('DomainMinted', async () => {
console.log('event: domain minted');
await fetchMints();
});
@zh
zh / blockchain_services.md
Last active January 5, 2022 16:02
Services on different blockchains
$ yarn deploy --network amber
yarn run v1.22.11
$ yarn workspace @liquity/lib-ethers hardhat deploy --network amber
$ hardhat deploy --network amber
Deploying contracts...
Deploying ActivePool ...
Waiting for transaction 0x7364195aca947c50db58ad9b4bd44eda6fd99efdd4e91a5ae6fc2fbf2beef0e5 ...
{
contractAddress: '0x3666d38578C26A2228Fc54860aC35D5DDA9A7054',
@zh
zh / 3box auth
Created November 11, 2021 03:43
did:3:kjzl6cwe1jw148l2vtave512ut9938ysphzjaogyzi6bzddb189sqoalolwwahp
@zh
zh / verified_contract.sol
Last active November 4, 2021 09:43
verified open source woocommerce contract
/**
*Submitted for verification at Etherscan.io on 2018-04-28
*/
pragma solidity ^0.4.18;
/**
* @title SafeMath
* @dev Math operations with safety checks that throw on error
*/
@zh
zh / open_contract.v.py
Last active November 4, 2021 10:29
open source woocommerce contract
#
# Panoramix v4 Oct 2019
# Decompiled source of 0x3E0371bcb61283c036A48274AbDe0Ab3DA107a50
#
# Let's make the world open source
#
def storage:
owner is addr at storage 0
feeAccount1 is addr at storage 1
@zh
zh / contract.v.py
Last active November 4, 2021 10:28
woocommerce closed source contract (decompiled)
#
# Panoramix v4 Oct 2019
# Decompiled source of 0xd0E4e3A739A454386DA9957432b170C006327B0d
#
# Let's make the world open source
#
def storage:
owner is addr at storage 0
stor1 is mapping of uint8 at storage 1
did:3:kjzl6cwe1jw145xl4u7b4pwb5q5cosr1uypr0o5vhp2fquze0mjfu6slapwlioz
/**
* Base contract that all upgradeable contracts should use.
*
* Contracts implementing this interface are all called using delegatecall from
* a dispatcher. As a result, the _sizes and _dest variables are shared with the
* dispatcher contract, which allows the called contract to update these at will.
*
* _sizes is a map of function signatures to return value sizes. Due to EVM
* limitations, these need to be populated by the target contract, so the
* dispatcher knows how many bytes of data to return from called functions.