Dank - The Internet Computer Decentralized Bank - A collection of Open Internet Services - Including the Cycles Token (XTC)

Related tags

Cryptography dank
Overview

Dank Logo

Dank - The Internet Computer Decentralized Bank

Dank is a collection of Open Internet Services for users and developers on the Internet Computer. In this repository, you will find the codebase for Dank's projects, including the canisters that provide these services.

Main Products

Cycles Token (XTC) - Alpha

The Cycles Token (XTC) is a cycles ledger canister that provides users with a “wrapped/tokenized” version of cycles (XTC) that can be held with just a Principal ID (no need for a Cycles Wallet), and that also includes all the same developer features and functions (calls) as the Cycles Wallet (built into the XTC token itself).

Each Cycles Token (XTC) is backed 1-to-1 with 1 Trillion Cycles (1 XTC = 1 Trillion Cycles), with cycles locked in the canister. Through the XTC canister users & developers can call/perform any traditional trade cycle actions (send, deposit, withdraw, etc.), as well as proxy canister calls funded by cycles in their XTC balance (create canister, proxy calls to canister methods, topping up cycles in calls).

Dank's Cycles Token (XTC) is an Alpha product and is in active development. During this testing/development period, the Dank core team will have control over the canister's upgradeability and the "stop/halt" feature to facilitate bug and security updates, prevent malicious acts, and grow the Main Dank Canister in features. When the project reaches a solid maturity level, it will transition towards a fully community-owned governance system.


License

Dank © Fleek LLC 2021 - License (GPL-3.0)

