Skip to content

Instantly share code, notes, and snippets.

View graemecode's full-sized avatar
🎯
Focusing

Graeme graemecode

🎯
Focusing
View GitHub Profile
@graemecode
graemecode / ERC20Upgrader.sol
Created October 1, 2021 16:35
ERC20Upgrader.sol
// SPDX-License-Identifier: GPL-3.0-or-later
pragma solidity 0.8.6;
import {IERC20} from "../../external/interface/IERC20.sol";
/**
* @title ERC20Upgrader
* @author MirrorXYZ
* @notice This contract allows swapping a legacy ERC20 token for an upgraded one.
*/
//SPDX-License-Identifier: GPL-3.0-or-later
pragma solidity 0.6.8;
pragma experimental ABIEncoderV2;
import {ERC721} from "@openzeppelin/contracts/token/ERC721/ERC721.sol";
/**
* @title ZoraColdieAuctionReference
* @author Graeme (@strangechances) from MirrorXYZ
*
@graemecode
graemecode / Crowdfund.sol
Last active October 3, 2021 19:08
Crowdfunding NFTs with Zora
//SPDX-License-Identifier: GPL-3.0-or-later
pragma solidity 0.6.8;
pragma experimental ABIEncoderV2;
import {ERC20} from "@openzeppelin/contracts/token/ERC20/ERC20.sol";
import {
ReentrancyGuard
} from "@openzeppelin/contracts/utils/ReentrancyGuard.sol";
import {SafeMath} from "@openzeppelin/contracts/math/SafeMath.sol";
<html>
<style type="text/css">
#recent-avatars-container img {
width: 64px;
height: 64px;
margin: 5px;
}
#cropped-image-preview img {
border: 1px solid #ccc;
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="utf-8" />
<meta
name="viewport"
content="width=device-width, user-scalable=no, minimum-scale=1.0, maximum-scale=1.0"
/>
<script type="module">
window.process = { env: { NODE_ENV: "development" } };
export interface Entity {
id: string;
forSale: boolean,
price: number,
// A list of components
components: Component[],
}
export interface Component {
// STUB.
@graemecode
graemecode / returnERC721Collateral.js
Last active August 31, 2018 08:26
Part 4/4 in a series on collateralizing ERC721s for loans on Dharma Protocol
/*********************
* Setup Dharma.js *
*********************/
// Instantiate Dharma
const dharma = new Dharma();
/*****************
* Repay a Loan *
*****************/
@graemecode
graemecode / fillDebtOrder.js
Last active August 31, 2018 08:25
Part 3/4 in a series on collateralizing ERC721s for loans on Dharma Protocol
/*********************
* Setup Dharma.js *
*********************/
// Import Dharma from Dharma.js
import Dharma from "@dharmaprotocol/dharma.js";
// Import BigNumber.js version 5.0.0, for wrapping numbers before sending to blockchain.
import * as BigNumber from "bignumber.js";
// Instantiate Dharma
@graemecode
graemecode / createERC721DebtOrder.js
Last active August 31, 2018 08:25
Part 2/4 in a series on collateralizing ERC721s for loans on Dharma Protocol
/*********************
* Setup Dharma.js *
*********************/
// Import Dharma from Dharma.js
import Dharma from "@dharmaprotocol/dharma.js";
// Import BigNumber.js version 5.0.0, which we will use when posting numbers to the blockchain.
import * as BigNumber from "bignumber.js";
@graemecode
graemecode / mintERC721.js
Last active August 31, 2018 08:25
Part 1/4 in a series on collateralizing ERC721s for loans on Dharma Protocol
/********************
* Setup Dharma.js *
*******************/
// Instantiate Dharma
const dharma = new Dharma();
/********************
* Mint an ERC721 *
*******************/