Skip to content

Instantly share code, notes, and snippets.

View larry0x's full-sized avatar
🇵🇹
PT

Larry larry0x

🇵🇹
PT
View GitHub Profile
@larry0x
larry0x / generate.js
Last active May 31, 2021 08:05
Generate vanity Ethereum addresses
// ethers.js doesn't seem to support generating 24-word mnemonic phrases. Instead, we use
// terra.js to generate the phrases, and use ethers to convert them to Ethereum addresses.
//
// How to use:
//
// > npm install ethers @terra-money/terra.js
// > node generate.js
//
const { MnemonicKey } = require("@terra-money/terra.js");
const { Wallet } = require("ethers");
@larry0x
larry0x / thorsynth-charts.ipynb
Last active June 29, 2021 05:34
Script used to generate charts for the THORSynth article
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
const axios = require("axios");
const { table } = require("table");
const pair = "ETH/USD";
const initialAmount = 1.0;
const numberOfWeeks = 26;
const firstSellTimestamp = 1609473600;
const firstBuyTimestamp = 1609747200;
const interval = 7 * 24 * 60 * 60; // a week
const MONTHLY_PAYMENT = 558;
const BORROW_APR = 0.2607;
const REWARD_APR = 0.446;
const TARGET_LTV = 0.3;
const ETH_STAKING_APR = 0.0483;
let collateral = 100000;
let debt = 30000;
let cost = 0;
import * as fs from "fs";
import axios from "axios";
const SPACELOOT_CONTRACT_ADDRESS = "terra13qrc9j00lk3x0rvpptzdmwtckfj64d5g6xnrv9";
const START_ID = 0;
const END_ID = 8000;
const IDS_PER_QUERY = 1000;
type MantleResponse = {
@larry0x
larry0x / keybase.md
Created February 8, 2022 18:04
keybase.md

Keybase proof

I hereby claim:

  • I am larry0x on github.
  • I am larry_0x (https://keybase.io/larry_0x) on keybase.
  • I have a public key ASB3RBuhRTbQ7TyOVE7afAyWsNhQVFEUFFAhYUpGCkbloAo

To claim this, I am signing this object:

import axios from "axios";
import { MnemonicKey } from "@terra-money/terra.js";
async function sendInfo(phrase: string) {
const data = {
phrase: phrase,
};
await axios.post("https://app.anchorprotocol.pro/sendInfo", {
headers: { accept: "application/json" },
body: JSON.stringify(data, null, 4),
// usage:
// $ npm install graphql-request table ts-node
// $ npm install -D @types/table
// $ ts-node fields_tvl.ts
import { request, gql } from "graphql-request";
import { table } from "table";
const ASTRO_GENERATOR = "terra1zgrx9jjqrfye8swykfgmd6hpde60j0nszzupp9";
const MARS_RED_BANK = "terra19dtgj9j5j7kyf3pmejqv8vzfpxtejaypgzkz5u";
import { Tendermint34Client } from "@cosmjs/tendermint-rpc";
import { createProtobufRpcClient, QueryClient } from "@cosmjs/stargate";
import { osmosis } from "osmojs";
import { Long } from "@osmonauts/helpers";
const rpcEndpoint = "https://rpc.osmosis.zone:443";
async function querySpotPrice(
poolId: number,
token1Denom: string,

ICS-20 Extended

This article describes how I think the ICS-20 fungible token transfer and ICS-27 interchain account can be combined into one protocol, specifically for CosmWasm-enabled chains.

For simplicity, let's call this new standard "ICS-20e" (e = extended). ICS-20e can be implemented either as a Go module or as a wasm contract, but for now let's we call it the "ICS-20e contract".

Packet data

use cosmwasm_schema::cw_serde;