Skip to content

Instantly share code, notes, and snippets.

View olegpetroveth's full-sized avatar

Oleg Petrov olegpetroveth

View GitHub Profile
@olegpetroveth
olegpetroveth / sop-pause-a-chain.md
Created January 18, 2026 14:13
SOP for disabling a chain

SOP: Temporarily Disable a Chain

Standard Operating Procedure for Node Operators to temporarily halt a specific chain integration.

Overview

If a Node Operator notices an issue with a specific chain (e.g., unusual behavior, potential exploit, sync issues, or external chain problems), it is recommended to pause the chain integration. This brings attention to the issue, prevents potential fund loss, and allows time for investigation.

{% hint style="warning" %} Even during chain halts, Node Operators should refrain from doxxing themselves. Staying pseudo-anonymous is critical to ensuring the network is impartial, neutral and resistant to capture.

@olegpetroveth
olegpetroveth / base64
Last active November 14, 2025 17:45
ZCash Payloads
cHNidP8BAIYFAACACienJrTQ1sIAAAAAAAAAAAF7kIYWQuvY6o/h3GLbeeIDyNEN+LdbYCGbiCshWMMOpQAAAAAA/////wJAS0wAAAAAABl2qRSUFqidZFfKTYjGRnZnsaROOV0WE4istlICAAAAAAAZdqkUUDCjBMlkz1XM/ehPWQp3PQY2Bb6IrAAAAAABASJiIk8AAAAAABl2qRRQMKMEyWTPVcz96E9ZCnc9BjYFvoisAAAA
@olegpetroveth
olegpetroveth / swapkitTransaction.ts
Created May 29, 2025 07:46
SwapKit Tracker Transaction types and stages
export enum TxnType {
approve = "approve", // token approve
claim = "claim", // claim rewards, claim tokens, etc.
deposit = "deposit", // msgDeposit and related cosmos operations, not deposit to vault or deposit contract name
lending = "lending", // lending operations
lp_action = "lp_action", // deposit to an evm pool, tc pool, etc.
native_contract_call = "native_contract_call", // native contract call
native_send = "native_send", // native send, msgSend, etc.
stake = "stake", // defi operations like $vthor and other types of staking
unstake = "unstake", // defi operations like $vthor and other types of unstaking
async function ({
sourceAddress,
destinationAddress,
sellAssetAmount,
buyAssetAmount,
// affiliateFee,
slipPercentage,
}: ProviderQuoteRequest): Promise<ProviderQuoteResponse> {
try {
// Check provider chain action enabled status
@olegpetroveth
olegpetroveth / chainflip_ccm_broadcast.ts
Created March 6, 2025 09:46
This can be used to broadcast a Chainflip signed payload and pay for gas using an EOA
import { ethers, Wallet } from "ethers";
// This can be used to broadcast a transaction stuck in Chainflip.
//
// One way this can happen is if a deposit channel's CCM payload has an insufficient gas limit.
// It can also happen if you transaction requires external state changes like an approval.
// Just run replace the privateKey and payload value and run `bun run ./script/chainflip/broadcast.ts` from root to broadcast the transaction
// `payload` can be found on CF's explorer swap page e.g. https://scan.chainflip.io/swaps/345692
const privateKey = "0x";
@olegpetroveth
olegpetroveth / ledgerSign.ts
Created August 19, 2024 20:07
Sample Ledger signature WIP
/* eslint-disable @typescript-eslint/no-unused-vars */
import * as fs from "fs";
import path from "path";
import type { LedgerMessageProtobuf } from "@thorswap/models";
import * as elliptic from "elliptic";
import forge from "node-forge";
import * as protobuf from "protobufjs";
import { env } from "./env.mjs";
syntax = "proto3";
package ledger_swap;
enum ExtraDataParsingMode {
NATIVE = 0;
EVM_CALLDATA = 1;
OP_RETURN = 2;
}
message NewTransactionResponse {
@olegpetroveth
olegpetroveth / warnings.ts
Created May 28, 2024 02:59
SwapKit API V1 WarningCodes
export interface IWarning {
warningCode: WarningCode;
warningMessage: string;
}
export enum WarningCode {
// transactional warnings
SwapAmountTooSmall = '1001',
LargeSwapAmount = '1002',
@olegpetroveth
olegpetroveth / swapKitClient.ts
Last active March 22, 2024 02:01
Up to date SwapKit Client example
import type { AssetValue, ConnectWalletParams, SwapKit } from "@swapkit/core";
import type { ThorchainProvider } from "@swapkit/thorchain";
import type { keystoreWallet } from "@swapkit/wallet-keystore";
import { SwapKitApi } from "@swapkit/api";
import { FeeOption } from "@swapkit/core";
import { Chain } from "@swapkit/types";
import { logger } from "@thorswap/logger";
type SupportedWallet = typeof keystoreWallet;
@olegpetroveth
olegpetroveth / txn_type.ts
Last active March 8, 2024 15:36
Tracker txn_type short list
export enum TransactionType {
SWAP_TC_TO_TC = 'SWAP:TC-TC',
SWAP_ETH_TO_TC = 'SWAP:ETH-TC',
SWAP_TC_TO_ETH = 'SWAP:TC-ETH',
SWAP_ETH_TO_ETH = 'SWAP:ETH-ETH',
SWAP_AVAX_TO_TC = 'SWAP:AVAX-TC',
SWAP_TC_TO_AVAX = 'SWAP:TC-AVAX',
SWAP_AVAX_TO_AVAX = 'SWAP:AVAX-AVAX',