Skip to content

Instantly share code, notes, and snippets.

View larry0x's full-sized avatar
🇵🇹
PT

Larry larry0x

🇵🇹
PT
View GitHub Profile
@larry0x
larry0x / setup2.md
Last active December 21, 2022 01:07
Linux server setup

Linux server setup

Start from a freshly installed Ubuntu Server.

Install stuff

sudo apt update &&
sudo apt upgrade -y &&
sudo apt install aria2 build-essential cmake git jq libclang-dev libleveldb-dev liblz4-tool net-tools neofetch vim unzip -y &&
@larry0x
larry0x / osmosis-grants-dao.md
Last active January 3, 2023 23:32
[DRAFT] Osmosis Grants DAO proposal

[DRAFT] Replace Osmosis Grants Program (OGP) with Osmosis Grants DAO (OGD)

This is a very early-stage draft. All numerical values (e.g. that OGD is to consist of 100 members) are chosen without much thought, and are likely to be changed.

TL;DR

  • OGD is an on-chain committee of 100 members.
  • The DAO operates in terms, each lasting a quarter (3 months).
  • Prior to the beginning of each term, Osmosis L1 governance approves a budget for the DAO and deposits the funds to the DAO's smart contract. The budget includes funds to be dispensed as grants, compensations to the DAO members, legal costs, etc.
  • For each term, the DAO members are selected via an election by OSMO stakers.
package main
import (
"encoding/base64"
"encoding/json"
"fmt"
"time"
codectypes "github.com/cosmos/cosmos-sdk/codec/types"
sdk "github.com/cosmos/cosmos-sdk/types"
  1. Each validator is identified by an integer id, instead of by the operator address.

  2. The operator address and Tendermint consensus key associated with a validator can be changed.

  3. The operator uses the normal bech32 address prefix, not the valoper prefix.

  4. Provide a method for validators to voluntarily cease operation (instead of withdrawing min-self-bond.)

  5. Built-in LSD: when making a delegation, suppose the bond denom is uosmo, and validator id is 123, the delegator is issued a liquid token with the denom staked/uosmo/123 representing their shares in this validator.

#!/bin/zsh
set -e
# change this to your address!
delegator="mars1..."
append-msg() {
tx=$1
msgs=$(echo $tx | jq ".body.messages")
@larry0x
larry0x / .bashrc
Last active February 24, 2023 03:05
Set up a Ubuntu server
# ls
alias ls="ls -avhl --color=auto --group-directories-first"
# systemd
alias start="sudo systemctl start"
alias stop="sudo systemctl stop"
alias restart="sudo systemctl restart"
# ports
alias ports="netstat -tulpn | sort -t: -k2 -n"
ics title stage category author created modified
999
One Channel
draft
IBC/APP
Larry Engineer <[email protected]>
2023-03-02
2023-03-02

Set token creation fee to zero; introduce an alternative spam-prevention mechanism

Background

In Cosmos ecosystem there are two prevailing fungible token standards, the native token and the CW20. Osmosis is equipped with a “tokenfactory” module which allows anyone (human users or smart contracts) to mint native tokens. This is a much desired feature, as native token is superior than CW20 for many reasons which I will not cover here.

Given that Osmosis currently has a very low gas price, tokenfactory needs a mechanism to deter spamming, meaning an attacker creating a massive amount of new tokens that take up nodes’ storage space. It does this by charging a fee, currently set at 10 OSMO, whenever a new token is created. This is known as the denom_creation_fee in the code.

// This script generates a v1 TextProposal, that is, a v1 proposal with no
// message.
const mrc = 23;
const title = "Add WBTC/OSMO 14d vault tokens as a collateral asset in Mars Farm";
//------------------------------------------------------------------------------
const fs = require("fs");
# ---------------------------------- method 1 ----------------------------------
git clone https://github.com/cosmos/cosmos-sdk.git
git clone https://github.com/larry0x/simapp.git
cd cosmos-sdk
git checkout v0.47.2
git subtree split -P simapp -b split
cd ../simapp