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 / index.js
Created October 22, 2024 13:39
Mock Oracle for Hashi
import { http, createWalletClient, parseAbiItem, publicActions } from "viem";
import { gnosisChiado, sepolia } from "viem/chains";
import { privateKeyToAccount } from "viem/accounts";
const main = async () => {
console.log("Start event listener");
// Configuration
const sourceChain = sepolia;
const destinationChain = gnosisChiado;
@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,
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,
{
"@context": [
{
"@protected": true,
"@version": 1.1,
"id": "@id",
"type": "@type",
"EmploymentProof": {
"@context": {
"@propagate": true,
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,
@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) {
@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 / 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);
}