Skip to content

Instantly share code, notes, and snippets.

View JhonatanHern's full-sized avatar
🎯
Focusing

Jhonatan JhonatanHern

🎯
Focusing
View GitHub Profile
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.9;
// IMPORTANT
// Use 0xf3bE1A4a47576208C1592Cc027087CE154B00672
// As the contract address. Don't deploy from scratch.
// To send the mint transaction use 10 Finney as value
import 'https://github.com/immutable/zkevm-contracts/blob/master/contracts/token/erc721/abstract/ImmutableERC721Base.sol';
// contracts/royalty-enforcement/RoyaltyAllowlist.sol
pragma solidity ^0.8.0;
import "@openzeppelin/contracts/token/ERC721/ERC721.sol";
import "@openzeppelin/contracts/access/Ownable.sol";
import "@openzeppelin/contracts/token/ERC20/IERC20.sol";
import "@openzeppelin/contracts/token/ERC20/utils/SafeERC20.sol";
contract MyNFT is ERC721, Ownable {
using SafeERC20 for IERC20;
// SPDX-License-Identifier: GPL-3.0
pragma solidity >=0.7.0 <0.9.0;
import "https://github.com/OpenZeppelin/openzeppelin-contracts/blob/master/contracts/token/ERC1155/ERC1155.sol";
import "https://github.com/OpenZeppelin/openzeppelin-contracts/blob/master/contracts/token/ERC20/utils/SafeERC20.sol";
import "https://github.com/OpenZeppelin/openzeppelin-contracts/blob/master/contracts/token/ERC20/IERC20.sol";
/// @title Open Edition NFT demo
/// @author Jhonatan Hernández
/// @notice You can use this contract for only the most basic simulation
import { ImmutableX, Config, ListTransfersResponse } from '@imtbl/core-sdk';
import { ethers } from 'ethers';
const client = new ImmutableX(Config.PRODUCTION);
// fetch all of the transactions where an address has received a specific token
const listTransfersOfAssetPerUser = async (user: string, tokenId: string) => {
let results: any[] = [],
transactionResult: ListTransfersResponse | undefined;
do {
const sleep = (milliseconds) => { return new Promise(resolve => setTimeout(resolve, milliseconds)) }
const waitUntilTransactionIsConfirmed = hash => new Promise(async (succ, err) => {
while(true) {
const transaction = await web3.eth.getTransactionReceipt(hash)
if (transaction) {
console.log('transaction status: ', transaction);
return (transaction.status ? succ : err)(transaction)
}
await sleep(1000) // 1 second
type retailClient = {
id: Number,
fName: String,
lName: String,
email: String,
phone: String,
instaTowClientId: Number,
retailVehicles: Number[],
}
@JhonatanHern
JhonatanHern / escrow3000.sol
Last active December 13, 2021 00:20
Fast escrow
// SPDX-License-Identifier: GPL-3.0
pragma solidity >=0.7.0 <0.9.0;
import "github.com/OpenZeppelin/openzeppelin-contracts/blob/master/contracts/token/ERC721/IERC721.sol";
import "github.com/OpenZeppelin/openzeppelin-contracts/blob/master/contracts/token/ERC721/IERC721Receiver.sol";
contract EscrowUWU is IERC721Receiver{
address private auctioncontract;
function setAuctionContract(address _auctioncontract) external{
require(auctioncontract == address(0));
[
{
"inputs": [
{
"internalType": "address",
"name": "_paymentToken",
"type": "address"
}
],
"stateMutability": "nonpayable",
import { Orchestrator, Config, InstallAgentsHapps } from '@holochain/tryorama'
// Set up a Conductor configuration using the handy `Conductor.config` helper.
// Read the docs for more on configuration.
const conductorConfig = Config.gen()
// Construct proper paths for your DNAs
const appDna = '../travol.dna.gz' // path.join(__dirname, 'todo_rename_dna.dna.gz')
// create an InstallAgentsHapps array with your DNAs to tell tryorama what
#!/usr/bin/env node
const { spawn } = require('child_process')
let holocServer = null,
reactServer = null,
holoData = '',
reacData = ''
process.chdir('frontend')
reactServer = spawn('npm',['start'])