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
| // why use deposit tokens to get the balance? | |
| function depositTokens(uint256 amount) external nonReentrant { | |
| require(amount > 0, "Must deposit at least one token"); | |
| // Transfer token from sender. Sender must have first approved them. | |
| damnValuableToken.transferFrom(msg.sender, address(this), amount); | |
| poolBalance = poolBalance + amount; | |
| } |
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
| subscribe(topic) { | |
| this.web3.on(topic, async (txnHash) => { | |
| setTimeout(async () => { | |
| try { | |
| const txn = await this.web3.getTransaction(txnHash); | |
| if (txn !== null && txn.to !== null) { | |
| if (this.accounts === txn.from.toLowerCase()) { | |
| // dumps the data onto the CLI | |
| console.log({ | |
| address: txn.from, |
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
| const { ethers } = require("ethers"); | |
| require("dotenv").config(); | |
| class TxnChecker { | |
| web3 = null; | |
| accounts = null; | |
| subscription = null; | |
| constructor(projectId, account) { | |
| console.log(account); |
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
| // SPDX-License-Identifier: MIT | |
| pragma solidity ^0.8.7; | |
| /// @title A simple contract named MerkleTrie | |
| /// @author 0xAnon101 | |
| /// @notice Shows you the functioning of Merkle Trie. Not meant to be used in Production environment | |
| /// due to high gas cost in this demo methodology. It is here just to understand the underlining | |
| /// structure of Merkle Trie. | |
| /// @dev Implementaion using custom string based array which includes sample transactions. | |
| contract MerkleTrie { |
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 { log, ipfs, json, JSONValue } from "@graphprotocol/graph-ts"; | |
| import { | |
| Transfer as TransferEvent, | |
| baycToken as BaycTokenContract, | |
| } from "../generated/baycToken/baycToken"; | |
| import { BoredApeToken, BoredApeUser } from "../generated/schema"; | |
| export function handleTransfer(event: TransferEvent): void { | |
| /** | |
| * load ipfs of bayc |
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
| # fulltext query: searchable keywords | |
| type _Schema_ | |
| @fulltext( | |
| name: "apeFilter" | |
| language: en | |
| algorithm: rank | |
| include: [ | |
| { | |
| entity: "BoredApeToken" | |
| fields: [{ name: "eyes" }, { name: "background" }] |
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
| specVersion: 0.0.5 | |
| schema: | |
| file: ./schema.graphql | |
| features: | |
| - fullTextSearch | |
| - ipfsOnEthereumContracts | |
| dataSources: | |
| - kind: ethereum | |
| name: baycToken | |
| network: mainnet |
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
| const Registration = artifacts.require("Registration"); | |
| const fs = require('fs'); | |
| const path = '/../src/metaData.js'; // need to create src folder first | |
| module.exports = async function (deployer) { | |
| await deployer.deploy(Registration); | |
| const instance = await Registration.deployed(); | |
| fs.writeFile( | |
| __dirname + path, |
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
| // SPDX-License-Identifier: GPL-3.0 | |
| pragma solidity >=0.5.0 <0.9.0; | |
| import "github/OpenZeppelin/openzeppelin-contracts/contracts/math/SafeMath.sol"; | |
| contract Scoin { | |
| using SafeMath for uint256; | |
| address public minter; | |
| mapping (address => uint256) public balances; |
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
| // SPDX-License-Identifier: GPL-3.0 | |
| pragma solidity >=0.4.22 <0.7.0; | |
| contract Address { | |
| // address addressA = 0x111122223333444455556666777788889999AAAABBBBCCCCDDDDEEEEFFFFCCCC; notimplicity convertible | |
| address addressA; | |
| function compressAddressSize() external pure returns(address ) { |