Giter Site home page Giter Site logo

fluxus's Introduction

Fluxus

Capstone Demo

Devnet Address - 4XvNtZ1Z9GZ5YyZDJaAxC5TSFGHx1McbL5G2YphGQ1EG

Overview:

Fluxus is a decentralized finance (DeFi) protocol built on the Solana blockchain. It enables users to create and participate in token streams, where tokens can be gradually released over time to a recipient(s). These streams can be used for a variety of purposes, such as salary payments, crowdfunding, or regular payments for services.

Users can interact with the protocol using the Fluxus SDK or can perform CPIs to the Fluxus Program or Frontend which provides an easy-to-use interface for creating, managing, and participating in token streams.

Getting Started:

  1. Fluxus SDK

Install the Fluxus SDK from NPM or from GitHub

using npm:

npm i fluxus-sdk

using yarn

yarn install fluxus-sdk

Creating fluxus with FluxusWithWallet Class on Node Environment using Keypair.

const connection = new Connection("http://localhost:8899");
const wallet = new Wallet(payer); // payer: Keypair
const fluxus = new FluxusWithWallet(connection, payer);

Creating fluxus with Fluxus Class on Browser Environment using Wallet Adapter

const fluxus = new Fluxus(connection as Connection);

API References:

  1. Constant Flux
  • Provides a steady stream of funds over a specified period.
  • Offers flexibility to both payers and payees.
  • Reduces the need for manual transaction processing.
  • Ensures consistent cash flow.
  • There are 3 functions create, claim and cancel.

Create Constant Flux

// with wallet: makes sure the transaction is send to network and returns signature.
const { signature } = await fluxus.createConstantFluxWithWallet(
  authority: PublicKey,  // sender
  mint: PublicKey,       // SPL Token Mint
  receiver: PublicKey,   // recipient
  fluxId: string,        // unique identifier per user
  amount: number,        // amount to stream
  decimals: number,      // decimals of SPL Mint
  days: number           // number of days to stream
);
// with adapter: returns transaction
const { transaction } = await fluxus.createConstantFlux(
  authority: PublicKey,  // sender
  mint: PublicKey,       // SPL Token Mint
  receiver: PublicKey,   // recipient
  fluxId: string,        // unique identifier per user
  amount: number,        // amount to stream
  decimals: number,      // decimals of SPL Mint
  days: number           // number of days to stream
);

Note: You can send the transaction to the network using wallet adapter as shown below

const sig = await walletAdapter.sendTransaction(transaction, connection, {
  signers: [],
});

Claim Constant Flux

// with wallet
const { signature } = await fluxus.claimConstantFluxWithWallet(
  mint: PublicKey,                  // SPL Token Mint
  authority: PublicKey,             // sender
  receiver: PublicKey,              // recipient
  fluxId: string,                   // unique identifier used to create constant flux
  receiverTokenAccount: PublicKey   // recipient mint token account
);
// with adapter
const { transaction } = await fluxus.claimConstantFlux(
  mint: PublicKey,                  // SPL Token Mint
  authority: PublicKey,             // sender
  receiver: PublicKey,              // recipient
  fluxId: string,                   // unique identifier used to create constant flux
  receiverTokenAccount: PublicKey   // recipient mint token account
);

Cancel Constant Flux

// with wallet
const { signature } = await fluxus.cancelConstantFluxWithWallet(
  authority: PublicKey,     // sender
  mint: PublicKey,          // SPL Token Mint
  receiver: PublicKey,      // recipient
  fluxId: string            // unique identifier used to create constant flux
);
// with adapter
const { transaction } = await fluxus.cancelConstantFlux(
  authority: PublicKey,     // sender
  mint: PublicKey,          // SPL Token Mint
  receiver: PublicKey,      // recipient
  fluxId: string            // unique identifier used to create constant flux
);
  1. Instant Distribution Flux
  • Distributes funds instantly to multiple recipients.
  • Eliminates the need for manual distribution.
  • Offers real-time transparency on payments.
  • Increases efficiency and reduces costs
// with wallet
const { signature } = await fluxus.instantDistributionFluxWithWallet(
  authority: PublicKey,      // sender
  mint: PublicKey,           // SPL Token Mint
  receivers: PublicKey[],    // receivers (max 5)
  amount: number,            // amount to distribute
  decimals: number,          // decimals of SPL Mint
  shares: number[]           // share of each recipient (equals to receivers)
);
// with adapter
const { transaction } = await fluxus.instantDistributionFlux(
  authority: PublicKey,      // sender
  mint: PublicKey,           // SPL Token Mint
  receivers: PublicKey[],    // receivers (max 5)
  amount: number,            // amount to distribute
  decimals: number,          // decimals of SPL Mint
  shares: number[]           // share of each recipient (equals to receivers)
);
  1. Fluxus Program
  • Fluxus Accounts

accounts

For more details check program

fluxus's People

Contributors

saicharanpogul 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.