Navigation Menu

Skip to content

Instantly share code, notes, and snippets.

View madhavanmalolan's full-sized avatar

Madhavan Malolan madhavanmalolan

View GitHub Profile
@madhavanmalolan
madhavanmalolan / contracts...troubleshoot.sol
Created March 22, 2023 00:41
Created using remix-ide: Realtime Ethereum Contract Compiler and Runtime. Load this file by pasting this gists URL or ID at https://remix.ethereum.org/#version=soljson-v0.8.18+commit.87f61d96.js&optimize=false&runs=200&gist=
// SPDX-License-Identifier: UNLICENSED
pragma solidity ^0.8.9;
// Uncomment this line to use console.log
import "hardhat/console.sol";
import "@openzeppelin/contracts/token/ERC20/ERC20.sol";
import "@openzeppelin/contracts/access/Ownable.sol";
// SPDX-License-Identifier: GPL-3.0
pragma solidity >=0.7.0 <0.9.0;
contract Benchmark {
mapping (uint => uint) onchainStorage;
mapping (uint => uint) params;
address bridge;
constructor(){
{
"name": "test-multisend-test",
"version": "0.1.0",
"private": true,
"dependencies": {
"@gnosis.pm/safe-core-sdk": "^2.3.2",
"@gnosis.pm/safe-core-sdk-types": "^1.4.0",
"@gnosis.pm/safe-ethers-lib": "^1.4.0",
"@gnosis.pm/safe-service-client": "^1.2.0",
"@testing-library/jest-dom": "^5.16.5",
import logo from './logo.svg';
import './App.css';
import { ethers } from "ethers";
import EthersAdapter from '@gnosis.pm/safe-ethers-lib'
import SafeServiceClient from '@gnosis.pm/safe-service-client'
import Safe, { SafeFactory } from '@gnosis.pm/safe-core-sdk'
import { SafeTransactionOptionalProps } from '@gnosis.pm/safe-core-sdk'
import { MetaTransactionData } from '@gnosis.pm/safe-core-sdk-types'
function App() {
import hashlib
from web3 import Web3
def bytes_to_u64_4(hex):
# to u64[4]
return [str(int(hex[i:i+16], 16)) for i in range(0,64, 16)]
def zokrates_sha3(hex):
hash = Web3.sha3(hexstr=hex).hex()[:64]
return bytes_to_u64_4(hash)
import "utils/casts/u64_to_bits" as unpack64
from "hashes/sha3/256bit" import sha3_256 as hash
import "utils/casts/u8_from_bits" as pack8
def bits_to_u8_array<N, P>(bool[N] bits) -> u8[P]:
assert(N == 8 * P)
u8[P] res = [0; P]
for u32 i in 0..P do
@madhavanmalolan
madhavanmalolan / contracts...meta.sol
Created March 30, 2022 05:14
Created using remix-ide: Realtime Ethereum Contract Compiler and Runtime. Load this file by pasting this gists URL or ID at https://remix.ethereum.org/#version=soljson-v0.8.7+commit.e28d00a7.js&optimize=false&runs=200&gist=
pragma solidity >=0.7.0 <0.9.0;
contract MetaTx {
event Executed(address relayer, address behalfOf);
function execute(address from, address to, uint value, uint gas, bytes memory data, bytes32 txHash, uint8 v, bytes32 r, bytes32 s) public returns(address){
address a = ecrecover(txHash, v,r,s);
emit Executed(msg.sender, a);
}
}
string[9] memory parts;
parts[0] = '<svg xmlns="http://www.w3.org/2000/svg" preserveAspectRatio="xMinYMin meet" viewBox="0 0 350 350"><style>.base { fill: white; font-family: serif; font-size: 14px; }</style><rect width="100%" height="100%" fill="black" /><text x="10" y="20" class="base">';
parts[1] = Strings.toString(1);
parts[2] = '</text><text x="10" y="40" class="base">';
parts[3] = "to";
parts[4] = '</text><text x="10" y="60" class="base">';
library Base64 {
bytes internal constant TABLE = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/";
/// @notice Encodes some bytes to the base64 representation
function encode(bytes memory data) internal pure returns (string memory) {
uint256 len = data.length;
if (len == 0) return "";
// multiply by 4/3 rounded up
uint256 encodedLen = 4 * ((len + 2) / 3);
import logo from './logo.svg';
import './App.css';
import React, { useState, useEffect } from 'react';
const SuperfluidSdk = require('@superfluid-finance/js-sdk');
const {Web3Provider} = require('@ethersproject/providers');
function App() {
const [subscribed, setSubscribed] = useState();
const init = async () => {