Skip to content

Instantly share code, notes, and snippets.

View 2075's full-sized avatar

2075

View GitHub Profile
@2075
2075 / substrate-fixed-arithmetic.md
Last active March 2, 2022 14:15
Substrate and Fixed Point Arithmetic

Collection of reference material to do fixed point arithmetic on substrate based chains.

overview

How can I do math on floating point values in substrate runtime. As a simple example imagine I want to keep track of an interest rate in a decentralized finance application. I can prototype by using the percentage as an integer:

  let rate = 2;
  let dividend = capital * rate / 100;

But what if my interest rate is 2.5% or 2.4554%?

@2075
2075 / 1.43.0
Created January 15, 2022 08:17
{
"Address": "MultiAddress",
"LookupSource": "MultiAddress",
"AccountInfo": "AccountInfoWithDualRefCount",
"AccountInfoWithDualRefCount": {
"nonce": "Index",
"consumers": "RefCount",
"providers": "RefCount",
"data": "AccountData"
},
@2075
2075 / makefile
Created September 1, 2021 21:42
polkadot+kusama: create a local relaychain and parachain setup
# setup your node parameters here
ROOT_DIR = $(CURDIR)
RELAY_DIR = $(ROOT_DIR)/polkadot
RELAY_NAME = rococo-local
PARA_NAME = gamedao
PARA_DIR = $(ROOT_DIR)/$(PARA_NAME)-parachain
RES_DIR = $(ROOT_DIR)/resources
PARA_ID = 2075
# build all nodes and required configs and specs
@2075
2075 / jumpstart-zero-validator.md
Created August 5, 2021 13:36
download a zero network snapshot to feed into your validator
curl https://ipfs.io/ipfs/QmUF87tsWpG1HgwuuqKdBMB8hHjk57Ag5wVnPptL7uKmTN?filename=db.partaa && \
curl https://ipfs.io/ipfs/QmYHuEehCETAat3GV8MbxrmZ7DzjtoV1pabfSSmvSkNyyn?filename=db.partab && \
curl https://ipfs.io/ipfs/QmRHom4VZHzAiJcBe8F3hJBWecr8NWfzDcHSeqt6ZwNZ9L?filename=db.partac && \
curl https://ipfs.io/ipfs/QmZLBdDWMo9or8JqfwRqniFAaGm2UvoBcpj4nho4W8Lrqi?filename=db.partad && \
curl https://ipfs.io/ipfs/QmNzMHAbRrBYEb7TSzpwrB1sMHwTMngW2LLJtiH65Xhfsi?filename=db.partae && \
curl https://ipfs.io/ipfs/QmavxbmSzpcEA5KzR4LoLYJUVCAwceVJMEtbyuQwyLrwTR?filename=db.partaf && \
cat db.part* > db.tar.gz
@2075
2075 / w3f-marcobahn-bondingcurves.md
Last active August 2, 2021 12:55
W3F Open Grant — Generic Bonding Curves

W3F Open Grant Proposal

This document will be part of the terms and conditions of your agreement and therefore needs to contain all the required information about the project. Don't remove any of the mandatory parts presented in bold letters or as headlines! Lines starting with a > (such as this one) can be removed.

See the Open Grants Program Process on how to submit a proposal.

  • Project Name: Generic Bonding Curves
  • Team Name: ZERO.IO / GameDAO
  • Payment Address: DAI 0x5ae30612FC6CDA7190a5195cdA95107605450dF4
@2075
2075 / gist:775036b5311580b491d9472f93e5c012
Last active August 17, 2022 15:27
rebuild spotlight index on macos

Version A

sudo mdutil -E /

Version B

sudo mdutil -a -i off
sudo launchctl unload -w /System/Library/LaunchDaemons/com.apple.metadata.mds.plist`
sudo launchctl load -w /System/Library/LaunchDaemons/com.apple.metadata.mds.plist`
@2075
2075 / gist:5010099011e7454c3db08e36a53b7f37
Last active June 30, 2021 11:13
updated types for zero network 210511
{
  "Address": "MultiAddress",
  "LookupSource": "MultiAddress",
  
  "AccountInfo": "AccountInfoWithDualRefCount",
  "AccountInfoWithDualRefCount": {
    "nonce": "Index",
    "consumers": "RefCount",
    "providers": "RefCount",
@2075
2075 / gist:cba54cf36b2d6f135320ce4132fcc871
Last active June 30, 2021 11:24
ubuntu install kernel 5.10, 5.12 one liner, get nvidia drivers

Handle with care

5.10.0

mkdir -p /tmp/ && cd /tmp/ && \
  wget -c https://kernel.ubuntu.com/~kernel-ppa/mainline/v5.10/amd64/linux-headers-5.10.0-051000_5.10.0-051000.202012132330_all.deb && \
  wget -c https://kernel.ubuntu.com/~kernel-ppa/mainline/v5.10/amd64/linux-headers-5.10.0-051000-generic_5.10.0-051000.202012132330_amd64.deb && \
  wget -c https://kernel.ubuntu.com/~kernel-ppa/mainline/v5.10/amd64/linux-image-unsigned-5.10.0-051000-generic_5.10.0-051000.202012132330_amd64.deb && \
  wget -c https://kernel.ubuntu.com/~kernel-ppa/mainline/v5.10/amd64/linux-modules-5.10.0-051000-generic_5.10.0-051000.202012132330_amd64.deb && \
  sudo dpkg -i *.deb
@2075
2075 / run-a-zero-node.md
Last active February 2, 2021 13:44
quickly create a zero.io node for development from scratch

setup a node

  • this example assumes you are using e.g. ubuntu and is a simple and direct route.
  • if you want to use this in production you should take care of better security measures!

updates

sudo apt update

HAVEN/VISION

Ownership and Location for real world assets*

A consensus algorithm for mobile items

About HAVEN

HAVEN/VISION is an innovation company in personal item security. Across our services we implement and run various decentralised network structures on hardware and software level.

Network Topography

To enable services for endusers and business partners, we have decided to run a combination of centralised and decentralised network nodes to accomplish a shorter setup period leaving room for innovation and stable growth: