Giter Club home page Giter Club logo

astraplusplus's Introduction

bOS-workspace (ALPHA)

bOS-workspace is a comprehensive framework equipped with a build script that streamlines the process of managing, coding and testing bOS widgets. This script performs various operations including parsing the bos.config.json file, injecting content via specific comments, replacing widget sources, importing modules, generating SocialDB, and more.

Key Features

  1. Reads the bos.config.json file located in each app/{appname} folder. Note: bos.config.json is crucial for certain commands to function properly.

  2. Utilizes special comments to inject the desired content at the right place.

  3. Utilizes the aliases map from bos.config.json to replace comments with the correct value, it's specially useful for widget sources. For instance:

    "aliases": {
        "nui": "nui.sking.near",
        "something": "abc"
    }

    This operation will replace all instances of the following:

    • From: /*__@replace:something__*/ to abc
    • From: <Widget src="/*__@replace:nui__*//widget/Button" /> to <Widget src="nui.sking.near/widget/Button" />
  4. Supports module import from the /modules folder using the syntax: /*__@import:moduleName__*/. All occurrences from the mentioned syntax will be replaced with the content of /modules/moduleName.js and from /*__@import:folder1/folder2/moduleName__*/ with the content of /modules/folder1/folder2/moduleName.js.

  5. The build script also replace the following special comments:

  • From /*__@appAccount__*/ to the app account defined in bos.config.json.
  1. File' comments can be excluded from processing by the build script by adding the following comment at the beginning of the file: /*__@skip__*/.

Guidelines

  • All bOS specific comments should strictly adhere to the format: /*__@command:argument__*/ or /*__@command__*/.
  • The comment commands are operational on .js, .jsx, .ts, .tsx, and .jsonc files, the only exception being bos.config.json.

Project Structure

The build.js or dev.js script should execute at the project's root, and the project should maintain the following structure:

- apps
  - {appname}
    - bos.config.json
    - widget
        - (your widgets codes with any folder structure)
    - (other folders or files)
- modules
  - (any folder structure)

Each app represents the bOS widgets that can be deployed under the app account specified in bos.config.json.

Upon execution, the build script will generate a build folder at the project's root with the following structure:

- build
  - {appname}
    - src: the widgets code identical to the widget folder but prepared for deployment.
    - data.json: a JSON file that encompasses all .jsonc files from the {appname} folder, including its subfolders.

Example of bos.config.json:

{
  "appAccount": "nui.sking.near",
  "aliases": {
    "nui": "nui.sking.near",
    "imageWidget": "mob.near/widget/Image",
    "something": "abc"
  }
}

The data.json File

The data.json file is utilized to store data in SocialDB under the app account. It employs folders as keys and files as values, supporting only .jsonc and .txt files.

For instance, consider the following structure:

- apps
  - {appname}
    - something.txt
    - types
      - ui
        - imageType.jsonc
    - widget
      - Button.metadata.jsonc

The data.json file will appear as follows:

{
  "something": "unchanged content of something.txt",
  "types": {
    "ui": {
      "imageType": "Stringified JSON content of imageType.jsonc"
    }
  },
  "widget": {
    "Button.metadata": "Stringified JSON content of Button.metadata.jsonc"
  }
}

Excluding Files from data.json

The @ignore comment can be leveraged to omit a file from the data.json file. To execute this, add the following comment at the beginning of the file: /*__@ignore__*/.

jsonc Files

The jsonc files will be passed through JSON.stringify and stored in the data.json file, the build script will also remove all the comments and spaces from the jsonc files. If you want to skip the JSON.stringify operation, add the following comment at the beginning of the file: /*__@noStringify__*/

Development

bOS-workspace allows you to run a local server similar to bos-loader that can supply the widget's code to the bOS gateways for development purposes. To do so, run the following command:

# Install dependencies
yarn install
# Run the server
yarn dev

To access the local widgets, go to https://near.org/flags and add the following URL: http://127.0.0.1:4040/

Note: The server will serve all the widgets from all the apps, each app under the account specified in bos.config.json. If an app uses a widget from another account that you have in the workspace, the gateway will show you the local widget instead of the remote one. That's great for working on multiple apps/accounts simultaneously.

Build

To build the widgets for deployment, run the following command:

# Install dependencies
yarn install
# Build the widgets
yarn build

Deploy

To start the deploy cli, run the following command:

yarn deploy

To deploy a specific app, run the following command:

yarn deploy {appname}

Testing

To test the build/dev scripts, run the following command:

yarn test:tools

Future Improvements (TODO)

  • Improve the deployment of data.json to SocialDB.
  • The build script should initially try to fetch the data.json structure file from SocialDB and will then only generate a data.json file containing the new changes, bypassing the remaining files.
  • Testing framework for the bOS widgets, with the ability to mock the SocialDB, near and fetch.
  • Make this README.md more clear, it's a mess right now.

