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
// See Mesc Reference for setup: https://github.com/paradigmxyz/mesc/tree/main/cli#reference | |
contract TestSetup is Test { | |
function fetchRpcUrlFromMesc(string memory networkName) internal returns (string memory url) { | |
string[] memory inputs = new string[](3); | |
inputs[0] = "mesc"; | |
inputs[1] = "url"; | |
inputs[2] = networkName; |
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.11; | |
import "forge-std/src/Test.sol"; | |
contract Counter { | |
uint256 value = 10; | |
event Incremented(uint256 _value); |
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
// Read more about this here: https://twitter.com/0xkarmacoma/status/1691251106561540097 | |
// SPDX-License-Identifier: Unlicense | |
pragma solidity ^0.8.15; | |
import "forge-std/Test.sol"; | |
contract SignedWadMathAsm { | |
function wadMul(int256 x, int256 y) public pure returns (int256 r) { | |
/// @solidity memory-safe-assembly |
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
#Credits: https://twitter.com/jtriley_eth/status/1653885929592090625 | |
#make directories (can be anything) | |
mkdir src out lib | |
# specify the 'src', 'out', and 'lib directories under | |
# [profile.default] | |
vim foundry.toml | |
# add 'forge-std module to 'lib' |
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 Ipfs = require("nano-ipfs-store"); | |
const ethers = require("ethers"); | |
const epnsAbi = require("../abis/epnsAbi.json"); | |
const daiAbi = require("../abis/daiAbi.json"); | |
const { EPNS_PROXY_ADDRESS, PROVIDER } = require("../constants"); | |
async function createChannel() { | |
const channelName = "News Channel"; |
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 Ipfs = require("nano-ipfs-store"); // Used to spin up local ipfs node | |
const ethers = require("ethers"); | |
const epnsAbi = require("../abis/epnsAbi.json"); | |
const { EPNS_PROXY_ADDRESS, PROVIDER } = require("../constants"); | |
async function newMessage(newsTitle, description) { | |
return await new Promise((resolve, reject) => { | |
const title = newsTitle; | |
const message = description; |
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 express = require("express"); | |
const moment = require("moment"); | |
const app = express(); | |
const PORT = process.env.PORT || 5000; | |
app.use(express.json()); | |
const MAX_ATTEMPTS = 3; // after which the account should be locked | |
const LOCK_WINDOW = 2; // in minutes |
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: UNLISCENSED | |
pragma solidity ^0.8.4; | |
interface IERC20 { | |
/** | |
* @dev returns the tokens owned by `account`. | |
*/ | |
function balanceOf(address account) external view returns (uint256); |
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
//Import dependencies | |
const bip32 = require('bip32') | |
const bip39 = require('bip39') | |
const bitcoin = require('bitcoinjs-lib') | |
//Define the network | |
const network = bitcoin.networks.bitcoin //use networks.testnet for testnet | |
// Derivation path | |
const path = `m/49'/0'/0'/0` // Use m/49'/1'/0'/0 for testnet |
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 express = require("express"); | |
const app = express(); // Initialize an express instance | |
const PORT = process.env.PORT || 5000; // Define the port | |
app.use(express.json()); | |
app.get("/", (req, res) => { // Health check endpoint (optional) | |
return res.json({ status: "Up and running" }); | |
}); |
NewerOlder