Comments
  • fix: add clippy to CI and resolve clippy lints

    fix: add clippy to CI and resolve clippy lints

    Adds clippy to the CI workflow for dank. Resolves all clippy lints as well.

    Notable changes:

    • I added #![allow(dead_code)] to xtc to get the lints to pass for the PR, I don't know enough about the project to know if the structs should be re-exported or the modules made public to resolve the dead code lints.
    opened by ambeeeeee 9
  • [WIP] Add transaction fee

    [WIP] Add transaction fee

    This PR adds a constant transaction fee of 2B cycles for every transaction, keeps track of total volume of captured fees and handles the upgrade logic required for deployment.

    opened by qti3e 6
  • NFT-Draft

    NFT-Draft

    no proper support for NFT metadata until the standard changes no support for account identifier no support for history no support for allowances no fees no tests extensions method missing contains some inefficient copying/missing inline attributes... warnings suppressed

    opened by ferencdg 3
  • Adding overflow/underflow protection in release mode

    Adding overflow/underflow protection in release mode

    In release build we will now have runtime checks whether integers overflow or underflow. By doing so, one of the most common smart contract security weaknesses are prevented.

    issue: Guard against overflows on balances [ch23813]

    opened by ferencdg 2
  • fix(xtc): update history record schema to include from in call/create

    fix(xtc): update history record schema to include from in call/create

    The canister create and canister call functions now record the xtc balance that was used to fund the call under the history transaction. The candid has been updated to reflect the change.

    The from property has been added to the CanisterCalled and CanisterCreated history record schemas. It is the principal id of the balance the call was paid from.

        CanisterCalled : record {
            from : principal;
            canister : principal;
            method_name: text;
        };
        CanisterCreated : record {
            from : principal;
            canister : principal;
        };
    

    TODO

    • [x] Update candid formats
    • [x] Update code to save to those formats
    • [x] Add upgrade code, that corrects for missing information in the transaction history

    Clubhouse

    [23578] XTC history records for CanisterCreated and CanisterCalled are missing the from address

    Testing

    To manually test, first start the local dfx environement and deploy:

    dfx start
    
    # in a different tab
    dfx deploy
    

    Then run through xtc setup and make two example calls, checking the output of get_transaction now has from entries.

    
    xtcID=$(dfx canister id xtc)  
    walletId=rwlgt-iiaaa-aaaaa-aaaaa-cai
    
    # Transfer cycles to dank under your account
    dfx canister call piggy-bank perform_mint "(record { canister= principal \"$xtcID\"; account=null; cycles=1000000 })"
    
    # Perform a proxy call (send cycles to your deployed wallet)
    dfx canister call xtc wallet_call "(record { canister= principal \"$walletId\"; method_name= \"wallet_receive\"; args= blob \"DIDL\01nh\01\00\00\"; cycles= (1000:nat64); })"
    
    dfx canister call xtc get_transaction "(1)"
    
    # Expecting a transaction for CanisterCalled with a from as your principal id
    
    # (
    #   opt record {
    #     fee = 0 : nat64;
    #     kind = variant {
    #       CanisterCalled = record {
    #         from = principal "mwp5g-agwxm-genl7-rh5gi-4nbla-e5mn5-6bkj4-3ellr-qlq4m-npwsx-sae";
    #         method_name = "wallet_receive";
    #         canister = principal "rwlgt-iiaaa-aaaaa-aaaaa-cai";
    #       }
    #     };
    #     cycles = 1_000 : nat64;
    #     timestamp = 1_628_775_471_350 : nat64;
    #   },
    # )
    
    # Create an empty canister
    dfx canister --no-wallet call xtc wallet_create_canister "(record {cycles= (999_000:nat64); controller= (null); })"
    
    dfx canister call xtc get_transaction "(2)"
    
    # Expecting
    
    # (
    #   opt record {
    #     fee = 0 : nat64;
    #     kind = variant {
    #       CanisterCreated = record {
    #         from = principal "mwp5g-agwxm-genl7-rh5gi-4nbla-e5mn5-6bkj4-3ellr-qlq4m-npwsx-sae";
    #         canister = principal "rkp4c-7iaaa-aaaaa-aaaca-cai";
    #       }
    #     };
    #     cycles = 999_000 : nat64;
    #     timestamp = 1_628_775_791_145 : nat64;
    #   },
    # )
    
    opened by kanej 2
  • feat(meta.rs): rename `dank` to `Cycles`

    feat(meta.rs): rename `dank` to `Cycles`

    This change is confirmed by Harrison.

    It will change the name as returned from the name function against the canister as well, as that is populated from metadata.

    So:

    dfx canister --network=ic call xtc name
    # (opt "Cycles")
    
    opened by kanej 2
  • release: IC-Token support stage 1

    release: IC-Token support stage 1

    This release adds functionality that will allow us to support https://github.com/dfinance-tech/ic-token

    This will be a two stage process, with the old functions being retained but deprecated, while temporary new methods are added. In a future release, the final version of the IC-Token methods will be added, and the intermediary versions marked as deprecated.

    opened by kanej 1
  • Type mismatch in XTC mint function Result

    Type mismatch in XTC mint function Result

    Hello, There's a mismatch in theTxReceipt of the mint function between the candid and the rust implementation In Rust it's Nat and in candid it's Nat64

    candid

    type MintResult = variant {
        Ok : TransactionId;
        Err: MintError;
    };
    type TransactionId = nat64;
    

    https://github.com/Psychedelic/dank/blob/965e3dfea7788ed71078849b864d030f547cc215/candid/xtc.did#L59

    Rust implementation

    pub type TxReceipt = Result<Nat, TxError>;
    

    https://github.com/Psychedelic/dank/blob/f80e1e419029cd6d4e8df3069694df226c731784/xtc/src/ledger.rs#L310

    opened by tarek-eg 1
  • Example code typo at /xtc/README.md

    Example code typo at /xtc/README.md

    A commend line typo which causes bash returns an error $ dfx canister --network=ic --wallet=$(dfx identity --network=ic get-wallet) call --with-cycles AMOUNT aanaa-xaaaa-aaaah-aaeiq-cai mint "(principal \"Some-Principal-ID\",0:nat")" Should be $ dfx canister --network=ic --wallet=$(dfx identity --network=ic get-wallet) call --with-cycles AMOUNT aanaa-xaaaa-aaaah-aaeiq-cai mint "(principal \"Some-Principal-ID\",0:nat)"

    opened by KevinTroyT 0
  • WICP was not sent from PlugWallet to Stoic

    WICP was not sent from PlugWallet to Stoic

    Hello, I sent a WICP from Plug to Stoic but it didn't arrive (https://dashboard.internetcomputer.org/account/33d8485170a0b7fb16314db89e44c53edbdd402d4d25f665d90228611140a364).

    I don't see it on either the starting wallet or the destination one. I don't even see it among the transactions on https://dashboard.internetcomputer.org/account/b1aea4232927d66fe69800627f006722a891335328c064fa89e3c4276be8469d

    It only shows up in the list of transactions in the Plug wallet Chrome plugin. Can you help me?

    opened by kom1n 0
  • XTC is not compatible with DIP20

    XTC is not compatible with DIP20

    DIP20 has errors defined like this

    pub enum Dip20TxError {
        InsufficientAllowance,
        InsufficientBalance,
        ErrorOperationStyle,
        Unauthorized,
        LedgerTrap,
        ErrorTo,
        Other,
        BlockUsed,
        AmountTooSmall,
    }
    

    While XTC's errors are defined like this

    pub enum TxError {
        InsufficientAllowance,
        InsufficientBalance,
        ErrorOperationStyle,
        Unauthorized,
        LedgerTrap,
        ErrorTo,
        Other,
        BlockUsed,
        FetchRateFailed,
        NotifyDfxFailed,
        UnexpectedCyclesResponse,
        AmountTooSmall,
        InsufficientXTCFee,
    }
    

    As you can see, XTC has more enum entries. When trying to use DIP20 types against XTC canister and bump into an error, one would get an error message like:

    The Replica returned an error: code 5, message: "Canister knhk5-cyaaa-aaaak-aagoq-cai trapped explicitly: Custom(Fail to decode argument 0 from table0 to variant {
      Ok : nat;
      Err : variant {
        InsufficientAllowance;
        InsufficientBalance;
        ErrorOperationStyle;
        Unauthorized;
        LedgerTrap;
        ErrorTo;
        Other;
        BlockUsed;
        AmountTooSmall;
      };
    }
    
    Caused by:
        0: input: 4449444c026b02bc8a017dc5fed201016b0dea99f1497fb5da9aa3037fffcc9bc5057fb9d6c894067fa2dab8d7077fd292d883087fd4b4c59a097fd6e89efe097fc3feeeba0b7fb0ad8fcd0c7ff7c295940e7f8afcbca80f7fabb7cef40f7f0100_00dbb301
           table: type table0 = variant { 17_724 : nat; 3_456_837 : table1 }
           type table1 = variant {
             154_946_794;
             879_144_245;
             1_487_332_991;
             1_653_746_489;
             2_062_429_474;
             2_155_219_282;
             2_471_582_292;
             2_680_665_174;
             3_076_243_267;
             3_382_957_744;
             3_800_392_055;
             4_111_416_842;
             4_271_086_507;
           }
           wire_type: table0, expect_type: variant {
             Ok : nat;
             Err : variant {
               InsufficientAllowance;
               InsufficientBalance;
               ErrorOperationStyle;
               Unauthorized;
               LedgerTrap;
               ErrorTo;
               Other;
               BlockUsed;
               AmountTooSmall;
             };
           }
        1: table0 is not a subtype of variant {
             Ok : nat;
             Err : variant {
               InsufficientAllowance;
               InsufficientBalance;
               ErrorOperationStyle;
               Unauthorized;
               LedgerTrap;
               ErrorTo;
               Other;
               BlockUsed;
               AmountTooSmall;
             };
           }
        2: Variant field 3_456_837: table1 is not a subtype of variant {
             InsufficientAllowance;
             InsufficientBalance;
             ErrorOperationStyle;
             Unauthorized;
             LedgerTrap;
             ErrorTo;
             Other;
             BlockUsed;
             AmountTooSmall;
           }
        3: Variant field 154_946_794 not found in the expected type)"
    

    Please, make them compatible. Otherwise, what's the point of the standard?

    opened by seniorjoinu 2
