- We start from the bottom, approach the middle become large and then again become narrow down going to the top.
- That means, I do not study the docs or try to get the larger picture about the protocol in the beginning.I completely avoid that.
This file contains 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.20; | |
// chosen to use an initializer instead of a constructor | |
import { OwnableUpgradeable } from "@openzeppelin/contracts-upgradeable/access/OwnableUpgradeable.sol"; | |
// chosen not to use Solady because EIP-2612 is not needed | |
import { | |
ERC20Upgradeable, | |
IERC20, | |
IERC20Metadata |
This file contains 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
pragma solidity 0.8.23; | |
import {EIP712} from "openzeppelin-contracts/utils/cryptography/EIP712.sol"; | |
import {ECDSA} from "openzeppelin-contracts/utils/cryptography/ECDSA.sol"; | |
contract Swap is EIP712 { | |
constructor() EIP712("Hand 2 Hand Exchange", "1") {} | |
struct Data { | |
IERC721 nft; |
This file contains 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: UNLICENSED | |
pragma solidity ^0.8.17; | |
import {MerkleProof} from "openzeppelin-contracts/utils/cryptography/MerkleProof.sol"; | |
// install murky with: `forge install dmfxyz/murky --no-commit ` | |
import {Strings2} from "murky/differential_testing/test/utils/Strings2.sol"; | |
import {Strings} from "openzeppelin-contracts/utils/Strings.sol"; | |
import "forge-std/Test.sol"; |
This file contains 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
/** | |
* | |
* @param {ethers.Wallet} wallet | |
* @param {ethers.BigNumber} chainId | |
* @param {string} verifyingContract | |
* @returns {string} full signature | |
* | |
* rewards is an object: { | |
id: ethers.BigNumber, | |
amount: ethers.BigNumber, |
This file contains 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
// consider our struct to be: | |
/** | |
struct TaskReward { | |
uint256 igoId; | |
Tier tier; | |
address rewardee; | |
uint256 taskId; | |
} | |
*/ |
This file contains 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'); | |
/** | |
* @notice Path to where your .env file is. If the .env is at the root of your project, | |
* you can simply write `require('dotenv').config()` | |
*/ | |
require('dotenv').config({ path: '../../.env' }); | |
async function main() { | |
// instanciation can also be done using a private key | |
const wallet = new ethers.Wallet.fromMnemonic(process.env.SEED); |
This file contains 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
require("dotenv").config(); | |
const { EthersEthereum } = require("@rarible/ethers-ethereum"); | |
const fetch = (...args) => | |
import("node-fetch").then(({ default: fetch }) => fetch(...args)); | |
global.FormData = require("form-data"); | |
global.window = { | |
fetch: fetch, | |
dispatchEvent: () => {}, | |
}; |
This file contains 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
{"lastUpload":"2021-01-02T01:32:22.133Z","extensionVersion":"v3.4.3"} |