struct LeafSize(u32);
struct ParentSize(u32);
struct NodeSize(u32);
impl LeafSize {
// returns None when leafs in (0, 1)
fn sibling(self, leafs: LeafSize) -> Option<LeafSize>;
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
use std::cell::RefCell; | |
use std::collections::HashMap; | |
use std::net::TcpStream; | |
use std::rc::Rc; | |
use std::sync::atomic::{AtomicUsize, Ordering}; | |
use std::sync::Arc; | |
use anyhow::Result; | |
use easy_parallel::Parallel; | |
use futures::channel::{mpsc, oneshot}; |
-- current validator state, in memory.
create table validator (
staking_address primary key,
bonded_coins btree_indexed,
voting_power = bonded_coins / 10000_0000,
validator_address unique_indexed,
council_node_info json,
proposer_stat int, -- or vote_stat
punishment json null,
1、Run the docker version of PostgreSQL 12
$ docker run --rm -p 5432:5432 -v /tmp:/data -e POSTGRES_USER=exchange -e POSTGRES_DB=exchange -e POSTGRES_PASSWORD=123456 postgres:12-alpine
2、Download the attached files to /tmp
3、Import the schema and data
$ docker exec -it $CONTAINER psql -U exchange exchange -f /data/t_order_schema.sql
$ docker exec -it $CONTAINER psql -U exchange exchange -f /data/t_order_data.sql
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
use std::fmt; | |
trait Listener where Self: Sized + fmt::Debug { | |
fn on_event(&self, obj: &TestObject<Self>, args: &str); | |
} | |
#[derive(Debug)] | |
struct TestObject<F> where F:Listener { | |
listener: F | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
{-# LANGUAGE GADTs, KindSignatures, DataKinds #-} | |
module Test where | |
data Test = | |
Test1 { test1 :: Int } | |
| Test2 { test2 :: Int } | |
data TestBranch = TTest1 | TTest2 | |
data Test' (a :: TestBranch) where | |
Test'1 :: { test'1 :: Int } -> Test' TTest1 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
from pyswagger import App, Security | |
from pyswagger.contrib.client.requests import Client | |
from pyswagger.primitives import Primitive, create_str, validate_str | |
from mnemonic import Mnemonic | |
def validate_hex_base16(obj, ret, val, ctx): | |
print('validate', val) | |
return val | |
prim = Primitive() |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
{"swagger":"2.0","info":{"version":"cardano-sl:1","title":"Cardano Wallet API","license":{"url":"https://raw.githubusercontent.com/input-output-hk/cardano-sl/develop/lib/LICENSE","name":"MIT"},"description":"This is the specification for the Cardano Wallet API, automatically generated as a [Swagger](https://swagger.io/) spec from the [Servant](http://haskell-servant.readthedocs.io/en/stable/) API of [Cardano](https://github.com/input-output-hk/cardano-sl).\n\nSoftware Version | Git Revision\n-------------------|-------------------\ncardano-sl:1 | c3a292fee627bc9e76bb5b4896df59471a4dbdc4\n\n> **Warning**: This version is currently a **BETA-release** which is still under testing before\n> its final stable release. Should you encounter any issues or have any remarks, please let us\n> know; your feedback is highly appreciated.\n\n\nGetting Started\n===============\n\nIn the following examples, we will use *curl* to illustrate request to an API running on the default port **8090**.\n\nPlease note that wallet web |