This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// NonFungibleTicket.cdc | |
// contract to manage unique tradeable tickets (based on Flow NFT standard) | |
// see: https://docs.onflow.org/cadence/tutorial/04-non-fungible-tokens/ | |
pub contract NonFungibleTicket { | |
// set up a couple events for key deposits/withdrawals | |
pub event Withdraw(id: UInt64, from: Address?) | |
pub event Deposit(id: UInt64, to: Address?) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
{ | |
"emulators": { | |
"default": { | |
"port": 3569, | |
"serviceAccount": "emulator-account" | |
} | |
}, | |
"contracts": { | |
"NonFungibleTicket": "./cadence/contracts/NonFungibleTicket.cdc" | |
}, |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import NonFungibleTicket from 0xf8d6e0586b0a20c7 | |
// This transaction allows the Minter account to mint an NFT | |
// and deposit it into its collection. | |
transaction { | |
// The reference to the collection that will be receiving the NFT | |
let receiverRef: &{NonFungibleTicket.NFTReceiver} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import NonFungibleTicket from 0xf8d6e0586b0a20c7 | |
pub fun main() : [UInt64] { | |
let acct1 = getAccount(0xf8d6e0586b0a20c7) | |
let capability1 = acct1.getCapability<&{NonFungibleTicket.NFTReceiver}>(/public/NFTReceiver) | |
let receiverRef1 = capability1.borrow() | |
?? panic("Could not borrow the receiver reference") | |
return receiverRef1.getIDs() |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import NonFungibleTicket from 0xf8d6e0586b0a20c7 | |
// This transaction configures a user's account | |
// to use the NFT contract by creating a new empty collection, | |
// storing it in their account storage, and publishing a capability | |
transaction { | |
prepare(acct: AuthAccount) { | |
// Create a new empty collection | |
let collection <- NonFungibleTicket.createEmptyCollection() |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import NonFungibleTicket from 0xf8d6e0586b0a20c7 | |
// This transaction transfers an NFT from one user's collection | |
// to another user's collection. | |
transaction { | |
// The field that will hold the NFT as it is being | |
// transferred to the other account | |
let transferToken: @NonFungibleTicket.NFT | |
let metadata: { String : String } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import React, { useState, useEffect } from "react"; | |
import * as fcl from "@onflow/fcl"; | |
import { Address } from "@onflow/types"; | |
import * as t from "@onflow/types" | |
const TokenData = () => { | |
const [user, setUser] = useState({loggedIn: null}) | |
useEffect(() => fcl.currentUser().subscribe(setUser), []) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
pragma solidity >=0.7.0 <0.9.0; | |
contract HeightValidation { | |
struct User { | |
uint userid; | |
uint height; | |
address validator; | |
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import config | |
import time | |
from web3 import Web3, HTTPProvider | |
import web3 | |
import json | |
contract_address = config.CONTRACT_ADDRESS | |
wallet_private_key = config.WALLET_PRIVATE_KEY | |
wallet_address = config.WALLET_ADDRESS |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
from sqlalchemy import Table, Column, String, Integer, MetaData, func | |
def users_table(db): | |
table = Table('users', MetaData(db), | |
Column('id', Integer, primary_key=True, nullable=False), | |
Column('name', String, nullable=False), | |
Column('email', String, nullable=False), | |
Column('address', String, nullable=False), | |
Column('age', Integer), |
OlderNewer