astraplusplus's People

Contributors

megha-dev-19 avatar rubycop avatar sekaiking avatar

Watchers

Jane Wang avatar  avatar

Forkers

eren-yeaager

astraplusplus's Issues

Add NFT + Token based DAOs (New Version of Sputnik)

Feature Request

Description

A clear and concise description of the feature you are proposing.

Proposed Solution

  • when creating dao allow a group set to membership absed on fungible token or nft based token
  • specify based on token and nft contract
  • set ownership threshold for a vote and weight or unique ownership (whether it is one vote per certain amount of theshold) or it is threshold + weighted
  • snapshot holders based on time of proposal

Benefits

  • enable companies and tokens to easily create DAos

Turn FC Proposal Into A Library ๐ŸŸ 

Feature Request

Turn existing function call proposals into FC call proposal temaplte

Description

A clear and concise description of the feature you are proposing.

Use Case

  • nft list

Acceptance criterion

  • hard code args for fc proposal or set them as a variable
  • easy to use form based on fc library type

Navigation from shared proposal link back to proposal overview not possible

Hey,

when you share a link to a proposal like this:
https://near.org/astraplusplus.ndctools.near/widget/home?page=dao&tab=proposals&daoId=shitzu.sputnik-dao.near&proposalId=34
there is no way to navigate to the list of all proposals. I assumed that clicking the proposal tab should send you back. It properly removes the proposalId from the query parameters, but it doesn't navigate to the proposals. It just reloads the currently displayed proposal.

It would also be nice to have a "<-- back to proposal overview" button to make this more clear.

See My DAOs

Feature Request

See navigations for DAOs im in

Use Case

  • users cannot see what daos there in, currently more of ndc app than practical DAO user app

Proposed Solution

  • show my daos with icons on left navbar

THis was case in https://app.astrodao.com

Image

Fix DAO Search Filters + Sort

Feature Request

Add DAO Filters + Search

Description

Use Case

  • allow DAOs to prioritize metrics like balance number of membes and activity, some form of gamification

Proposed Solution

  • filter by daos with most members
  • filter with daos with recent acitvty
  • sort by daos with biggest balance
  • sort daos by date created newest to oldest

Benefits

  • have people easily find relevant daos

Improvement Suggestion

  • currently global DAOs dont show much

Image

Update dao funds page

  • add graph with funds value over time, with option to show in either Near or USD
  • reduce the "available funds" by the required 6-7 Near that the DAO does not in fact have access to, plus whatever Sputnik requires you leave in there for storage.

FunctionCall proposal no Gas check

Hey,

when creating a FunctionCall proposal there is no check, if the proposed attached Gas makes any sense. I can attach more than 300TGas. There should be safety checks for this.

Also bear in mind that attaching 300TGas will also always fail. The Gas you insert here is the Gas that will be attached to the cross contract call. Some Gas will be consumed prior to doing this call. There should be a flat Gas fee that should be subtracted from this. I think with 270TGas we would definitely be on the safe side as an upper limit.

Toggle Pikespeak Indexer

Feature Request

Toggle Pikespeak Indexer in props for component

Proposed Solution

  • props that toggle indexer vs near api js
  • don't use pikespeak where you dont have to

Benefits

  • other gateways can use astra++ without paying for middleware, tradeoff (global search of dao may suffer)

Current Situation

Proposed Improvement

If you have specific ideas or suggestions for improvement, outline them here. Be clear about how the suggested changes will benefit the project.

Benefits

  • more gateways using dao tooling
  • will be a fork on DAO tooling

Finalize expired or failed proposal

Hey,

when a proposal expired its status stays as "InProgress" as long as it doesn't get finalized. See e.g. this proposal:
https://near.org/astraplusplus.ndctools.near/widget/home?page=dao&tab=proposals&daoId=shitzu.sputnik-dao.near&proposalId=33

There can also be failed proposals. A FunctionCall proposal gets into failed status, when it has been approved but the tx failed, e.g. here:
https://near.org/astraplusplus.ndctools.near/widget/home?page=dao&tab=proposals&daoId=shitzu.sputnik-dao.near&proposalId=27

In order to finalize a proposal you can use act_proposal function and send Action::Finalize:
https://github.com/near-daos/sputnik-dao-contract/blob/main/sputnikdao2/src/proposals.rs#L585-L592

There are also edge cases explained:

  • if proposal expired during the failed state it will be marked as expired.
  • if the number of votes in the group has changed (new members has been added) the proposal can loose it's approved state.

Nevertheless no matter about the edge case, any expired or failed proposal should be able to be finalized, which should be really easy to add. There just needs to be a button to prompt the user to send the act_proposal tx.

