Coder Social home page Coder Social logo

fuellabs / sway-applications Goto Github PK

View Code? Open in Web Editor NEW
1.6K 42.0 533.0 11.81 MB

Swaypplications

Home Page: https://sway-applications.vercel.app/

License: Apache License 2.0

Rust 61.72% JavaScript 2.34% TypeScript 11.33% HTML 0.23% Sway 24.38%

sway-applications's Issues

Contract

Transferring assets can be done to outputs and contracts.

This issue is meant to support transfers from the contract to another contract.

General purpose NFT contract

WIP

A general purpose NFT contract that will have the following attribute:

  • the contract should represent a collection of NFTs, not just a single token
  • every token minted should have a unique, immutable token id
  • there should be a way to find the owner of any token given its id.
  • access control for minting - the contract should store an Identity as the minter, which allows for either an address or a minter contract to be set as the entity with minting rights
  • an event should be emitted when approvals are made, an NFT is minted or burned, and when transfers are made

The contract ABI will follow the format below:

fn allowMint(minter: Identity) -> bool;
fn approve(to: Identity, token_id: b256) -> bool;
fn balance_of(owner: Identity) -> u64;
fn burn(token_id: b256) -> bool ;
fn constructor(owner: Identity, access_control: bool, token_count: u64) -> bool;
fn getApproved(token_id: b256) -> Identity;
fn getTotalSupply() -> u64;
fn isApprovedForAll(owner: Identity, operator: Identity) -> bool;
fn mint(to: Identity, amount: u64) -> bool ;
fn owner_of(token_id: b256) -> Option<Identity>;
fn setApprovalForAll(owner: Identity, operator: Idenity) -> bool;
fn transferFrom(from: Identity, to: Identity, token_id: b256) -> bool;

Move `logo.png` from the root of the project to a hidden `.docs` directory in the root

How does this improve a feature?

It removes unnecessary clutter from the perspective of the user.
They do not need to see this file in the root as it has nothing to do with why they would be browsing this repository.
This will make it slightly easier to navigate the repository since there will be less to click / "take in".

Specification

Creates a .docs directory in the root of the repository and places the logo.png there.
An update to the README.md is also required so that the correct path continues to point at the logo.

Additional context

Tuturu.

Escrow Application

This issue is meant to document the creation of a new application namely an Escrow.

Features

Multisig frontend

In order to interact with the multi-signature wallet in a user friendly manner a user interface should be created.

Fundraiser frontend

Requirements

  1. As an author I should have an option to create a new crowdfund / fundraiser which allows me to specify
    • The asset that I want to use for people to pledge
    • The amount of asset required to reach the goal
    • The deadline after which the crowdfund is locked
  2. As an author I should be able to share my crowdfund with others via a link to a page
    • This page should demonstrate the required asset
    • The current amount pledged by everyone and the goal
    • The deadline
    • Should allow someone to pledge any amount from their wallet of the specified asset & also withdraw
  3. As an author I should be able to see all of my past and current fundraisers and their status.

Create Issue Templates

GitHub allows us to create templates for new issues.
These should be implemented to aid contributors in submitting issues because a guide is likely to lead to greater detail rather than a blank and unstructured page.

Call contracts without knowing their ABI at compile time of the multisig

Once a Tx has been approved past a threshold it should be executable.

In order to accomplish execution we need to be able to call arbitrary contracts without knowing anything about them at the compilation of the multi-signature wallet.
This means that we need to be able to make generic calls at runtime.

Fundraiser Application

Application Description

Sway smart contract similar to an escrow, also has a user interface.

Users can deposit a specified asset to the contract within a specified time range.

  1. If the total sum pledged meets the goal then the author can claim the funds and automatically close the contract
  2. Otherwise everyone can withdraw their pledge

Motivation

It has a similar application to an Escrow and it is a viable real world use case via decentralized conditional funding.
A sway application should be created to demonstrate its usage.

Features

Additional context

Tuturu

Create a fundraiser program that is fully tested

Requirements

  1. As an author I should be able to
    • Specify the asset that is used to measure against a target goal amount
    • Specify how long the crowdfund will last
    • Claim the amount once the goal is reached
  2. As a non-author I should be able to
    • Pledge any amount of the specified asset if the fund has not expired
    • Withdraw my pledge at any point after my pledge unless the goal has been reached

Extension: The contract should be a single contract that can spawn any number of independent fundraisers / campaigns. This can be done via handling data through various mappings.

Create a CONTRIBUTING.md

