Skip to content

Instantly share code, notes, and snippets.

View nonkung51's full-sized avatar

Nonthakon Jitchiranant nonkung51

  • Bangkok, Thailand
View GitHub Profile
@nonkung51
nonkung51 / CCIPTokenAndDataReceiver.sol
Created December 13, 2023 14:28
NEAR BOS X Chainlink CCIP: The Workshop
// SPDX-License-Identifier: MIT
pragma solidity 0.8.20;
import "@openzeppelin/contracts/token/ERC721/extensions/ERC721URIStorage.sol";
import {CCIPReceiver} from "@chainlink/contracts-ccip/src/v0.8/ccip/applications/CCIPReceiver.sol";
import {Client} from "@chainlink/contracts-ccip/src/v0.8/ccip/libraries/Client.sol";
contract MyNFT is ERC721URIStorage {
string constant TOKEN_URI =
"https://ipfs.io/ipfs/QmYuKY45Aq87LeL1R5dhb1hqHLp6ZFbJaCP8jxqKM1MX6y/babe_ruth_1.json";
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.20;
import "@openzeppelin/contracts/token/ERC721/ERC721.sol";
import "@openzeppelin/contracts/token/ERC721/extensions/ERC721URIStorage.sol";
import "@openzeppelin/contracts/utils/Base64.sol";
contract ChainlinkNFT is ERC721URIStorage {
using Strings for uint256;
Tax Cer Logic:
TaxCer_Flow_In_Enquiry / TaxCer_Flow_Out_Enquiry
เธ„เธธเธ“เธ•เน‰เธญเธ‡เธเธฒเธฃเธ‚เธญเธซเธ™เธฑเธ‡เธชเธทเธญเธฃเธฑเธšเธฃเธญเธ‡เธเธฒเธฃเธŠเธณเธฃเธฐเน€เธšเธตเน‰เธข เนƒเธŠเนˆเธซเธฃเธทเธญเน„เธกเนˆเธ„เธฐ
// Handle by Dialogflow
if caller answer in variation of โ€œYesโ€:
intent = TaxCer_Flow_In_Year_Request / TaxCer_Flow_Out_Year_Request
else:
// Handle by Backend logic
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.20;
import "@openzeppelin/contracts/token/ERC721/ERC721.sol";
import "@openzeppelin/contracts/token/ERC721/extensions/ERC721URIStorage.sol";
import "@openzeppelin/contracts/utils/Base64.sol";
contract ChainlinkNFT is ERC721URIStorage {
using Strings for uint256;
{"name":"Exploring Lens Protocol","children":[{"name":"MockProfileCreatorProxy","children":[{"lock":false,"address":"{{MOCK_PROFILE_CREATOR_PROXY}}","name":"proxyCreateProfile","abi":{"inputs":[{"components":[{"internalType":"address","name":"to","type":"address"},{"internalType":"string","name":"handle","type":"string"},{"internalType":"string","name":"imageURI","type":"string"},{"internalType":"address","name":"followModule","type":"address"},{"internalType":"bytes","name":"followModuleInitData","type":"bytes"},{"internalType":"string","name":"followNFTURI","type":"string"}],"internalType":"struct DataTypes.CreateProfileData","name":"vars","type":"tuple"}],"name":"proxyCreateProfile","outputs":[],"stateMutability":"nonpayable","type":"function"},"params":[[]]}],"lock":false},{"name":"LensHub","children":[{"lock":true,"address":"{{LENS_HUB}}","name":"whitelistReferenceModule","abi":{"inputs":[{"internalType":"address","name":"referenceModule","type":"address"},{"internalType":"bool","name":"whitelist","type"
// Unlike Solmate, we're going to try to detect what went wrong
// and return a more meaningful error. There are a few different
// cases here:
//
// - Bubble up the original error message if we have enough gas
// - Return an error indicating a bad return value
// - Return an error indicating that the contract has no code
// - Return a generic error message
// If the transfer failed or it returned nothing:
contract Seaport {
function _performERC20Transfer(
address token,
address from,
address to,
uint256 amount
) internal {
// Utilize assembly to perform an optimized ERC20 token transfer.
assembly {
// We require the Hardhat Runtime Environment explicitly here. This is optional
// but useful for running the script in a standalone fashion through `node <script>`.
//
// When running the script with `npx hardhat run <script>` you'll find the Hardhat
// Runtime Environment's members available in the global scope.
const hre = require("hardhat");
async function main() {
// Hardhat always runs the compile task when running scripts with its command
// line interface.
require("@nomiclabs/hardhat-waffle");
require("hardhat-laika"); // << this line
// This is a sample Hardhat task. To learn how to create your own go to
// https://hardhat.org/guides/create-task.html
task("accounts", "Prints the list of accounts", async (taskArgs, hre) => {
const accounts = await hre.ethers.getSigners();
for (const account of accounts) {
console.log(account.address);
import { extendEnvironment } from "hardhat/config";
import laikaSync from "./tasks/laika-sync";
import "./tasks/laika-sync";
import "./type-extensions";
extendEnvironment((hre) => {
hre.laikaSync = laikaSync;
});