Skip to content

Instantly share code, notes, and snippets.

View pradyuman-verma's full-sized avatar
❄️
Living in Web3

prady pradyuman-verma

❄️
Living in Web3
View GitHub Profile
// SPDX-License-Identifier: WTFPL
pragma solidity ^0.8.0;
// Simple order-based exchange for selling ERC20 tokens in exchange for ETH. Orders are stored off-chain and signed by the sellers.
// Buyers submit the order to execute to the contract, along with the seller's signature and the ETH to purchase the tokens.
// Orders can be EXACT or PARTIAL. Exact orders need to be fulfilled in a single operation, whereas partial orders can be fulfilled in multiple purchases from multiple buyers.
// Orders can also optionally define a referrer address, who will receive 1% of the value in ETH of the purchase. Can be used to reward the app that stores the orders off-chain.
// Does not allocate a fee if set to the zero address.
// ==========================
@pradyuman-verma
pradyuman-verma / evm-puzzle.yul
Last active April 13, 2023 10:27
evm-puzzle-007: RULES - 1. The puzzle has more than one solution | 2. All the values should be non zero | 3. You need to hack it such a way it satisfies every calldata passed.
GASPRICE
CALLDATASIZE
CALLVALUE
PUSH2 0x3E8
PUSH0
CALLDATALOAD
PUSH1 0xf4
SHR
MUL
PUSH0
// SPDX-License-Identifier: WTF
pragma solidity ^0.8.0;
interface IERC20 {
function balanceOf(address account) external view returns (uint256);
function transfer(address to, uint256 amount) external returns (bool);
function allowance(address owner, address spender)
external
[
{
"market": "0xc3d688B66703497DAA19211EEdff47f25384cdc3",
"marketName": "USDC",
"key": "usdc",
"baseToken": {
"key": "usdc",
"type": "token",
"symbol": "USDC",
"name": "USD Coin",
[
{
"market": "0xc3d688B66703497DAA19211EEdff47f25384cdc3",
"marketName": "USDC",
"key": "usdc",
"totalSupplyInBase": "77.497297179140780653",
"totalBorrowInBase": "0",
"totalSupplyInUsd": "77.497297179140780653",
"totalBorrowInUsd": "0",
"netBaseBalance": "0",
//SPDX-License-Identifier: Unlicense
pragma solidity ^0.8.0;
interface ListInterface {
function accountID(address) external returns (uint64);
}
contract InstaEventManager {
ListInterface internal immutable instalist;
@pradyuman-verma
pradyuman-verma / sob21.md
Created May 24, 2022 20:25
Regtest Playground - Performing a Double-Spent and Chain Reorg in bcoin !

In the previous blog, we are done with setting up our bcoin node in regtest mode. In this blog, we will try to play more in this regtest mode and try performing chain reorganisation, and Double-spent attacks.

So, the first question that arises is what the regtest mode is?

Regtest mode

Bitcoin Core provides testing tools designed to let developers test their applications with reduced risks and limitations. One of the modes is the regtest.

Regtest (regression test) mode creates a local private blockchain where you can adjust the parameters to what you want. You usually use this when it is not needed to communicate with other peers and blocks. An example of what you can do with the parameters is created blocks instantly, and you have complete control over the environment.

@pradyuman-verma
pradyuman-verma / bcoin.md
Created May 24, 2022 20:30
Getting started with Bcoin (JavaScript Implementation of Full Node)

In this article, we will walk through "how to install and run a full node of Bitcoin using Bcoin."

We will create a wallet, send some coins and mine some blocks in regtest mode. So, let's start.

Introduction

The Bitcoin blockchain is designed as a decentralised P2P network where nobody owns or controls Bitcoin, and everyone can participate. A full node is a program that fully validates transactions and blocks. By running a Bitcoin full node, you are supporting the Bitcoin network to become more decentralised and fostering the growth of Bitcoin.

What is Bcoin?

@pradyuman-verma
pradyuman-verma / push-to-someone-elses-pr.md
Created March 23, 2022 09:15 — forked from wtbarnes/push-to-someone-elses-pr.md
Brief instructions for how to modify and push to someone else's PR on github

How to Push to Someone Else's Pull Request

Let's say contributor has submitted a pull request to your (author) project (repo). They have made changes on their branch feature and have proposed to merge this into origin/master, where

origin -> https://github.com/author/repo.git

Now say you would like to make commits to their PR and push those changes. First, add their fork as a remote called

@pradyuman-verma
pradyuman-verma / FlashLoan.md
Last active December 13, 2021 08:02
FlashLoan

This gist will explain how you can use the dsa-connect Flashloan feature.

I will be using this code.

/**
This code is from the Instadapp terminal, so there is no need to import node modules.
*/

// Connect your metamask account. It will be rendered as USER_ADDRESS