The README.md contains some info about contributing however that is the incorrect place to store such information.
Moreover, it is not particularly descriptive.
Expand on the contributions in this file.

Weighted signers

A weight of a signer is the number of approvals that they "give" when they approve a Tx.

A basic application is where each signer has a weight of 1 approval (their own) and thus if there are 5 signers with an approval threshold of 3 then 3 signers must approve the Tx.

This issue specifies that a signer can have a greater approval than 1 and thus it would be possible to approve a Tx (in the aforementioned example) with only 2 signers.

Counter Tutorial Example

Application Description

A simple smart contract for a counter which has a user interface.

Motivation

The repository consists of end-to-end applications however tutorial applications should be added in order to walk a user through the creation process of decentralised applications.

A simple counter example could be the first application to go under a new path of sway-applications/tutorials/counter

Features

  • Sway counter contract
  • Contract tests
  • User interface
  • Tutorial Docs
  • CI: static analysis
  • Update base Readme

Additional context

cc @camsjams edit the issue as needed - especially the features (+new issues).

Create and add myself to CODEOWNERS file under `.github/CODEOWNERS`

Why should this feature be added?

It will automatically add me as a reviewer to any PR in the repository. It makes it easier to submit PRs for everyone.

Specification

Create a new CODEOWNERS file and append * @Braqzen with a new line at the end

Additional context

No response

Supports 1-25 signatures

The wallet should be able to support an arbitrary number of signers meaning that we do not hardcode up to 25 variables in storage for the signers.

In this instance the goal is 1-25 signers.

Multi-Signature Wallet Application

This issue is meant to document the various sub tasks that are required in order to create a fully functional multi-signature wallet written in Sway.

There are various components and they are grouped into categories.

The Basics

Ethereum Signature Capability

Frontend

Contract Calls

Documentation

Use a nonce to prevent double spends

Once a Tx has reached the required number of approvals it can be executed.

The nonce is meant to prevent multiple executions which could result e.g. having funds sent multiple times to an address until a contract is drained of an asset.
The execution should only be played out at most once and never again.

Comprehensive documentation external to the codebase

Documenting the Sway code is a good start however there should be a user friendly page which takes the developer through the creation process and explains the intricacies beyond the functionality documented directly in the code.

Todo Tutorial Example

Application Description

A simple smart contract for a todo which has a user interface.

Motivation

The repository consists of end-to-end applications however tutorial applications should be added in order to walk a user through the creation process of decentralised applications.

A simple todo example should be added in sway-applications/tutorials/todo

Features

  • Sway Todo contract
  • Contract tests
  • User interface
  • Tutorial Docs
  • CI: static analysis
  • Update base Readme

Additional context

No response

User interface for English auction

The user interface should allow the owner of an NFT to create an auction.

The auction should be shareable so that any user can place a bid
The owner should be able to see all of their auctions and their state.

Blind Auction program

A blind auction is where users can bid without others knowing their bid amounts. This is achieved with hashing (the value they want to bid, whether or not its a fake bid, and a secret) and sending that onto the chain. This hashed bid is later revealed, and if the deposits are greater than the value, and its a real bid, its accepted as a valid bid.
After the reveal period ends, the highest bidder wins.

solidity implementation

NFT Auctions

Application Description

Related: #47

Application which allows a user to specify the type of auction for their NFT sale.
This would allow the user to choose between a dutch auction, english auction and a blind auction.

Motivation

An NFT can have a value set inside of it for a sale and that value may be static.

Alternatively, an auction mechanism may be used to allow the market to choose the price for the NFT (barring some restrictions such as a minimum and maximum price).

Features

Additional context

cc @bitzoic

English auction program

An English auction is one where the auctioneer sets an opening price and a reserve price that must be met in order to sell the item.
Bidders continue to place bids in order to be the highest bidder and the highest bidder will be the one the item is sold to if conditions are met.

Improve the README.md

The current README.md has some basic info and it is mixed with CONTRIBUTING.md.

It should be split to contain a banner, badges, clearer explanation of the applications in the repository and how to navigate them etc.

Dutch auction program

A Dutch auction is a type of auction where securities are priced via bids rather than the seller setting the price.
In this scenario, the seller sets a maximum price, which is lowered over time until all of the securities have been bid on.

Citation

Comprehensive documentation in the code

Simply writing code that is functional is insufficient and as such we need to document the Sway code once the multi-signature wallet has been created and passed extensive testing.

The purpose is not just a functional contract but knowledge transfer to future Sway developers.

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.