This file contains hidden or 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
| ul>li*4 | |
| <!-- which becomes --> | |
| <ul> | |
| <li></li> | |
| <li></li> | |
| <li></li> | |
| <li></li> | |
| </ul> |
This file contains hidden or 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
| html>head+body>div.header+main+div.footer | |
| <!-- miracously turns into --> | |
| <html> | |
| <head></head> | |
| <body> | |
| <div class="header"></div> | |
| <main></main> | |
| <div class="footer"></div> | |
| </body> | |
| </html> |
This file contains hidden or 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
| [default] | |
| src = 'contracts' | |
| libs = ['lib', '../../node_modules'] | |
| cache_path = 'foundry-cache' | |
| out = 'foundry-out' | |
| solc_version = '0.8.15' |
This file contains hidden or 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
| interface IERC3754 { | |
| event Transfer(address indexed from, address indexed to, uint256 indexed tokenId); | |
| event Approval(address indexed owner, address indexed approved, uint256 indexed tokenId); | |
| event ApprovalForAll(address indexed owner, address indexed operator, bool approved); | |
| function balanceOf(address owner) external view returns (uint256); | |
| function ownerOf(uint256 tokenId) external view returns (address); | |
| function approve(address to, uint256 tokenId) external; | |
| function getApproved(uint256 tokenId) external view returns (address); | |
| function setApprovalForAll(address operator, bool approved) external; |
This file contains hidden or 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
| bytes32 public root = 0x11....; | |
| function checkValidity(bytes32[] calldata _merkleProof) public view returns (bool){ | |
| bytes32 leaf = keccak256(abi.encodePacked(msg.sender)); | |
| require(MerkleProof.verify(_merkleProof, root, leaf), "Incorrect proof"); | |
| return true; | |
| } |
This file contains hidden or 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: GPL-3.0 | |
| pragma solidity 0.8.0; | |
| import "@openzeppelin/contracts/utils/cryptography/MerkleProof.sol"; | |
| contract Merkle { | |
| // Functions and variables go here... | |
| } |
This file contains hidden or 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 leaf = keccak256('0x123') | |
| const proof = tree.getProof(leaf) | |
| console.log(tree.verify(proof, leaf, root)) //-> true |
This file contains hidden or 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 root = tree.getRoot().toString('hex') |
This file contains hidden or 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 tree = new MerkleTree(leaves, keccak256, {sortPairs: true}) |
This file contains hidden or 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 { MerkleTree } = require('merkletreejs') | |
| const keccak256 = require("keccak256") | |
| const leaves = ['0x789','0x456','0x123'].map(x => keccak256(x)) |
NewerOlder