Skip to content

Instantly share code, notes, and snippets.

// SPDX-License-Identifier: MIT
pragma solidity ^0.8.0;
import "./proxy/Proxiable.sol";
import "@openzeppelin/contracts/access/Ownable.sol";
import "@openzeppelin/contracts/token/ERC20/IERC20.sol";
import "@openzeppelin/contracts/utils/Counters.sol";
import "@openzeppelin/contracts/utils/math/SafeMath.sol";
contract SurveysV2 {
contract BidderTwo {
 uint256 highestBid;
 address currentHighestBidder;
 mapping(address => uint) bidBalances;
function bid() external payable {
 require(msg.value > highestBid, "Bid higher");
 bidBalances[msg.sender] += msg.value;
 highestBid = msg.value;
 currentHighestBidder = msg.sender;
 }
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.7;
contract Bidder {
 uint256 highestBid;
 address currentHighestBidder;
function bid() external payable {
 require(msg.value > highestBid, "Bid higher");
 require(payable(currentHighestBidder).transfer(highestBid)); // ensure the bid is sent back, else revert the transaction
 highestBid = msg.value;
 currentHighestBidder = msg.sender;
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.0;
contract rejectContracts {
function isContract(address account) public view returns (bool) {
 uint256 size;
 assembly {
 size := extcodesize(account)
 }
 return size > 0;
 }
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.0;
contract rejectContracts {
function isContract(address account) public view returns (bool) {
 uint256 size;
 assembly {
 size := extcodesize(account)
 }
 return size > 0;
@Jesserc
Jesserc / axios.js
Created October 31, 2022 22:31 — forked from apow2/axios.js
use axios to get data from IPFS
import axios from "axios";
let myContract;
let init = async () => {
await ethStore.setProvider("https://api.avax-test.network/ext/bc/C/rpc");
await ethStore.setBrowserProvider();
let contract = await new $web3.eth.Contract(abi, contractAddress);
if ($chainId != 43113) {
alert("Warning: You are not connected to Avalanche Fuji test-net!");
}
require("@nomiclabs/hardhat-waffle");
require("@nomiclabs/hardhat-ethers");
// 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 () => {
const accounts = await ethers.getSigners();
for (const account of accounts) {
console.log(account.address);
@Jesserc
Jesserc / demo.js
Created September 6, 2022 16:00 — forked from okeken/JS File
let animal = {
name:"cat",
type:"mammal",
color:"black",
class:'carnivorous',
gender:'female',
legs:{
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.0;
import "@openzeppelin/contracts/token/ERC20/IERC20.sol";
contract Swapper{
struct Order{
address ofSwaper;
// SPDX-License-Identifier: UNLICENSED
pragma solidity ^0.8.0;
contract MultiSig {
///A contract that allows 70% of validSigner to Approve before a withdrawal can be succesful
address[] validSigner;
uint256 ID = 1;
uint256 public Quorum = 3;
//maping of trnsaction Id to number of approval to status