Owner
Psychedelic
Decentralized venture studio focused on building products on the Internet Computer.
Psychedelic
DIP721 - An Internet Computer Non-fungible Token Standard

DIP721 - Introduction DIP721 is an ERC-721 style non-fungible token standard built mirroring its Ethereum counterpart and adapting it to the Internet

Psychedelic 48 Nov 24, 2022
All the data an IC app needs to make seamless experiences, accessible directly on the IC. DAB is an open internet service for NFT, Token, Canister, and Dapp registries.

DAB ?? Overview An Internet Computer open internet service for data. All the data an IC app needs to make a seamless experience, accessible directly o

Psychedelic 58 Oct 6, 2022
Demo: Connect Phala's Fat Contract to external storage services, both centralized (Amazon s3) and decentralized .

This demo shows how to connect Phala's Fat Contract to external storage services, both centralized (Amazon s3) and decentralized (Arweave/Filecoin thr

Christopher Fok 2 Aug 30, 2022
Yi Token by Crate Protocol: the primitive for auto-compounding single token staking pools.

yi Yi Token by Crate Protocol: the primitive for auto-compounding single token staking pools. About Yi is a Solana primitive for building single-sided

Crate Protocol 12 Apr 7, 2022
Source project for the Internet Computer software

The Internet Computer is the world’s first blockchain that runs at web speed and can increase its capacity without bound. Like the Internet (which is composed of many machines adhering to TCP/IP protocol) and blockchain protocols (such as Bitcoin and Ethereum).

