Giter Club home page Giter Club logo

hydra's Introduction

Hydra

Collective account pooling, fan out wallet, dao treasury, all of the things you need to FAN OUT

Setup && Development

To get started the basic steps are to install all the JS dependencies, cargo dependencies will be installed automatically when you run anchor build. This package uses the latest yarn, which is yarn 3 and I will accept no hate for using the latest yarn :)

yarn

There are three components in this repo..

  1. Program
  2. SDK
  3. Docs

Program Development

The Hydra smart contract is written with anchor but we have changed the development flow slightly to allow for what we think is a better SDK. Using anchor build you get the BPF so file and the IDL. You then run the following to generate the SDK and spin up a local validator when you want to test your changes.

yarn run api:gen
yarn run amman:start

Now you have a validator running your newly compiled SO file and any other programs you have listed in the .ammanrc.cjs.

Currently we require the local validator to have the Token Metadata program from Metaplex. We suggest you clone the Metaplex Program Library and put it in the same root folder as hydra like this:

 /root-folder
    /hydra
    /metaplex-program-library

To build the latest token metadata program you will need to do the following:

cd metaplex-program-library/token-metadata/program
cargo build-bpf --bpf-out-dir ../../target/deploy/

Now your top level MPL target folder will have the token metadata so file that amman can find and deploy to the local validator.

After accomplishing this your workflow to build new code will be:

anchor build //Optional as the next commant runs anchor build for you
yarn run api:gen
yarn run amman:start

SDK Development

Now that you know how to build the program, building the SDK is easy. All you need to do is run:

yarn run watch

This will watch your packages/sdk folder for any changes, which means it will build the SDK for use in apps or tests when the auto generated code from the api generator is saved in the folder.

Testing

Now that you have the ability to build the program, generated sdk and the rest of the sdk, running tests is a breeze. With the local validator up and running you can simply run.

yarn test

Using ts-node/register you can even setup breakpoints and debuggers on your IDE to debug your tests. If you dont have the local validator running do:

yarn run amman:start
yarn test

Or if you are like Noah or Will and are extremely lazy and can't be bothered to run more than one command run yarn run mega-test

Docs Development

cd packages/docs
yarn start

hydra's People

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar

hydra's Issues

Puff Out String of Fanout Name

Describe the bug
The name field of the fanout account is saved as is from the input of the user. It does not follow the pattern of puffing out the string to the max length allocated for the field within the account.

Example from Metaplex Program Library
https://github.com/metaplex-foundation/metaplex-program-library/blob/f39cbb663ba499c4167ad6e0cf6509b9367cf271/fixed-price-sale/program/src/utils.rs

Code saving the name within Hydra
https://github.com/GlassEaters/hydra/blob/main/programs/hydra/src/processors/init/init_parent.rs#L52

To Reproduce
Create a fanout with a name less than 50 characters.

Distribution Bot Reward Model

Allow optional Configuration to allow a reward for distributors. They should get their txn fee + some non-trivial amount of money to continue to distribute.

[Feature] Fanout authority would want to be able to airdrop

  1. new/existing fanout, with token style
  2. I, fanout authority, want to use some of my tokens to stake on someone else's behalf:
    a. I create a tokenacc if needed
    b. send em tokens? in same instruction set
    c. stake them for them?

alternatively could I delegate them some? or some shit lol

--> this doesn't work

usecase: airdrop

Uniform address for using as royalties for NFTs in both SOL and SPL

I trying to see if I can use Hydra to act as creator wallet for NFTs.

I created a Fanout, added the shares, and got the Fanout address and Native account address.

When I send SOL to the Fanout address, then the distribute shows no balance, as the SOL needs to go to the Native account. So, if I was to use Hydra for royalties coming from regular Marketplaces (such as Magic Eden), then I'd have to use the Native account.

When I tried to send SPL to the fanout address, the balance shows and can be distributed properly.

The thing, I'm also creating a custom marketplace (with LIQNFT) that will work with a SPL, so it'll distribute SPL royalties to creators in the NFT.

So the problem I'm facing is not being able to use a single address to put as creator of the NFTs so whether SOL or SPL arrives there, then Hydra will be able to distribute.

Any suggestions I could do?

I looked at the program code, but couldn't find a way to move the funds from the Fanout address to the Native account, that would work as a escape hatch.

UI always using devnet

Describe the bug
When trying to create a wallet in mainnet-beta the transaction is always sent to devnet

To Reproduce
Steps to reproduce the behavior:

  1. Go to https://hydra.glasseaters.xyz/?cluster=mainnet-beta
  2. connect wallet
  3. Make sure that mainnet cluster is chosen
  4. Create a fanout wallet

Expected behavior
Wallet should be created in mainnet-beta. Not devnet

Screenshots
If applicable, add screenshots to help explain your problem.
image

