Giter Site home page Giter Site logo

aaronkzhou / strata Goto Github PK

View Code? Open in Web Editor NEW

This project forked from stratafoundation/strata

0.0 0.0 0.0 28.19 MB

Strata Protocol is an open-source protocol to launch tokens around a person, project, idea, or collective on Solana.

Home Page: https://docs.strataprotocol.com

License: Other

Shell 0.04% JavaScript 2.35% Rust 12.90% TypeScript 84.32% CSS 0.38%

strata's Introduction

Strata

What is strata? Check out our Hello World

View the live documentation here

This series of smart contracts serves to standardizing and indexing all social tokens.

Docs are located in packages/docs

Development

We recommend using localnet for working on Strata.

Install Submodules

Pull the deps

git submodule init
git submodule update

Lerna Setup

Strata uses Lerna to make it easier to develope on our JS SDKs.

npx lerna bootstrap

Build the deps

anchor run build-deps

Build the Strata packages

yarn build

Test

anchor test --provider.cluster localnet

Bootstrap the Open Collective

If you wish to use this on devnet, first the open collective needs to be created. This has already been run for devent, but putting it here for the sake of completeness

env ANCHOR_WALLET=~/.config/solana/id.json ANCHOR_PROVIDER_URL=https://api.devnet.solana.com yarn run bootstrap

Development Philosophy: On Initializing vs Passing

In Solana programs, you can either

  • (a) Pass a fully initialized account to your contract, and verify that it looks the way you expect it to
  • (b) Pass an empty account to the program and have it initialize it as a PDA.

Let's take token bonding as an example. Token bonding bonds a base mint to a target mint. We could either

  • (a) Pass in a target mint that is already initialized and verify it has supply 0 and authority set to token bonding program.
  • (b) Pass an empty account and have token bonding initialize it with the authority set to itself

Benefits of Passing:

When we pass the target mint to token bonding, someone could have done something with the mint before it got to token bonding. This is useful in that decorators around the mint will often use the mint authority to give permission for decoration. For example, the Metaplex token metadata contract requires the mint authorities approval. If token bonding initializes the mint, every call to every decorator must go through token bonding

Detriments of Passing:

Someone could have done something nefarious before it got to token bonding. In the case of a token account, they could have placed a nefarious delegate. You have to be very careful about verifying the pased in account. Additionally, if the smart contract changes to support more fields that could be nefarious, you need to update your own smart contract code to blacklist these fields.

Benefits of Initializing

  • PDAs - You can only have a PDA of a value that is being initialized by the program. PDAs are useful for quick hash lookups.
  • Safety You can guarentee the object fits the spec of your program and is not nefarious

Detriments of Initializing

You cannot do anything that requires authority on the account without having to pass through your contract.

When to use Both

Passing

Use passing when the account has utility outside of this contract. For example a Mint.

Initializing

Use initializing for actual program data. For example, for the bonding curve or for the Wumbo token ref. This way users can directly lookup the account via PDA.

You should also use initializing on Token accounts that are exclusively for the program, for example a holding account in token staking.

Contribution

Thank you for your interest in contributing to Strata! All contributions are welcome no matter how big or small. This includes (but is not limited to) filing issues, adding documentation, fixing bugs, creating examples, and implementing features.

If you'd like to contribute, please claim an issue by commenting, forking, and opening a pull request, even if empty. This allows the maintainers to track who is working on what issue as to not overlap work.

For simple documentation changes, feel free to just open a pull request.

If you're considering larger changes or self motivated features, please file an issue and engage with the maintainers in Discord.

strata's People

Contributors

chewingglass avatar bryzettler avatar thornm9 avatar franklyphresh avatar wozgun avatar benrobot avatar ebramanti avatar staccdotsol avatar tjkyner 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.