Skip to content

Instantly share code, notes, and snippets.

View zengzengzenghuy's full-sized avatar
:octocat:

zengzengzenghuy

:octocat:
  • Kuala Lumpur, Malaysia
View GitHub Profile
@zengzengzenghuy
zengzengzenghuy / TestHashiModule.sol
Created August 28, 2023 05:20
Deploy your own Hashi Module
// SPDX-License-Identifier: LGPL-3.0-only
pragma solidity ^0.8.17;
import {Yaru} from "../Yaru.sol";
import {Module, Enum} from "@gnosis.pm/zodiac/contracts/core/Module.sol";
contract TestHashiModule is Module {
event HashiModuleSetup(
address indexed initiator,
address indexed owner,
@zengzengzenghuy
zengzengzenghuy / IHashiReceiver.sol
Last active November 1, 2023 09:55
YahoMessageDispatcher
// SPDX-License-Identifier: LGPL-3.0-only
pragma solidity ^0.8.17;
interface IHashiExecutor {
function onMessage(bytes data, bytes32 messageId, uint256 fromChainId, address from);
}
@zengzengzenghuy
zengzengzenghuy / .deps...npm...@openzeppelin...contracts...utils...math...Math.sol
Created November 17, 2023 08:15
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.22+commit.4fc1097e.js&optimize=false&runs=200&gist=
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v5.0.0) (utils/math/Math.sol)
pragma solidity ^0.8.20;
/**
* @dev Standard math utilities missing in the Solidity language.
*/
library Math {
/**
@zengzengzenghuy
zengzengzenghuy / Merkle.sol
Last active November 17, 2023 16:38
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.22+commit.4fc1097e.js&optimize=false&runs=200&gist=
// taken here: https://github.com/maticnetwork/contracts/blob/main/contracts/common/lib/Merkle.sol
pragma solidity ^0.8.20;
library Merkle {
function checkMembership(
bytes32 leaf,
uint256 index,
bytes32 rootHash,
bytes memory proof
) internal pure returns (bool) {
const { Trie } = require("@ethereumjs/trie")
const { RLP } = require("@ethereumjs/rlp")
const { bufferToHex, toBuffer } = require("@ethereumjs/util")
// const { hexlify } = require("ethers")
import { isHexString } from "@ethereumjs/util"
import {
createWalletClient,
http,
Chain,
{
"@context": [
{
"@protected": true,
"@version": 1.1,
"id": "@id",
"type": "@type",
"EmploymentProof": {
"@context": {
"@propagate": true,
pragma solidity 0.5.10;
interface IValidatorSetAuRa {
function addPool(address, address) external returns(uint256);
function initialize(
address,
address,
address,
address[] calldata,
pragma solidity 0.5.10;
interface IValidatorSetAuRa {
function addPool(address, address) external returns(uint256);
function initialize(
address,
address,
address,
address[] calldata,
@zengzengzenghuy
zengzengzenghuy / index.ts
Last active September 25, 2024 08:36
Hyperbridge script
require("log-timestamp");
import { HyperClient, MessageStatusWithMeta } from "@polytope-labs/hyperclient";
import { config } from "dotenv";
import {
createPublicClient,
createWalletClient,
decodeFunctionData,
getContract,
http,