Skip to content

Instantly share code, notes, and snippets.

@mikekeke
mikekeke / calc.ts
Last active September 26, 2023 07:50
calculations
const base = 1200;
const total = 7100 + 1250 + 400 + 70.183;
const MihaR = base;
const Costya = base - 400;
const LyohaM = base - 70.183;
const Antoha = base;
const DimanK = base - 1250;
const DimanV = base;
const Me = base;
@mikekeke
mikekeke / radix.sql
Last active September 13, 2023 14:00
radix
with token_res_id as (select id
from entities
where address = ?),
current_state as (select entity_id,
max(from_state_version) as state
from entity_resource_aggregated_vaults_history,
token_res_id
where resource_entity_id = token_res_id.id
and from_state_version <= ? -- 3293441 -- 3297103
group by entity_id)
@mikekeke
mikekeke / promise-then.js
Created May 24, 2023 11:22
promise-then
async function deploy() {
contract.setContractHash("hash-2131266e1784f2f1bd9061f579f4a55ef04b40d1e11ad7dc12dd9597d3870f05");
provider.getActivePublicKey()
.then(pubKeyHex => {
console.log("PK hex: " + pubKeyHex);
const pubKey = CLPublicKey.fromHex(pubKeyHex);
const deploy = contract.callEntrypoint(
"counter_inc",
RuntimeArgs.fromMap({}),
diff --git a/tests/Cargo.lock b/tests/Cargo.lock
index 3feacfe..635bbcf 100644
--- a/tests/Cargo.lock
+++ b/tests/Cargo.lock
@@ -98,9 +98,9 @@ dependencies = [
[[package]]
name = "bumpalo"
-version = "3.12.2"
+version = "3.12.1"
@mikekeke
mikekeke / embedano-demo-snippets.md
Last active March 20, 2023 14:25
embedano-demo-snippets

Code snippets

Run Nix with flake

nix develop --extra-experimental-features 'flakes nix-command'

Links

@mikekeke
mikekeke / custodial-scrip-design.md
Last active February 6, 2023 16:01
seath design

Design with custodial script

The idea is that participants submit action UTXOs and then single "batcher" (as referred in some DEXes) runs those "actions" by submitting transactions that can spend state UTXO. The difference form existing batchers is that batcher - is leader picked among participants in trustless manner.

Step 1

Each participant builds and submits "action" transaction that creates UTXO at custodial script address.

flowchart LR
@mikekeke
mikekeke / const-foldmap-plc-err.md
Last active March 4, 2022 09:52
Const foldMap

GHC Core to PLC plugin: E042:Error: Unsupported feature: Kind: forall k. * -> k -> * Context: Compiling kind: forall k. * -> k -> * Context: Compiling type: Data.Functor.Const.Const () Context: Compiling expr: PlutusTx.Foldable.foldMap @ (Data.Functor.Const.Const ()) Context: Compiling expr: PlutusTx.Foldable.foldMap @ (Data.Functor.Const.Const ()) (PlutusTx.Foldable.$fFoldableConst @ ()) Context: Compiling expr: PlutusTx.Foldable.foldMap @ (Data.Functor.Const.Const ())

@mikekeke
mikekeke / PAB_setup.md
Last active January 25, 2023 17:43
PAB setup

Hosted PAB setup

This document describes how to prepare hosted PAB deployment from scratch that can operate on Alonzo purple testnet.

The following required to be run on host machine to use PAB with contracts in hosted scenario on testnet (for 2020-11-05 PAB Release):

  • Cardano node connected to Alonzo testnet
  • cardano wallet connected to node
  • chain-index connected to node
  • PAB executable connected to node, cardano-wallet and chain-index

Note: we are using somewhat more involved setup with a bit custom docker compose, and wallet and chain-index being built from sources, but there is ready to go node+wallet docker solution available

@mikekeke
mikekeke / bash_strict_mode.md
Created March 30, 2021 09:53 — forked from mohanpedala/bash_strict_mode.md
set -e, -u, -o pipefail explanation

set -e, -u, -o pipefail

The "set" lines These lines deliberately cause your script to fail. Wait, what? Believe me, this is a good thing. With these settings, certain common errors will cause the script to immediately fail, explicitly and loudly. Otherwise, you can get hidden bugs that are discovered only when they blow up in production.

set -euo pipefail is short for:

set -e
set -u