DFINITY 1.2k Jan 1, 2023
Terabethia - A Bridge and Messaging Protocol between Ethereum and the Internet Computer.

Terabethia - A Bridge Between Ethereum & the Internet Computer Terabethia is a bridge between Ethereum & the Internet Computer that contracts in both

Psychedelic 36 Dec 26, 2022
A preview of the integration between Bitcoin and the Internet Computer.

Bitcoin Integration Developer Preview Overview The integration between the Internet Computer and Bitcoin will enable developers to build canisters tha

DFINITY 39 Sep 21, 2022
Rust library for build smart contracts on Internet Computer, by the Spinner.Cash team.

Spinner Rust library for building smart contracts on the Internet Computer. More specifically it is used by Spinner.Cash, a decentralized layer-2 prot

Spinner 6 May 31, 2022
A demo of the Internet Computer's Bitcoin API

Bitcoin Integration Demo A demo of the bitcoin endpoints on the Internet Computer. This demo is already deployed to the IC, so you can already try it

Islam El-Ashi 8 Jul 2, 2022
Simple PoC to issue JSON Web Tokens (JWTs) with a canister on the Internet Computer.

JWT Issuer Proof of Concept Overview Simple PoC to issue JSON Web Tokens (JWTs) with a canister on the Internet Computer. It allows the issuance of tw

Dominic Wörner 7 Oct 13, 2022
[Open Source] Blockchain Decentralized Lightweight VPN in Rust

[Open Source] Blockchain Decentralized Lightweight VPN in Rust DCVPN_Rust (Decentralized VPN in Rust) is an open-source initiative started by @anandgo

Anand Gokul 29 Jun 2, 2023
Crates - A collection of open source Rust crates from iqlusion

iqlusion crates ?? This repository contains a set of Apache 2.0-licensed packages (a.k.a. "crates") for the Rust programming language, contributed to

iqlusion 335 Dec 26, 2022
A contract to lock fungible tokens with a given vesting schedule including cliffs.

Fungible Token Lockup contract Features A reusable lockup contract for a select fungible token. Lockup schedule can be set as a list of checkpoints wi

null 15 Dec 16, 2022
🎙️ Catalyst Voices provides a unified experience and platform including production-ready liquid democracy

??️ Catalyst Voices provides a unified experience and platform including production-ready liquid democracy, meaningful collaboration opportunities & data-driven context for better onboarding & decisions.

Input Output 6 Oct 11, 2023
Open Protocol Indexer, OPI, is the best-in-slot open-source indexing client for meta-protocols on Bitcoin.

OPI - Open Protocol Indexer Open Protocol Indexer, OPI, is the best-in-slot open-source indexing client for meta-protocols on Bitcoin. OPI uses a fork

Best in Slot 33 Dec 16, 2023
A program on solana blockchain to provide escrow services.

Environment Setup Install Rust from https://rustup.rs/ Install Solana from https://docs.solana.com/cli/install-solana-cli-tools#use-solanas-install-to

null 0 Dec 24, 2021
Narrowlink securely connects devices and services together, even when both nodes are behind separate NAT

Narrowlink Narrowlink is a self-hosted platform that allows you to establish secure remote connections between devices within a network that may be hi

Narrowlink 355 Aug 17, 2023
Microunit is a decentralized unit orchestration framework.

Microunit is a decentralized unit orchestration framework.

Engula 13 Oct 10, 2021
cashio is a decentralized stablecoin made for the people, by the people.

cashio is a decentralized stablecoin made for the people, by the people. We're in active development. For the latest updates, please join our c

Cashio App 42 Sep 29, 2022