Giter Site home page Giter Site logo

documentation's Introduction

Cygnus Tool: Adding Canisters

The Cygnus Tool provides users with three different implementation types for adding canisters:

  1. Cygnus Library: Import Cygnus code into your Canister using one of the following programming languages:

    In addition, you can view a list of controllers and withdraw cycles from this type of canister.

  2. Blackhole Canister: This option grants access to an immutable canister.

    Similar to the Cygnus Library, you can view a list of controllers for the Blackhole Canister. However, withdrawing cycles is not possible.

  3. Available Cycles (Public method): This method exposes the availableCycles function in your code, commonly used in ext NFT token standards. An example implementation is provided below:

    public query func availableCycles() : async Nat {	
    	return Cycles.balance();
    };

    You can also whitelist the following PrincipalId to restrict access and only Cygnys can retrieve the cycles data.

CYGNUS_CANISTER_ID: "dowzh-nyaaa-aaaai-qnowq-cai"

For this type of canister, controllers and the ability to withdraw cycles are not visible.

There are two ways to add a canister to the Cygnus Tool:

  1. Using the Front-End Tool: Utilize the front-end tool provided.

  2. Using Cygnus Candid File: Add the canister using the Cygnus candid file.

    An example is provided below in Motoko:

    public shared(msg) func registerCanister() : async Text {

        let CYGNUS_CANISTER_ID = "dowzh-nyaaa-aaaai-qnowq-cai";
        type implementationType = {
                #AvailableCycles;
                #BlackholeCanister;
                #CygnusLibrary;
		#SnsCanister;
            };

        let CygnusCanitser = actor (CYGNUS_CANISTER_ID) : actor {
                            registerProjectCanister : shared (
                                {
                                    projectId : Text;
                                    canisterIdToBeRegistered : Text;
                                    canisterName : Text;
                                    implementationType : implementationType;
                                    topUpAmountInTrillon: ?Float;
                                    thresholdAmountInTrillon:?Float;
                                })-> async (Text);
        };

        await CygnusCanitser.registerProjectCanister({
            projectId = "upr_0E5CHK7ZYP4XRTK807VFSZCQTH";
            canisterIdToBeRegistered = "r75rh-rqaaa-aaaah-qctda-cai";
            canisterName = "Eleos";
            implementationType = #AvailableCycles;
            topUpAmountInTrillon = ?15.0;
            thresholdAmountInTrillon = ?5.0;
        });
    };

//if you do not pass topUpAmountInTrillon and thresholdAmountInTrillon values, we set the default values to 4.00T and 1.00T respectfully. 

Please note that in the registerProjectCanister function, you need to provide the appropriate values for projectId, canisterId, canisterName, and implementationType to register the desired canister.

documentation's People

Contributors

sagcryptoicp avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.