Desktop (please complete the following information):

  • OS: Windows
  • Browser chrome
  • Version 101

keypair for the fanout wallet to sign as CMV2 creator

hi all, i used hydra sol wallet address as creator in the candy machine V2.
I would like to sign the metadata as verified creator, but there is no keypair from fanout wallet available,,,

p.s. I used https://hydra.cardinal.so/ to create the fanout wallet which give me the FANOUT ADDRESS and SOL WALLET ADDRESS.

anyone have idea on how to deal with? much appreciated

distributeformint gives error 6012

Hi technical geeks, I need help in calling hydra SDK. I am able to sucessfully send airdrop of SOL but when I try using sending SPl20 token with the below given reference code I get error:
{InstructionError: Array(2)}InstructionError: Array(2)0: 11: {Custom: 6012}length: 2[[Prototype]]: Array(0)[[Prototype]]: Object

[bug] fanout cannot pay fanout fungibles as inputs to that same fungible as output

in the following code, I am able to pay claim2 but not claim

async function claim(){
if (wallet){ let fanoutSdk: FanoutClient;
fanoutSdk = new FanoutClient(
connection2,
// @ts-ignore
wallet
);
const fanout = new PublicKey("2DdevS3SFCsuUBAjnhi4krz1GSvDenZfMETaHqWFWUn9")

let ix = await fanoutSdk.distributeTokenMemberInstructions(
{
fanoutMint: new PublicKey("DLbjx3D65yP7yy4eKSfMFzUgvTfKB9ApTXYunA2NUMtF"),
distributeForMint: true,
membershipMint: mintPublicKey,
fanout: fanout,
member: wallet.publicKey,
payer: wallet.publicKey

}

);
let tx2 = await fanoutSdk.sendInstructions(
ix.instructions,
[],
wallet.publicKey
);
}
}
async function claim2(){
if (wallet){ let fanoutSdk: FanoutClient;
fanoutSdk = new FanoutClient(
connection2,
// @ts-ignore
wallet
);
const fanout = new PublicKey("2DdevS3SFCsuUBAjnhi4krz1GSvDenZfMETaHqWFWUn9")
let ix = await fanoutSdk.distributeTokenMemberInstructions(
{
fanoutMint: new PublicKey("BAjRRdbhNWwc1SWWHNHGLGtqS1kDct78qz9oGqGcL6H9"),
distributeForMint: true,
membershipMint: mintPublicKey,
fanout: fanout,
member: wallet.publicKey,
payer: wallet.publicKey

}

);
let tx2 = await fanoutSdk.sendInstructions(
ix.instructions,
[],
wallet.publicKey
);
}
}

No Support for wSOL for Distribution

Hydra currently does not support adding wSOL as an SPL token when calling initializeForFanoutMint. The function violates a raw constraint on the method.

Upon further research, the constraint in question can be found here:
constraint = mint_holding_account.is_native() == false,

The issue is that wSOL is an SPL token, but also considered a native token. The associated token account created violated this constraint. Is there a way we can modify or remove this constraint to support wSOL?

Missing dependencies from SDK (yarn)

Description

The SDK package uses some packages not listed in its dependencies, which yarn complains about. For example:

Error: @glasseaters/hydra-sdk tried to access @project-serum/anchor, but it isn't declared in its dependencies; this makes the require call ambiguous and unsound.

To Reproduce

Given the following file (index.ts):

import { Connection, Keypair } from '@solana/web3.js';
import { FanoutClient, MembershipModel } from '@glasseaters/hydra-sdk';
import { NodeWallet } from '@metaplex/js';

(async () => {
  const connection = new Connection("devnet", "confirmed");
  let fanoutSdk: FanoutClient;

  const authorityWallet = Keypair.generate();

  fanoutSdk = new FanoutClient(
    connection,
    new NodeWallet(authorityWallet)
  );

  const init = await fanoutSdk.initializeFanout({
    totalShares: 100,
    name: `Test${Date.now()}`,
    membershipModel: MembershipModel.Wallet,
  });
})();

Run the following commands:

$ yarn init -y
$ yarn add --dev typescript @types/node ts-node
$ yarn add @solana/web3.js @metaplex/js @glasseaters/hydra-sdk
$ yarn exec ts-node index.ts

Expected Behavior

Dependencies should be included in the SDK's package.json

distributeAll always results in IncorrectOwner for NFT model

Describe the bug
In both the GUI and the SDK, the ProcessDistributeNft program call always results in an IncorrectOwner error. In this CLI I've attempted to use distributeAll, distributeAllInstructions, and distributeNftMemberInstructions and each call results in an IncorrectOwner AnchorError.

To Reproduce

  1. Use the NFT membership model in the GUI
  2. Fund the Hydra account with tokens
  3. Hit the Hydra button and watch the JS console.

Expected behavior
The hydra button or the distributeAll command in the SDK should distribute tokens.

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.