This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
async function ({ | |
sourceAddress, | |
destinationAddress, | |
sellAssetAmount, | |
buyAssetAmount, | |
// affiliateFee, | |
slipPercentage, | |
}: ProviderQuoteRequest): Promise<ProviderQuoteResponse> { | |
try { | |
// Check provider chain action enabled status |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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"; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/* 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"; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
syntax = "proto3"; | |
package ledger_swap; | |
enum ExtraDataParsingMode { | |
NATIVE = 0; | |
EVM_CALLDATA = 1; | |
OP_RETURN = 2; | |
} | |
message NewTransactionResponse { |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
export interface IWarning { | |
warningCode: WarningCode; | |
warningMessage: string; | |
} | |
export enum WarningCode { | |
// transactional warnings | |
SwapAmountTooSmall = '1001', | |
LargeSwapAmount = '1002', |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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', |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// SPDX-License-Identifier: MIT | |
pragma solidity ^0.8.17; | |
// I don't recommend anyone deploy or use this contract. | |
// This is not tested, not reviewed and certainly not audited. | |
import {Owners} from "../../lib/Owners.sol"; | |
import {ReentrancyGuard} from "../../lib/ReentrancyGuard.sol"; | |
import {SafeTransferLib} from "../../lib/SafeTransferLib.sol"; | |
import {IThorchainRouterV4} from "../../interfaces/IThorchainRouterV4.sol"; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// SPDX-License-Identifier: MIT | |
pragma solidity 0.8.17; | |
import { IERC20 } from './interfaces/IERC20.sol'; | |
import { Owners } from "./Owners.sol"; | |
contract TSDistributor is Owners { | |
address public walletA; | |
address public walletB; | |
uint16 public shareA; |
NewerOlder