Filter Proposals By Type of Function Call Proposal

Feature Request

Description

Filter DAO proposals by Function call type (specific method + contract)

Use Case

  • currently difficult to find function call proposals of particular type

Proposed Solution

  • filter on search on type of fc proposal
  • ability to search based on method and or contract name

Benefits

  • easily filter dao proposals based on type of action

Propose to Add A List of Members to Roles in 1 Transaction

Feature Request

Propose to Add A List of Members to Roles in 1 Transaction

Current Situation

  • propose new member 1 proposal at a time

Benefits

  • improves time to add alot of people, currently need to do this at beggining of dao creating

DAO settings page

  • Add config settings UI
  • Add policy settings UI
  • Add bonds settings UI
  • Support ChangeConfig and ChangePolicyUpdateParameters in proposals args in proposals page
  • Add autocomplete for members

Global Feed of DAO Proposals -> Make Home Page

Feature Request

Description

  • create proposal feed of all proposals for sputnik-dao contracts

Use Case

  • this was already in the case for
  • more DAOs are making proposals than making posts

Proposed Solution

  • filter by daos i am a part of
  • filter by daos i follow
  • filter by all daos
  • able to filter by specific time period
  • make dao homepage instead of social feed on astra++

Benefits

  • no way to see what all DAOs are doing

Label "Deposit" in FunctionCall proposal as NEAR

When creating a FunctionCall proposal it is very confusing, that Gas should be given in Gas (instead of e.g. TGas), but Deposit right below should be given in NEAR instead of yoctoNEAR. These need to be labeled properly.

It's also kind of annoying to insert 0.000000000000000000000001, if you need to attach 1 yoctoNEAR for e.g. ft_transfer_call.

Integrate Ref Finance liquidity pool shares into DAO funds

As a DAO user I would like to see the liquidity pool shares of that DAO on Ref Finance. These LP shares have a USD valuation, because they can be unwrapped to the respective tokens of that pool.

Ref Finance uses the Multi Token standard for LP shares, but I noticed that it's not exactly compliant with the spec, but since it's Near Protocol's major DEX it would be good to support their interface, which can be found in their smart contract.

Use view function to get proposals

Hey,

it becomes a recurring problem, that the indexer is either broken or slow and we need to wait multiple hours eventually for our proposal to show up. I don't see a reason why an external API should be used to fetch proposals, if there is a view function, which does exactly this:
https://github.com/near-daos/sputnik-dao-contract/blob/main/sputnikdao2/src/views.rs#L89

It's really easy to call (example via CLI):

near contract call-function as-read-only shitzu.sputnik-dao.near get_proposals json-args '{"from_index": 0, "limit": 100}' network-config mainnet now

Idk what would be the exact limit for pagination. That depends on the proposals that are serialized, so better use something conservative.

Decide how much Gas should be attached to a vote

Hey,

when voting on a FunctionCall proposal it might be critical to attach max Gas to the vote itself.
It the proposal succeeds it will do the cross contract call that has been defined in the proposal. This call might need more than the hardcoded 200TGas that is currently attached to the vote button.

If the proposal fails, because not enough Gas has been attached to the vote that triggers the cross contract call, then the proposal needs to be recreated.

Notifications support

  • Send Notifications to members when proposal is created (add checkbox if the proposer wants to send it)
  • Notify the creator when proposal is voted on

Save Navbar Configs for A User

Feature Request

Save configurations for astro dao that turns off certain tabs so can have more focused dao experience

Use Case

  • ndc features make too clustered

Proposed Solution

  • easy way to turn off tabs so when forking astra++
  • save navbar configs; example communtiy voice = false, ndc=false and just shows daos are core functionltiy

Similar DAOs

Feature Request

on DAO page see similar DAOs based on DAO actions, similar members and name and descriptiona s well as follow history

Description

  • create a dao reccomendatio system based on memberships, activity, and descriptions

Use Case

  • improve dao disocvery

Proposed Solution

  • on a DAO page show similar DAOs
  • based on profile, membership and activity activity

Pay storage_deposit when creating "Transfer" proposal

It just happened to us, that we finalized a proposal for a token transfer, but the receiving account was not yet registered to the token contract via calling storage_deposit. Here is the tx:
https://nearblocks.io/txns/9CjZkVbfAXy54fxD3oGyymemmniQvCy2KP7HYBK4dM8M#execution

In order to prevent this, I propose the solution to check in Astra++ UI whether the receiving account is already registered. This is fairly easy to check. You just call the view function ft_balance_of on that token contract. If it returns null, then that account is not yet registered and the UI should prompt to sign a tx to pay the storage deposit on behalf of that user.

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.