Skip to content

Instantly share code, notes, and snippets.

@Lucas-Kohorst
Lucas-Kohorst / orca_swap_function.rs
Created July 27, 2023 13:59
Orca vs. Uniswap V3
fn perform_swap<'info>(
whirlpool: &Account<'info, Whirlpool>,
token_authority: &Signer<'info>,
token_owner_account_a: &Account<'info, TokenAccount>,
token_owner_account_b: &Account<'info, TokenAccount>,
token_vault_a: &Account<'info, TokenAccount>,
token_vault_b: &Account<'info, TokenAccount>,
token_program: &Program<'info, Token>,
amount_a: u64,
amount_b: u64,
This file has been truncated, but you can view the full file.
Jul 26 14:05:51 k1 systemd[1]: Starting kuutamod.service...
Jul 26 14:05:51 k1 kdf63jb73lz23f1yv01xmb3zybhwwxgp-neard-setup[174662]: + install -d -o neard -g neard /var/lib/neard
Jul 26 14:05:51 k1 kdf63jb73lz23f1yv01xmb3zybhwwxgp-neard-setup[174662]: + [[ ! -f /var/lib/neard/.finished ]]
Jul 26 14:05:51 k1 kdf63jb73lz23f1yv01xmb3zybhwwxgp-neard-setup[174662]: + runuser -u neard -g neard -- /nix/store/14kkvm3fc0zinxyks4mvycw4xlqjnf5d-neard-1.27.0/bin/neard --home /var/lib/neard init --chain-id=testnet --download-genesis
Jul 26 14:05:51 k1 runuser[174664]: pam_unix(runuser:session): session opened for user neard(uid=995) by (uid=0)
Jul 26 14:05:51 k1 kdf63jb73lz23f1yv01xmb3zybhwwxgp-neard-setup[174665]: 2022-07-26T18:05:51.430376Z INFO neard: version="1.27.0" build="nix:1.27.0" latest_protocol=54
Jul 26 14:05:51 k1 kdf63jb73lz23f1yv01xmb3zybhwwxgp-neard-setup[174665]: 2022-07-26T18:05:51.430550Z INFO near: Using key ed25519:6g6mKqSxtcubbTAkxUGbZ2YUvrBinvDuPPF8tqbdVPhE for node
Jul 26 14:05:51 k1 kdf63jb73lz2

Kuutamod Near Validator

Kuutamod is a distributed supervisor for neard that implements failover for NEAR validators

Following instructions on kuutamod/run.md

Running a localnet setup consists of

  • hivemind consists of
    • consul as the RAFT consensus layer
    • 3 seperate near localnet nodes to start the network
  • validator with metrics available at curl localhost:2233/metrics
@Lucas-Kohorst
Lucas-Kohorst / .vimrc
Created February 9, 2022 21:59
.vimrc
syntax on
syntax enable
filetype plugin indent on
set noerrorbells
set tabstop=2
set softtabstop=2
set expandtab
set shiftwidth=2
set smartindent
set nowrap
@Lucas-Kohorst
Lucas-Kohorst / Cargo.toml
Last active January 29, 2022 15:01
Function Signatures from ABI
[package]
name = "method_decode"
version = "0.1.0"
edition = "2021"
[dependencies]
dotenv = "0.15.0"
ethabi = "15.0.0"
hex = "0.4.3"
rustc-hex = "2.1.0"
@Lucas-Kohorst
Lucas-Kohorst / univ3Fees.py
Created August 1, 2021 20:28
Get fees, upper and lower price bounds for a uv3 position
## Thanks to https://twitter.com/JNP7771 for the script at https://playcode.io/780618/
## imports
import requests
import json
import pandas as pd
import math
from beautifultable import BeautifulTable
x96 = math.pow(2, 96)

Keybase proof

I hereby claim:

  • I am lucas-kohorst on github.
  • I am lucaskohorst (https://keybase.io/lucaskohorst) on keybase.
  • I have a public key ASA3pcrEoFnBSld3beA4_Bi4BwNj-KAQdWu7vI-6T5UZMAo

To claim this, I am signing this object:

@Lucas-Kohorst
Lucas-Kohorst / LList.java
Last active October 18, 2019 13:42
Intersection of nodes in linked lists
import java.util.List;
import java.util.ArrayList;
import java.util.Collections;
import java.util.Comparator;
public class LList {
/**
* Default Constructor
*/
public LList() {