Skip to content

Instantly share code, notes, and snippets.

Avatar

Ravindra Naik naik899

View GitHub Profile
@naik899
naik899 / Staking.sol
Created Mar 24, 2022
Spock Staking contract
View Staking.sol
pragma solidity ^0.8;
import "@openzeppelin/contracts/token/ERC20/IERC20.sol";
contract StakingRewards {
IERC20 public rewardsToken;
IERC20 public stakingToken;
uint public rewardRate = 100;
uint public lastUpdateTime;
@naik899
naik899 / marketplace.sol
Created Mar 11, 2022
Quark marketplace
View marketplace.sol
pragma solidity ^0.8.0;
import "hardhat/console.sol";
import "@openzeppelin/contracts/token/ERC721/ERC721.sol";
import "@openzeppelin/contracts/token/ERC721/IERC721Receiver.sol";
contract NFTMarketplace {
@naik899
naik899 / LazyMintingNFT.sol
Created Feb 27, 2022
Lazy minting contract
View LazyMintingNFT.sol
//SPDX-License-Identifier: Unlicense
pragma solidity ^0.8.0;
pragma experimental ABIEncoderV2;
import "hardhat/console.sol";
import "@openzeppelin/contracts/access/AccessControl.sol";
import "@openzeppelin/contracts/token/ERC721/ERC721.sol";
import "@openzeppelin/contracts/token/ERC721/extensions/ERC721URIStorage.sol";
import "@openzeppelin/contracts/utils/cryptography/ECDSA.sol";
import "@openzeppelin/contracts/utils/cryptography/draft-EIP712.sol";
View LazyMinter.js
const ethers = require('ethers')
// These constants must match the ones used in the smart contract.
const SIGNING_DOMAIN_NAME = "QuarkNFT-Voucher"
const SIGNING_DOMAIN_VERSION = "1"
/**
* JSDoc typedefs.
*
* @typedef {object} NFTVoucher
@naik899
naik899 / calendar.sol
Last active Feb 10, 2022
365daysOfWeb
View calendar.sol
// SPDX-License-Identifier: MIT
//tuple(uint256,string)[]: 0,https://gateway.pinata.cloud/ipfs/QmUM2jvm9Ya795JoQMMc652tZgPiygPwfPrUpDmqbN4d6K
//Floor Price: 1000000000000000000
pragma solidity ^0.8.4;
import "@openzeppelin/contracts/token/ERC721/extensions/ERC721URIStorage.sol";
import "@openzeppelin/contracts/token/ERC721/ERC721.sol";
import "@openzeppelin/contracts/access/Ownable.sol";
import "@openzeppelin/contracts/utils/Counters.sol";
import "@openzeppelin/contracts/security/ReentrancyGuard.sol";
View SpockToken.sol
// contracts/SpockToken.sol
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.0;
import "@openzeppelin/contracts/token/ERC20/ERC20.sol";
contract SpockToken is ERC20 {
address owner;
address multiSig;
@naik899
naik899 / spockproxy.sol
Last active Jun 15, 2022
Spock Proxy Contract
View spockproxy.sol
// contracts/SpockProxy.sol
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.0;
import "@openzeppelin/contracts/token/ERC20/ERC20.sol";
import "@openzeppelin/contracts/token/ERC721/extensions/ERC721URIStorage.sol";
import "@openzeppelin/contracts/utils/Counters.sol";
contract SpockProxy {
@naik899
naik899 / ERC721.sol
Created Jan 8, 2022
ERC 721 Mint and Whitelist
View ERC721.sol
// contracts/Leaf_NFT.sol
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.0;
import "@openzeppelin/contracts/token/ERC721/ERC721.sol";
import "@openzeppelin/contracts/access/Ownable.sol";
import "@openzeppelin/contracts/utils/Counters.sol";
contract LeafNft is ERC721, Ownable {
using Counters for Counters.Counter;
View nearwallet.txt
const fetchTokens = createAsyncThunk(
${SLICE_NAME}/fetchTokens,
async ({ accountId }, thunkAPI) => {
const { dispatch, getState } = thunkAPI;
const likelyContracts = [...new Set([...(await FungibleTokens.getLikelyTokenContracts({ accountId })), ...WHITELISTED_CONTRACTS])];
await Promise.all(likelyContracts.map(async contractName => {
const { actions: { setContractMetadata } } = tokensSlice;
try {
View increment.txt
import { storage, logging } from "near-sdk-as";
// --- contract code goes below
export function incrementCounter(value: i32): void {
const newCounter = storage.getPrimitive<i32>("counter", 0) + value;
storage.set<i32>("counter", newCounter);
logging.log("Counter is now: " + newCounter.toString());
}