├── .devops
├── .template
│ ├── .docs
│ │ └── .gitkeep
│ ├── libraries
│ │ └── .gitkeep
│ ├── predicates
│ │ └── .gitkeep
│ ├── scripts
│ │ └── .gitkeep
│ ├── template-contract
│ │ ├── src
│ │ │ ├── errors.sw
│ │ │ ├── events.sw
│ │ │ ├── utils.sw
│ │ │ ├── data_structures
│ │ │ │ └── example.sw
│ │ │ ├── data_structures.sw
│ │ │ ├── interface.sw
│ │ │ └── main.sw
│ │ ├── tests
│ │ │ ├── functions
│ │ │ │ ├── info
│ │ │ │ │ └── mod.rs
│ │ │ │ ├── core
│ │ │ │ │ ├── mod.rs
│ │ │ │ │ └── template.rs
│ │ │ │ └── mod.rs
│ │ │ ├── utils
│ │ │ │ ├── interface
│ │ │ │ │ ├── info.rs
│ │ │ │ │ ├── mod.rs
│ │ │ │ │ └── core.rs
│ │ │ │ └── mod.rs
│ │ │ └── harness.rs
│ │ ├── Forc.toml
│ │ └── Cargo.toml
│ ├── .gitignore
│ ├── Forc.toml
│ ├── Cargo.toml
│ ├── fuel-toolchain.toml
│ ├── Forc.lock
│ └── SPECIFICATION.md
└── aurora
│ ├── .gitignore
│ ├── src
│ ├── commands
│ │ ├── mod.rs
│ │ └── test.rs
│ └── main.rs
│ ├── fuel-toolchain.toml
│ ├── apps.txt
│ └── Cargo.toml
├── AMM
├── .gitignore
├── AMM-contract
│ ├── tests
│ │ ├── harness.rs
│ │ ├── functions
│ │ │ └── mod.rs
│ │ └── utils
│ │ │ └── mod.rs
│ ├── Forc.toml
│ ├── Cargo.toml
│ └── src
│ │ ├── errors.sw
│ │ └── events.sw
├── exchange-contract
│ ├── tests
│ │ ├── harness.rs
│ │ └── functions
│ │ │ └── mod.rs
│ ├── Forc.toml
│ └── Cargo.toml
├── swap-exact-input
│ ├── tests
│ │ ├── cases
│ │ │ └── mod.rs
│ │ └── harness.rs
│ ├── Forc.toml
│ └── Cargo.toml
├── swap-exact-output
│ ├── tests
│ │ ├── cases
│ │ │ └── mod.rs
│ │ └── harness.rs
│ ├── Forc.toml
│ └── Cargo.toml
├── atomic-add-liquidity
│ ├── tests
│ │ ├── cases
│ │ │ └── mod.rs
│ │ └── harness.rs
│ ├── Forc.toml
│ └── Cargo.toml
├── test-utils
│ ├── src
│ │ ├── lib.rs
│ │ └── paths.rs
│ ├── test-artifacts
│ │ └── malicious-implementation
│ │ │ └── Forc.toml
│ └── Cargo.toml
├── .docs
│ ├── amm_logo-dark_theme.png
│ ├── amm-sequence-diagram.png
│ └── amm_logo-light_theme.png
├── libraries
│ └── Forc.toml
├── fuel-toolchain.toml
├── Cargo.toml
├── Forc.toml
└── Forc.lock
├── DAO
├── .gitignore
├── Forc.toml
├── DAO-contract
│ ├── tests
│ │ ├── functions
│ │ │ ├── mod.rs
│ │ │ ├── core
│ │ │ │ └── mod.rs
│ │ │ └── info
│ │ │ │ ├── mod.rs
│ │ │ │ ├── proposal_count.rs
│ │ │ │ ├── balance.rs
│ │ │ │ ├── governance_asset_id.rs
│ │ │ │ └── user_balance.rs
│ │ ├── utils
│ │ │ ├── mod.rs
│ │ │ └── interface
│ │ │ │ └── mod.rs
│ │ └── harness.rs
│ ├── Forc.toml
│ ├── Cargo.toml
│ └── src
│ │ └── utils.sw
├── Cargo.toml
├── .docs
│ ├── dao-logo-dark-theme.png
│ ├── dao-logo-light-theme.png
│ └── dao-sequence-diagram.png
├── fuel-toolchain.toml
└── Forc.lock
├── NFT
├── .gitignore
├── Forc.toml
├── NFT-contract
│ ├── tests
│ │ ├── harness.rs
│ │ ├── utils
│ │ │ └── mod.rs
│ │ └── functions
│ │ │ ├── mod.rs
│ │ │ └── set_decimals.rs
│ ├── src
│ │ ├── interface.sw
│ │ └── errors.sw
│ ├── Forc.toml
│ └── Cargo.toml
├── Cargo.toml
├── .docs
│ ├── nft-logo_black.png
│ └── nft-logo_white.png
├── fuel-toolchain.toml
└── Forc.lock
├── OTC-swap-predicate
├── SPECIFICATION.md
├── .gitignore
├── Forc.toml
├── Cargo.toml
├── fuel-toolchain.toml
├── swap-predicate
│ ├── Forc.toml
│ └── Cargo.toml
├── .docs
│ ├── otc-swap-predicate-logo-dark-theme.png
│ └── otc-swap-predicate-logo-light-theme.png
└── Forc.lock
├── airdrop
├── .gitignore
├── Forc.toml
├── airdrop-contract
│ ├── tests
│ │ ├── functions
│ │ │ ├── mod.rs
│ │ │ ├── core
│ │ │ │ └── mod.rs
│ │ │ └── info
│ │ │ │ ├── mod.rs
│ │ │ │ ├── number_of_leaves.rs
│ │ │ │ ├── admin.rs
│ │ │ │ ├── end_block.rs
│ │ │ │ └── merkle_root.rs
│ │ ├── harness.rs
│ │ └── utils
│ │ │ ├── mod.rs
│ │ │ └── interface
│ │ │ └── mod.rs
│ ├── Forc.toml
│ ├── Cargo.toml
│ └── src
│ │ ├── data_structures.sw
│ │ ├── errors.sw
│ │ └── events.sw
├── Cargo.toml
├── fuel-toolchain.toml
├── .docs
│ ├── airdrop-distributor_dark.png
│ ├── airdrop-distributor_light.png
│ └── airdrop-sequence-diagram.png
└── Forc.lock
├── escrow
├── .gitignore
├── Forc.toml
├── escrow-contract
│ ├── tests
│ │ ├── functions
│ │ │ ├── mod.rs
│ │ │ ├── info
│ │ │ │ ├── mod.rs
│ │ │ │ ├── assets.rs
│ │ │ │ └── escrow_count.rs
│ │ │ └── core
│ │ │ │ └── mod.rs
│ │ ├── harness.rs
│ │ └── utils
│ │ │ ├── mod.rs
│ │ │ └── interface
│ │ │ ├── mod.rs
│ │ │ └── info.rs
│ ├── Forc.toml
│ └── Cargo.toml
├── Cargo.toml
├── .docs
│ ├── escrow-logo-dark-theme.png
│ ├── escrow-logo-light-theme.png
│ └── escrow-sequence-diagram.png
├── fuel-toolchain.toml
└── Forc.lock
├── timelock
├── .gitignore
├── timelock-contract
│ ├── .gitignore
│ ├── tests
│ │ ├── functions
│ │ │ ├── mod.rs
│ │ │ ├── core
│ │ │ │ ├── mod.rs
│ │ │ │ ├── cancel.rs
│ │ │ │ ├── queue.rs
│ │ │ │ └── execute.rs
│ │ │ └── info
│ │ │ │ ├── mod.rs
│ │ │ │ ├── delays.rs
│ │ │ │ ├── balance.rs
│ │ │ │ ├── transaction_hash.rs
│ │ │ │ └── queued.rs
│ │ ├── harness.rs
│ │ └── utils
│ │ │ ├── mod.rs
│ │ │ └── interface
│ │ │ ├── mod.rs
│ │ │ ├── info.rs
│ │ │ └── core.rs
│ ├── Forc.toml
│ ├── Cargo.toml
│ └── src
│ │ ├── data_structures.sw
│ │ ├── errors.sw
│ │ └── events.sw
├── Forc.toml
├── Cargo.toml
├── fuel-toolchain.toml
├── .docs
│ ├── timelock-logo-dark-theme.png
│ ├── timelock-logo-light-theme.png
│ ├── timelock-sequence-diagram.png
│ └── timelock-timestamp-validity.png
└── Forc.lock
├── .docs
├── contributing-book
│ ├── .gitignore
│ ├── src
│ │ ├── code
│ │ │ ├── .gitignore
│ │ │ ├── Forc.toml
│ │ │ ├── fuel-toolchain.toml
│ │ │ ├── connect_four
│ │ │ │ ├── src
│ │ │ │ │ ├── events.sw
│ │ │ │ │ ├── utils.sw
│ │ │ │ │ ├── errors.sw
│ │ │ │ │ ├── data_structures.sw
│ │ │ │ │ ├── main.sw
│ │ │ │ │ └── interface.sw
│ │ │ │ └── Forc.toml
│ │ │ ├── bad_documentation
│ │ │ │ ├── Forc.toml
│ │ │ │ └── src
│ │ │ │ │ └── lib.sw
│ │ │ └── Forc.lock
│ │ ├── images
│ │ │ ├── app-filter.png
│ │ │ ├── filter-dropdown.png
│ │ │ ├── issue-templates.png
│ │ │ ├── app-documentation.png
│ │ │ ├── app-filter-assignee.png
│ │ │ └── app-filter-comments.png
│ │ └── documentation
│ │ │ ├── project-quality
│ │ │ ├── documentation
│ │ │ │ ├── code
│ │ │ │ │ ├── style.md
│ │ │ │ │ ├── index.md
│ │ │ │ │ ├── abi.md
│ │ │ │ │ └── comments.md
│ │ │ │ └── index.md
│ │ │ ├── project-structure
│ │ │ │ ├── index.md
│ │ │ │ └── external.md
│ │ │ ├── index.md
│ │ │ └── code-structure.md
│ │ │ ├── pull-requests
│ │ │ └── index.md
│ │ │ ├── welcome.md
│ │ │ └── issues
│ │ │ ├── search
│ │ │ ├── summary.md
│ │ │ ├── assignment.md
│ │ │ ├── filtering.md
│ │ │ └── index.md
│ │ │ ├── index.md
│ │ │ └── create-issue.md
│ └── book.toml
├── issues.png
├── sway-apps-logo-dark-theme.png
└── sway-apps-logo-light-theme.png
├── .github
├── CODEOWNERS
├── ISSUE_TEMPLATE
│ ├── config.yml
│ ├── brand_new_feature.yml
│ ├── improvement_to_existing_feature.yml
│ └── new_application.yml
└── workflows
│ └── gh-pages.yml
├── fundraiser
├── .gitignore
├── Forc.toml
├── fundraiser-contract
│ ├── tests
│ │ ├── functions
│ │ │ ├── mod.rs
│ │ │ ├── core
│ │ │ │ └── mod.rs
│ │ │ └── info
│ │ │ │ ├── mod.rs
│ │ │ │ ├── asset_count.rs
│ │ │ │ ├── total_campaigns.rs
│ │ │ │ ├── pledge_count.rs
│ │ │ │ ├── user_campaign_count.rs
│ │ │ │ └── campaign.rs
│ │ ├── harness.rs
│ │ └── utils
│ │ │ ├── mod.rs
│ │ │ └── interface
│ │ │ └── mod.rs
│ ├── Forc.toml
│ ├── src
│ │ ├── data_structures.sw
│ │ ├── data_structures
│ │ │ ├── asset_info.sw
│ │ │ ├── campaign.sw
│ │ │ ├── pledge.sw
│ │ │ └── campaign_state.sw
│ │ └── utils.sw
│ └── Cargo.toml
├── Cargo.toml
├── fuel-toolchain.toml
├── .docs
│ ├── fundraiser-logo-dark-theme.png
│ ├── fundraiser-logo-light-theme.png
│ └── fundraiser-sequence-diagram.png
└── Forc.lock
├── name-registry
├── .gitignore
├── Forc.toml
├── registry-contract
│ ├── tests
│ │ ├── functions
│ │ │ ├── mod.rs
│ │ │ ├── info
│ │ │ │ ├── mod.rs
│ │ │ │ └── rate.rs
│ │ │ └── core
│ │ │ │ └── mod.rs
│ │ ├── harness.rs
│ │ └── utils
│ │ │ ├── mod.rs
│ │ │ └── interface
│ │ │ ├── mod.rs
│ │ │ └── info.rs
│ ├── Forc.toml
│ ├── Cargo.toml
│ └── src
│ │ ├── errors.sw
│ │ └── data_structures.sw
├── Cargo.toml
├── fuel-toolchain.toml
├── .docs
│ ├── name-registry-logo-dark-theme.png
│ └── name-registry-logo-light-theme.png
└── Forc.lock
├── native-asset
├── .gitignore
├── Forc.toml
├── native-asset-contract
│ ├── tests
│ │ ├── harness.rs
│ │ ├── utils
│ │ │ └── mod.rs
│ │ └── functions
│ │ │ └── mod.rs
│ ├── src
│ │ ├── interface.sw
│ │ └── errors.sw
│ ├── Forc.toml
│ └── Cargo.toml
├── Cargo.toml
├── fuel-toolchain.toml
├── .docs
│ ├── native-asset-logo-dark-theme.png
│ └── native-asset-logo-light-theme.png
└── Forc.lock
├── counter-script
├── .gitignore
├── counter
│ ├── .gitignore
│ ├── Forc.toml
│ └── src
│ │ └── main.sw
├── libraries
│ ├── .gitignore
│ ├── Forc.toml
│ └── src
│ │ └── interface.sw
├── interaction_script
│ ├── .gitignore
│ ├── Forc.toml
│ └── Cargo.toml
├── Forc.toml
├── Cargo.toml
├── fuel-toolchain.toml
├── .docs
│ ├── counter-script-logo-dark-theme.png
│ └── counter-script-logo-light-theme.png
└── Forc.lock
├── english-auction
├── .gitignore
├── Forc.toml
├── auction-contract
│ ├── tests
│ │ ├── harness.rs
│ │ ├── functions
│ │ │ ├── mod.rs
│ │ │ ├── core
│ │ │ │ └── mod.rs
│ │ │ └── info
│ │ │ │ └── mod.rs
│ │ └── utils
│ │ │ ├── mod.rs
│ │ │ └── interface
│ │ │ ├── mod.rs
│ │ │ └── info.rs
│ ├── src
│ │ ├── data_structures.sw
│ │ └── data_structures
│ │ │ └── state.sw
│ ├── Forc.toml
│ └── Cargo.toml
├── Cargo.toml
├── fuel-toolchain.toml
├── .docs
│ ├── english-auction_dark.png
│ ├── english-auction_light.png
│ └── english-auction-sequence-diagram.png
└── Forc.lock
├── fractional-NFT
├── .gitignore
├── f-NFT-contract
│ ├── .gitignore
│ ├── tests
│ │ ├── harness.rs
│ │ ├── utils
│ │ │ └── mod.rs
│ │ └── functions
│ │ │ └── mod.rs
│ ├── Forc.toml
│ ├── Cargo.toml
│ └── src
│ │ └── errors.sw
├── Forc.toml
├── Cargo.toml
├── .docs
│ ├── f-nft-logo_black.png
│ └── f-nft-logo_white.png
├── fuel-toolchain.toml
└── test-artifacts
│ ├── src
│ └── errors.sw
│ └── Forc.toml
├── multisig-wallet
├── .gitignore
├── multisig-contract
│ ├── tests
│ │ ├── harness.rs
│ │ ├── functions
│ │ │ ├── mod.rs
│ │ │ ├── core
│ │ │ │ └── mod.rs
│ │ │ └── info
│ │ │ │ ├── mod.rs
│ │ │ │ ├── nonce.rs
│ │ │ │ ├── threshold.rs
│ │ │ │ ├── approval_weight.rs
│ │ │ │ └── balance.rs
│ │ └── utils
│ │ │ ├── mod.rs
│ │ │ └── interface
│ │ │ ├── mod.rs
│ │ │ └── target_contract.rs
│ ├── src
│ │ ├── data_structures.sw
│ │ ├── data_structures
│ │ │ ├── user.sw
│ │ │ └── signatures.sw
│ │ └── events.sw
│ ├── Forc.toml
│ └── Cargo.toml
├── Cargo.toml
├── Forc.toml
├── fuel-toolchain.toml
├── .docs
│ ├── multi-signature-logo-dark-theme.png
│ ├── multi-signature-logo-light-theme.png
│ └── multisig-wallet-sequence-diagram.png
├── test-artifacts
│ └── target-contract
│ │ └── Forc.toml
└── Forc.lock
├── TicTacToe
├── .env.production
├── src
│ ├── utils
│ │ ├── index.ts
│ │ └── address.ts
│ ├── contract-types
│ │ ├── index.ts
│ │ ├── contract-ids.json
│ │ ├── contracts
│ │ │ ├── index.ts
│ │ │ └── common.d.ts
│ │ └── common.d.ts
│ ├── vite-env.d.ts
│ ├── queryKeys.ts
│ ├── components
│ │ ├── index.tsx
│ │ ├── Providers.tsx
│ │ ├── ConnectionInfo.tsx
│ │ ├── NewGameButton.tsx
│ │ └── ConnectButton.tsx
│ ├── hooks
│ │ ├── index.ts
│ │ ├── useGetPlayers.ts
│ │ ├── useGetMoveCounter.ts
│ │ ├── useGetCurrentPlayer.ts
│ │ ├── useGetGameBoard.ts
│ │ ├── useGetGameState.ts
│ │ └── useMakeMove.ts
│ ├── main.tsx
│ └── config.ts
├── Forc.toml
├── tictactoe-contract
│ ├── tests
│ │ ├── harness.rs
│ │ ├── functions
│ │ │ └── mod.rs
│ │ └── utils
│ │ │ ├── mod.rs
│ │ │ └── interface.rs
│ ├── Forc.toml
│ ├── Cargo.toml
│ └── src
│ │ ├── data_structures.sw
│ │ ├── errors.sw
│ │ └── events.sw
├── Cargo.toml
├── fuel-toolchain.toml
├── .docs
│ ├── tictactoe-logo-dark-theme.png
│ ├── tictactoe-logo-light-theme.png
│ └── tictactoe-sequence-diagram.png
├── production-contract
│ └── contract-ids.json
├── tsconfig.json
├── .eslintignore
├── .prettierignore
├── tsconfig.node.json
├── vite.config.ts
├── .prettierrc.js
├── .eslintrc
├── Forc.lock
├── index.html
├── .gitignore
└── fuels.config.ts
├── pnpm-workspace.yaml
├── oracle
├── .gitignore
├── oracle-contract
│ ├── tests
│ │ ├── harness.rs
│ │ └── functions
│ │ │ ├── mod.rs
│ │ │ ├── owner.rs
│ │ │ └── price.rs
│ ├── Forc.toml
│ ├── src
│ │ ├── events.sw
│ │ ├── errors.sw
│ │ ├── data_structures.sw
│ │ ├── interface.sw
│ │ └── main.sw
│ └── Cargo.toml
├── oracle-node
│ ├── tests
│ │ └── harness.rs
│ ├── .env.example
│ └── Cargo.toml
├── Forc.toml
├── .docs
│ ├── oracle_diagram.png
│ ├── oracle-logo-dark-theme.png
│ └── oracle-logo-light-theme.png
├── fuel-toolchain.toml
├── Cargo.toml
├── utils
│ └── Cargo.toml
├── Forc.lock
└── SPECIFICATION.md
├── public
└── fuel-logo-64.png
├── scripts
└── build-website
│ └── index.mjs
├── .gitignore
├── vercel.json
├── turbo.json
├── tsconfig.json
├── CHANGELOG.md
└── package.json
/.devops/.template/.docs/.gitkeep:
--------------------------------------------------------------------------------
1 |
--------------------------------------------------------------------------------
/AMM/.gitignore:
--------------------------------------------------------------------------------
1 | target
2 | out
3 |
--------------------------------------------------------------------------------
/DAO/.gitignore:
--------------------------------------------------------------------------------
1 | target
2 | out
3 |
--------------------------------------------------------------------------------
/NFT/.gitignore:
--------------------------------------------------------------------------------
1 | target
2 | out
3 |
--------------------------------------------------------------------------------
/.devops/.template/libraries/.gitkeep:
--------------------------------------------------------------------------------
1 |
--------------------------------------------------------------------------------
/.devops/.template/predicates/.gitkeep:
--------------------------------------------------------------------------------
1 |
--------------------------------------------------------------------------------
/.devops/.template/scripts/.gitkeep:
--------------------------------------------------------------------------------
1 |
--------------------------------------------------------------------------------
/OTC-swap-predicate/SPECIFICATION.md:
--------------------------------------------------------------------------------
1 |
--------------------------------------------------------------------------------
/airdrop/.gitignore:
--------------------------------------------------------------------------------
1 | target
2 | out
3 |
--------------------------------------------------------------------------------
/escrow/.gitignore:
--------------------------------------------------------------------------------
1 | target
2 | out
3 |
--------------------------------------------------------------------------------
/timelock/.gitignore:
--------------------------------------------------------------------------------
1 | target
2 | out
3 |
--------------------------------------------------------------------------------
/.docs/contributing-book/.gitignore:
--------------------------------------------------------------------------------
1 | book
2 |
--------------------------------------------------------------------------------
/.github/CODEOWNERS:
--------------------------------------------------------------------------------
1 | * @FuelLabs/Devrel
2 |
--------------------------------------------------------------------------------
/fundraiser/.gitignore:
--------------------------------------------------------------------------------
1 | target
2 | out
3 |
--------------------------------------------------------------------------------
/name-registry/.gitignore:
--------------------------------------------------------------------------------
1 | target
2 | out
3 |
--------------------------------------------------------------------------------
/native-asset/.gitignore:
--------------------------------------------------------------------------------
1 | target
2 | out
3 |
--------------------------------------------------------------------------------
/OTC-swap-predicate/.gitignore:
--------------------------------------------------------------------------------
1 | target
2 | out
3 |
--------------------------------------------------------------------------------
/counter-script/.gitignore:
--------------------------------------------------------------------------------
1 | target
2 | out
3 |
--------------------------------------------------------------------------------
/english-auction/.gitignore:
--------------------------------------------------------------------------------
1 | target
2 | out
3 |
--------------------------------------------------------------------------------
/fractional-NFT/.gitignore:
--------------------------------------------------------------------------------
1 | target
2 | out
3 |
--------------------------------------------------------------------------------
/multisig-wallet/.gitignore:
--------------------------------------------------------------------------------
1 | target
2 | out
3 |
--------------------------------------------------------------------------------
/.devops/aurora/.gitignore:
--------------------------------------------------------------------------------
1 | *.lock
2 | /target/
3 |
--------------------------------------------------------------------------------
/TicTacToe/.env.production:
--------------------------------------------------------------------------------
1 | VITE_NODE_ENV=production
--------------------------------------------------------------------------------
/counter-script/counter/.gitignore:
--------------------------------------------------------------------------------
1 | out
2 | target
3 |
--------------------------------------------------------------------------------
/pnpm-workspace.yaml:
--------------------------------------------------------------------------------
1 | packages:
2 | - "TicTacToe/"
--------------------------------------------------------------------------------
/counter-script/libraries/.gitignore:
--------------------------------------------------------------------------------
1 | out
2 | target
3 |
--------------------------------------------------------------------------------
/oracle/.gitignore:
--------------------------------------------------------------------------------
1 | target
2 | out
3 | oracle-node/.env
4 |
--------------------------------------------------------------------------------
/oracle/oracle-contract/tests/harness.rs:
--------------------------------------------------------------------------------
1 | mod functions;
2 |
--------------------------------------------------------------------------------
/oracle/oracle-node/tests/harness.rs:
--------------------------------------------------------------------------------
1 | mod functions;
2 |
--------------------------------------------------------------------------------
/timelock/timelock-contract/.gitignore:
--------------------------------------------------------------------------------
1 | out
2 | target
3 |
--------------------------------------------------------------------------------
/.devops/.template/template-contract/src/errors.sw:
--------------------------------------------------------------------------------
1 | library;
2 |
--------------------------------------------------------------------------------
/.devops/.template/template-contract/src/events.sw:
--------------------------------------------------------------------------------
1 | library;
2 |
--------------------------------------------------------------------------------
/.devops/.template/template-contract/src/utils.sw:
--------------------------------------------------------------------------------
1 | library;
2 |
--------------------------------------------------------------------------------
/DAO/Forc.toml:
--------------------------------------------------------------------------------
1 | [workspace]
2 | members = ["./DAO-contract"]
3 |
--------------------------------------------------------------------------------
/NFT/Forc.toml:
--------------------------------------------------------------------------------
1 | [workspace]
2 | members = ["./NFT-contract"]
3 |
--------------------------------------------------------------------------------
/TicTacToe/src/utils/index.ts:
--------------------------------------------------------------------------------
1 | export * from './address';
2 |
--------------------------------------------------------------------------------
/counter-script/interaction_script/.gitignore:
--------------------------------------------------------------------------------
1 | out
2 | target
3 |
--------------------------------------------------------------------------------
/fractional-NFT/f-NFT-contract/.gitignore:
--------------------------------------------------------------------------------
1 | out
2 | target
3 |
--------------------------------------------------------------------------------
/.devops/.template/template-contract/tests/functions/info/mod.rs:
--------------------------------------------------------------------------------
1 |
2 |
--------------------------------------------------------------------------------
/AMM/AMM-contract/tests/harness.rs:
--------------------------------------------------------------------------------
1 | mod functions;
2 | mod utils;
3 |
--------------------------------------------------------------------------------
/DAO/DAO-contract/tests/functions/mod.rs:
--------------------------------------------------------------------------------
1 | mod core;
2 | mod info;
3 |
--------------------------------------------------------------------------------
/NFT/NFT-contract/tests/harness.rs:
--------------------------------------------------------------------------------
1 | mod functions;
2 | mod utils;
3 |
--------------------------------------------------------------------------------
/escrow/Forc.toml:
--------------------------------------------------------------------------------
1 | [workspace]
2 | members = ["./escrow-contract"]
3 |
--------------------------------------------------------------------------------
/oracle/Forc.toml:
--------------------------------------------------------------------------------
1 | [workspace]
2 | members = ["./oracle-contract"]
3 |
--------------------------------------------------------------------------------
/.devops/.template/template-contract/tests/utils/interface/info.rs:
--------------------------------------------------------------------------------
1 |
2 |
--------------------------------------------------------------------------------
/AMM/exchange-contract/tests/harness.rs:
--------------------------------------------------------------------------------
1 | mod functions;
2 | mod utils;
3 |
--------------------------------------------------------------------------------
/AMM/swap-exact-input/tests/cases/mod.rs:
--------------------------------------------------------------------------------
1 | mod revert;
2 | mod success;
3 |
--------------------------------------------------------------------------------
/AMM/swap-exact-output/tests/cases/mod.rs:
--------------------------------------------------------------------------------
1 | mod revert;
2 | mod success;
3 |
--------------------------------------------------------------------------------
/TicTacToe/src/contract-types/index.ts:
--------------------------------------------------------------------------------
1 | export * from './contracts';
2 |
--------------------------------------------------------------------------------
/TicTacToe/src/vite-env.d.ts:
--------------------------------------------------------------------------------
1 | ///
2 |
--------------------------------------------------------------------------------
/airdrop/Forc.toml:
--------------------------------------------------------------------------------
1 | [workspace]
2 | members = ["./airdrop-contract"]
3 |
--------------------------------------------------------------------------------
/escrow/escrow-contract/tests/functions/mod.rs:
--------------------------------------------------------------------------------
1 | mod core;
2 | mod info;
3 |
--------------------------------------------------------------------------------
/escrow/escrow-contract/tests/harness.rs:
--------------------------------------------------------------------------------
1 | mod functions;
2 | mod utils;
3 |
--------------------------------------------------------------------------------
/timelock/Forc.toml:
--------------------------------------------------------------------------------
1 | [workspace]
2 | members = ["./timelock-contract"]
3 |
--------------------------------------------------------------------------------
/AMM/atomic-add-liquidity/tests/cases/mod.rs:
--------------------------------------------------------------------------------
1 | mod revert;
2 | mod success;
3 |
--------------------------------------------------------------------------------
/DAO/DAO-contract/tests/utils/mod.rs:
--------------------------------------------------------------------------------
1 | pub mod interface;
2 | pub mod setup;
3 |
--------------------------------------------------------------------------------
/NFT/NFT-contract/tests/utils/mod.rs:
--------------------------------------------------------------------------------
1 | pub mod interface;
2 | pub mod setup;
3 |
--------------------------------------------------------------------------------
/TicTacToe/Forc.toml:
--------------------------------------------------------------------------------
1 | [workspace]
2 | members = ["./tictactoe-contract"]
3 |
--------------------------------------------------------------------------------
/airdrop/airdrop-contract/tests/functions/mod.rs:
--------------------------------------------------------------------------------
1 | mod core;
2 | mod info;
3 |
--------------------------------------------------------------------------------
/airdrop/airdrop-contract/tests/harness.rs:
--------------------------------------------------------------------------------
1 | mod functions;
2 | mod utils;
3 |
--------------------------------------------------------------------------------
/english-auction/Forc.toml:
--------------------------------------------------------------------------------
1 | [workspace]
2 | members = ["./auction-contract"]
3 |
--------------------------------------------------------------------------------
/fundraiser/Forc.toml:
--------------------------------------------------------------------------------
1 | [workspace]
2 | members = ["./fundraiser-contract"]
3 |
--------------------------------------------------------------------------------
/name-registry/Forc.toml:
--------------------------------------------------------------------------------
1 | [workspace]
2 | members = ["./registry-contract"]
3 |
--------------------------------------------------------------------------------
/timelock/timelock-contract/tests/functions/mod.rs:
--------------------------------------------------------------------------------
1 | mod core;
2 | mod info;
3 |
--------------------------------------------------------------------------------
/.devops/.template/.gitignore:
--------------------------------------------------------------------------------
1 | target
2 | project/contracts/template-contract/out
3 |
--------------------------------------------------------------------------------
/.devops/.template/Forc.toml:
--------------------------------------------------------------------------------
1 | [workspace]
2 | members = ["./template-contract"]
3 |
--------------------------------------------------------------------------------
/.devops/.template/template-contract/src/data_structures/example.sw:
--------------------------------------------------------------------------------
1 | library;
2 |
--------------------------------------------------------------------------------
/.devops/.template/template-contract/tests/functions/core/mod.rs:
--------------------------------------------------------------------------------
1 | mod template;
2 |
--------------------------------------------------------------------------------
/DAO/DAO-contract/tests/utils/interface/mod.rs:
--------------------------------------------------------------------------------
1 | pub mod core;
2 | pub mod info;
3 |
--------------------------------------------------------------------------------
/OTC-swap-predicate/Forc.toml:
--------------------------------------------------------------------------------
1 | [workspace]
2 | members = ["./swap-predicate"]
3 |
--------------------------------------------------------------------------------
/TicTacToe/tictactoe-contract/tests/harness.rs:
--------------------------------------------------------------------------------
1 | mod functions;
2 | mod utils;
3 |
--------------------------------------------------------------------------------
/english-auction/auction-contract/tests/harness.rs:
--------------------------------------------------------------------------------
1 | mod functions;
2 | mod utils;
3 |
--------------------------------------------------------------------------------
/escrow/escrow-contract/tests/utils/mod.rs:
--------------------------------------------------------------------------------
1 | pub mod interface;
2 | pub mod setup;
3 |
--------------------------------------------------------------------------------
/fundraiser/fundraiser-contract/tests/functions/mod.rs:
--------------------------------------------------------------------------------
1 | mod core;
2 | mod info;
3 |
--------------------------------------------------------------------------------
/fundraiser/fundraiser-contract/tests/harness.rs:
--------------------------------------------------------------------------------
1 | mod functions;
2 | mod utils;
3 |
--------------------------------------------------------------------------------
/name-registry/registry-contract/tests/functions/mod.rs:
--------------------------------------------------------------------------------
1 | mod core;
2 | mod info;
3 |
--------------------------------------------------------------------------------
/name-registry/registry-contract/tests/harness.rs:
--------------------------------------------------------------------------------
1 | mod functions;
2 | mod utils;
3 |
--------------------------------------------------------------------------------
/native-asset/Forc.toml:
--------------------------------------------------------------------------------
1 | [workspace]
2 | members = ["./native-asset-contract"]
3 |
--------------------------------------------------------------------------------
/timelock/timelock-contract/tests/harness.rs:
--------------------------------------------------------------------------------
1 | // mod functions;
2 | // mod utils;
3 |
--------------------------------------------------------------------------------
/.devops/.template/template-contract/tests/functions/mod.rs:
--------------------------------------------------------------------------------
1 | mod core;
2 | mod info;
3 |
--------------------------------------------------------------------------------
/.devops/.template/template-contract/tests/harness.rs:
--------------------------------------------------------------------------------
1 | mod functions;
2 | mod utils;
3 |
--------------------------------------------------------------------------------
/TicTacToe/tictactoe-contract/tests/functions/mod.rs:
--------------------------------------------------------------------------------
1 | mod make_move;
2 | mod new_game;
3 |
--------------------------------------------------------------------------------
/airdrop/airdrop-contract/tests/utils/mod.rs:
--------------------------------------------------------------------------------
1 | pub mod interface;
2 | pub mod setup;
3 |
--------------------------------------------------------------------------------
/english-auction/auction-contract/tests/functions/mod.rs:
--------------------------------------------------------------------------------
1 | mod core;
2 | mod info;
3 |
--------------------------------------------------------------------------------
/escrow/escrow-contract/tests/utils/interface/mod.rs:
--------------------------------------------------------------------------------
1 | pub mod core;
2 | pub mod info;
3 |
--------------------------------------------------------------------------------
/fractional-NFT/f-NFT-contract/tests/harness.rs:
--------------------------------------------------------------------------------
1 | pub mod functions;
2 | pub mod utils;
3 |
--------------------------------------------------------------------------------
/multisig-wallet/multisig-contract/tests/harness.rs:
--------------------------------------------------------------------------------
1 | mod functions;
2 | mod utils;
3 |
--------------------------------------------------------------------------------
/native-asset/native-asset-contract/tests/harness.rs:
--------------------------------------------------------------------------------
1 | mod functions;
2 | mod utils;
3 |
--------------------------------------------------------------------------------
/timelock/timelock-contract/tests/utils/mod.rs:
--------------------------------------------------------------------------------
1 | pub mod interface;
2 | pub mod setup;
3 |
--------------------------------------------------------------------------------
/AMM/AMM-contract/tests/functions/mod.rs:
--------------------------------------------------------------------------------
1 | mod add_pool;
2 | mod initialize;
3 | mod pool;
4 |
--------------------------------------------------------------------------------
/TicTacToe/tictactoe-contract/tests/utils/mod.rs:
--------------------------------------------------------------------------------
1 | pub mod interface;
2 | pub mod setup;
3 |
--------------------------------------------------------------------------------
/airdrop/airdrop-contract/tests/utils/interface/mod.rs:
--------------------------------------------------------------------------------
1 | pub mod core;
2 | pub mod info;
3 |
--------------------------------------------------------------------------------
/counter-script/Forc.toml:
--------------------------------------------------------------------------------
1 | [workspace]
2 | members = ["./counter", "./interaction_script"]
3 |
--------------------------------------------------------------------------------
/english-auction/auction-contract/tests/utils/mod.rs:
--------------------------------------------------------------------------------
1 | pub mod interface;
2 | pub mod setup;
3 |
--------------------------------------------------------------------------------
/fractional-NFT/f-NFT-contract/tests/utils/mod.rs:
--------------------------------------------------------------------------------
1 | pub mod interface;
2 | pub mod setup;
3 |
--------------------------------------------------------------------------------
/fundraiser/fundraiser-contract/tests/utils/mod.rs:
--------------------------------------------------------------------------------
1 | pub mod interface;
2 | pub mod setup;
3 |
--------------------------------------------------------------------------------
/name-registry/registry-contract/tests/utils/mod.rs:
--------------------------------------------------------------------------------
1 | pub mod interface;
2 | pub mod setup;
3 |
--------------------------------------------------------------------------------
/timelock/timelock-contract/tests/utils/interface/mod.rs:
--------------------------------------------------------------------------------
1 | pub mod core;
2 | pub mod info;
3 |
--------------------------------------------------------------------------------
/.devops/.template/template-contract/src/data_structures.sw:
--------------------------------------------------------------------------------
1 | library;
2 |
3 | pub mod example;
4 |
--------------------------------------------------------------------------------
/.devops/.template/template-contract/tests/utils/mod.rs:
--------------------------------------------------------------------------------
1 | pub mod interface;
2 | pub mod setup;
3 |
--------------------------------------------------------------------------------
/.docs/issues.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/FuelLabs/sway-applications/HEAD/.docs/issues.png
--------------------------------------------------------------------------------
/DAO/Cargo.toml:
--------------------------------------------------------------------------------
1 | [workspace]
2 | resolver = "2"
3 | members = [
4 | "./DAO-contract",
5 | ]
6 |
--------------------------------------------------------------------------------
/NFT/Cargo.toml:
--------------------------------------------------------------------------------
1 | [workspace]
2 | resolver = "2"
3 | members = [
4 | "./NFT-contract",
5 | ]
6 |
--------------------------------------------------------------------------------
/english-auction/Cargo.toml:
--------------------------------------------------------------------------------
1 | [workspace]
2 | resolver = "2"
3 | members = ["./auction-contract"]
4 |
--------------------------------------------------------------------------------
/english-auction/auction-contract/tests/utils/interface/mod.rs:
--------------------------------------------------------------------------------
1 | pub mod core;
2 | pub mod info;
3 |
--------------------------------------------------------------------------------
/fractional-NFT/Forc.toml:
--------------------------------------------------------------------------------
1 | [workspace]
2 | members = ["./f-NFT-contract", "./test-artifacts"]
3 |
--------------------------------------------------------------------------------
/fundraiser/fundraiser-contract/tests/utils/interface/mod.rs:
--------------------------------------------------------------------------------
1 | pub mod core;
2 | pub mod info;
3 |
--------------------------------------------------------------------------------
/name-registry/registry-contract/tests/utils/interface/mod.rs:
--------------------------------------------------------------------------------
1 | pub mod core;
2 | pub mod info;
3 |
--------------------------------------------------------------------------------
/native-asset/native-asset-contract/tests/utils/mod.rs:
--------------------------------------------------------------------------------
1 | pub mod interface;
2 | pub mod setup;
3 |
--------------------------------------------------------------------------------
/oracle/oracle-contract/tests/functions/mod.rs:
--------------------------------------------------------------------------------
1 | mod owner;
2 | mod price;
3 | mod set_price;
4 |
--------------------------------------------------------------------------------
/.devops/.template/template-contract/tests/utils/interface/mod.rs:
--------------------------------------------------------------------------------
1 | pub mod core;
2 | pub mod info;
3 |
--------------------------------------------------------------------------------
/escrow/Cargo.toml:
--------------------------------------------------------------------------------
1 | [workspace]
2 | resolver = "2"
3 | members = [
4 | "./escrow-contract",
5 | ]
6 |
--------------------------------------------------------------------------------
/multisig-wallet/Cargo.toml:
--------------------------------------------------------------------------------
1 | [workspace]
2 | resolver = "2"
3 | members = ["./multisig-contract"]
4 |
--------------------------------------------------------------------------------
/timelock/timelock-contract/tests/functions/core/mod.rs:
--------------------------------------------------------------------------------
1 | mod cancel;
2 | mod execute;
3 | mod queue;
4 |
--------------------------------------------------------------------------------
/.devops/aurora/src/commands/mod.rs:
--------------------------------------------------------------------------------
1 | pub mod build;
2 | pub mod bump;
3 | pub mod fmt;
4 | pub mod test;
5 |
--------------------------------------------------------------------------------
/airdrop/Cargo.toml:
--------------------------------------------------------------------------------
1 | [workspace]
2 | resolver = "2"
3 | members = [
4 | "./airdrop-contract",
5 | ]
6 |
--------------------------------------------------------------------------------
/airdrop/airdrop-contract/tests/functions/core/mod.rs:
--------------------------------------------------------------------------------
1 | mod claim;
2 | mod clawback;
3 | mod constructor;
4 |
--------------------------------------------------------------------------------
/multisig-wallet/multisig-contract/tests/functions/mod.rs:
--------------------------------------------------------------------------------
1 | pub(crate) mod core;
2 | pub(crate) mod info;
3 |
--------------------------------------------------------------------------------
/multisig-wallet/multisig-contract/tests/utils/mod.rs:
--------------------------------------------------------------------------------
1 | pub(crate) mod interface;
2 | pub(crate) mod setup;
3 |
--------------------------------------------------------------------------------
/public/fuel-logo-64.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/FuelLabs/sway-applications/HEAD/public/fuel-logo-64.png
--------------------------------------------------------------------------------
/timelock/Cargo.toml:
--------------------------------------------------------------------------------
1 | [workspace]
2 | resolver = "2"
3 | members = [
4 | "./timelock-contract",
5 | ]
6 |
--------------------------------------------------------------------------------
/.docs/contributing-book/src/code/.gitignore:
--------------------------------------------------------------------------------
1 | bad_documentation/out
2 | connect_four/out
3 | style_guide/out
4 |
--------------------------------------------------------------------------------
/TicTacToe/Cargo.toml:
--------------------------------------------------------------------------------
1 | [workspace]
2 | resolver = "2"
3 | members = [
4 | "./tictactoe-contract",
5 | ]
6 |
--------------------------------------------------------------------------------
/english-auction/auction-contract/src/data_structures.sw:
--------------------------------------------------------------------------------
1 | library;
2 |
3 | pub mod state;
4 | pub mod auction;
5 |
--------------------------------------------------------------------------------
/fractional-NFT/Cargo.toml:
--------------------------------------------------------------------------------
1 | [workspace]
2 | resolver = "2"
3 | members = [
4 | "./f-NFT-contract",
5 | ]
6 |
--------------------------------------------------------------------------------
/fundraiser/Cargo.toml:
--------------------------------------------------------------------------------
1 | [workspace]
2 | resolver = "2"
3 | members = [
4 | "./fundraiser-contract",
5 | ]
6 |
--------------------------------------------------------------------------------
/name-registry/Cargo.toml:
--------------------------------------------------------------------------------
1 | [workspace]
2 | resolver = "2"
3 | members = [
4 | "./registry-contract",
5 | ]
6 |
--------------------------------------------------------------------------------
/.docs/contributing-book/src/code/Forc.toml:
--------------------------------------------------------------------------------
1 | [workspace]
2 | members = ["./bad_documentation", "./connect_four"]
3 |
--------------------------------------------------------------------------------
/AMM/test-utils/src/lib.rs:
--------------------------------------------------------------------------------
1 | pub mod data_structures;
2 | pub mod interface;
3 | pub mod paths;
4 | pub mod setup;
5 |
--------------------------------------------------------------------------------
/NFT/.docs/nft-logo_black.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/FuelLabs/sway-applications/HEAD/NFT/.docs/nft-logo_black.png
--------------------------------------------------------------------------------
/NFT/.docs/nft-logo_white.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/FuelLabs/sway-applications/HEAD/NFT/.docs/nft-logo_white.png
--------------------------------------------------------------------------------
/OTC-swap-predicate/Cargo.toml:
--------------------------------------------------------------------------------
1 | [workspace]
2 | resolver = "2"
3 | members = [
4 | "./swap-predicate",
5 | ]
6 |
--------------------------------------------------------------------------------
/counter-script/Cargo.toml:
--------------------------------------------------------------------------------
1 | [workspace]
2 | resolver = "2"
3 | members = [
4 | "./interaction_script",
5 | ]
6 |
--------------------------------------------------------------------------------
/multisig-wallet/Forc.toml:
--------------------------------------------------------------------------------
1 | [workspace]
2 | members = ["./multisig-contract", "./test-artifacts/target-contract"]
3 |
--------------------------------------------------------------------------------
/native-asset/Cargo.toml:
--------------------------------------------------------------------------------
1 | [workspace]
2 | resolver = "2"
3 | members = [
4 | "./native-asset-contract",
5 | ]
6 |
--------------------------------------------------------------------------------
/.devops/.template/Cargo.toml:
--------------------------------------------------------------------------------
1 | [workspace]
2 | resolver = "2"
3 | members = [
4 | "./template-contract",
5 | ]
6 |
7 |
--------------------------------------------------------------------------------
/english-auction/auction-contract/tests/functions/core/mod.rs:
--------------------------------------------------------------------------------
1 | mod bid;
2 | mod cancel;
3 | mod create;
4 | mod withdraw;
5 |
--------------------------------------------------------------------------------
/name-registry/registry-contract/tests/functions/info/mod.rs:
--------------------------------------------------------------------------------
1 | mod expiry;
2 | mod identity;
3 | mod owner;
4 | mod rate;
5 |
--------------------------------------------------------------------------------
/AMM/.docs/amm_logo-dark_theme.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/FuelLabs/sway-applications/HEAD/AMM/.docs/amm_logo-dark_theme.png
--------------------------------------------------------------------------------
/DAO/.docs/dao-logo-dark-theme.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/FuelLabs/sway-applications/HEAD/DAO/.docs/dao-logo-dark-theme.png
--------------------------------------------------------------------------------
/oracle/.docs/oracle_diagram.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/FuelLabs/sway-applications/HEAD/oracle/.docs/oracle_diagram.png
--------------------------------------------------------------------------------
/scripts/build-website/index.mjs:
--------------------------------------------------------------------------------
1 | import { buildWebsite, setEnv } from "./utils.mjs";
2 |
3 | setEnv();
4 | buildWebsite();
5 |
--------------------------------------------------------------------------------
/.docs/sway-apps-logo-dark-theme.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/FuelLabs/sway-applications/HEAD/.docs/sway-apps-logo-dark-theme.png
--------------------------------------------------------------------------------
/AMM/.docs/amm-sequence-diagram.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/FuelLabs/sway-applications/HEAD/AMM/.docs/amm-sequence-diagram.png
--------------------------------------------------------------------------------
/AMM/.docs/amm_logo-light_theme.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/FuelLabs/sway-applications/HEAD/AMM/.docs/amm_logo-light_theme.png
--------------------------------------------------------------------------------
/DAO/.docs/dao-logo-light-theme.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/FuelLabs/sway-applications/HEAD/DAO/.docs/dao-logo-light-theme.png
--------------------------------------------------------------------------------
/DAO/.docs/dao-sequence-diagram.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/FuelLabs/sway-applications/HEAD/DAO/.docs/dao-sequence-diagram.png
--------------------------------------------------------------------------------
/english-auction/auction-contract/tests/functions/info/mod.rs:
--------------------------------------------------------------------------------
1 | mod auction_info;
2 | mod deposit_balance;
3 | mod total_auctions;
4 |
--------------------------------------------------------------------------------
/escrow/escrow-contract/tests/functions/info/mod.rs:
--------------------------------------------------------------------------------
1 | mod arbiter_proposal;
2 | mod assets;
3 | mod escrow_count;
4 | mod escrows;
5 |
--------------------------------------------------------------------------------
/timelock/timelock-contract/tests/functions/info/mod.rs:
--------------------------------------------------------------------------------
1 | mod balance;
2 | mod delays;
3 | mod queued;
4 | mod transaction_hash;
5 |
--------------------------------------------------------------------------------
/.docs/sway-apps-logo-light-theme.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/FuelLabs/sway-applications/HEAD/.docs/sway-apps-logo-light-theme.png
--------------------------------------------------------------------------------
/DAO/fuel-toolchain.toml:
--------------------------------------------------------------------------------
1 | [toolchain]
2 | channel = "nightly-2024-05-28"
3 |
4 | [components]
5 | forc = "0.60.0"
6 | fuel-core = "0.26.0"
--------------------------------------------------------------------------------
/NFT/fuel-toolchain.toml:
--------------------------------------------------------------------------------
1 | [toolchain]
2 | channel = "nightly-2024-05-28"
3 |
4 | [components]
5 | forc = "0.60.0"
6 | fuel-core = "0.26.0"
--------------------------------------------------------------------------------
/multisig-wallet/multisig-contract/src/data_structures.sw:
--------------------------------------------------------------------------------
1 | library;
2 |
3 | pub mod user;
4 | pub mod hashing;
5 | pub mod signatures;
6 |
--------------------------------------------------------------------------------
/TicTacToe/fuel-toolchain.toml:
--------------------------------------------------------------------------------
1 | [toolchain]
2 | channel = "nightly-2024-05-28"
3 |
4 | [components]
5 | forc = "0.60.0"
6 | fuel-core = "0.26.0"
--------------------------------------------------------------------------------
/airdrop/fuel-toolchain.toml:
--------------------------------------------------------------------------------
1 | [toolchain]
2 | channel = "nightly-2024-05-28"
3 |
4 | [components]
5 | forc = "0.60.0"
6 | fuel-core = "0.26.0"
--------------------------------------------------------------------------------
/escrow/.docs/escrow-logo-dark-theme.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/FuelLabs/sway-applications/HEAD/escrow/.docs/escrow-logo-dark-theme.png
--------------------------------------------------------------------------------
/escrow/.docs/escrow-logo-light-theme.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/FuelLabs/sway-applications/HEAD/escrow/.docs/escrow-logo-light-theme.png
--------------------------------------------------------------------------------
/escrow/.docs/escrow-sequence-diagram.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/FuelLabs/sway-applications/HEAD/escrow/.docs/escrow-sequence-diagram.png
--------------------------------------------------------------------------------
/escrow/fuel-toolchain.toml:
--------------------------------------------------------------------------------
1 | [toolchain]
2 | channel = "nightly-2024-05-28"
3 |
4 | [components]
5 | forc = "0.59.0"
6 | fuel-core = "0.26.0"
--------------------------------------------------------------------------------
/fundraiser/fuel-toolchain.toml:
--------------------------------------------------------------------------------
1 | [toolchain]
2 | channel = "nightly-2024-05-28"
3 |
4 | [components]
5 | forc = "0.60.0"
6 | fuel-core = "0.26.0"
--------------------------------------------------------------------------------
/oracle/.docs/oracle-logo-dark-theme.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/FuelLabs/sway-applications/HEAD/oracle/.docs/oracle-logo-dark-theme.png
--------------------------------------------------------------------------------
/oracle/.docs/oracle-logo-light-theme.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/FuelLabs/sway-applications/HEAD/oracle/.docs/oracle-logo-light-theme.png
--------------------------------------------------------------------------------
/oracle/fuel-toolchain.toml:
--------------------------------------------------------------------------------
1 | [toolchain]
2 | channel = "nightly-2024-05-28"
3 |
4 | [components]
5 | forc = "0.60.0"
6 | fuel-core = "0.26.0"
--------------------------------------------------------------------------------
/timelock/fuel-toolchain.toml:
--------------------------------------------------------------------------------
1 | [toolchain]
2 | channel = "nightly-2024-05-28"
3 |
4 | [components]
5 | forc = "0.60.0"
6 | fuel-core = "0.26.0"
--------------------------------------------------------------------------------
/airdrop/.docs/airdrop-distributor_dark.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/FuelLabs/sway-applications/HEAD/airdrop/.docs/airdrop-distributor_dark.png
--------------------------------------------------------------------------------
/airdrop/.docs/airdrop-distributor_light.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/FuelLabs/sway-applications/HEAD/airdrop/.docs/airdrop-distributor_light.png
--------------------------------------------------------------------------------
/airdrop/.docs/airdrop-sequence-diagram.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/FuelLabs/sway-applications/HEAD/airdrop/.docs/airdrop-sequence-diagram.png
--------------------------------------------------------------------------------
/counter-script/fuel-toolchain.toml:
--------------------------------------------------------------------------------
1 | [toolchain]
2 | channel = "nightly-2024-05-28"
3 |
4 | [components]
5 | forc = "0.60.0"
6 | fuel-core = "0.26.0"
--------------------------------------------------------------------------------
/english-auction/fuel-toolchain.toml:
--------------------------------------------------------------------------------
1 | [toolchain]
2 | channel = "nightly-2024-05-28"
3 |
4 | [components]
5 | forc = "0.60.0"
6 | fuel-core = "0.26.0"
--------------------------------------------------------------------------------
/fractional-NFT/.docs/f-nft-logo_black.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/FuelLabs/sway-applications/HEAD/fractional-NFT/.docs/f-nft-logo_black.png
--------------------------------------------------------------------------------
/fractional-NFT/.docs/f-nft-logo_white.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/FuelLabs/sway-applications/HEAD/fractional-NFT/.docs/f-nft-logo_white.png
--------------------------------------------------------------------------------
/fractional-NFT/fuel-toolchain.toml:
--------------------------------------------------------------------------------
1 | [toolchain]
2 | channel = "nightly-2024-05-28"
3 |
4 | [components]
5 | forc = "0.60.0"
6 | fuel-core = "0.26.0"
--------------------------------------------------------------------------------
/multisig-wallet/multisig-contract/tests/utils/interface/mod.rs:
--------------------------------------------------------------------------------
1 | pub(crate) mod core;
2 | pub(crate) mod info;
3 | pub(crate) mod target_contract;
4 |
--------------------------------------------------------------------------------
/name-registry/fuel-toolchain.toml:
--------------------------------------------------------------------------------
1 | [toolchain]
2 | channel = "nightly-2024-05-28"
3 |
4 | [components]
5 | forc = "0.60.0"
6 | fuel-core = "0.26.0"
--------------------------------------------------------------------------------
/native-asset/fuel-toolchain.toml:
--------------------------------------------------------------------------------
1 | [toolchain]
2 | channel = "nightly-2024-05-28"
3 |
4 | [components]
5 | forc = "0.60.0"
6 | fuel-core = "0.26.0"
--------------------------------------------------------------------------------
/oracle/Cargo.toml:
--------------------------------------------------------------------------------
1 | [workspace]
2 | resolver = "2"
3 | members = [
4 | "./oracle-contract",
5 | "./oracle-node",
6 | "./utils",
7 | ]
8 |
--------------------------------------------------------------------------------
/timelock/.docs/timelock-logo-dark-theme.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/FuelLabs/sway-applications/HEAD/timelock/.docs/timelock-logo-dark-theme.png
--------------------------------------------------------------------------------
/.devops/aurora/fuel-toolchain.toml:
--------------------------------------------------------------------------------
1 | [toolchain]
2 | channel = "nightly-2024-01-24"
3 |
4 | [components]
5 | forc = "0.49.1"
6 | fuel-core = "0.22.0"
7 |
--------------------------------------------------------------------------------
/NFT/NFT-contract/src/interface.sw:
--------------------------------------------------------------------------------
1 | library;
2 |
3 | abi Constructor {
4 | #[storage(read, write)]
5 | fn constructor(owner: Identity);
6 | }
7 |
--------------------------------------------------------------------------------
/OTC-swap-predicate/fuel-toolchain.toml:
--------------------------------------------------------------------------------
1 | [toolchain]
2 | channel = "nightly-2024-05-28"
3 |
4 | [components]
5 | forc = "0.60.0"
6 | fuel-core = "0.26.0"
--------------------------------------------------------------------------------
/TicTacToe/.docs/tictactoe-logo-dark-theme.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/FuelLabs/sway-applications/HEAD/TicTacToe/.docs/tictactoe-logo-dark-theme.png
--------------------------------------------------------------------------------
/TicTacToe/src/contract-types/contract-ids.json:
--------------------------------------------------------------------------------
1 | {
2 | "tictactoeContract": "0xcfdf5a3b9bd11eb889539b7195c5d255e645b6e29f0878b31319ad09024a5704"
3 | }
--------------------------------------------------------------------------------
/multisig-wallet/fuel-toolchain.toml:
--------------------------------------------------------------------------------
1 | [toolchain]
2 | channel = "nightly-2024-01-24"
3 |
4 | [components]
5 | forc = "0.49.1"
6 | fuel-core = "0.22.0"
7 |
--------------------------------------------------------------------------------
/name-registry/registry-contract/tests/functions/core/mod.rs:
--------------------------------------------------------------------------------
1 | mod extend;
2 | mod register;
3 | mod set_asset;
4 | mod set_identity;
5 | mod set_owner;
6 |
--------------------------------------------------------------------------------
/timelock/.docs/timelock-logo-light-theme.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/FuelLabs/sway-applications/HEAD/timelock/.docs/timelock-logo-light-theme.png
--------------------------------------------------------------------------------
/timelock/.docs/timelock-sequence-diagram.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/FuelLabs/sway-applications/HEAD/timelock/.docs/timelock-sequence-diagram.png
--------------------------------------------------------------------------------
/.devops/.template/fuel-toolchain.toml:
--------------------------------------------------------------------------------
1 | [toolchain]
2 | channel = "nightly-2024-01-24"
3 |
4 | [components]
5 | forc = "0.49.1"
6 | fuel-core = "0.22.0"
7 |
--------------------------------------------------------------------------------
/TicTacToe/.docs/tictactoe-logo-light-theme.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/FuelLabs/sway-applications/HEAD/TicTacToe/.docs/tictactoe-logo-light-theme.png
--------------------------------------------------------------------------------
/TicTacToe/.docs/tictactoe-sequence-diagram.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/FuelLabs/sway-applications/HEAD/TicTacToe/.docs/tictactoe-sequence-diagram.png
--------------------------------------------------------------------------------
/TicTacToe/production-contract/contract-ids.json:
--------------------------------------------------------------------------------
1 | {
2 | "tictactoeContract": "0x2c38ca25d95b642f2ca5dca75a4609c12acae8d8d926dec3bda26818479cdf5c"
3 | }
4 |
--------------------------------------------------------------------------------
/TicTacToe/src/utils/address.ts:
--------------------------------------------------------------------------------
1 | export const shortAddress = (address: string) => {
2 | return `${address.slice(0, 8)}...${address.slice(-4)}`;
3 | };
4 |
--------------------------------------------------------------------------------
/TicTacToe/tsconfig.json:
--------------------------------------------------------------------------------
1 | {
2 | "extends": "../tsconfig.json",
3 | "include": ["src"],
4 | "references": [{ "path": "./tsconfig.node.json" }]
5 | }
6 |
--------------------------------------------------------------------------------
/english-auction/.docs/english-auction_dark.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/FuelLabs/sway-applications/HEAD/english-auction/.docs/english-auction_dark.png
--------------------------------------------------------------------------------
/english-auction/.docs/english-auction_light.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/FuelLabs/sway-applications/HEAD/english-auction/.docs/english-auction_light.png
--------------------------------------------------------------------------------
/fundraiser/.docs/fundraiser-logo-dark-theme.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/FuelLabs/sway-applications/HEAD/fundraiser/.docs/fundraiser-logo-dark-theme.png
--------------------------------------------------------------------------------
/fundraiser/.docs/fundraiser-logo-light-theme.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/FuelLabs/sway-applications/HEAD/fundraiser/.docs/fundraiser-logo-light-theme.png
--------------------------------------------------------------------------------
/fundraiser/.docs/fundraiser-sequence-diagram.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/FuelLabs/sway-applications/HEAD/fundraiser/.docs/fundraiser-sequence-diagram.png
--------------------------------------------------------------------------------
/multisig-wallet/multisig-contract/tests/functions/core/mod.rs:
--------------------------------------------------------------------------------
1 | mod constructor;
2 | mod execute_transaction;
3 | mod set_threshold;
4 | mod set_weight;
5 |
--------------------------------------------------------------------------------
/timelock/.docs/timelock-timestamp-validity.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/FuelLabs/sway-applications/HEAD/timelock/.docs/timelock-timestamp-validity.png
--------------------------------------------------------------------------------
/.docs/contributing-book/src/images/app-filter.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/FuelLabs/sway-applications/HEAD/.docs/contributing-book/src/images/app-filter.png
--------------------------------------------------------------------------------
/AMM/libraries/Forc.toml:
--------------------------------------------------------------------------------
1 | [project]
2 | authors = ["Fuel Labs "]
3 | entry = "interface.sw"
4 | license = "Apache-2.0"
5 | name = "libraries"
6 |
--------------------------------------------------------------------------------
/AMM/swap-exact-input/tests/harness.rs:
--------------------------------------------------------------------------------
1 | // TODO - Fix these tests. All the script tests have a change of failing at random.
2 | // mod cases;
3 | // mod utils;
4 |
--------------------------------------------------------------------------------
/AMM/swap-exact-output/tests/harness.rs:
--------------------------------------------------------------------------------
1 | // TODO - Fix these tests. All the script tests have a change of failing at random.
2 | // mod cases;
3 | // mod utils;
4 |
--------------------------------------------------------------------------------
/DAO/DAO-contract/Forc.toml:
--------------------------------------------------------------------------------
1 | [project]
2 | authors = ["Fuel Labs "]
3 | entry = "main.sw"
4 | license = "Apache-2.0"
5 | name = "DAO-contract"
6 |
--------------------------------------------------------------------------------
/fractional-NFT/f-NFT-contract/tests/functions/mod.rs:
--------------------------------------------------------------------------------
1 | mod deposit;
2 | mod managed_assets;
3 | mod max_depositable;
4 | mod max_withdrawable;
5 | mod withdraw;
6 |
--------------------------------------------------------------------------------
/multisig-wallet/multisig-contract/tests/functions/info/mod.rs:
--------------------------------------------------------------------------------
1 | mod approval_weight;
2 | mod balance;
3 | mod compute_hash;
4 | mod nonce;
5 | mod threshold;
6 |
--------------------------------------------------------------------------------
/.docs/contributing-book/src/code/fuel-toolchain.toml:
--------------------------------------------------------------------------------
1 | [toolchain]
2 | channel = "nightly-2024-05-28"
3 |
4 | [components]
5 | forc = "0.60.0"
6 | fuel-core = "0.26.0"
--------------------------------------------------------------------------------
/AMM/atomic-add-liquidity/tests/harness.rs:
--------------------------------------------------------------------------------
1 | // TODO - Fix these tests. All the script tests have a change of failing at random.
2 | // mod cases;
3 | // mod utils;
4 |
--------------------------------------------------------------------------------
/AMM/fuel-toolchain.toml:
--------------------------------------------------------------------------------
1 | [toolchain]
2 | channel = "nightly-2024-05-28"
3 |
4 | [components]
5 | forc = "0.60.0+nightly.20240528.4fe6f1ed51"
6 | fuel-core = "0.26.0"
--------------------------------------------------------------------------------
/fundraiser/fundraiser-contract/tests/functions/core/mod.rs:
--------------------------------------------------------------------------------
1 | mod cancel_campaign;
2 | mod claim_pledges;
3 | mod create_campaign;
4 | mod pledge;
5 | mod unpledge;
6 |
--------------------------------------------------------------------------------
/name-registry/.docs/name-registry-logo-dark-theme.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/FuelLabs/sway-applications/HEAD/name-registry/.docs/name-registry-logo-dark-theme.png
--------------------------------------------------------------------------------
/native-asset/.docs/native-asset-logo-dark-theme.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/FuelLabs/sway-applications/HEAD/native-asset/.docs/native-asset-logo-dark-theme.png
--------------------------------------------------------------------------------
/native-asset/.docs/native-asset-logo-light-theme.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/FuelLabs/sway-applications/HEAD/native-asset/.docs/native-asset-logo-light-theme.png
--------------------------------------------------------------------------------
/.docs/contributing-book/src/images/filter-dropdown.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/FuelLabs/sway-applications/HEAD/.docs/contributing-book/src/images/filter-dropdown.png
--------------------------------------------------------------------------------
/.docs/contributing-book/src/images/issue-templates.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/FuelLabs/sway-applications/HEAD/.docs/contributing-book/src/images/issue-templates.png
--------------------------------------------------------------------------------
/airdrop/airdrop-contract/tests/functions/info/mod.rs:
--------------------------------------------------------------------------------
1 | mod admin;
2 | mod claim_data;
3 | mod end_block;
4 | mod is_active;
5 | mod merkle_root;
6 | mod number_of_leaves;
7 |
--------------------------------------------------------------------------------
/counter-script/.docs/counter-script-logo-dark-theme.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/FuelLabs/sway-applications/HEAD/counter-script/.docs/counter-script-logo-dark-theme.png
--------------------------------------------------------------------------------
/escrow/escrow-contract/Forc.toml:
--------------------------------------------------------------------------------
1 | [project]
2 | authors = ["Fuel Labs "]
3 | entry = "main.sw"
4 | license = "Apache-2.0"
5 | name = "escrow-contract"
6 |
--------------------------------------------------------------------------------
/name-registry/.docs/name-registry-logo-light-theme.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/FuelLabs/sway-applications/HEAD/name-registry/.docs/name-registry-logo-light-theme.png
--------------------------------------------------------------------------------
/native-asset/native-asset-contract/src/interface.sw:
--------------------------------------------------------------------------------
1 | library;
2 |
3 | abi Constructor {
4 | #[storage(read, write)]
5 | fn constructor(owner: Identity);
6 | }
7 |
--------------------------------------------------------------------------------
/oracle/oracle-contract/Forc.toml:
--------------------------------------------------------------------------------
1 | [project]
2 | authors = ["Fuel Labs "]
3 | entry = "main.sw"
4 | license = "Apache-2.0"
5 | name = "oracle-contract"
6 |
--------------------------------------------------------------------------------
/.docs/contributing-book/src/images/app-documentation.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/FuelLabs/sway-applications/HEAD/.docs/contributing-book/src/images/app-documentation.png
--------------------------------------------------------------------------------
/.docs/contributing-book/src/images/app-filter-assignee.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/FuelLabs/sway-applications/HEAD/.docs/contributing-book/src/images/app-filter-assignee.png
--------------------------------------------------------------------------------
/.docs/contributing-book/src/images/app-filter-comments.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/FuelLabs/sway-applications/HEAD/.docs/contributing-book/src/images/app-filter-comments.png
--------------------------------------------------------------------------------
/DAO/DAO-contract/tests/functions/core/mod.rs:
--------------------------------------------------------------------------------
1 | mod constructor;
2 | mod create_proposal;
3 | mod deposit;
4 | mod execute;
5 | mod unlock_votes;
6 | mod vote;
7 | mod withdraw;
8 |
--------------------------------------------------------------------------------
/DAO/DAO-contract/tests/functions/info/mod.rs:
--------------------------------------------------------------------------------
1 | mod balance;
2 | mod governance_asset_id;
3 | mod proposal;
4 | mod proposal_count;
5 | mod user_balance;
6 | mod user_votes;
7 |
--------------------------------------------------------------------------------
/counter-script/.docs/counter-script-logo-light-theme.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/FuelLabs/sway-applications/HEAD/counter-script/.docs/counter-script-logo-light-theme.png
--------------------------------------------------------------------------------
/english-auction/.docs/english-auction-sequence-diagram.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/FuelLabs/sway-applications/HEAD/english-auction/.docs/english-auction-sequence-diagram.png
--------------------------------------------------------------------------------
/multisig-wallet/.docs/multi-signature-logo-dark-theme.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/FuelLabs/sway-applications/HEAD/multisig-wallet/.docs/multi-signature-logo-dark-theme.png
--------------------------------------------------------------------------------
/multisig-wallet/.docs/multi-signature-logo-light-theme.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/FuelLabs/sway-applications/HEAD/multisig-wallet/.docs/multi-signature-logo-light-theme.png
--------------------------------------------------------------------------------
/multisig-wallet/.docs/multisig-wallet-sequence-diagram.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/FuelLabs/sway-applications/HEAD/multisig-wallet/.docs/multisig-wallet-sequence-diagram.png
--------------------------------------------------------------------------------
/timelock/timelock-contract/Forc.toml:
--------------------------------------------------------------------------------
1 | [project]
2 | authors = ["Fuel Labs "]
3 | entry = "main.sw"
4 | license = "Apache-2.0"
5 | name = "timelock-contract"
6 |
--------------------------------------------------------------------------------
/OTC-swap-predicate/swap-predicate/Forc.toml:
--------------------------------------------------------------------------------
1 | [project]
2 | authors = ["Fuel Labs "]
3 | entry = "main.sw"
4 | license = "Apache-2.0"
5 | name = "swap-predicate"
6 |
--------------------------------------------------------------------------------
/english-auction/auction-contract/Forc.toml:
--------------------------------------------------------------------------------
1 | [project]
2 | authors = ["Fuel Labs "]
3 | entry = "main.sw"
4 | license = "Apache-2.0"
5 | name = "auction-contract"
6 |
--------------------------------------------------------------------------------
/fundraiser/fundraiser-contract/Forc.toml:
--------------------------------------------------------------------------------
1 | [project]
2 | authors = ["Fuel Labs "]
3 | entry = "main.sw"
4 | license = "Apache-2.0"
5 | name = "fundraiser-contract"
6 |
--------------------------------------------------------------------------------
/multisig-wallet/multisig-contract/Forc.toml:
--------------------------------------------------------------------------------
1 | [project]
2 | authors = ["Fuel Labs "]
3 | entry = "main.sw"
4 | license = "Apache-2.0"
5 | name = "multisig-contract"
6 |
--------------------------------------------------------------------------------
/name-registry/registry-contract/Forc.toml:
--------------------------------------------------------------------------------
1 | [project]
2 | authors = ["Fuel Labs "]
3 | entry = "main.sw"
4 | license = "Apache-2.0"
5 | name = "registry-contract"
6 |
--------------------------------------------------------------------------------
/.docs/contributing-book/src/code/connect_four/src/events.sw:
--------------------------------------------------------------------------------
1 | library;
2 |
3 | // ANCHOR: event
4 | pub struct WinnerEvent {
5 | player: Identity,
6 | }
7 | // ANCHOR_END: event
8 |
--------------------------------------------------------------------------------
/OTC-swap-predicate/.docs/otc-swap-predicate-logo-dark-theme.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/FuelLabs/sway-applications/HEAD/OTC-swap-predicate/.docs/otc-swap-predicate-logo-dark-theme.png
--------------------------------------------------------------------------------
/.docs/contributing-book/src/code/connect_four/src/utils.sw:
--------------------------------------------------------------------------------
1 | library;
2 |
3 | use ::data_structures::Game;
4 |
5 | pub fn validate_move(column: u64, game: Game) -> bool {
6 | true
7 | }
8 |
--------------------------------------------------------------------------------
/OTC-swap-predicate/.docs/otc-swap-predicate-logo-light-theme.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/FuelLabs/sway-applications/HEAD/OTC-swap-predicate/.docs/otc-swap-predicate-logo-light-theme.png
--------------------------------------------------------------------------------
/fundraiser/fundraiser-contract/src/data_structures.sw:
--------------------------------------------------------------------------------
1 | library;
2 |
3 | pub mod asset_info;
4 | pub mod campaign_state;
5 | pub mod campaign_info;
6 | pub mod campaign;
7 | pub mod pledge;
8 |
--------------------------------------------------------------------------------
/counter-script/libraries/Forc.toml:
--------------------------------------------------------------------------------
1 | [project]
2 | authors = ["Fuel Labs "]
3 | entry = "interface.sw"
4 | license = "Apache-2.0"
5 | name = "libraries"
6 |
7 | [dependencies]
8 |
--------------------------------------------------------------------------------
/fractional-NFT/test-artifacts/src/errors.sw:
--------------------------------------------------------------------------------
1 | library;
2 |
3 | pub enum MintError {
4 | CannotMintMoreThanOneNFTWithSubId: (),
5 | MaxNFTsMinted: (),
6 | NFTAlreadyMinted: (),
7 | }
8 |
--------------------------------------------------------------------------------
/TicTacToe/tictactoe-contract/Forc.toml:
--------------------------------------------------------------------------------
1 | [project]
2 | authors = ["Fuel Labs "]
3 | entry = "main.sw"
4 | license = "Apache-2.0"
5 | name = "tictactoe-contract"
6 |
7 | [dependencies]
8 |
--------------------------------------------------------------------------------
/oracle/oracle-contract/src/events.sw:
--------------------------------------------------------------------------------
1 | library;
2 |
3 | /// Event for when the price of an asset is updated.
4 | pub struct PriceUpdateEvent {
5 | /// Updated price.
6 | pub price: u64,
7 | }
8 |
--------------------------------------------------------------------------------
/.docs/contributing-book/src/code/connect_four/src/errors.sw:
--------------------------------------------------------------------------------
1 | library;
2 |
3 | // ANCHOR: error
4 | pub enum MoveError {
5 | OccupiedSquare: (),
6 | OutOfBounds: (),
7 | }
8 | // ANCHOR_END: error
9 |
--------------------------------------------------------------------------------
/TicTacToe/src/queryKeys.ts:
--------------------------------------------------------------------------------
1 | export const TicTacToeQueryKeys = {
2 | currentPlayer: 'currentPlayer',
3 | gameBoard: 'gameBoard',
4 | gameState: 'gameState',
5 | moveCounter: 'moveCounter',
6 | };
7 |
--------------------------------------------------------------------------------
/oracle/oracle-contract/src/errors.sw:
--------------------------------------------------------------------------------
1 | library;
2 |
3 | /// Errors related to access control.
4 | pub enum AccessError {
5 | /// The sender is not the owner of the contract.
6 | NotOwner: (),
7 | }
8 |
--------------------------------------------------------------------------------
/.docs/contributing-book/src/code/connect_four/Forc.toml:
--------------------------------------------------------------------------------
1 | [project]
2 | authors = ["Fuel Labs "]
3 | entry = "main.sw"
4 | license = "Apache-2.0"
5 | name = "connect_four"
6 |
7 | [dependencies]
8 |
--------------------------------------------------------------------------------
/.gitignore:
--------------------------------------------------------------------------------
1 | # Generated by Cargo
2 | # will have compiled files and executables
3 | /target/
4 |
5 | # These are backup files generated by rustfmt
6 | **/*.rs.bk
7 |
8 | node_modules
9 | .turbo
10 | dist
11 |
--------------------------------------------------------------------------------
/multisig-wallet/test-artifacts/target-contract/Forc.toml:
--------------------------------------------------------------------------------
1 | [project]
2 | authors = ["Fuel Labs "]
3 | entry = "main.sw"
4 | license = "Apache-2.0"
5 | name = "target-contract"
6 |
7 | [dependencies]
8 |
--------------------------------------------------------------------------------
/timelock/timelock-contract/tests/functions/info/delays.rs:
--------------------------------------------------------------------------------
1 | mod success {
2 |
3 | use crate::utils::{interface::info::delays, setup::setup};
4 |
5 | #[tokio::test]
6 | async fn returns_delays() {}
7 | }
8 |
--------------------------------------------------------------------------------
/.docs/contributing-book/src/code/bad_documentation/Forc.toml:
--------------------------------------------------------------------------------
1 | [project]
2 | authors = ["Fuel Labs "]
3 | entry = "lib.sw"
4 | license = "Apache-2.0"
5 | name = "bad_documentation"
6 |
7 | [dependencies]
8 |
--------------------------------------------------------------------------------
/timelock/timelock-contract/tests/functions/info/balance.rs:
--------------------------------------------------------------------------------
1 | mod success {
2 |
3 | use crate::utils::{interface::info::balance, setup::setup};
4 |
5 | #[tokio::test]
6 | async fn returns_balance() {}
7 | }
8 |
--------------------------------------------------------------------------------
/AMM/AMM-contract/Forc.toml:
--------------------------------------------------------------------------------
1 | [project]
2 | authors = ["Fuel Labs "]
3 | entry = "main.sw"
4 | license = "Apache-2.0"
5 | name = "AMM-contract"
6 |
7 | [dependencies]
8 | libraries = { path = "../libraries" }
9 |
--------------------------------------------------------------------------------
/AMM/exchange-contract/Forc.toml:
--------------------------------------------------------------------------------
1 | [project]
2 | authors = ["Fuel Labs "]
3 | entry = "main.sw"
4 | license = "Apache-2.0"
5 | name = "exchange-contract"
6 |
7 | [dependencies]
8 | libraries = { path = "../libraries" }
9 |
--------------------------------------------------------------------------------
/AMM/swap-exact-input/Forc.toml:
--------------------------------------------------------------------------------
1 | [project]
2 | authors = ["Fuel Labs "]
3 | entry = "main.sw"
4 | license = "Apache-2.0"
5 | name = "swap-exact-input"
6 |
7 | [dependencies]
8 | libraries = { path = "../libraries" }
9 |
--------------------------------------------------------------------------------
/AMM/swap-exact-output/Forc.toml:
--------------------------------------------------------------------------------
1 | [project]
2 | authors = ["Fuel Labs "]
3 | entry = "main.sw"
4 | license = "Apache-2.0"
5 | name = "swap-exact-output"
6 |
7 | [dependencies]
8 | libraries = { path = "../libraries" }
9 |
--------------------------------------------------------------------------------
/counter-script/counter/Forc.toml:
--------------------------------------------------------------------------------
1 | [project]
2 | authors = ["Fuel Labs "]
3 | entry = "main.sw"
4 | license = "Apache-2.0"
5 | name = "counter_contract"
6 |
7 | [dependencies]
8 | libraries = { path = "../libraries" }
9 |
--------------------------------------------------------------------------------
/timelock/timelock-contract/tests/functions/info/transaction_hash.rs:
--------------------------------------------------------------------------------
1 | mod success {
2 |
3 | use crate::utils::{interface::info::transaction_hash, setup::setup};
4 |
5 | #[tokio::test]
6 | async fn returns_hash() {}
7 | }
8 |
--------------------------------------------------------------------------------
/.devops/.template/template-contract/Forc.toml:
--------------------------------------------------------------------------------
1 | [project]
2 | authors = ["Fuel Labs "]
3 | entry = "main.sw"
4 | license = "Apache-2.0"
5 | name = "template-contract"
6 |
7 | [constants]
8 |
9 | [dependencies]
10 |
--------------------------------------------------------------------------------
/AMM/atomic-add-liquidity/Forc.toml:
--------------------------------------------------------------------------------
1 | [project]
2 | authors = ["Fuel Labs "]
3 | entry = "main.sw"
4 | license = "Apache-2.0"
5 | name = "atomic-add-liquidity"
6 |
7 | [dependencies]
8 | libraries = { path = "../libraries" }
9 |
--------------------------------------------------------------------------------
/vercel.json:
--------------------------------------------------------------------------------
1 | {
2 | "$schema": "https://openapi.vercel.sh/vercel.json",
3 | "installCommand": "pnpm install",
4 | "buildCommand": "pnpm build:website",
5 | "outputDirectory": "./dist",
6 | "trailingSlash": true
7 | }
8 |
--------------------------------------------------------------------------------
/counter-script/interaction_script/Forc.toml:
--------------------------------------------------------------------------------
1 | [project]
2 | authors = ["Fuel Labs "]
3 | entry = "main.sw"
4 | license = "Apache-2.0"
5 | name = "interaction_script"
6 |
7 | [dependencies]
8 | libraries = { path = "../libraries" }
9 |
--------------------------------------------------------------------------------
/AMM/Cargo.toml:
--------------------------------------------------------------------------------
1 | [workspace]
2 | resolver = "2"
3 | members = [
4 | "./AMM-contract",
5 | "./exchange-contract",
6 | "./atomic-add-liquidity",
7 | "./swap-exact-input",
8 | "./swap-exact-output",
9 | "./test-utils",
10 | ]
11 |
--------------------------------------------------------------------------------
/NFT/NFT-contract/src/errors.sw:
--------------------------------------------------------------------------------
1 | library;
2 |
3 | pub enum MintError {
4 | CannotMintMoreThanOneNFTWithSubId: (),
5 | MaxNFTsMinted: (),
6 | NFTAlreadyMinted: (),
7 | }
8 |
9 | pub enum SetError {
10 | ValueAlreadySet: (),
11 | }
12 |
--------------------------------------------------------------------------------
/TicTacToe/.eslintignore:
--------------------------------------------------------------------------------
1 |
2 | **/node_modules/
3 | **/coverage/
4 | *.js
5 | *.html
6 | dist
7 | CHANGELOG.md
8 | src/contract-types
9 | contracts
10 | **/*.typegen.ts
11 | .eslintrc.js
12 | **/__generated__/
13 | **/generated/*
14 | .changeset/**.md
15 |
--------------------------------------------------------------------------------
/AMM/Forc.toml:
--------------------------------------------------------------------------------
1 | [workspace]
2 | members = [
3 | "./AMM-contract",
4 | "./exchange-contract",
5 | "./test-utils/test-artifacts/malicious-implementation",
6 | "./atomic-add-liquidity",
7 | "./swap-exact-input",
8 | "./swap-exact-output",
9 | ]
10 |
--------------------------------------------------------------------------------
/native-asset/native-asset-contract/src/errors.sw:
--------------------------------------------------------------------------------
1 | library;
2 |
3 | pub enum AmountError {
4 | AmountMismatch: (),
5 | }
6 |
7 | pub enum MintError {
8 | MaxMinted: (),
9 | }
10 |
11 | pub enum SetError {
12 | ValueAlreadySet: (),
13 | }
14 |
--------------------------------------------------------------------------------
/TicTacToe/.prettierignore:
--------------------------------------------------------------------------------
1 | .coverage_*
2 | .github
3 | CHANGELOG.md
4 | coverage
5 | dist
6 | dist-crx
7 | node_modules
8 | pnpm-lock.yaml
9 | **/*.typegen.ts
10 | .next
11 | **/storybook/**/*
12 | **/__generated__/
13 | **/generated/
14 | .changeset/**.md
15 |
--------------------------------------------------------------------------------
/.devops/aurora/apps.txt:
--------------------------------------------------------------------------------
1 | AMM
2 | DAO
3 | OTC-swap-predicate
4 | airdrop
5 | english-auction
6 | counter-script
7 | escrow
8 | fundraiser
9 | TicTacToe
10 | multisig-wallet
11 | name-registry
12 | NFT
13 | native-asset
14 | fractional-NFT
15 | oracle
16 | timelock
17 |
--------------------------------------------------------------------------------
/TicTacToe/src/components/index.tsx:
--------------------------------------------------------------------------------
1 | export * from './Cell';
2 | export * from './ConnectButton';
3 | export * from './ConnectionInfo';
4 | export * from './NewGameButton';
5 | export * from './Providers';
6 | export * from './Board';
7 | export * from './AppContextProvider';
8 |
--------------------------------------------------------------------------------
/fundraiser/fundraiser-contract/tests/functions/info/mod.rs:
--------------------------------------------------------------------------------
1 | mod asset_count;
2 | mod asset_info_by_count;
3 | mod asset_info_by_id;
4 | mod campaign;
5 | mod campaign_info;
6 | mod pledge_count;
7 | mod pledged;
8 | mod total_campaigns;
9 | mod user_campaign_count;
10 |
--------------------------------------------------------------------------------
/AMM/test-utils/test-artifacts/malicious-implementation/Forc.toml:
--------------------------------------------------------------------------------
1 | [project]
2 | authors = ["Fuel Labs "]
3 | entry = "main.sw"
4 | license = "Apache-2.0"
5 | name = "malicious-implementation"
6 |
7 | [dependencies]
8 | libraries = { path = "../../../libraries" }
9 |
--------------------------------------------------------------------------------
/airdrop/airdrop-contract/Forc.toml:
--------------------------------------------------------------------------------
1 | [project]
2 | authors = ["Fuel Labs "]
3 | entry = "main.sw"
4 | license = "Apache-2.0"
5 | name = "airdrop-contract"
6 |
7 | [dependencies]
8 | sway_libs = { git = "https://github.com/FuelLabs/sway-libs", tag = "v0.21.0" }
9 |
--------------------------------------------------------------------------------
/fractional-NFT/f-NFT-contract/Forc.toml:
--------------------------------------------------------------------------------
1 | [project]
2 | authors = ["Fuel Labs "]
3 | entry = "main.sw"
4 | license = "Apache-2.0"
5 | name = "f-NFT-contract"
6 |
7 | [dependencies]
8 | standards = { git = "https://github.com/FuelLabs/sway-standards", tag = "v0.4.4" }
9 |
--------------------------------------------------------------------------------
/native-asset/native-asset-contract/tests/functions/mod.rs:
--------------------------------------------------------------------------------
1 | mod burn;
2 | mod constructor;
3 | mod decimals;
4 | mod mint;
5 | mod name;
6 | mod owner;
7 | mod set_decimals;
8 | mod set_name;
9 | mod set_symbol;
10 | mod symbol;
11 | mod total_assets;
12 | mod total_supply;
13 |
--------------------------------------------------------------------------------
/TicTacToe/src/hooks/index.ts:
--------------------------------------------------------------------------------
1 | export * from './useNewGame';
2 | export * from './useGetPlayers';
3 | export * from './useGetCurrentPlayer';
4 | export * from './useGetGameState';
5 | export * from './useGetGameBoard';
6 | export * from './useMakeMove';
7 | export * from './useGetMoveCounter';
8 |
--------------------------------------------------------------------------------
/escrow/escrow-contract/tests/functions/core/mod.rs:
--------------------------------------------------------------------------------
1 | mod accept_arbiter;
2 | mod create_escrow;
3 | mod deposit;
4 | mod dispute;
5 | mod propose_arbiter;
6 | mod resolve_dispute;
7 | mod return_deposit;
8 | mod take_payment;
9 | mod transfer_to_seller;
10 | mod withdraw_collateral;
11 |
--------------------------------------------------------------------------------
/.devops/.template/template-contract/src/interface.sw:
--------------------------------------------------------------------------------
1 | library;
2 |
3 | abi Template {
4 | ///
5 | ///
6 | /// # Arguments
7 | ///
8 | /// * ``:
9 | ///
10 | /// # Reverts
11 | ///
12 | /// *
13 | fn template();
14 | }
15 |
--------------------------------------------------------------------------------
/AMM/test-utils/Cargo.toml:
--------------------------------------------------------------------------------
1 | [package]
2 | name = "test-utils"
3 | version = "0.0.0"
4 | authors = ["Fuel Labs "]
5 | edition = "2021"
6 | license = "Apache-2.0"
7 |
8 | [dependencies]
9 | fuels = { version = "0.62.0", features = ["fuel-core-lib"] }
10 |
11 | [lib]
12 | doctest = false
13 |
--------------------------------------------------------------------------------
/TicTacToe/tsconfig.node.json:
--------------------------------------------------------------------------------
1 | {
2 | "compilerOptions": {
3 | "composite": true,
4 | "skipLibCheck": true,
5 | "module": "ESNext",
6 | "moduleResolution": "bundler",
7 | "allowSyntheticDefaultImports": true,
8 | "strict": true
9 | },
10 | "include": ["vite.config.ts"]
11 | }
12 |
--------------------------------------------------------------------------------
/multisig-wallet/multisig-contract/src/data_structures/user.sw:
--------------------------------------------------------------------------------
1 | library;
2 |
3 | /// The information about a specific user.
4 | pub struct User {
5 | /// The wallet address of a user.
6 | address: b256,
7 | /// The number of approvals the user provides when approving.
8 | weight: u64,
9 | }
10 |
--------------------------------------------------------------------------------
/oracle/utils/Cargo.toml:
--------------------------------------------------------------------------------
1 | [project]
2 | name = "utils"
3 | version = "0.0.0"
4 | authors = ["Fuel Labs "]
5 | edition = "2021"
6 | license = "Apache-2.0"
7 |
8 | [dependencies]
9 | fuels = { version = "0.62.0", features = ["fuel-core-lib"] }
10 |
11 | [lib]
12 | test = false
13 | doctest = false
14 |
--------------------------------------------------------------------------------
/TicTacToe/vite.config.ts:
--------------------------------------------------------------------------------
1 | import react from '@vitejs/plugin-react';
2 | import { defineConfig } from 'vite';
3 |
4 | // https://vitejs.dev/config/
5 | export default defineConfig({
6 | base: process.env.TICTACTOE_BASE_URL,
7 | build: {
8 | outDir: process.env.TICTACTOE_DIST,
9 | },
10 | plugins: [react()],
11 | });
12 |
--------------------------------------------------------------------------------
/.github/ISSUE_TEMPLATE/config.yml:
--------------------------------------------------------------------------------
1 | blank_issues_enabled: true
2 | contact_links:
3 | - name: Need Support? Visit the Fuel Forum
4 | url: https://forum.fuel.network
5 | about: >
6 | For support queries, please visit the Fuel Forum at https://forum.fuel.network. Only bug reports and feature requests in this repo are guaranteed a response.
--------------------------------------------------------------------------------
/AMM/exchange-contract/tests/functions/mod.rs:
--------------------------------------------------------------------------------
1 | mod add_liquidity;
2 | mod balance;
3 | mod constructor;
4 | mod deposit;
5 | mod pool_info;
6 | mod preview_add_liquidity;
7 | mod preview_swap_exact_input;
8 | mod preview_swap_exact_output;
9 | mod remove_liquidity;
10 | mod swap_exact_input;
11 | mod swap_exact_output;
12 | mod withdraw;
13 |
--------------------------------------------------------------------------------
/.devops/.template/template-contract/tests/utils/interface/core.rs:
--------------------------------------------------------------------------------
1 | use fuels::{prelude::WalletUnlocked, programs::call_response::FuelCallResponse};
2 |
3 | use crate::utils::setup::Template;
4 |
5 | pub async fn template(contract: &Template) -> FuelCallResponse<()> {
6 | contract.methods().template().call().await.unwrap()
7 | }
8 |
--------------------------------------------------------------------------------
/NFT/NFT-contract/Forc.toml:
--------------------------------------------------------------------------------
1 | [project]
2 | authors = ["Fuel Labs "]
3 | entry = "main.sw"
4 | license = "Apache-2.0"
5 | name = "NFT-contract"
6 |
7 | [dependencies]
8 | standards = { git = "https://github.com/FuelLabs/sway-standards", tag = "v0.4.3" }
9 | sway_libs = { git = "https://github.com/FuelLabs/sway-libs", tag = "v0.21.0" }
10 |
--------------------------------------------------------------------------------
/NFT/NFT-contract/tests/functions/mod.rs:
--------------------------------------------------------------------------------
1 | mod burn;
2 | mod constructor;
3 | mod decimals;
4 | mod is_paused;
5 | mod metadata;
6 | mod mint;
7 | mod name;
8 | mod owner;
9 | mod pause;
10 | mod set_decimals;
11 | mod set_metadata;
12 | mod set_name;
13 | mod set_symbol;
14 | mod symbol;
15 | mod total_assets;
16 | mod total_supply;
17 | mod unpause;
18 |
--------------------------------------------------------------------------------
/oracle/oracle-node/.env.example:
--------------------------------------------------------------------------------
1 | API_URL="https://min-api.cryptocompare.com/data/price?fsym=ETH&tsyms=USD&api_key="
2 | ORACLE_CONTRACT_ID=0x7de13c3e07f345b3d8924682e0a0b201b0d7179aa5e867b36f36aabf9e1cbc4d
3 | WALLET_SECRET=0x0000000000000000000000000000000000000000000000000000000000000001
4 | FUEL_PROVIDER_URL=http://localhost:4000/graphql
5 |
--------------------------------------------------------------------------------
/DAO/Forc.lock:
--------------------------------------------------------------------------------
1 | [[package]]
2 | name = "DAO-contract"
3 | source = "member"
4 | dependencies = ["std"]
5 |
6 | [[package]]
7 | name = "core"
8 | source = "path+from-root-E19CE48B3E858B72"
9 |
10 | [[package]]
11 | name = "std"
12 | source = "git+https://github.com/fuellabs/sway?tag=v0.60.0#2f0392ee35a1e4dd80bd8034962d5b4083dfb8b6"
13 | dependencies = ["core"]
14 |
--------------------------------------------------------------------------------
/fractional-NFT/test-artifacts/Forc.toml:
--------------------------------------------------------------------------------
1 | [project]
2 | authors = ["Fuel Labs "]
3 | entry = "main.sw"
4 | license = "Apache-2.0"
5 | name = "NFT-contract"
6 |
7 | [dependencies]
8 | standards = { git = "https://github.com/FuelLabs/sway-standards", tag = "v0.4.4" }
9 | sway_libs = { git = "https://github.com/FuelLabs/sway-libs", tag = "v0.21.0" }
10 |
--------------------------------------------------------------------------------
/TicTacToe/.prettierrc.js:
--------------------------------------------------------------------------------
1 | const fuelPrettierConfig = require('@fuels/prettier-config');
2 |
3 | /** @type {import("prettier").Config} */
4 | module.exports = {
5 | ...fuelPrettierConfig,
6 | // trailingComma always adds comma on the end of functions params, that can cause
7 | // issues, when a second param can't be undefined.
8 | trailingComma: 'es5',
9 | };
10 |
--------------------------------------------------------------------------------
/escrow/Forc.lock:
--------------------------------------------------------------------------------
1 | [[package]]
2 | name = "core"
3 | source = "path+from-root-148AAAB4460F1A9D"
4 |
5 | [[package]]
6 | name = "escrow-contract"
7 | source = "member"
8 | dependencies = ["std"]
9 |
10 | [[package]]
11 | name = "std"
12 | source = "git+https://github.com/fuellabs/sway?tag=v0.59.0#d9985d8111f94235edba9a08fc71a9513ec2a95c"
13 | dependencies = ["core"]
14 |
--------------------------------------------------------------------------------
/oracle/Forc.lock:
--------------------------------------------------------------------------------
1 | [[package]]
2 | name = "core"
3 | source = "path+from-root-E19CE48B3E858B72"
4 |
5 | [[package]]
6 | name = "oracle-contract"
7 | source = "member"
8 | dependencies = ["std"]
9 |
10 | [[package]]
11 | name = "std"
12 | source = "git+https://github.com/fuellabs/sway?tag=v0.60.0#2f0392ee35a1e4dd80bd8034962d5b4083dfb8b6"
13 | dependencies = ["core"]
14 |
--------------------------------------------------------------------------------
/TicTacToe/.eslintrc:
--------------------------------------------------------------------------------
1 | {
2 | "extends": ["plugin:@fuels/base"],
3 | "rules": {
4 | "import/prefer-default-export": "off",
5 | "import/no-named-as-default": "off",
6 | "import/export": "off",
7 | "import/default": "off",
8 | "no-console": "error",
9 | "@typescript-eslint/no-empty-function": "off",
10 | "jsx-a11y/alt-text": "off"
11 | }
12 | }
13 |
--------------------------------------------------------------------------------
/TicTacToe/Forc.lock:
--------------------------------------------------------------------------------
1 | [[package]]
2 | name = "core"
3 | source = "path+from-root-E19CE48B3E858B72"
4 |
5 | [[package]]
6 | name = "std"
7 | source = "git+https://github.com/fuellabs/sway?tag=v0.60.0#2f0392ee35a1e4dd80bd8034962d5b4083dfb8b6"
8 | dependencies = ["core"]
9 |
10 | [[package]]
11 | name = "tictactoe-contract"
12 | source = "member"
13 | dependencies = ["std"]
14 |
--------------------------------------------------------------------------------
/TicTacToe/index.html:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 | Fuel Tic Tac Toe
7 |
8 |
9 |
10 |
11 |
12 |
13 |
--------------------------------------------------------------------------------
/timelock/Forc.lock:
--------------------------------------------------------------------------------
1 | [[package]]
2 | name = "core"
3 | source = "path+from-root-E19CE48B3E858B72"
4 |
5 | [[package]]
6 | name = "std"
7 | source = "git+https://github.com/fuellabs/sway?tag=v0.60.0#2f0392ee35a1e4dd80bd8034962d5b4083dfb8b6"
8 | dependencies = ["core"]
9 |
10 | [[package]]
11 | name = "timelock-contract"
12 | source = "member"
13 | dependencies = ["std"]
14 |
--------------------------------------------------------------------------------
/.devops/aurora/Cargo.toml:
--------------------------------------------------------------------------------
1 | [package]
2 | name = "aurora"
3 | version = "0.1.0"
4 | edition = "2021"
5 | authors = ["Fuel Labs "]
6 | publish = false
7 |
8 | # See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html
9 |
10 | [dependencies]
11 | anyhow = "1.0.69"
12 | clap = { version = "4.1.6", features = ["derive"] }
13 |
--------------------------------------------------------------------------------
/OTC-swap-predicate/Forc.lock:
--------------------------------------------------------------------------------
1 | [[package]]
2 | name = "core"
3 | source = "path+from-root-E19CE48B3E858B72"
4 |
5 | [[package]]
6 | name = "std"
7 | source = "git+https://github.com/fuellabs/sway?tag=v0.60.0#2f0392ee35a1e4dd80bd8034962d5b4083dfb8b6"
8 | dependencies = ["core"]
9 |
10 | [[package]]
11 | name = "swap-predicate"
12 | source = "member"
13 | dependencies = ["std"]
14 |
--------------------------------------------------------------------------------
/TicTacToe/src/main.tsx:
--------------------------------------------------------------------------------
1 | import React from 'react';
2 | import ReactDOM from 'react-dom/client';
3 |
4 | import App from './App.js';
5 | import { Providers } from './components/index.js';
6 |
7 | ReactDOM.createRoot(document.getElementById('root')!).render(
8 |
9 |
10 |
11 |
12 |
13 | );
14 |
--------------------------------------------------------------------------------
/counter-script/interaction_script/Cargo.toml:
--------------------------------------------------------------------------------
1 | [package]
2 | name = "tests"
3 | version = "0.0.0"
4 | edition = "2021"
5 |
6 |
7 | [dependencies]
8 | fuels = { version = "0.62.0", features = ["fuel-core-lib"] }
9 | tokio = { version = "1.12", features = ["rt", "macros"] }
10 |
11 | [[test]]
12 | harness = true
13 | name = "integration_tests"
14 | path = "tests/harness.rs"
15 |
--------------------------------------------------------------------------------
/english-auction/Forc.lock:
--------------------------------------------------------------------------------
1 | [[package]]
2 | name = "auction-contract"
3 | source = "member"
4 | dependencies = ["std"]
5 |
6 | [[package]]
7 | name = "core"
8 | source = "path+from-root-E19CE48B3E858B72"
9 |
10 | [[package]]
11 | name = "std"
12 | source = "git+https://github.com/fuellabs/sway?tag=v0.60.0#2f0392ee35a1e4dd80bd8034962d5b4083dfb8b6"
13 | dependencies = ["core"]
14 |
--------------------------------------------------------------------------------
/fundraiser/Forc.lock:
--------------------------------------------------------------------------------
1 | [[package]]
2 | name = "core"
3 | source = "path+from-root-E19CE48B3E858B72"
4 |
5 | [[package]]
6 | name = "fundraiser-contract"
7 | source = "member"
8 | dependencies = ["std"]
9 |
10 | [[package]]
11 | name = "std"
12 | source = "git+https://github.com/fuellabs/sway?tag=v0.60.0#2f0392ee35a1e4dd80bd8034962d5b4083dfb8b6"
13 | dependencies = ["core"]
14 |
--------------------------------------------------------------------------------
/name-registry/Forc.lock:
--------------------------------------------------------------------------------
1 | [[package]]
2 | name = "core"
3 | source = "path+from-root-E19CE48B3E858B72"
4 |
5 | [[package]]
6 | name = "registry-contract"
7 | source = "member"
8 | dependencies = ["std"]
9 |
10 | [[package]]
11 | name = "std"
12 | source = "git+https://github.com/fuellabs/sway?tag=v0.60.0#2f0392ee35a1e4dd80bd8034962d5b4083dfb8b6"
13 | dependencies = ["core"]
14 |
--------------------------------------------------------------------------------
/native-asset/native-asset-contract/Forc.toml:
--------------------------------------------------------------------------------
1 | [project]
2 | authors = ["Fuel Labs "]
3 | entry = "main.sw"
4 | license = "Apache-2.0"
5 | name = "native-asset-contract"
6 |
7 | [dependencies]
8 | standards = { git = "https://github.com/FuelLabs/sway-standards", tag = "v0.4.3" }
9 | sway_libs = { git = "https://github.com/FuelLabs/sway-libs", tag = "v0.21.0" }
10 |
--------------------------------------------------------------------------------
/.devops/.template/Forc.lock:
--------------------------------------------------------------------------------
1 | [[package]]
2 | name = "core"
3 | source = "path+from-root-C3992B43B72ADB8C"
4 |
5 | [[package]]
6 | name = "std"
7 | source = "git+https://github.com/fuellabs/sway?tag=v0.49.1#2ac7030570f22510b0ac2a7b5ddf7baa20bdc0e1"
8 | dependencies = ["core"]
9 |
10 | [[package]]
11 | name = "template-contract"
12 | source = "member"
13 | dependencies = ["std"]
14 |
--------------------------------------------------------------------------------
/timelock/timelock-contract/tests/functions/info/queued.rs:
--------------------------------------------------------------------------------
1 | mod success {
2 |
3 | use crate::utils::{
4 | interface::{
5 | core::queue,
6 | info::{queued, transaction_hash},
7 | },
8 | setup::setup,
9 | };
10 |
11 | #[tokio::test]
12 | async fn returns_none() {}
13 |
14 | #[tokio::test]
15 | async fn returns_info() {}
16 | }
17 |
--------------------------------------------------------------------------------
/.docs/contributing-book/book.toml:
--------------------------------------------------------------------------------
1 | [book]
2 | authors = ["Fuel Labs "]
3 | language = "en"
4 | multilingual = false
5 | src = "src"
6 | title = "Contributing to Sway Applications"
7 |
8 | [output.html]
9 | git-repository-url = "https://github.com/FuelLabs/sway-applications"
10 |
11 | [output.html.fold]
12 | enable = true
13 | level = 100 # Allow them to fold but keep it all visible as the default
14 |
--------------------------------------------------------------------------------
/.docs/contributing-book/src/code/connect_four/src/data_structures.sw:
--------------------------------------------------------------------------------
1 | library;
2 |
3 | pub struct Game {
4 | player_one: Player,
5 | player_two: Player,
6 | }
7 |
8 | impl Game {
9 | pub fn new(player_one: Player, player_two: Player) -> Self {
10 | Self {
11 | player_one,
12 | player_two,
13 | }
14 | }
15 | }
16 |
17 | pub struct Player {
18 | score: u64,
19 | }
20 |
--------------------------------------------------------------------------------
/TicTacToe/.gitignore:
--------------------------------------------------------------------------------
1 | out
2 | target
3 |
4 | # Logs
5 | logs
6 | *.log
7 | npm-debug.log*
8 | yarn-debug.log*
9 | yarn-error.log*
10 | pnpm-debug.log*
11 | lerna-debug.log*
12 |
13 | node_modules
14 | dist
15 | dist-ssr
16 | *.local
17 | .env
18 | .fuels
19 |
20 | # Editor directories and files
21 | .vscode/*
22 | !.vscode/extensions.json
23 | .idea
24 | .DS_Store
25 | *.suo
26 | *.ntvs*
27 | *.njsproj
28 | *.sln
29 | *.sw?
30 |
--------------------------------------------------------------------------------
/DAO/DAO-contract/Cargo.toml:
--------------------------------------------------------------------------------
1 | [package]
2 | name = "DAO-contract"
3 | version = "0.0.0"
4 | authors = ["Fuel Labs "]
5 | edition = "2021"
6 | license = "Apache-2.0"
7 |
8 | [dependencies]
9 | fuels = { version = "0.62.0", features = ["fuel-core-lib"] }
10 | tokio = { version = "1.12", features = ["rt", "macros"] }
11 |
12 | [[test]]
13 | harness = true
14 | name = "integration_tests"
15 | path = "tests/harness.rs"
16 |
--------------------------------------------------------------------------------
/TicTacToe/src/contract-types/contracts/index.ts:
--------------------------------------------------------------------------------
1 | /* Autogenerated file. Do not edit manually. */
2 |
3 | /* tslint:disable */
4 | /* eslint-disable */
5 |
6 | /*
7 | Fuels version: 0.76.2
8 | Forc version: 0.51.1
9 | Fuel-Core version: 0.22.1
10 | */
11 |
12 | export type { TictactoeContractAbi } from './TictactoeContractAbi';
13 |
14 | export { TictactoeContractAbi__factory } from './factories/TictactoeContractAbi__factory';
15 |
--------------------------------------------------------------------------------
/escrow/escrow-contract/Cargo.toml:
--------------------------------------------------------------------------------
1 | [project]
2 | name = "escrow-contract"
3 | version = "0.0.0"
4 | authors = ["Fuel Labs "]
5 | edition = "2021"
6 | license = "Apache-2.0"
7 |
8 | [dependencies]
9 | fuels = { version = "0.62.0", features = ["fuel-core-lib"] }
10 | tokio = { version = "1.12", features = ["rt", "macros"] }
11 |
12 | [[test]]
13 | harness = true
14 | name = "integration_tests"
15 | path = "tests/harness.rs"
16 |
--------------------------------------------------------------------------------
/timelock/timelock-contract/Cargo.toml:
--------------------------------------------------------------------------------
1 | [project]
2 | name = "timelock-contract"
3 | version = "0.0.0"
4 | authors = ["Fuel Labs "]
5 | edition = "2021"
6 | license = "Apache-2.0"
7 |
8 | [dependencies]
9 | fuels = { version = "0.62.0", features = ["fuel-core-lib"] }
10 | tokio = { version = "1.12", features = ["rt", "macros"] }
11 |
12 | [[test]]
13 | harness = true
14 | name = "integration_tests"
15 | path = "tests/harness.rs"
16 |
--------------------------------------------------------------------------------
/OTC-swap-predicate/swap-predicate/Cargo.toml:
--------------------------------------------------------------------------------
1 | [project]
2 | name = "swap-predicate"
3 | version = "0.0.0"
4 | authors = ["Fuel Labs "]
5 | edition = "2021"
6 | license = "Apache-2.0"
7 |
8 | [dependencies]
9 | fuels = { version = "0.62.0", features = ["fuel-core-lib"] }
10 | tokio = { version = "1.12", features = ["rt", "macros"] }
11 |
12 | [[test]]
13 | harness = true
14 | name = "integration_tests"
15 | path = "tests/harness.rs"
16 |
--------------------------------------------------------------------------------
/TicTacToe/tictactoe-contract/Cargo.toml:
--------------------------------------------------------------------------------
1 | [project]
2 | name = "tictactoe-contract"
3 | version = "0.0.0"
4 | authors = ["Fuel Labs "]
5 | edition = "2021"
6 | license = "Apache-2.0"
7 |
8 | [dependencies]
9 | fuels = { version = "0.62.0", features = ["fuel-core-lib"] }
10 | tokio = { version = "1.12", features = ["rt", "macros"] }
11 |
12 | [[test]]
13 | harness = true
14 | name = "integration_tests"
15 | path = "tests/harness.rs"
16 |
--------------------------------------------------------------------------------
/english-auction/auction-contract/Cargo.toml:
--------------------------------------------------------------------------------
1 | [project]
2 | name = "auction-contract"
3 | version = "0.0.0"
4 | authors = ["Fuel Labs "]
5 | edition = "2021"
6 | license = "Apache-2.0"
7 |
8 | [dependencies]
9 | fuels = { version = "0.62.0", features = ["fuel-core-lib"] }
10 | tokio = { version = "1.12", features = ["rt", "macros"] }
11 |
12 | [[test]]
13 | harness = true
14 | name = "integration_tests"
15 | path = "tests/harness.rs"
16 |
--------------------------------------------------------------------------------
/name-registry/registry-contract/Cargo.toml:
--------------------------------------------------------------------------------
1 | [project]
2 | name = "registry-contract"
3 | version = "0.0.0"
4 | authors = ["Fuel Labs "]
5 | edition = "2021"
6 | license = "Apache-2.0"
7 |
8 | [dependencies]
9 | fuels = { version = "0.62.0", features = ["fuel-core-lib"] }
10 | tokio = { version = "1.12", features = ["rt", "macros"] }
11 |
12 | [[test]]
13 | harness = true
14 | name = "integration_tests"
15 | path = "tests/harness.rs"
16 |
--------------------------------------------------------------------------------
/.devops/.template/template-contract/Cargo.toml:
--------------------------------------------------------------------------------
1 | [project]
2 | name = "template-contract"
3 | version = "0.0.0"
4 | authors = ["Fuel Labs "]
5 | edition = "2021"
6 | license = "Apache-2.0"
7 |
8 | [dependencies]
9 | fuels = { version = "0.53.0", features = ["fuel-core-lib"] }
10 | tokio = { version = "1.12", features = ["rt", "macros"] }
11 |
12 | [[test]]
13 | harness = true
14 | name = "integration_tests"
15 | path = "tests/harness.rs"
16 |
--------------------------------------------------------------------------------
/TicTacToe/src/config.ts:
--------------------------------------------------------------------------------
1 | import productionContractIds from '../production-contract/contract-ids.json';
2 |
3 | import contractIds from './contract-types/contract-ids.json';
4 |
5 | export const CONTRACT_ID = import.meta.env.PROD
6 | ? productionContractIds.tictactoeContract
7 | : contractIds.tictactoeContract;
8 | export const PROVIDER_URL = import.meta.env.PROD
9 | ? 'https://beta-5.fuel.network/graphql'
10 | : 'http://localhost:4000/graphql';
11 |
--------------------------------------------------------------------------------
/fundraiser/fundraiser-contract/Cargo.toml:
--------------------------------------------------------------------------------
1 | [project]
2 | name = "fundraiser-contract"
3 | version = "0.0.0"
4 | authors = ["Fuel Labs "]
5 | edition = "2021"
6 | license = "Apache-2.0"
7 |
8 | [dependencies]
9 | fuels = { version = "0.62.0", features = ["fuel-core-lib"] }
10 | tokio = { version = "1.12", features = ["rt", "macros"] }
11 |
12 | [[test]]
13 | harness = true
14 | name = "integration_tests"
15 | path = "tests/harness.rs"
16 |
--------------------------------------------------------------------------------
/.docs/contributing-book/src/code/connect_four/src/main.sw:
--------------------------------------------------------------------------------
1 | contract;
2 |
3 | mod data_structures;
4 | mod interface;
5 |
6 | use ::data_structures::{Game, Player};
7 | use ::interface::ConnectFour;
8 |
9 | impl ConnectFour for Contract {
10 | fn create_game(player_one: Player, player_two: Player) -> Game {
11 | Game::new(player_one, player_two)
12 | }
13 |
14 | fn move(_column: u64, game: Game) -> Game {
15 | game
16 | }
17 | }
18 |
--------------------------------------------------------------------------------
/AMM/AMM-contract/Cargo.toml:
--------------------------------------------------------------------------------
1 | [package]
2 | name = "AMM-contract"
3 | version = "0.0.0"
4 | authors = ["Fuel Labs "]
5 | edition = "2021"
6 | license = "Apache-2.0"
7 |
8 | [dependencies]
9 | fuels = { version = "0.62.0", features = ["fuel-core-lib"] }
10 | test-utils = { path = "../test-utils" }
11 | tokio = { version = "1.21.0", features = ["rt", "macros"] }
12 |
13 | [[test]]
14 | harness = true
15 | name = "tests"
16 | path = "tests/harness.rs"
17 |
--------------------------------------------------------------------------------
/NFT/NFT-contract/Cargo.toml:
--------------------------------------------------------------------------------
1 | [project]
2 | name = "NFT-contract"
3 | version = "0.0.0"
4 | authors = ["Fuel Labs "]
5 | edition = "2021"
6 | license = "Apache-2.0"
7 |
8 | [dependencies]
9 | fuels = { version = "0.62.0", features = ["fuel-core-lib"] }
10 | sha2 = { version = "0.10.7" }
11 | tokio = { version = "1.12", features = ["rt", "macros"] }
12 |
13 | [[test]]
14 | harness = true
15 | name = "integration_tests"
16 | path = "tests/harness.rs"
17 |
--------------------------------------------------------------------------------
/.docs/contributing-book/src/documentation/project-quality/documentation/code/style.md:
--------------------------------------------------------------------------------
1 | # Style Guide
2 |
3 | Programming languages have different ways of styling code i.e. how variables, functions, structures etc. are written. These are not syntactical rules, but rather a set of conventions and best practices to encourage standardization and improve readability. Sway has a style guide which can be found in the [Sway Reference](https://fuellabs.github.io/sway/master/reference/)
4 |
--------------------------------------------------------------------------------
/oracle/oracle-contract/Cargo.toml:
--------------------------------------------------------------------------------
1 | [project]
2 | name = "oracle-contract"
3 | version = "0.0.0"
4 | authors = ["Fuel Labs "]
5 | edition = "2021"
6 | license = "Apache-2.0"
7 |
8 | [dependencies]
9 | fuels = { version = "0.62.0", features = ["fuel-core-lib"] }
10 | tokio = { version = "1.12", features = ["full"] }
11 | utils = { path = "../utils" }
12 |
13 | [[test]]
14 | harness = true
15 | name = "integration_tests"
16 | path = "tests/harness.rs"
17 |
--------------------------------------------------------------------------------
/AMM/exchange-contract/Cargo.toml:
--------------------------------------------------------------------------------
1 | [package]
2 | name = "exchange-contract"
3 | version = "0.0.0"
4 | authors = ["Fuel Labs "]
5 | edition = "2021"
6 | license = "Apache-2.0"
7 |
8 | [dependencies]
9 | fuels = { version = "0.62.0", features = ["fuel-core-lib"] }
10 | test-utils = { path = "../test-utils" }
11 | tokio = { version = "1.21.0", features = ["rt", "macros"] }
12 |
13 | [[test]]
14 | harness = true
15 | name = "tests"
16 | path = "tests/harness.rs"
17 |
--------------------------------------------------------------------------------
/AMM/swap-exact-input/Cargo.toml:
--------------------------------------------------------------------------------
1 | [package]
2 | name = "swap-exact-input"
3 | version = "0.0.0"
4 | authors = ["Fuel Labs "]
5 | edition = "2021"
6 | license = "Apache-2.0"
7 |
8 | [dev-dependencies]
9 | fuels = { version = "0.62.0", features = ["fuel-core-lib"] }
10 | test-utils = { path = "../test-utils" }
11 | tokio = { version = "1.12", features = ["rt", "macros"] }
12 |
13 | [[test]]
14 | harness = true
15 | name = "tests"
16 | path = "tests/harness.rs"
17 |
--------------------------------------------------------------------------------
/DAO/DAO-contract/tests/harness.rs:
--------------------------------------------------------------------------------
1 | // TODO: Until the SDK supports block manipulation changing tests may break them because of the
2 | // specifically& selected block dead&lines so your test might b&e correct but the deadline is
3 | // messing up the test
4 | // - votes
5 | // - panics_on_expired_proposal (need SDK to manipulate block height)
6 | //
7 | // When logging is deserialized in the SDK, check logs are correct
8 |
9 | mod functions;
10 | mod utils;
11 |
--------------------------------------------------------------------------------
/AMM/swap-exact-output/Cargo.toml:
--------------------------------------------------------------------------------
1 | [package]
2 | name = "swap-exact-output"
3 | version = "0.0.0"
4 | authors = ["Fuel Labs "]
5 | edition = "2021"
6 | license = "Apache-2.0"
7 |
8 | [dev-dependencies]
9 | fuels = { version = "0.62.0", features = ["fuel-core-lib"] }
10 | test-utils = { path = "../test-utils" }
11 | tokio = { version = "1.12", features = ["rt", "macros"] }
12 |
13 | [[test]]
14 | harness = true
15 | name = "tests"
16 | path = "tests/harness.rs"
17 |
--------------------------------------------------------------------------------
/DAO/DAO-contract/src/utils.sw:
--------------------------------------------------------------------------------
1 | library;
2 |
3 | use ::errors::UserError;
4 |
5 | /// Validates that the given id is within the given count.
6 | ///
7 | /// # Arguments
8 | ///
9 | /// * `id`: [u64] - The id to validate.
10 | /// * `count`: [u64] - The count to validate against.
11 | ///
12 | /// # Reverts
13 | ///
14 | /// * When the id is greater than or equal to the count.
15 | pub fn validate_id(id: u64, count: u64) {
16 | require(id < count, UserError::InvalidId);
17 | }
18 |
--------------------------------------------------------------------------------
/fractional-NFT/f-NFT-contract/Cargo.toml:
--------------------------------------------------------------------------------
1 | [project]
2 | name = "f-NFT-contract"
3 | version = "0.0.0"
4 | authors = ["Fuel Labs "]
5 | edition = "2021"
6 | license = "Apache-2.0"
7 |
8 | [dependencies]
9 | fuels = { version = "0.62.0", features = ["fuel-core-lib"] }
10 | sha2 = { version = "0.10.7" }
11 | tokio = { version = "1.12", features = ["rt", "macros"] }
12 |
13 | [[test]]
14 | harness = true
15 | name = "integration_tests"
16 | path = "tests/harness.rs"
17 |
--------------------------------------------------------------------------------
/multisig-wallet/Forc.lock:
--------------------------------------------------------------------------------
1 | [[package]]
2 | name = "core"
3 | source = "path+from-root-C3992B43B72ADB8C"
4 |
5 | [[package]]
6 | name = "multisig-contract"
7 | source = "member"
8 | dependencies = ["std"]
9 |
10 | [[package]]
11 | name = "std"
12 | source = "git+https://github.com/fuellabs/sway?tag=v0.49.1#2ac7030570f22510b0ac2a7b5ddf7baa20bdc0e1"
13 | dependencies = ["core"]
14 |
15 | [[package]]
16 | name = "target-contract"
17 | source = "member"
18 | dependencies = ["std"]
19 |
--------------------------------------------------------------------------------
/AMM/atomic-add-liquidity/Cargo.toml:
--------------------------------------------------------------------------------
1 | [package]
2 | name = "atomic-add-liquidity"
3 | version = "0.0.0"
4 | authors = ["Fuel Labs "]
5 | edition = "2021"
6 | license = "Apache-2.0"
7 |
8 | [dev-dependencies]
9 | fuels = { version = "0.62.0", features = ["fuel-core-lib"] }
10 | test-utils = { path = "../test-utils" }
11 | tokio = { version = "1.12", features = ["rt", "macros"] }
12 |
13 | [[test]]
14 | harness = true
15 | name = "tests"
16 | path = "tests/harness.rs"
17 |
--------------------------------------------------------------------------------
/.docs/contributing-book/src/code/Forc.lock:
--------------------------------------------------------------------------------
1 | [[package]]
2 | name = "bad_documentation"
3 | source = "member"
4 | dependencies = ["std"]
5 |
6 | [[package]]
7 | name = "connect_four"
8 | source = "member"
9 | dependencies = ["std"]
10 |
11 | [[package]]
12 | name = "core"
13 | source = "path+from-root-E19CE48B3E858B72"
14 |
15 | [[package]]
16 | name = "std"
17 | source = "git+https://github.com/fuellabs/sway?tag=v0.60.0#2f0392ee35a1e4dd80bd8034962d5b4083dfb8b6"
18 | dependencies = ["core"]
19 |
--------------------------------------------------------------------------------
/multisig-wallet/multisig-contract/Cargo.toml:
--------------------------------------------------------------------------------
1 | [project]
2 | name = "multisig-contract"
3 | version = "0.0.0"
4 | authors = ["Fuel Labs "]
5 | edition = "2021"
6 | license = "Apache-2.0"
7 |
8 | [dependencies]
9 | fuels = { version = "0.53.0", features = ["fuel-core-lib"] }
10 | rand = "0.8"
11 | sha3 = "0.10.8"
12 | tokio = { version = "1.12", features = ["rt", "macros"] }
13 |
14 | [[test]]
15 | harness = true
16 | name = "integration_tests"
17 | path = "tests/harness.rs"
18 |
--------------------------------------------------------------------------------
/native-asset/native-asset-contract/Cargo.toml:
--------------------------------------------------------------------------------
1 | [project]
2 | name = "native-asset-contract"
3 | version = "0.0.0"
4 | authors = ["Fuel Labs "]
5 | edition = "2021"
6 | license = "Apache-2.0"
7 |
8 | [dependencies]
9 | fuels = { version = "0.62.0", features = ["fuel-core-lib"] }
10 | sha2 = { version = "0.10.7" }
11 | tokio = { version = "1.12", features = ["rt", "macros"] }
12 |
13 | [[test]]
14 | harness = true
15 | name = "integration_tests"
16 | path = "tests/harness.rs"
17 |
--------------------------------------------------------------------------------
/fundraiser/fundraiser-contract/src/data_structures/asset_info.sw:
--------------------------------------------------------------------------------
1 | library;
2 |
3 | /// Used to track the total amount pledged to an asset.
4 | pub struct AssetInfo {
5 | /// The amount that is currently pledged.
6 | pub amount: u64,
7 | }
8 |
9 | impl AssetInfo {
10 | /// Creates a new `AssetInfo` with no pledges.
11 | ///
12 | /// # Returns
13 | ///
14 | /// * [AssetInfo] - The new `AssetInfo`.
15 | pub fn new() -> Self {
16 | Self { amount: 0 }
17 | }
18 | }
19 |
--------------------------------------------------------------------------------
/fundraiser/fundraiser-contract/src/data_structures/campaign.sw:
--------------------------------------------------------------------------------
1 | library;
2 |
3 | /// Used to track the campaigns that a user has created.
4 | pub struct Campaign {
5 | /// The unique identifier for the campaign.
6 | pub id: u64,
7 | }
8 |
9 | impl Campaign {
10 | /// Creates a new campaign.
11 | ///
12 | /// # Arguments
13 | ///
14 | /// * `id`: [u64] - The unique identifier for the campaign.
15 | pub fn new(id: u64) -> Self {
16 | Self { id }
17 | }
18 | }
19 |
--------------------------------------------------------------------------------
/oracle/oracle-contract/tests/functions/owner.rs:
--------------------------------------------------------------------------------
1 | use fuels::{prelude::Address, types::Identity};
2 | use utils::{abi_calls::owner, test_helpers::setup};
3 |
4 | mod success {
5 | use super::*;
6 |
7 | #[tokio::test]
8 | async fn can_get_owner() {
9 | let (user, _) = setup().await;
10 | let owner = owner(&user.oracle).await;
11 | assert_eq!(
12 | owner,
13 | Identity::Address(Address::from(user.wallet.address()))
14 | );
15 | }
16 | }
17 |
--------------------------------------------------------------------------------
/fundraiser/fundraiser-contract/src/utils.sw:
--------------------------------------------------------------------------------
1 | library;
2 |
3 | use ::errors::UserError;
4 |
5 | /// Ensures that the given id is valid.
6 | ///
7 | /// # Arguments
8 | ///
9 | /// * `id`: [u64] - The id to validate.
10 | /// * `count`: [u64] - The count to validate against.
11 | ///
12 | /// # Reverts
13 | ///
14 | /// * When the id is 0.
15 | /// * When the id is higher than the count.
16 | pub fn validate_campaign_id(id: u64, count: u64) {
17 | require(id != 0 && id <= count, UserError::InvalidID);
18 | }
19 |
--------------------------------------------------------------------------------
/TicTacToe/fuels.config.ts:
--------------------------------------------------------------------------------
1 | import { createConfig } from 'fuels';
2 |
3 | const isProd = process.env.NODE_ENV === 'production';
4 |
5 | export default createConfig({
6 | workspace: './',
7 | output: isProd ? './production-contract' : './src/contract-types',
8 | useBuiltinForc: false,
9 | useBuiltinFuelCore: true,
10 | autoStartFuelCore: true,
11 | chainConfig: './chainConfig.json',
12 | providerUrl: isProd
13 | ? 'https://beta-5.fuel.network/graphql'
14 | : 'http://127.0.0.1:4000/graphql',
15 | });
16 |
--------------------------------------------------------------------------------
/airdrop/airdrop-contract/Cargo.toml:
--------------------------------------------------------------------------------
1 | [project]
2 | name = "distributor-contract"
3 | version = "0.0.0"
4 | authors = ["Fuel Labs "]
5 | edition = "2021"
6 | license = "Apache-2.0"
7 |
8 | [dependencies]
9 | fuel-merkle = { version = "0.33.0" }
10 | fuels = { version = "0.62.0", features = ["fuel-core-lib"] }
11 | sha2 = { version = "0.10.7" }
12 | tokio = { version = "1.12", features = ["rt", "macros"] }
13 |
14 | [[test]]
15 | harness = true
16 | name = "integration_tests"
17 | path = "tests/harness.rs"
18 |
--------------------------------------------------------------------------------
/.devops/.template/template-contract/src/main.sw:
--------------------------------------------------------------------------------
1 | contract;
2 |
3 | mod data_structures;
4 | mod errors;
5 | mod events;
6 | mod interface;
7 | mod utils;
8 |
9 | // These are example files so they contain no code. Have to use * to import.
10 | // Avoid using * imports in applications. Explicitly import dependencies whenever possible.
11 | use ::data_structures::example::*;
12 | use ::errors::*;
13 | use ::events::*;
14 | use ::interface::Template;
15 | use ::utils::*;
16 |
17 | impl Template for Contract {
18 | fn template() {}
19 | }
20 |
--------------------------------------------------------------------------------
/turbo.json:
--------------------------------------------------------------------------------
1 | {
2 | "$schema": "https://turbo.build/schema.json",
3 | "globalDependencies": [".env", ".env.production", ".env.test"],
4 | "globalEnv": ["NODE_ENV"],
5 | "pipeline": {
6 | "ts:check": {
7 | "dependsOn": [],
8 | "outputs": ["./**/*.typegen.ts"]
9 | },
10 | "build": {
11 | "dependsOn": ["ts:check"],
12 | "outputs": ["dist/**"]
13 | },
14 | "build:all": {
15 | "dependsOn": ["^build"],
16 | "outputs": ["dist/**", "./dist"]
17 | }
18 | }
19 | }
20 |
--------------------------------------------------------------------------------
/TicTacToe/tictactoe-contract/src/data_structures.sw:
--------------------------------------------------------------------------------
1 | library;
2 |
3 | use core::ops::Eq;
4 |
5 | /// Represents the state of a game.
6 | pub enum State {
7 | /// The game is currently being played.
8 | Playing: (),
9 | /// The game has ended.
10 | Ended: (),
11 | }
12 |
13 | impl Eq for State {
14 | fn eq(self, other: Self) -> bool {
15 | match (self, other) {
16 | (State::Playing, State::Playing) => true,
17 | (State::Ended, State::Ended) => true,
18 | _ => false,
19 | }
20 | }
21 | }
22 |
--------------------------------------------------------------------------------
/timelock/timelock-contract/src/data_structures.sw:
--------------------------------------------------------------------------------
1 | library;
2 |
3 | /// Asset used for transfer during execution.
4 | pub struct Asset {
5 | /// The quantity of an asset.
6 | pub amount: u64,
7 | /// Identifier used to distinguish assets.
8 | pub id: AssetId,
9 | }
10 |
11 | /// Represents the time range in which a transaction may be executed.
12 | pub struct ExecutionRange {
13 | /// The earliest time a transaction may be executed.
14 | pub start: u64,
15 | /// The latest time a transaction may be executed.
16 | pub end: u64,
17 | }
18 |
--------------------------------------------------------------------------------
/AMM/AMM-contract/src/errors.sw:
--------------------------------------------------------------------------------
1 | library;
2 |
3 | /// Determines the type of error during initialisation.
4 | pub enum InitError {
5 | /// The exchange bytecode root has already been set.
6 | BytecodeRootAlreadySet: (),
7 | /// The exchange bytecode root passed in does not match the set exchange bytecode root.
8 | BytecodeRootDoesNotMatch: (),
9 | /// The exchange bytecode root has not been set.
10 | BytecodeRootNotSet: (),
11 | /// The asset pair passed in does not match the asset pair from the set exchange bytecode root.
12 | PairDoesNotDefinePool: (),
13 | }
14 |
--------------------------------------------------------------------------------
/english-auction/auction-contract/src/data_structures/state.sw:
--------------------------------------------------------------------------------
1 | library;
2 |
3 | /// The state of an auction.
4 | pub enum State {
5 | /// The state at which the auction is no longer accepting bids.
6 | Closed: (),
7 | /// The state where bids may be placed on an auction.
8 | Open: (),
9 | }
10 |
11 | impl core::ops::Eq for State {
12 | fn eq(self, other: Self) -> bool {
13 | match (self, other) {
14 | (State::Open, State::Open) => true,
15 | (State::Closed, State::Closed) => true,
16 | _ => false,
17 | }
18 | }
19 | }
20 |
--------------------------------------------------------------------------------
/.docs/contributing-book/src/documentation/project-quality/project-structure/index.md:
--------------------------------------------------------------------------------
1 | # Project Structure
2 |
3 | In order to navigate through a project easily, there needs to be a structure that compartmentalizes concepts. This means that code is grouped together based on some concept.
4 |
5 | The following sections will outline the structures of broadly two kinds of projects:
6 |
7 | - [Internal project](internal.md)
8 | - Projects that do not need to expose any interface for external use
9 | - [External project](external.md)
10 | - Projects that expose an interface that can be imported into other projects
--------------------------------------------------------------------------------
/.docs/contributing-book/src/documentation/pull-requests/index.md:
--------------------------------------------------------------------------------
1 | # Pull Requests
2 |
3 | A pull request is a term used to identify when a piece of work is ready to be pulled into and merged with another piece of work. This functionality is especially useful when collaborating with others because it allows a review process to take place.
4 |
5 | In order to create a high quality pull request there are a couple areas that need to be considered:
6 |
7 | - [Committing your work](commit.md)
8 | - How to incrementally save your work
9 | - [Creating a pull request](creating-pr.md)
10 | - How to request a review
11 |
--------------------------------------------------------------------------------
/oracle/oracle-contract/src/data_structures.sw:
--------------------------------------------------------------------------------
1 | library;
2 |
3 | use core::ops::Eq;
4 |
5 | /// Represents the state of the oracle.
6 | pub enum State {
7 | /// The oracle has not been initialized.
8 | NotInitialized: (),
9 | /// The oracle has been initialized.
10 | Initialized: (),
11 | }
12 |
13 | impl Eq for State {
14 | fn eq(self, other: Self) -> bool {
15 | match (self, other) {
16 | (State::Initialized, State::Initialized) => true,
17 | (State::NotInitialized, State::NotInitialized) => true,
18 | _ => false,
19 | }
20 | }
21 | }
22 |
--------------------------------------------------------------------------------
/AMM/AMM-contract/src/events.sw:
--------------------------------------------------------------------------------
1 | library;
2 |
3 | /// The information logged when a pool is registered.
4 | pub struct RegisterPoolEvent {
5 | /// The pair of asset identifiers that make up the pool.
6 | pub asset_pair: (AssetId, AssetId),
7 | /// The exchange contract identifier that manages the pool which also identifies the pool asset.
8 | pub pool: ContractId,
9 | }
10 |
11 | /// The information logged when an exchange bytecode root is set.
12 | pub struct SetExchangeBytecodeRootEvent {
13 | /// The bytecode root of the valid exchange contract implementation.
14 | pub root: b256,
15 | }
16 |
--------------------------------------------------------------------------------
/counter-script/counter/src/main.sw:
--------------------------------------------------------------------------------
1 | contract;
2 |
3 | use libraries::Counter;
4 |
5 | storage {
6 | /// Internal counter updated via calls from a script.
7 | count: u64 = 0,
8 | }
9 |
10 | impl Counter for Contract {
11 | #[storage(read, write)]
12 | fn increment() -> u64 {
13 | let count = storage.count.read() + 1;
14 | storage.count.write(count);
15 | count
16 | }
17 |
18 | #[storage(read)]
19 | fn count() -> u64 {
20 | storage.count.read()
21 | }
22 |
23 | #[storage(write)]
24 | fn clear() {
25 | storage.count.write(0);
26 | }
27 | }
28 |
--------------------------------------------------------------------------------
/.devops/.template/template-contract/tests/functions/core/template.rs:
--------------------------------------------------------------------------------
1 | use crate::utils::{interface::core::template, setup::setup};
2 |
3 | mod success {
4 | use super::*;
5 |
6 | #[tokio::test]
7 | async fn pass() {
8 | let (instance, _wallet) = setup().await;
9 | let _response = template(&instance).await;
10 | }
11 | }
12 |
13 | mod revert {
14 | use super::*;
15 |
16 | #[tokio::test]
17 | #[should_panic]
18 | // #[should_panic(expected = "SomeErrorMessage")]
19 | async fn fail() {
20 | let (_instance, _wallet) = setup().await;
21 | panic!();
22 | }
23 | }
24 |
--------------------------------------------------------------------------------
/TicTacToe/tictactoe-contract/src/errors.sw:
--------------------------------------------------------------------------------
1 | library;
2 |
3 | /// Errors related to the state of the game.
4 | pub enum GameStateError {
5 | /// The game has ended.
6 | GameHasEnded: (),
7 | /// The game has not ended.
8 | GameHasNotEnded: (),
9 | }
10 |
11 | /// Errors made by players.
12 | pub enum PlayerError {
13 | /// It is not the player's turn.
14 | IncorrectPlayerTurn: (),
15 | }
16 |
17 | /// Errors related to the position of a cell.
18 | pub enum PositionError {
19 | /// The cell is occupied.
20 | CellIsNotEmpty: (),
21 | /// The cell is out of bounds.
22 | InvalidPosition: (),
23 | }
24 |
--------------------------------------------------------------------------------
/TicTacToe/tictactoe-contract/src/events.sw:
--------------------------------------------------------------------------------
1 | library;
2 |
3 | /// Event for when a game results in a draw.
4 | pub struct GameDrawnEvent {
5 | /// The first player.
6 | pub player_one: Identity,
7 | /// The second player.
8 | pub player_two: Identity,
9 | }
10 |
11 | /// Event for when a game is won.
12 | pub struct GameWonEvent {
13 | /// The winning player.
14 | pub player: Identity,
15 | }
16 |
17 | /// Event for when a new game is started.
18 | pub struct NewGameEvent {
19 | /// The first player.
20 | pub player_one: Identity,
21 | /// The second player.
22 | pub player_two: Identity,
23 | }
24 |
--------------------------------------------------------------------------------
/.docs/contributing-book/src/code/bad_documentation/src/lib.sw:
--------------------------------------------------------------------------------
1 | library;
2 |
3 | // ANCHOR: data_structures
4 | // This is bad. It's repeating the names of the fields which can be easily read
5 | pub struct Item1 {
6 | /// Identifier
7 | id: u64,
8 | /// Quantity
9 | quantity: u64,
10 | }
11 |
12 | // This is better. It conveys the context of what the fields are
13 | pub struct Item2 {
14 | /// Unique identifier used to retrieve the item from a vector of items held in storage
15 | id: u64,
16 | /// The number of remaining items left in production
17 | quantity: u64,
18 | }
19 | // ANCHOR_END: data_structures
20 |
--------------------------------------------------------------------------------
/tsconfig.json:
--------------------------------------------------------------------------------
1 | {
2 | "compilerOptions": {
3 | "target": "ES2020",
4 | "useDefineForClassFields": true,
5 | "lib": ["ES2020", "DOM", "DOM.Iterable"],
6 | "module": "ESNext",
7 | "skipLibCheck": true,
8 |
9 | /* Bundler mode */
10 | "moduleResolution": "bundler",
11 | "allowImportingTsExtensions": true,
12 | "resolveJsonModule": true,
13 | "isolatedModules": true,
14 | "noEmit": true,
15 | "jsx": "react-jsx",
16 |
17 | /* Linting */
18 | "strict": true,
19 | "noUnusedLocals": true,
20 | "noUnusedParameters": true,
21 | "noFallthroughCasesInSwitch": true
22 | },
23 | }
24 |
--------------------------------------------------------------------------------
/.docs/contributing-book/src/documentation/project-quality/documentation/code/index.md:
--------------------------------------------------------------------------------
1 | # Code
2 |
3 | Documenting code is an important skill to have because it conveys information to developers about the intention and usage of the project.
4 |
5 | In the following sections we'll take a look at three ways of documenting code and a code style guide.
6 |
7 |
8 | - [ABI Documentation](abi.md)
9 | - [Comments](comments.md)
10 | - [Naming Components](naming-components.md)
11 | - [Style Guide](style.md)
12 |
13 | For general documentation refer to how [Rust](https://doc.rust-lang.org/rustdoc/how-to-write-documentation.html) documents code.
14 |
--------------------------------------------------------------------------------
/.github/ISSUE_TEMPLATE/brand_new_feature.yml:
--------------------------------------------------------------------------------
1 | name: Requesting New Feature
2 | description: If you are adding something completely new then use this template!
3 | title: ""
4 | labels: ["New Feature"]
5 | body:
6 | - type: textarea
7 | id: motivation
8 | attributes:
9 | label: Motivation
10 | description: Describe your feature, motivation behind it and write a mini-specification
11 | placeholder: |
12 | #### Description
13 | This feature ...
14 |
15 | #### Motivation
16 | It allows ...
17 |
18 | #### Specification
19 | ...
20 | validations:
21 | required: true
22 |
--------------------------------------------------------------------------------
/airdrop/airdrop-contract/src/data_structures.sw:
--------------------------------------------------------------------------------
1 | library;
2 |
3 | /// The state of a claim.
4 | pub enum ClaimState {
5 | /// The claim is unclaimed.
6 | Unclaimed: (),
7 | /// The claim has been claimed for the given amount.
8 | Claimed: u64,
9 | }
10 |
11 | impl core::ops::Eq for ClaimState {
12 | fn eq(self, other: Self) -> bool {
13 | match (self, other) {
14 | (ClaimState::Claimed(balance1), ClaimState::Claimed(balance2)) => {
15 | balance1 == balance2
16 | },
17 | (ClaimState::Unclaimed, ClaimState::Unclaimed) => true,
18 | _ => false,
19 | }
20 | }
21 | }
22 |
--------------------------------------------------------------------------------
/counter-script/Forc.lock:
--------------------------------------------------------------------------------
1 | [[package]]
2 | name = "core"
3 | source = "path+from-root-E19CE48B3E858B72"
4 |
5 | [[package]]
6 | name = "counter_contract"
7 | source = "member"
8 | dependencies = [
9 | "libraries",
10 | "std",
11 | ]
12 |
13 | [[package]]
14 | name = "interaction_script"
15 | source = "member"
16 | dependencies = [
17 | "libraries",
18 | "std",
19 | ]
20 |
21 | [[package]]
22 | name = "libraries"
23 | source = "path+from-root-4F344E6D2A50F28B"
24 | dependencies = ["std"]
25 |
26 | [[package]]
27 | name = "std"
28 | source = "git+https://github.com/fuellabs/sway?tag=v0.60.0#2f0392ee35a1e4dd80bd8034962d5b4083dfb8b6"
29 | dependencies = ["core"]
30 |
--------------------------------------------------------------------------------
/.docs/contributing-book/src/documentation/welcome.md:
--------------------------------------------------------------------------------
1 | # Welcome
2 |
3 | Thank you for taking the time to consider contributing to the project!
4 |
5 | The aim of this guide is to introduce general concepts that can be taken across many projects in your professional career while directing them specifically at this project.
6 |
7 | In this contributing guide, we will cover various topics starting from navigating GitHub issues to submitting a pull request for review.
8 |
9 | We advise taking the time to carefully familiarize yourself with the content in each section. Every section has a purpose and it's likely that we will comment on any, if not all, sections in a pull request.
10 |
--------------------------------------------------------------------------------
/TicTacToe/src/contract-types/common.d.ts:
--------------------------------------------------------------------------------
1 | /* Autogenerated file. Do not edit manually. */
2 |
3 | /* tslint:disable */
4 |
5 |
6 | /*
7 | Fuels version: 0.76.0
8 | Forc version: 0.51.1
9 | Fuel-Core version: 0.22.1
10 | */
11 |
12 | /*
13 | Mimics Sway Enum, requires at least one Key-Value but
14 | does not raise error on multiple pairs.
15 | This is done in the abi-coder
16 | */
17 | export type Enum }> = Partial &
18 | U[keyof U];
19 |
20 | /*
21 | Mimics Sway Option and Vectors.
22 | Vectors are treated like arrays in Typescript.
23 | */
24 | export type Option = T | undefined;
25 |
26 | export type Vec = T[];
27 |
--------------------------------------------------------------------------------
/multisig-wallet/multisig-contract/tests/utils/interface/target_contract.rs:
--------------------------------------------------------------------------------
1 | use fuels::{
2 | accounts::wallet::WalletUnlocked, programs::call_response::FuelCallResponse, types::Address,
3 | };
4 |
5 | use crate::utils::setup::TargetContract;
6 |
7 | pub(crate) async fn count(
8 | contract: &TargetContract,
9 | address: Address,
10 | ) -> FuelCallResponse {
11 | contract.methods().count(address).call().await.unwrap()
12 | }
13 |
14 | pub(crate) async fn deposit(
15 | contract: &TargetContract,
16 | address: Address,
17 | ) -> FuelCallResponse {
18 | contract.methods().deposit(address).call().await.unwrap()
19 | }
20 |
--------------------------------------------------------------------------------
/oracle/oracle-node/Cargo.toml:
--------------------------------------------------------------------------------
1 | [project]
2 | name = "oracle-node"
3 | version = "0.0.0"
4 | authors = ["Fuel Labs "]
5 | edition = "2021"
6 | license = "Apache-2.0"
7 |
8 | [dependencies]
9 | anyhow = "1.0.71"
10 | async-trait = "0.1.71"
11 | dotenv = "0.15.0"
12 | fuels = { version = "0.62.0", features = ["fuel-core-lib"] }
13 | futures = "0.3"
14 | itertools = "0.11"
15 | reqwest = { version = "0.11.18", features = ["json"] }
16 | serde = { version = "1.0", features = ["derive"] }
17 | tokio = { version = "1.12", features = ["full"] }
18 | utils = { path = "../utils" }
19 |
20 | [[test]]
21 | harness = true
22 | name = "integration_tests"
23 | path = "tests/harness.rs"
24 |
--------------------------------------------------------------------------------
/.github/ISSUE_TEMPLATE/improvement_to_existing_feature.yml:
--------------------------------------------------------------------------------
1 | name: Improvement to Feature
2 | description: If you are improving something that already exists then use this template!
3 | title: ""
4 | labels: ["Improvement"]
5 | body:
6 | - type: textarea
7 | id: motivation
8 | attributes:
9 | label: Motivation
10 | description: Describe the improvement, motivation behind it and write a mini-specification
11 | placeholder: |
12 | #### Description
13 | This improves the feature by ...
14 |
15 | #### Motivation
16 | It allows ...
17 |
18 | #### Specification
19 | ...
20 | validations:
21 | required: true
22 |
--------------------------------------------------------------------------------
/.docs/contributing-book/src/documentation/issues/search/summary.md:
--------------------------------------------------------------------------------
1 | # Issue summary
2 |
3 | You can see the activity of an issue by looking at the number of comments. This doesn't really tell you much aside from that there is a discussion about what should be done.
4 |
5 | 
6 |
7 | Clicking on the issue at the bottom `DAO Voting Application` we can see some information about the application with some tasks linked to track the overall progress. Scrolling down would present comments in this specific issue which could provide greater insight into the task.
8 |
9 | 
--------------------------------------------------------------------------------
/TicTacToe/src/contract-types/contracts/common.d.ts:
--------------------------------------------------------------------------------
1 | /* Autogenerated file. Do not edit manually. */
2 |
3 | /* tslint:disable */
4 | /* eslint-disable */
5 |
6 | /*
7 | Fuels version: 0.76.2
8 | Forc version: 0.51.1
9 | Fuel-Core version: 0.22.1
10 | */
11 |
12 | /*
13 | Mimics Sway Enum, requires at least one Key-Value but
14 | does not raise error on multiple pairs.
15 | This is done in the abi-coder
16 | */
17 | export type Enum }> = Partial &
18 | U[keyof U];
19 |
20 | /*
21 | Mimics Sway Option and Vectors.
22 | Vectors are treated like arrays in Typescript.
23 | */
24 | export type Option = T | undefined;
25 |
26 | export type Vec = T[];
27 |
--------------------------------------------------------------------------------
/.docs/contributing-book/src/documentation/issues/index.md:
--------------------------------------------------------------------------------
1 | # GitHub Issues
2 |
3 | GitHub provides a ticketing system called [issues](https://docs.github.com/en/issues) which allows users to create and track the progress of tasks that need to be done.
4 |
5 | When looking to contribute to a project one of the first places to look is their [issues](https://github.com/FuelLabs/sway-applications/issues) section while following the guidance that the authors of the project have provided in their contributing document.
6 |
7 | The issue should describe the work that needs to be done and the contributing document should outline the expectations that must be met in order for the work to eventually make its way into the repository.
8 |
--------------------------------------------------------------------------------
/.docs/contributing-book/src/documentation/issues/search/assignment.md:
--------------------------------------------------------------------------------
1 | # Checking for available issues
2 |
3 | It's important to check if anyone else is currently working on a particular issue to avoid performing duplicate work. Not only would this be frustrating but also be an inefficient use of time.
4 |
5 | You can check whether someone is assigned to an issue by looking under the `Assignee` tab. If there is an icon, then someone is tasked with that issue. If there is no icon, then it's likely that no one is currently working on that issue and you're free to assign it to yourself or post a comment so that the author can assign you.
6 |
7 | 
8 |
--------------------------------------------------------------------------------
/multisig-wallet/multisig-contract/tests/functions/info/nonce.rs:
--------------------------------------------------------------------------------
1 | mod success {
2 |
3 | use crate::utils::{
4 | interface::{core::constructor, info::nonce},
5 | setup::{default_users, setup_env, VALID_SIGNER_PK},
6 | };
7 |
8 | #[tokio::test]
9 | async fn gets_nonce() {
10 | let (_private_key, deployer, _non_owner) = setup_env(VALID_SIGNER_PK).await.unwrap();
11 |
12 | let initial_nonce = nonce(&deployer.contract).await.value;
13 |
14 | constructor(&deployer.contract, default_users()).await;
15 |
16 | let final_nonce = nonce(&deployer.contract).await.value;
17 |
18 | assert_eq!(initial_nonce, 0);
19 | assert_eq!(final_nonce, initial_nonce + 1);
20 | }
21 | }
22 |
--------------------------------------------------------------------------------
/oracle/oracle-contract/tests/functions/price.rs:
--------------------------------------------------------------------------------
1 | use utils::{
2 | abi_calls::{price, set_price},
3 | test_helpers::setup,
4 | };
5 |
6 | mod success {
7 | use super::*;
8 |
9 | #[tokio::test]
10 | async fn can_get_price() {
11 | let (user, _) = setup().await;
12 | let set_price_amount: u64 = 1000;
13 | set_price(&user.oracle, set_price_amount).await;
14 | let price = price(&user.oracle).await;
15 | assert_eq!(price, Some(set_price_amount));
16 | }
17 |
18 | #[tokio::test]
19 | async fn can_get_price_when_not_initialized() {
20 | let (user, _) = setup().await;
21 | let price = price(&user.oracle).await;
22 | assert_eq!(price, None);
23 | }
24 | }
25 |
--------------------------------------------------------------------------------
/timelock/timelock-contract/tests/functions/core/cancel.rs:
--------------------------------------------------------------------------------
1 | use crate::utils::{interface::core::cancel, setup::setup};
2 |
3 | mod success {
4 |
5 | use super::*;
6 | use crate::utils::{
7 | interface::{
8 | core::queue,
9 | info::{queued, transaction_hash},
10 | },
11 | setup::CancelEvent,
12 | };
13 |
14 | #[tokio::test]
15 | async fn cancels() {}
16 | }
17 |
18 | mod revert {
19 |
20 | use super::*;
21 |
22 | #[tokio::test]
23 | #[should_panic(expected = "AuthorizationError")]
24 | async fn when_unauthorized() {}
25 |
26 | #[tokio::test]
27 | #[should_panic(expected = "InvalidTransaction")]
28 | async fn when_transaction_not_queued() {}
29 | }
30 |
--------------------------------------------------------------------------------
/CHANGELOG.md:
--------------------------------------------------------------------------------
1 | # Change Log
2 |
3 | All notable changes to this project will be documented in this file.
4 |
5 | The format is based on [Keep a Changelog](http://keepachangelog.com/)
6 | and this project adheres to [Semantic Versioning](http://semver.org/).
7 |
8 | ## [Unreleased] - yyyy-mm-dd
9 |
10 | Description of the upcoming release here.
11 |
12 | ### Added
13 |
14 | - Something new here 1
15 | - Something new here 2
16 |
17 | ### Changed
18 |
19 | - [#809](https://github.com/FuelLabs/sway-applications/issues/809) Set Devrel team as codeowners
20 | - Something changed here 2
21 |
22 | ### Fixed
23 |
24 | - Some fix here 1
25 | - Some fix here 2
26 |
27 | #### Breaking
28 |
29 | - Some breaking change here 1
30 | - Some breaking change here 2
31 |
--------------------------------------------------------------------------------
/.devops/aurora/src/commands/test.rs:
--------------------------------------------------------------------------------
1 | use crate::utils::{execute, print_applications, project_path};
2 | use std::process::Command;
3 |
4 | const MESSAGE: &str = "Errors found in";
5 |
6 | pub(crate) fn run(apps: Vec, root: String) -> anyhow::Result<()> {
7 | let mut errors: Vec = vec![];
8 |
9 | for app in apps {
10 | println!("\nTesting {}", app);
11 |
12 | let project = project_path(app.clone(), root.clone())?;
13 |
14 | execute(
15 | Command::new("cargo")
16 | .current_dir(project)
17 | .args(["test", "--color", "always", "-q"]),
18 | &mut errors,
19 | &app,
20 | );
21 | }
22 |
23 | print_applications(errors, MESSAGE.into());
24 | Ok(())
25 | }
26 |
--------------------------------------------------------------------------------
/DAO/DAO-contract/tests/functions/info/proposal_count.rs:
--------------------------------------------------------------------------------
1 | mod success {
2 | use crate::utils::{
3 | interface::{
4 | core::{constructor, create_proposal},
5 | info::proposal_count,
6 | },
7 | setup::{proposal_transaction, setup},
8 | };
9 |
10 | #[tokio::test]
11 | async fn use_can_get_proposal_count() {
12 | let (gov_asset_id, _other_asset_id, deployer, user, _asset_amount) = setup().await;
13 | constructor(&deployer.dao_voting, gov_asset_id).await;
14 |
15 | let proposal_transaction = proposal_transaction(gov_asset_id);
16 | create_proposal(&user.dao_voting, 10, 10, proposal_transaction.clone()).await;
17 |
18 | assert_eq!(proposal_count(&user.dao_voting).await, 1);
19 | }
20 | }
21 |
--------------------------------------------------------------------------------
/fractional-NFT/f-NFT-contract/src/errors.sw:
--------------------------------------------------------------------------------
1 | library;
2 |
3 | /// Error thrown when there is an issue with the Vault SubId.
4 | pub enum SubIdError {
5 | /// Logged when an invalid SubId is passed as an argument.
6 | InvalidSubId: (),
7 | }
8 |
9 | /// Error thrown when something goes wrong with the deposit function.
10 | pub enum DepositError {
11 | /// Logged when the asset sent does not adhere to the SRC-20 standard.
12 | InvalidSRC20NFT: (),
13 | }
14 |
15 | /// Error thrown when something goes wrong with the withdraw function.
16 | pub enum WithdrawError {
17 | /// Logged when not all shares have been included in the transaction.
18 | AllSharesNotReturned: (),
19 | /// Logged when the asset sent is not the issued shares of an NFT.
20 | InvalidAsset: (),
21 | }
22 |
--------------------------------------------------------------------------------
/airdrop/Forc.lock:
--------------------------------------------------------------------------------
1 | [[package]]
2 | name = "airdrop-contract"
3 | source = "member"
4 | dependencies = [
5 | "std",
6 | "sway_libs",
7 | ]
8 |
9 | [[package]]
10 | name = "core"
11 | source = "path+from-root-E19CE48B3E858B72"
12 |
13 | [[package]]
14 | name = "standards"
15 | source = "git+https://github.com/FuelLabs/sway-standards?tag=v0.4.3#6f63eb7dff2458a7d976184e565b5cbf26f61da2"
16 | dependencies = ["std"]
17 |
18 | [[package]]
19 | name = "std"
20 | source = "git+https://github.com/fuellabs/sway?tag=v0.60.0#2f0392ee35a1e4dd80bd8034962d5b4083dfb8b6"
21 | dependencies = ["core"]
22 |
23 | [[package]]
24 | name = "sway_libs"
25 | source = "git+https://github.com/FuelLabs/sway-libs?tag=v0.21.0#6a227ed34c86fe1ebd334dbdfeccf66c43e3915b"
26 | dependencies = [
27 | "standards",
28 | "std",
29 | ]
30 |
--------------------------------------------------------------------------------
/NFT/Forc.lock:
--------------------------------------------------------------------------------
1 | [[package]]
2 | name = "NFT-contract"
3 | source = "member"
4 | dependencies = [
5 | "standards",
6 | "std",
7 | "sway_libs",
8 | ]
9 |
10 | [[package]]
11 | name = "core"
12 | source = "path+from-root-E19CE48B3E858B72"
13 |
14 | [[package]]
15 | name = "standards"
16 | source = "git+https://github.com/FuelLabs/sway-standards?tag=v0.4.3#6f63eb7dff2458a7d976184e565b5cbf26f61da2"
17 | dependencies = ["std"]
18 |
19 | [[package]]
20 | name = "std"
21 | source = "git+https://github.com/fuellabs/sway?tag=v0.60.0#2f0392ee35a1e4dd80bd8034962d5b4083dfb8b6"
22 | dependencies = ["core"]
23 |
24 | [[package]]
25 | name = "sway_libs"
26 | source = "git+https://github.com/FuelLabs/sway-libs?tag=v0.21.0#6a227ed34c86fe1ebd334dbdfeccf66c43e3915b"
27 | dependencies = [
28 | "standards",
29 | "std",
30 | ]
31 |
--------------------------------------------------------------------------------
/TicTacToe/src/components/Providers.tsx:
--------------------------------------------------------------------------------
1 | import { FuelWalletConnector } from '@fuel-wallet/sdk';
2 | import { FuelProvider } from '@fuels/react';
3 | import { QueryClient, QueryClientProvider } from '@tanstack/react-query';
4 | import type { ReactNode } from 'react';
5 |
6 | import { AppContextProvider } from '.';
7 |
8 | type ProvidersProps = {
9 | children?: ReactNode;
10 | };
11 |
12 | // TODO add toast for errors?
13 | export const queryClient = new QueryClient();
14 |
15 | export const Providers = ({ children }: ProvidersProps) => {
16 | return (
17 |
18 |
19 | {children}
20 |
21 |
22 | );
23 | };
24 |
--------------------------------------------------------------------------------
/.docs/contributing-book/src/documentation/project-quality/index.md:
--------------------------------------------------------------------------------
1 | # Project Quality
2 |
3 | The quality of a project can be determined by a variety of measures such as intended utility or adoption. The metric that the following sections will focus on is developer experience.
4 |
5 | In the following sections we will take a look at:
6 |
7 | - [Project Structure](project-structure/index.md)
8 | - The file structure and how easily a project may be navigated
9 | - [Code Structure](code-structure.md)
10 | - How to structure the code inside a file
11 | - [Documentation](documentation/index.md)
12 | - How to present information about your project
13 | - [Testing](testing.md)
14 | - The file structure and tips for testing
15 |
16 | If the project is well structured, tested and documented then the developer experience will be good.
17 |
--------------------------------------------------------------------------------
/fundraiser/fundraiser-contract/src/data_structures/pledge.sw:
--------------------------------------------------------------------------------
1 | library;
2 |
3 | /// Used to track the amount pledged by a user to a specific campaign.
4 | pub struct Pledge {
5 | /// The amount pledged to a campaign.
6 | pub amount: u64,
7 | /// The unique identifier for the campaign.
8 | pub campaign_id: u64,
9 | }
10 |
11 | impl Pledge {
12 | /// Creates a new pledge.
13 | ///
14 | /// # Arguments
15 | ///
16 | /// * `amount`: [u64] - The amount pledged to a campaign.
17 | /// * `campaign_id`: [u64] - The unique identifier for the campaign.
18 | ///
19 | /// # Returns
20 | ///
21 | /// * [Pledge] - The new pledge.
22 | pub fn new(amount: u64, campaign_id: u64) -> Self {
23 | Self {
24 | amount,
25 | campaign_id,
26 | }
27 | }
28 | }
29 |
--------------------------------------------------------------------------------
/fundraiser/fundraiser-contract/src/data_structures/campaign_state.sw:
--------------------------------------------------------------------------------
1 | library;
2 |
3 | use core::ops::Eq;
4 |
5 | /// Represents the current state of the campaign.
6 | pub enum CampaignState {
7 | /// The campaign has been cancelled.
8 | Cancelled: (),
9 | /// The campaign was successful and the funds have been claimed.
10 | Claimed: (),
11 | /// The campaign is still accepting funds.
12 | Funding: (),
13 | }
14 |
15 | impl Eq for CampaignState {
16 | fn eq(self, other: CampaignState) -> bool {
17 | match (self, other) {
18 | (CampaignState::Cancelled, CampaignState::Cancelled) => true,
19 | (CampaignState::Claimed, CampaignState::Claimed) => true,
20 | (CampaignState::Funding, CampaignState::Funding) => true,
21 | _ => false,
22 | }
23 | }
24 | }
25 |
--------------------------------------------------------------------------------
/native-asset/Forc.lock:
--------------------------------------------------------------------------------
1 | [[package]]
2 | name = "core"
3 | source = "path+from-root-E19CE48B3E858B72"
4 |
5 | [[package]]
6 | name = "native-asset-contract"
7 | source = "member"
8 | dependencies = [
9 | "standards",
10 | "std",
11 | "sway_libs",
12 | ]
13 |
14 | [[package]]
15 | name = "standards"
16 | source = "git+https://github.com/FuelLabs/sway-standards?tag=v0.4.3#6f63eb7dff2458a7d976184e565b5cbf26f61da2"
17 | dependencies = ["std"]
18 |
19 | [[package]]
20 | name = "std"
21 | source = "git+https://github.com/fuellabs/sway?tag=v0.60.0#2f0392ee35a1e4dd80bd8034962d5b4083dfb8b6"
22 | dependencies = ["core"]
23 |
24 | [[package]]
25 | name = "sway_libs"
26 | source = "git+https://github.com/FuelLabs/sway-libs?tag=v0.21.0#6a227ed34c86fe1ebd334dbdfeccf66c43e3915b"
27 | dependencies = [
28 | "standards",
29 | "std",
30 | ]
31 |
--------------------------------------------------------------------------------
/.github/workflows/gh-pages.yml:
--------------------------------------------------------------------------------
1 | name: github pages
2 |
3 | on:
4 | push:
5 | branches:
6 | - master
7 | tags:
8 | - v*
9 |
10 | env:
11 | RUST_VERSION: 1.74.0
12 |
13 | jobs:
14 | deploy:
15 | runs-on: ubuntu-latest
16 | steps:
17 | - uses: actions/checkout@v2
18 |
19 | - name: Setup mdBook
20 | uses: peaceiris/actions-mdbook@v1
21 | with:
22 | mdbook-version: "0.4.15"
23 |
24 | - run: mdbook build ./.docs/contributing-book
25 |
26 | - name: Deploy master
27 | uses: peaceiris/actions-gh-pages@v3
28 | with:
29 | github_token: ${{ secrets.GITHUB_TOKEN }}
30 | publish_dir: ./.docs/contributing-book/book
31 | destination_dir: book
32 | cname: swayapps.fuel.network
33 | if: github.ref == 'refs/heads/master'
34 |
--------------------------------------------------------------------------------
/DAO/DAO-contract/tests/functions/info/balance.rs:
--------------------------------------------------------------------------------
1 | mod success {
2 | use crate::utils::{
3 | interface::{
4 | core::{constructor, deposit},
5 | info::balance,
6 | },
7 | setup::setup,
8 | };
9 | use fuels::{prelude::CallParameters, types::AssetId};
10 |
11 | #[tokio::test]
12 | pub async fn user_can_check_contract_balance() {
13 | let (gov_asset_id, _other_asset_id, deployer, user, asset_amount) = setup().await;
14 | constructor(&deployer.dao_voting, gov_asset_id).await;
15 |
16 | let call_params = CallParameters::new(asset_amount, AssetId::from(*gov_asset_id), 100_000);
17 | assert_eq!(balance(&user.dao_voting).await, 0);
18 | deposit(&user.dao_voting, call_params).await;
19 | assert_eq!(balance(&user.dao_voting).await, asset_amount);
20 | }
21 | }
22 |
--------------------------------------------------------------------------------
/multisig-wallet/multisig-contract/tests/functions/info/threshold.rs:
--------------------------------------------------------------------------------
1 | mod success {
2 |
3 | use crate::utils::{
4 | interface::{core::constructor, info::threshold},
5 | setup::{default_users, setup_env, DEFAULT_THRESHOLD, VALID_SIGNER_PK},
6 | };
7 |
8 | #[tokio::test]
9 | async fn returns_threshold() {
10 | let (_private_key, deployer, _non_owner) = setup_env(VALID_SIGNER_PK).await.unwrap();
11 |
12 | let initial_threshold = threshold(&deployer.contract).await.value;
13 |
14 | constructor(&deployer.contract, default_users()).await;
15 |
16 | let current_threshold = threshold(&deployer.contract).await.value;
17 |
18 | assert_eq!(0, initial_threshold);
19 | assert_eq!(DEFAULT_THRESHOLD, current_threshold);
20 | assert_ne!(DEFAULT_THRESHOLD, initial_threshold);
21 | }
22 | }
23 |
--------------------------------------------------------------------------------
/counter-script/libraries/src/interface.sw:
--------------------------------------------------------------------------------
1 | library;
2 |
3 | abi Counter {
4 | /// Increments the counter by one.
5 | ///
6 | /// # Returns
7 | ///
8 | /// * [u64] - The new value of the counter.
9 | ///
10 | /// # Number of Storage Accesses
11 | ///
12 | /// * Reads: `1`
13 | /// * Write: `1`
14 | #[storage(read, write)]
15 | fn increment() -> u64;
16 | /// Returns the current value of the counter.
17 | ///
18 | /// # Returns
19 | ///
20 | /// * [u64] - The current value of the counter.
21 | ///
22 | /// # Number of Storage Accesses
23 | ///
24 | /// * Reads: `1`
25 | #[storage(read)]
26 | fn count() -> u64;
27 | /// Clears the counter.
28 | ///
29 | /// # Number of Storage Accesses
30 | ///
31 | /// * Clears: `1`
32 | #[storage(write)]
33 | fn clear();
34 | }
35 |
--------------------------------------------------------------------------------
/name-registry/registry-contract/src/errors.sw:
--------------------------------------------------------------------------------
1 | library;
2 |
3 | pub enum AssetError {
4 | /// Emitted when the amount of asset sent is less than the fee.
5 | InsufficientPayment: (),
6 | /// Emitted when an incorrect asset is sent for payment.
7 | IncorrectAssetSent: (),
8 | }
9 |
10 | pub enum AuthorizationError {
11 | /// Emitted when the caller is not the owner of a record or the registry.
12 | SenderNotOwner: (),
13 | }
14 |
15 | pub enum RegistrationValidityError {
16 | /// Emitted when interacting with a name that has expired.
17 | NameExpired: (),
18 | /// Emitted when interacting with a name that has never been registered.
19 | NameNotRegistered: (),
20 | /// Emitted when attempting to register a name that has not expired.
21 | NameNotExpired: (),
22 | /// Emitted when the name length is less than 3 bytes.
23 | NameTooShort: (),
24 | }
25 |
--------------------------------------------------------------------------------
/.docs/contributing-book/src/documentation/project-quality/documentation/index.md:
--------------------------------------------------------------------------------
1 | # Documentation
2 |
3 | Documentation is arguably the most important aspect of any open source project because it educates others about how the project works, how to use it, how to contribute etc.
4 |
5 | Good documentation enables frictionless interaction with the project which in turn may lead to a greater userbase, including contributors, which causes a positive feedback loop.
6 |
7 | In the following sections we will take a look at how to document the:
8 |
9 | - [Read me](read-me.md)
10 | - The first document a user will see which includes content such as installation instructions
11 | - [Code](./code/index.md)
12 | - Documenting the code itself such that contributors know how to interact with it
13 | - [Specification](specification.md)
14 | - Presenting technical (or non-technical) information about your project
15 |
--------------------------------------------------------------------------------
/NFT/NFT-contract/tests/functions/set_decimals.rs:
--------------------------------------------------------------------------------
1 | use crate::utils::{
2 | interface::{constructor, set_decimals},
3 | setup::{defaults, setup},
4 | };
5 |
6 | mod revert {
7 |
8 | use super::*;
9 |
10 | #[tokio::test]
11 | #[should_panic(expected = "ValueAlreadySet")]
12 | async fn when_attempting_to_set_decimals() {
13 | let (owner_wallet, other_wallet, id, instance_1, instance_2) = setup().await;
14 | let (
15 | asset_id_1,
16 | _asset_id_2,
17 | _asset_id_3,
18 | _sub_id_1,
19 | _sub_id_2,
20 | _sub_id_3,
21 | owner_identity,
22 | _other_identity,
23 | ) = defaults(id, owner_wallet, other_wallet.clone());
24 |
25 | constructor(&instance_1, owner_identity).await;
26 |
27 | set_decimals(&instance_2, asset_id_1, 9u8).await;
28 | }
29 | }
30 |
--------------------------------------------------------------------------------
/TicTacToe/src/components/ConnectionInfo.tsx:
--------------------------------------------------------------------------------
1 | import { Stack, Typography } from '@mui/material';
2 |
3 | import { useGetPlayers } from '../hooks';
4 | import { shortAddress } from '../utils';
5 |
6 | import { ConnectButton } from '.';
7 |
8 | export const ConnectionInfo = () => {
9 | const { players, isPlayer1Turn } = useGetPlayers();
10 |
11 | return (
12 |
13 |
14 | {players.length === 0 ? null : (
15 | <>
16 | {`${
17 | isPlayer1Turn ? 'Turn ------->' : ''
18 | } Player 1: ${shortAddress(players[0])}`}
19 | {`${
20 | !isPlayer1Turn && isPlayer1Turn !== undefined ? 'Turn ------->' : ''
21 | } Player 2: ${shortAddress(players[1])}`}
22 | >
23 | )}
24 |
25 | );
26 | };
27 |
--------------------------------------------------------------------------------
/.docs/contributing-book/src/documentation/project-quality/documentation/code/abi.md:
--------------------------------------------------------------------------------
1 | # ABI Documentation
2 |
3 | ABI documentation refers to documenting the interface that another developer may be interested in using.
4 |
5 | The form of documentation we focus on uses the `///` syntax as we are interested in documenting the `ABI` functions.
6 |
7 | In the following snippet, we provide a short description about the functions, the arguments they take, and when the calls will revert. Additional data may be added such as the structure of the return type, how to call the function, etc.
8 |
9 | ```sway
10 | {{#include ../../../../code/connect_four/src/interface.sw:interface}}
11 | ```
12 |
13 |
14 |
15 | In order to know what should be documented, the author of the code should put themselves in the position of a developer that knows nothing about the function and think about what sort of questions they may have.
16 |
--------------------------------------------------------------------------------
/timelock/timelock-contract/src/errors.sw:
--------------------------------------------------------------------------------
1 | library;
2 |
3 | /// Errors related to access control.
4 | pub enum AccessControlError {
5 | /// The user is not authorized to perform the action.
6 | AuthorizationError: (),
7 | }
8 |
9 | /// Errors related to balances.
10 | pub enum FundingError {
11 | /// The user does not have enough balance to perform the action.
12 | InsufficientContractBalance: u64,
13 | }
14 |
15 | /// Errors related to the transaction.
16 | pub enum TransactionError {
17 | /// The transaction is a duplicate.
18 | DuplicateTransaction: b256,
19 | /// The transaction is invalid.
20 | InvalidTransaction: b256,
21 | /// The timestamp is not in the valid range.
22 | /// Valid range is: start_timestamp <= your_timestamp <= end_timestamp
23 | /// The order of the values is (start_timestamp, end_timestamp, your_timestamp).
24 | TimestampNotInRange: (u64, u64, u64),
25 | }
26 |
--------------------------------------------------------------------------------
/.docs/contributing-book/src/documentation/issues/create-issue.md:
--------------------------------------------------------------------------------
1 | # Creating an Issue
2 |
3 | If there is work that a project can benefit from then an issue can be filed via a template or a blank form.
4 |
5 | We encourage the use of the provided templates because they guide a user into answering questions that we may have. The templates are not mandatory but they provide structure for answering questions like:
6 |
7 | - What steps can be taken to reproduce the issue?
8 | - What feature is missing and how would you like it to work?
9 | - Is the improvement an improvement or a personal nitpick?
10 |
11 |
12 |
13 | 
14 |
15 |
16 |
17 | The questions themselves are not that important, but what is important is providing as much detail about the task as possible. This allows other developers to come to a decision quickly and efficiently regarding the new issue.
18 |
--------------------------------------------------------------------------------
/fundraiser/fundraiser-contract/tests/functions/info/asset_count.rs:
--------------------------------------------------------------------------------
1 | mod success {
2 |
3 | use crate::utils::{
4 | interface::{core::create_campaign, info::asset_count},
5 | setup::setup,
6 | };
7 |
8 | #[tokio::test]
9 | async fn returns_zero() {
10 | let (author, _, _, _, _) = setup().await;
11 |
12 | assert_eq!(0, asset_count(&author.contract).await);
13 | }
14 |
15 | #[tokio::test]
16 | async fn returns_one() {
17 | let (author, _, _, _, defaults) = setup().await;
18 |
19 | assert_eq!(0, asset_count(&author.contract).await);
20 | create_campaign(
21 | &author.contract,
22 | &defaults.asset_id,
23 | &defaults.beneficiary,
24 | defaults.deadline,
25 | defaults.target_amount,
26 | )
27 | .await;
28 | assert_eq!(1, asset_count(&author.contract).await);
29 | }
30 | }
31 |
--------------------------------------------------------------------------------
/package.json:
--------------------------------------------------------------------------------
1 | {
2 | "name": "sway-applications",
3 | "version": "0.0.1",
4 | "private": true,
5 | "description": "Sway Applications",
6 | "author": "Fuel Labs (https://fuel.network/)",
7 | "homepage": "https://github.com/FuelLabs/sway-applications",
8 | "repository": {
9 | "type": "git",
10 | "url": "git+https://github.com/FuelLabs/sway-applications.git"
11 | },
12 | "license": "Apache-2.0",
13 | "bugs": {
14 | "url": "https://github.com/FuelLabs/sway-applications/issues"
15 | },
16 | "scripts": {
17 | "build:website": "node ./scripts/build-website/index.mjs",
18 | "build:preview": "turbo run build:preview",
19 | "build:all": "turbo run build:all"
20 | },
21 | "dependencies": {
22 | "execa": "^8.0.1"
23 | },
24 | "devDependencies": {
25 | "@types/node": "^20.11.26",
26 | "dotenv": "^16.4.5",
27 | "turbo": "^1.12.5",
28 | "typescript": "^5.2.2"
29 | }
30 | }
31 |
--------------------------------------------------------------------------------
/.docs/contributing-book/src/documentation/project-quality/code-structure.md:
--------------------------------------------------------------------------------
1 | # Code Structure
2 |
3 | Structuring code in a way that is easy to navigate allows for a greater developer experience. In order to achieve this, there are some guidelines to consider.
4 |
5 | 1. Fields in all structures should be alphabetical
6 | 2. Functions should be declared by the weight of their purity e.g.
7 | 1. `read & write` first
8 | 2. `read` second
9 | 3. `pure` last
10 | 3. Structures should be grouped into modules and the content inside should be alphabetically ordered
11 | 4. Dependencies and imports should be alphabetical
12 | 5. Document the parameters of the interface in alphabetical order and preferably declare them in the same order in the function signature
13 |
14 | An important aspect to remember is to use the formatter(s) to format the code prior to a commit.
15 |
16 | - `cargo fmt` to format `Rust` files
17 | - `forc fmt` to format `Sway` files
18 |
--------------------------------------------------------------------------------
/TicTacToe/src/components/NewGameButton.tsx:
--------------------------------------------------------------------------------
1 | import { Button, Typography } from '@mui/material';
2 | import { Address } from 'fuels';
3 |
4 | import { useGetPlayers, useNewGame } from '../hooks';
5 |
6 | export const NewGameButton = () => {
7 | const { players } = useGetPlayers();
8 | const hasPlayers = players.length === 2;
9 | const newGame = useNewGame(
10 | hasPlayers ? Address.fromString(players[0]).toHexString() : '',
11 | hasPlayers ? Address.fromString(players[1]).toHexString() : ''
12 | );
13 |
14 | if (!hasPlayers) {
15 | return (
16 |
17 | Connect your wallet to start a new game.
18 |
19 | );
20 | }
21 |
22 | return (
23 |
32 | );
33 | };
34 |
--------------------------------------------------------------------------------
/fundraiser/fundraiser-contract/tests/functions/info/total_campaigns.rs:
--------------------------------------------------------------------------------
1 | mod success {
2 |
3 | use crate::utils::{
4 | interface::{core::create_campaign, info::total_campaigns},
5 | setup::setup,
6 | };
7 |
8 | #[tokio::test]
9 | async fn returns_zero() {
10 | let (author, _, _, _, _) = setup().await;
11 |
12 | assert_eq!(0, total_campaigns(&author.contract).await);
13 | }
14 |
15 | #[tokio::test]
16 | async fn returns_one() {
17 | let (author, _, _, _, defaults) = setup().await;
18 |
19 | assert_eq!(0, total_campaigns(&author.contract).await);
20 | create_campaign(
21 | &author.contract,
22 | &defaults.asset_id,
23 | &defaults.beneficiary,
24 | defaults.deadline,
25 | defaults.target_amount,
26 | )
27 | .await;
28 | assert_eq!(1, total_campaigns(&author.contract).await);
29 | }
30 | }
31 |
--------------------------------------------------------------------------------
/timelock/timelock-contract/tests/functions/core/queue.rs:
--------------------------------------------------------------------------------
1 | use crate::utils::{interface::core::queue, setup::setup};
2 |
3 | mod success {
4 |
5 | use super::*;
6 | use crate::utils::{
7 | interface::info::{queued, transaction_hash},
8 | setup::QueueEvent,
9 | };
10 |
11 | #[tokio::test]
12 | async fn queues() {}
13 | }
14 |
15 | mod revert {
16 |
17 | use super::*;
18 |
19 | #[tokio::test]
20 | #[should_panic(expected = "AuthorizationError")]
21 | async fn when_unauthorized() {}
22 |
23 | #[tokio::test]
24 | #[should_panic(expected = "DuplicateTransaction")]
25 | async fn when_transaction_is_a_duplicate() {}
26 |
27 | #[tokio::test]
28 | #[should_panic(expected = "TimestampNotInRange")]
29 | async fn when_timestamp_before_delay() {}
30 |
31 | #[tokio::test]
32 | #[should_panic(expected = "TimestampNotInRange")]
33 | async fn when_timestamp_after_delay() {}
34 | }
35 |
--------------------------------------------------------------------------------
/DAO/DAO-contract/tests/functions/info/governance_asset_id.rs:
--------------------------------------------------------------------------------
1 | use crate::utils::{interface::info::governance_asset_id, setup::setup};
2 |
3 | mod success {
4 | use super::*;
5 | use crate::utils::interface::core::constructor;
6 |
7 | #[tokio::test]
8 | pub async fn user_can_get_governance_asset_id() {
9 | let (gov_asset_id, _other_asset_id, deployer, _user, _asset_amount) = setup().await;
10 | constructor(&deployer.dao_voting, gov_asset_id).await;
11 | assert_eq!(
12 | governance_asset_id(&deployer.dao_voting).await,
13 | gov_asset_id
14 | );
15 | }
16 | }
17 |
18 | mod revert {
19 | use super::*;
20 |
21 | #[tokio::test]
22 | #[should_panic(expected = "ContractNotInitialized")]
23 | pub async fn on_not_inialized() {
24 | let (_gov_asset, _gov_asset_id, deployer, _user, _asset_amount) = setup().await;
25 | governance_asset_id(&deployer.dao_voting).await;
26 | }
27 | }
28 |
--------------------------------------------------------------------------------
/TicTacToe/src/hooks/useGetPlayers.ts:
--------------------------------------------------------------------------------
1 | import { useAccounts } from '@fuels/react';
2 | import { useEffect, useState } from 'react';
3 |
4 | import { useGetCurrentPlayer, useGetMoveCounter } from '.';
5 |
6 | export const useGetPlayers = () => {
7 | const { accounts } = useAccounts();
8 | const { currentPlayer } = useGetCurrentPlayer();
9 | const { moveCounter } = useGetMoveCounter();
10 | const [isPlayer1Turn, setIsPlayer1Turn] = useState(
11 | undefined
12 | );
13 |
14 | let players: string[] = [];
15 | if (accounts.length === 1) {
16 | players = [accounts[0], accounts[0]];
17 | } else if (accounts.length > 1) {
18 | players = [accounts[0], accounts[1]];
19 | }
20 |
21 | useEffect(() => {
22 | setIsPlayer1Turn(
23 | accounts.length > 0 && !!moveCounter
24 | ? moveCounter.toNumber() % 2 === 0
25 | : undefined
26 | );
27 | }, [accounts, moveCounter]);
28 |
29 | return { players, isPlayer1Turn, currentPlayer };
30 | };
31 |
--------------------------------------------------------------------------------
/DAO/DAO-contract/tests/functions/info/user_balance.rs:
--------------------------------------------------------------------------------
1 | mod success {
2 | use crate::utils::{
3 | interface::{
4 | core::{constructor, deposit},
5 | info::user_balance,
6 | },
7 | setup::setup,
8 | };
9 | use fuels::{prelude::CallParameters, types::AssetId};
10 |
11 | #[tokio::test]
12 | pub async fn user_can_check_user_balance() {
13 | let (gov_asset_id, _other_asset_id, deployer, user, asset_amount) = setup().await;
14 | constructor(&deployer.dao_voting, gov_asset_id).await;
15 |
16 | let call_params = CallParameters::new(asset_amount, AssetId::from(*gov_asset_id), 100_000);
17 | assert_eq!(
18 | user_balance(&user.dao_voting, user.wallet.address()).await,
19 | 0
20 | );
21 | deposit(&user.dao_voting, call_params).await;
22 | assert_eq!(
23 | user_balance(&user.dao_voting, user.wallet.address()).await,
24 | asset_amount
25 | );
26 | }
27 | }
28 |
--------------------------------------------------------------------------------
/name-registry/registry-contract/tests/functions/info/rate.rs:
--------------------------------------------------------------------------------
1 | mod success {
2 | use crate::utils::{
3 | interface::{core::set_asset, info::rate},
4 | setup::setup,
5 | };
6 | use fuels::prelude::AssetId;
7 |
8 | #[tokio::test]
9 | async fn asset_not_set_returns_none() {
10 | let (instance, _account, _wallet2) = setup().await;
11 | let value = rate(&instance, AssetId::new(*instance.contract_id().hash())).await;
12 | assert_eq!(value, None);
13 | }
14 |
15 | #[tokio::test]
16 | async fn returns_set_rate() {
17 | let (instance, _account, _wallet2) = setup().await;
18 |
19 | let asset_rate = Some(5);
20 | set_asset(
21 | &instance,
22 | AssetId::new(*instance.contract_id().hash()),
23 | asset_rate,
24 | )
25 | .await;
26 |
27 | let value = rate(&instance, AssetId::new(*instance.contract_id().hash())).await;
28 | assert_eq!(asset_rate, value);
29 | }
30 | }
31 |
--------------------------------------------------------------------------------
/multisig-wallet/multisig-contract/src/events.sw:
--------------------------------------------------------------------------------
1 | library;
2 |
3 | use ::data_structures::{hashing::TransactionParameters, user::User};
4 | use std::{bytes::Bytes, low_level_call::CallParams};
5 |
6 | /// Log of an executed transaction.
7 | pub struct ExecuteTransactionEvent {
8 | /// The nonce of the transaction.
9 | nonce: u64,
10 | /// The parameters of the transaction.
11 | /// The target of the transaction.
12 | // transaction_parameters: TransactionParameters, // TODO: Uncomment and reorder fields when SDK supports logs with nested Bytes https://github.com/FuelLabs/fuels-rs/issues/1046
13 | target: Identity,
14 | }
15 |
16 | /// Log of setting the threshold.
17 | pub struct SetThresholdEvent {
18 | /// The previous threshold.
19 | previous_threshold: u64,
20 | /// The new threshold.
21 | threshold: u64,
22 | }
23 |
24 | /// Log of setting the threshold.
25 | pub struct SetWeightEvent {
26 | /// The information of user who's weight has been changed.
27 | user: User,
28 | }
29 |
--------------------------------------------------------------------------------
/multisig-wallet/multisig-contract/tests/functions/info/approval_weight.rs:
--------------------------------------------------------------------------------
1 | mod success {
2 |
3 | use crate::utils::{
4 | interface::{core::constructor, info::approval_weight},
5 | setup::{default_users, setup_env, VALID_SIGNER_PK},
6 | };
7 |
8 | #[tokio::test]
9 | async fn gets_weight() {
10 | let (_private_key, deployer, _non_owner) = setup_env(VALID_SIGNER_PK).await.unwrap();
11 | let users = default_users();
12 |
13 | let initial_weight = approval_weight(&deployer.contract, users.first().unwrap().address)
14 | .await
15 | .value;
16 |
17 | constructor(&deployer.contract, users.clone()).await;
18 |
19 | let final_weight = approval_weight(&deployer.contract, users.first().unwrap().address)
20 | .await
21 | .value;
22 |
23 | assert_eq!(initial_weight, 0);
24 | assert_ne!(initial_weight, final_weight);
25 | assert_eq!(final_weight, users.first().unwrap().weight);
26 | }
27 | }
28 |
--------------------------------------------------------------------------------
/TicTacToe/tictactoe-contract/tests/utils/interface.rs:
--------------------------------------------------------------------------------
1 | use crate::utils::setup::TicTacToe;
2 | use fuels::{
3 | accounts::wallet::WalletUnlocked, prelude::TxPolicies,
4 | programs::call_response::FuelCallResponse, types::Identity,
5 | };
6 |
7 | pub(crate) async fn new_game(
8 | contract: &TicTacToe,
9 | player_one: &Identity,
10 | player_two: &Identity,
11 | ) -> FuelCallResponse<()> {
12 | contract
13 | .methods()
14 | .new_game(*player_one, *player_two)
15 | .with_tx_policies(TxPolicies::default().with_script_gas_limit(2_000_000))
16 | .call()
17 | .await
18 | .unwrap()
19 | }
20 |
21 | pub(crate) async fn make_move(
22 | contract: &TicTacToe,
23 | position: u64,
24 | ) -> FuelCallResponse<()> {
25 | contract
26 | .methods()
27 | .make_move(position)
28 | .with_tx_policies(TxPolicies::default().with_script_gas_limit(2_000_000))
29 | .call()
30 | .await
31 | .unwrap()
32 | }
33 |
--------------------------------------------------------------------------------
/.docs/contributing-book/src/documentation/project-quality/documentation/code/comments.md:
--------------------------------------------------------------------------------
1 | # Comments
2 |
3 | Comments are used by developers for themselves or other developers to provide insight into some functionality.
4 |
5 | There are many ways to achieve the same outcome for a line of code however there are implementation tradeoffs to consider and a developer might be interested in knowing why the current approach has been chosen.
6 |
7 | Moreover, it may not be immediately clear why, or what, some line of code is doing so it may be a good idea to add a comment summarizing the intent behind the implementation.
8 |
9 | The following snippet looks at two items being documented using the comment syntax `//`.
10 |
11 | - `Item1` has poor comments that do not convey any meaningful information and it's better to not include them at all.
12 | - `Item2` has taken the approach of describing the context in order to provide meaning behind each field
13 |
14 | ```sway
15 | {{#include ../../../../code/bad_documentation/src/lib.sw:data_structures}}
16 | ```
17 |
--------------------------------------------------------------------------------
/.github/ISSUE_TEMPLATE/new_application.yml:
--------------------------------------------------------------------------------
1 | name: New Application Specification
2 | description: "Designing a new application? Pick this template!"
3 | title: ""
4 | labels: ["New Application"]
5 | body:
6 | - type: textarea
7 | id: motivation
8 | attributes:
9 | label: Application Description
10 | description: Describe the application, motivation behind it and write a mini-specification
11 | placeholder: |
12 | #### Description
13 | The application ...
14 |
15 | #### Motivation
16 | It allows ...
17 |
18 | #### Specification
19 | ...
20 | validations:
21 | required: true
22 | - type: textarea
23 | id: features
24 | attributes:
25 | label: Features
26 | description: After you create this issue update the checklist below to track the progress of the sub tasks!
27 | placeholder: |
28 | - [ ] #(issue number 1)
29 | - [ ] #(issue number 2)
30 | - [ ] #(issue number 3)
31 | validations:
32 | required: true
33 |
--------------------------------------------------------------------------------
/multisig-wallet/multisig-contract/src/data_structures/signatures.sw:
--------------------------------------------------------------------------------
1 | library;
2 |
3 | use std::b512::B512;
4 |
5 | /// Determines the type of message formatting.
6 | pub enum MessageFormat {
7 | None: (),
8 | EIP191PersonalSign: (),
9 | }
10 |
11 | /// Determines the type of message prefixing.
12 | pub enum MessagePrefix {
13 | None: (),
14 | Ethereum: (),
15 | }
16 |
17 | /// Determines the type wallet.
18 | pub enum WalletType {
19 | Fuel: (),
20 | EVM: (),
21 | }
22 |
23 | /// Information about a specific signature.
24 | pub struct SignatureInfo {
25 | /// The type of formatting of the message that was signed.
26 | message_format: MessageFormat,
27 | /// The type of prefix prepended to the message that was signed.
28 | message_prefix: MessagePrefix,
29 | /// The signature generated by signing over a message hash with the format and prefix specified in the `format` and `prefix` fields.
30 | signature: B512,
31 | /// The wallet type of the signer of the message.
32 | wallet_type: WalletType,
33 | }
34 |
--------------------------------------------------------------------------------
/TicTacToe/src/hooks/useGetMoveCounter.ts:
--------------------------------------------------------------------------------
1 | import { useWallet } from '@fuels/react';
2 | import { useQuery } from '@tanstack/react-query';
3 |
4 | import { CONTRACT_ID } from '../config';
5 | import { TictactoeContractAbi__factory } from '../contract-types';
6 | import { TicTacToeQueryKeys } from '../queryKeys';
7 |
8 | export const useGetMoveCounter = () => {
9 | const { wallet, isError, isLoading } = useWallet();
10 |
11 | const query = useQuery({
12 | queryKey: [TicTacToeQueryKeys.moveCounter, wallet?.provider.url],
13 | queryFn: async () => {
14 | if (!wallet)
15 | throw new Error(`Cannot get move counter if wallet is ${wallet}`);
16 |
17 | const contract = TictactoeContractAbi__factory.connect(
18 | CONTRACT_ID,
19 | wallet
20 | );
21 |
22 | const result = await contract.functions.get_move_counter().simulate();
23 | return result.value ?? null;
24 | },
25 | enabled: !!wallet && !isError && !isLoading,
26 | });
27 |
28 | return { ...useQuery, moveCounter: query.data };
29 | };
30 |
--------------------------------------------------------------------------------
/.docs/contributing-book/src/documentation/issues/search/filtering.md:
--------------------------------------------------------------------------------
1 | # Filtering by label
2 |
3 | The default issues tab shows all of the issues that are currently open. GitHub already provides various search queries that can be made using the search bar. However an easier way is to use the labels that the authors have provided to quickly filter for the relevant issues such as bugs, improvements, documentation, etc.
4 |
5 | Under the `Label` tab you can select any number of labels and any issue that matches those labels will be shown while the other issues will be hidden.
6 |
7 | 
8 |
9 |
10 |
11 | After clicking on the `App: DAO` label the issues have been filtered to show only the issues that have `App: DAO` added to them.
12 |
13 | Notice that `App: DAO` is not the only label in the image below. If you wish to further reduce the number of presented issues then additional labels can be added in the same way.
14 |
15 | 
16 |
--------------------------------------------------------------------------------
/TicTacToe/src/hooks/useGetCurrentPlayer.ts:
--------------------------------------------------------------------------------
1 | import { useWallet } from '@fuels/react';
2 | import { useQuery } from '@tanstack/react-query';
3 |
4 | import { CONTRACT_ID } from '../config';
5 | import { TictactoeContractAbi__factory } from '../contract-types';
6 | import { TicTacToeQueryKeys } from '../queryKeys';
7 |
8 | export const useGetCurrentPlayer = () => {
9 | const { wallet, isError, isLoading } = useWallet();
10 |
11 | const query = useQuery({
12 | queryKey: [TicTacToeQueryKeys.currentPlayer, wallet?.provider.url],
13 | queryFn: async () => {
14 | if (!wallet)
15 | throw new Error(`Cannot get current player if wallet is ${wallet}`);
16 |
17 | const contract = TictactoeContractAbi__factory.connect(
18 | CONTRACT_ID,
19 | wallet
20 | );
21 | const result = await contract.functions.get_current_player().simulate();
22 | return result.value ?? null;
23 | },
24 | enabled: !!wallet && !isError && !isLoading,
25 | });
26 |
27 | return { ...query, currentPlayer: query.data };
28 | };
29 |
--------------------------------------------------------------------------------
/english-auction/auction-contract/tests/utils/interface/info.rs:
--------------------------------------------------------------------------------
1 | use crate::utils::setup::{Auction, EnglishAuction};
2 | use fuels::{prelude::WalletUnlocked, types::Identity};
3 |
4 | pub(crate) async fn auction_info(
5 | auction_id: u64,
6 | contract: &EnglishAuction,
7 | ) -> Option {
8 | contract
9 | .methods()
10 | .auction_info(auction_id)
11 | .call()
12 | .await
13 | .unwrap()
14 | .value
15 | }
16 |
17 | pub(crate) async fn deposit_balance(
18 | auction_id: u64,
19 | contract: &EnglishAuction,
20 | identity: Identity,
21 | ) -> Option {
22 | contract
23 | .methods()
24 | .deposit_balance(auction_id, identity)
25 | .call()
26 | .await
27 | .unwrap()
28 | .value
29 | }
30 |
31 | pub(crate) async fn total_auctions(contract: &EnglishAuction) -> u64 {
32 | contract
33 | .methods()
34 | .total_auctions()
35 | .call()
36 | .await
37 | .unwrap()
38 | .value
39 | }
40 |
--------------------------------------------------------------------------------
/oracle/oracle-contract/src/interface.sw:
--------------------------------------------------------------------------------
1 | library;
2 |
3 | abi Oracle {
4 | /// Return the owner (node) of the oracle.
5 | ///
6 | /// # Additional Information
7 | ///
8 | /// The owner is initialized to the first deterministically generated wallet using the SDK.
9 | ///
10 | /// # Returns
11 | ///
12 | /// * [Identity] - The owner of the oracle.
13 | fn owner() -> Identity;
14 |
15 | /// Return price of asset.
16 | ///
17 | /// # Additional Information
18 | ///
19 | /// The price is `None` until the price is set for the first time.
20 | /// # Returns
21 | ///
22 | /// * [Option] - The price of the tracked asset.
23 | #[storage(read)]
24 | fn price() -> Option;
25 |
26 | /// Changes the price in storage to the value of `price`.
27 | ///
28 | /// # Arguments
29 | ///
30 | /// * `price`: [u64] - New price of tracked asset.
31 | ///
32 | /// # Reverts
33 | ///
34 | /// * When the message sender is not the owner.
35 | #[storage(write)]
36 | fn set_price(price: u64);
37 | }
38 |
--------------------------------------------------------------------------------
/AMM/AMM-contract/tests/utils/mod.rs:
--------------------------------------------------------------------------------
1 | use fuels::prelude::{AssetId, WalletUnlocked};
2 | use test_utils::{
3 | data_structures::WalletAssetConfiguration,
4 | interface::AMM,
5 | setup::common::{deploy_amm, deploy_and_initialize_amm, setup_wallet_and_provider},
6 | };
7 |
8 | pub async fn setup(
9 | initialize: bool,
10 | ) -> (WalletUnlocked, AMM, Vec<(AssetId, AssetId)>) {
11 | let (wallet, asset_ids, _provider) =
12 | setup_wallet_and_provider(&WalletAssetConfiguration::default()).await;
13 |
14 | let amm = if initialize {
15 | deploy_and_initialize_amm(&wallet).await
16 | } else {
17 | deploy_amm(&wallet).await
18 | };
19 |
20 | // setup two asset pairs that will be used in tests
21 | let asset_pairs = vec![(asset_ids[0], asset_ids[1]), (asset_ids[1], asset_ids[2])];
22 |
23 | (wallet, amm.instance, asset_pairs)
24 | }
25 |
26 | pub fn ordered_pair(pair: (AssetId, AssetId)) -> (AssetId, AssetId) {
27 | if pair.0 < pair.1 {
28 | (pair.0, pair.1)
29 | } else {
30 | (pair.1, pair.0)
31 | }
32 | }
33 |
--------------------------------------------------------------------------------
/AMM/test-utils/src/paths.rs:
--------------------------------------------------------------------------------
1 | pub const AMM_CONTRACT_BINARY_PATH: &str = "../AMM-contract/out/debug/AMM-contract.bin";
2 | pub const AMM_CONTRACT_STORAGE_PATH: &str =
3 | "../AMM-contract/out/debug/AMM-contract-storage_slots.json";
4 | pub const ATOMIC_ADD_LIQUIDITY_SCRIPT_BINARY_PATH: &str = "./out/debug/atomic-add-liquidity.bin";
5 | pub const EXCHANGE_CONTRACT_BINARY_PATH: &str =
6 | "../exchange-contract/out/debug/exchange-contract.bin";
7 | pub const EXCHANGE_CONTRACT_STORAGE_PATH: &str =
8 | "../exchange-contract/out/debug/exchange-contract-storage_slots.json";
9 | pub const MALICIOUS_EXCHANGE_CONTRACT_BINARY_PATH: &str =
10 | "../test-utils/test-artifacts/malicious-implementation/out/debug/malicious-implementation.bin";
11 | pub const MALICIOUS_EXCHANGE_CONTRACT_STORAGE_PATH: &str =
12 | "../test-utils/test-artifacts/malicious-implementation/out/debug/malicious-implementation-storage_slots.json";
13 | pub const SWAP_EXACT_INPUT_SCRIPT_BINARY_PATH: &str = "./out/debug/swap-exact-input.bin";
14 | pub const SWAP_EXACT_OUTPUT_SCRIPT_BINARY_PATH: &str = "./out/debug/swap-exact-output.bin";
15 |
--------------------------------------------------------------------------------
/airdrop/airdrop-contract/src/errors.sw:
--------------------------------------------------------------------------------
1 | library;
2 |
3 | /// Errors related to permissions.
4 | pub enum AccessError {
5 | /// The caller is not the admin of the contract.
6 | CallerNotAdmin: (),
7 | /// There are not enough coins in the contract to perform the operation.
8 | NotEnoughCoins: (),
9 | /// The user has already claimed their coins.
10 | UserAlreadyClaimed: (),
11 | }
12 |
13 | /// Errors related to the initialization of the contract.
14 | pub enum InitError {
15 | /// The contract has already been initialized.
16 | AlreadyInitialized: (),
17 | /// No coins were transferred during initialization.
18 | CannotAirdropZeroCoins: (),
19 | }
20 |
21 | /// Errors related to the state of the contract.
22 | pub enum StateError {
23 | /// The claim period is not active.
24 | ClaimPeriodNotActive: (),
25 | /// The claim period is active.
26 | ClaimPeriodActive: (),
27 | }
28 |
29 | /// Errors related to the verification of the merkle proof.
30 | pub enum VerificationError {
31 | /// The merkle proof verification failed.
32 | MerkleProofFailed: (),
33 | }
34 |
--------------------------------------------------------------------------------
/.devops/.template/SPECIFICATION.md:
--------------------------------------------------------------------------------
1 | Table of Contents
2 | - [Overview](#overview)
3 | - [Use Cases](#use-cases)
4 | - [Core Functionality](#core-functionality)
5 | - [`template()`](#template)
6 | - [Miscellaneous Information](#miscellaneous-information)
7 | - [Diagrams](#diagrams)
8 | - [Sequence Diagram](#sequence-diagram)
9 |
10 | # Overview
11 |
12 | This document provides an overview of the application.
13 |
14 | It outlines the use cases, i.e. desirable functionality, in addition to requirements for the smart contract and the user interface.
15 |
16 | # Use Cases
17 |
18 | This section contains general information about the functionality of the application and thus does not touch upon any technical aspects.
19 |
20 | If you are interested in a functional overview then this is the section for you.
21 |
22 | ## Core Functionality
23 |
24 | ### `template()`
25 |
26 | TODO: description of function
27 |
28 | 1. TODO: description of requirement
29 |
30 | ## Miscellaneous Information
31 |
32 | ## Diagrams
33 |
34 | ### Sequence Diagram
35 |
36 | 
37 |
--------------------------------------------------------------------------------
/.devops/aurora/src/main.rs:
--------------------------------------------------------------------------------
1 | mod cli;
2 | mod commands;
3 | mod utils;
4 |
5 | use clap::Parser;
6 | use cli::{Cli, Mode};
7 | use commands::{build, bump, fmt, test};
8 | use utils::{read_applications, repo_root};
9 |
10 | fn main() -> anyhow::Result<()> {
11 | let cli = Cli::parse();
12 | let root = repo_root();
13 |
14 | match cli.command {
15 | Mode::Build(opt) => match opt.apps {
16 | Some(apps) => build::run(apps, opt.program, root),
17 | None => build::run(read_applications(), opt.program, root),
18 | },
19 | Mode::Bump { apps } => match apps {
20 | Some(apps) => bump::run(apps, root),
21 | None => bump::run(read_applications(), root),
22 | },
23 | Mode::Fmt(opt) => match opt.apps {
24 | Some(apps) => fmt::run(apps, opt.program, root),
25 | None => fmt::run(read_applications(), opt.program, root),
26 | },
27 | Mode::Test { apps } => match apps {
28 | Some(apps) => test::run(apps, root),
29 | None => test::run(read_applications(), root),
30 | },
31 | }
32 | }
33 |
--------------------------------------------------------------------------------
/TicTacToe/src/hooks/useGetGameBoard.ts:
--------------------------------------------------------------------------------
1 | import { useWallet } from '@fuels/react';
2 | import { useQuery } from '@tanstack/react-query';
3 |
4 | import { CONTRACT_ID, PROVIDER_URL } from '../config';
5 | import { TictactoeContractAbi__factory } from '../contract-types';
6 | import { TicTacToeQueryKeys } from '../queryKeys';
7 |
8 | export const useGetGameBoard = () => {
9 | const { wallet, isError, isLoading } = useWallet();
10 |
11 | const query = useQuery({
12 | queryKey: [TicTacToeQueryKeys.gameBoard, wallet?.provider.url],
13 | queryFn: async () => {
14 | if (!wallet)
15 | throw new Error(`Cannot get game board if wallet is ${wallet}`);
16 |
17 | if (PROVIDER_URL !== wallet.provider.url) {
18 | return null;
19 | }
20 |
21 | const contract = TictactoeContractAbi__factory.connect(
22 | CONTRACT_ID,
23 | wallet
24 | );
25 | const result = await contract.functions.get_board().simulate();
26 | return result.value ?? null;
27 | },
28 | enabled: !!wallet && !isError && !isLoading,
29 | });
30 |
31 | return { ...query, gameBoard: query.data };
32 | };
33 |
--------------------------------------------------------------------------------
/TicTacToe/src/hooks/useGetGameState.ts:
--------------------------------------------------------------------------------
1 | import { useWallet } from '@fuels/react';
2 | import { useQuery } from '@tanstack/react-query';
3 |
4 | import { CONTRACT_ID, PROVIDER_URL } from '../config';
5 | import { TictactoeContractAbi__factory } from '../contract-types';
6 | import { TicTacToeQueryKeys } from '../queryKeys';
7 |
8 | export const useGetGameState = () => {
9 | const { wallet, isError, isLoading } = useWallet();
10 |
11 | const query = useQuery({
12 | queryKey: [TicTacToeQueryKeys.gameState, wallet?.provider.url],
13 | queryFn: async () => {
14 | if (!wallet)
15 | throw new Error(`Cannot get game state if the wallet is ${wallet}`);
16 |
17 | if (PROVIDER_URL !== wallet.provider.url) {
18 | return null;
19 | }
20 |
21 | const contract = TictactoeContractAbi__factory.connect(
22 | CONTRACT_ID,
23 | wallet
24 | );
25 | const result = await contract.functions.get_game_state().simulate();
26 | return result.value ?? null;
27 | },
28 | enabled: !!wallet && !isError && !isLoading,
29 | });
30 |
31 | return { ...query, gameState: query.data };
32 | };
33 |
--------------------------------------------------------------------------------
/.docs/contributing-book/src/documentation/issues/search/index.md:
--------------------------------------------------------------------------------
1 | # Searching for Issues
2 |
3 | There are a few points to consider when looking for a task to contribute to.
4 | The following sections provide a quickstart guide for navigating the issues in the Sway Applications repository.
5 |
6 | ## [Filtering by label](./filtering.md)
7 |
8 | Issues can be grouped into categories through the use of labels and depending on the category a user may choose to contribute to one task or another.
9 |
10 | - Is it a bug fix, improvement, documentation etc.
11 | - Is it for the compiler, user interface, tooling etc.
12 | - Is the priority critical and must be resolved immediately or is it a low priority "nice to have"?
13 |
14 | ## [Checking for available issues](./assignment.md)
15 |
16 | Once the issues are filtered a task can be selected if another user is not currently assigned to that task otherwise multiple people may be working on the same issue when only one solution can be chosen.
17 |
18 | ## [Issue summary](./summary.md)
19 |
20 | Each issue should have a description which provides context into the problem and what may be done to resolve it.
21 |
22 |
--------------------------------------------------------------------------------
/airdrop/airdrop-contract/src/events.sw:
--------------------------------------------------------------------------------
1 | library;
2 |
3 | pub struct ClaimEvent {
4 | /// The quantity of an asset which is to be transferred to the user.
5 | pub amount: u64,
6 | /// The user that has a claim to coins with a valid proof.
7 | pub claimer: Identity,
8 | /// The identity that will receive the transferred asset.
9 | pub to: Identity,
10 | }
11 |
12 | pub struct ClawbackEvent {
13 | /// The quantity of an asset which will be returned after the claiming period has ended.
14 | pub amount: u64,
15 | /// The user that will receive the remaining asset balance.
16 | pub to: Identity,
17 | }
18 |
19 | pub struct CreateAirdropEvent {
20 | /// The user which can claim any left over coins after the claiming period.
21 | pub admin: Identity,
22 | /// The asset which is to be distributed.
23 | pub asset: AssetId,
24 | /// The block at which the claiming period will end.
25 | pub end_block: u32,
26 | /// The computed merkle root that will be used to verify claims.
27 | pub merkle_root: b256,
28 | /// The total number of leaves in the merkle tree
29 | pub number_of_leaves: u64,
30 | }
31 |
--------------------------------------------------------------------------------
/escrow/escrow-contract/tests/utils/interface/info.rs:
--------------------------------------------------------------------------------
1 | use crate::utils::setup::{Arbiter, Asset, EscrowInfo, User};
2 |
3 | pub(crate) async fn arbiter_proposal(caller: &User, identifier: u64) -> Option {
4 | caller
5 | .contract
6 | .methods()
7 | .arbiter_proposal(identifier)
8 | .call()
9 | .await
10 | .unwrap()
11 | .value
12 | }
13 |
14 | pub(crate) async fn assets(caller: &User, identifier: u64) -> Option {
15 | caller
16 | .contract
17 | .methods()
18 | .assets(identifier)
19 | .call()
20 | .await
21 | .unwrap()
22 | .value
23 | }
24 |
25 | pub(crate) async fn escrows(caller: &User, identifier: u64) -> Option {
26 | caller
27 | .contract
28 | .methods()
29 | .escrows(identifier)
30 | .call()
31 | .await
32 | .unwrap()
33 | .value
34 | }
35 |
36 | pub(crate) async fn escrow_count(caller: &User) -> u64 {
37 | caller
38 | .contract
39 | .methods()
40 | .escrow_count()
41 | .call()
42 | .await
43 | .unwrap()
44 | .value
45 | }
46 |
--------------------------------------------------------------------------------
/escrow/escrow-contract/tests/functions/info/assets.rs:
--------------------------------------------------------------------------------
1 | mod success {
2 |
3 | use crate::utils::{
4 | interface::{core::create_escrow, info::assets},
5 | setup::{create_arbiter, create_asset, setup},
6 | };
7 |
8 | #[tokio::test]
9 | async fn returns_none() {
10 | let (_arbiter, _buyer, seller, _defaults) = setup().await;
11 | assert!(assets(&seller, 0).await.is_none());
12 | }
13 |
14 | #[tokio::test]
15 | async fn returns_asset() {
16 | let (arbiter, buyer, seller, defaults) = setup().await;
17 | let arbiter_obj = create_arbiter(&arbiter, defaults.asset_id, defaults.asset_amount).await;
18 | let asset = create_asset(defaults.asset_amount, defaults.asset_id).await;
19 |
20 | assert!(assets(&seller, 0).await.is_none());
21 |
22 | create_escrow(
23 | defaults.asset_amount,
24 | &arbiter_obj,
25 | &defaults.asset_id,
26 | vec![asset.clone()],
27 | &buyer,
28 | &seller,
29 | defaults.deadline,
30 | )
31 | .await;
32 |
33 | assert_eq!(assets(&seller, 0).await.unwrap(), asset);
34 | }
35 | }
36 |
--------------------------------------------------------------------------------
/escrow/escrow-contract/tests/functions/info/escrow_count.rs:
--------------------------------------------------------------------------------
1 | mod success {
2 |
3 | use crate::utils::{
4 | interface::{core::create_escrow, info::escrow_count},
5 | setup::{create_arbiter, create_asset, setup},
6 | };
7 |
8 | #[tokio::test]
9 | async fn returns_zero() {
10 | let (_arbiter, _buyer, seller, _defaults) = setup().await;
11 | assert_eq!(0, escrow_count(&seller).await);
12 | }
13 |
14 | #[tokio::test]
15 | async fn returns_one() {
16 | let (arbiter, buyer, seller, defaults) = setup().await;
17 | let arbiter_obj = create_arbiter(&arbiter, defaults.asset_id, defaults.asset_amount).await;
18 | let asset = create_asset(defaults.asset_amount, defaults.asset_id).await;
19 |
20 | assert_eq!(0, escrow_count(&seller).await);
21 |
22 | create_escrow(
23 | defaults.asset_amount,
24 | &arbiter_obj,
25 | &defaults.asset_id,
26 | vec![asset.clone()],
27 | &buyer,
28 | &seller,
29 | defaults.deadline,
30 | )
31 | .await;
32 |
33 | assert_eq!(1, escrow_count(&seller).await);
34 | }
35 | }
36 |
--------------------------------------------------------------------------------
/name-registry/registry-contract/tests/utils/interface/info.rs:
--------------------------------------------------------------------------------
1 | use crate::utils::setup::{NameRegistry, RegistrationValidityError};
2 | use fuels::{
3 | prelude::{AssetId, WalletUnlocked},
4 | programs::call_response::FuelCallResponse,
5 | types::Identity,
6 | };
7 |
8 | pub(crate) async fn rate(instance: &NameRegistry, id: AssetId) -> Option {
9 | instance.methods().rate(id).call().await.unwrap().value
10 | }
11 |
12 | pub(crate) async fn expiry(
13 | instance: &NameRegistry,
14 | name: String,
15 | ) -> FuelCallResponse> {
16 | instance.methods().expiry(name).call().await.unwrap()
17 | }
18 |
19 | pub(crate) async fn identity(
20 | instance: &NameRegistry,
21 | name: String,
22 | ) -> FuelCallResponse> {
23 | instance.methods().resolver(name).call().await.unwrap()
24 | }
25 |
26 | pub(crate) async fn owner(
27 | instance: &NameRegistry,
28 | name: String,
29 | ) -> FuelCallResponse> {
30 | instance.methods().name_owner(name).call().await.unwrap()
31 | }
32 |
--------------------------------------------------------------------------------
/fundraiser/fundraiser-contract/tests/functions/info/pledge_count.rs:
--------------------------------------------------------------------------------
1 | mod success {
2 |
3 | use crate::utils::{
4 | interface::{
5 | core::{create_campaign, pledge},
6 | info::pledge_count,
7 | },
8 | setup::{identity, setup},
9 | };
10 |
11 | #[tokio::test]
12 | async fn returns_zero() {
13 | let (_, user, _, _, _) = setup().await;
14 |
15 | assert_eq!(
16 | 0,
17 | pledge_count(&user.contract, identity(user.wallet.address()).await).await
18 | );
19 | }
20 |
21 | #[tokio::test]
22 | async fn returns_one() {
23 | let (author, user, asset, _, defaults) = setup().await;
24 |
25 | create_campaign(
26 | &author.contract,
27 | &defaults.asset_id,
28 | &defaults.beneficiary,
29 | defaults.deadline,
30 | defaults.target_amount,
31 | )
32 | .await;
33 |
34 | pledge(&user.contract, 1, &asset, defaults.target_amount).await;
35 | assert_eq!(
36 | 1,
37 | pledge_count(&user.contract, identity(user.wallet.address()).await).await
38 | );
39 | }
40 | }
41 |
--------------------------------------------------------------------------------
/oracle/oracle-contract/src/main.sw:
--------------------------------------------------------------------------------
1 | contract;
2 |
3 | mod data_structures;
4 | mod errors;
5 | mod events;
6 | mod interface;
7 |
8 | use ::data_structures::State;
9 | use ::errors::AccessError;
10 | use ::events::PriceUpdateEvent;
11 | use ::interface::Oracle;
12 | use std::auth::msg_sender;
13 |
14 | configurable {
15 | /// Owner of the contract.
16 | OWNER: Identity = Identity::Address(Address::from(0x09c0b2d1a486c439a87bcba6b46a7a1a23f3897cc83a94521a96da5c23bc58db)),
17 | }
18 |
19 | storage {
20 | /// Current price of tracked asset.
21 | price: Option = Option::None,
22 | }
23 |
24 | impl Oracle for Contract {
25 | fn owner() -> Identity {
26 | OWNER
27 | }
28 |
29 | #[storage(read)]
30 | fn price() -> Option {
31 | match storage.price.try_read() {
32 | Option::Some(price) => price,
33 | Option::None => Option::None,
34 | }
35 | }
36 |
37 | #[storage(write)]
38 | fn set_price(price: u64) {
39 | require(msg_sender().unwrap() == OWNER, AccessError::NotOwner);
40 |
41 | storage.price.write(Option::Some(price));
42 |
43 | log(PriceUpdateEvent { price });
44 | }
45 | }
46 |
--------------------------------------------------------------------------------
/.docs/contributing-book/src/documentation/project-quality/project-structure/external.md:
--------------------------------------------------------------------------------
1 | # External Project
2 |
3 | These are projects that expose an interface, e.g., the `ABI` of your contract(s), that can be imported into other projects.
4 |
5 | The following structure separates the interface of the contract into its own library project so that it can be imported alongside projects in the `my_application` directory and outside of it.
6 |
7 | ```
8 | my_application/
9 | ├── my_library/
10 | └── my_contract/
11 | ```
12 |
13 | The interface has a simple structure in this example because it consists of a single file, `lib.sw`.
14 |
15 | ```
16 | my_library/
17 | ├── src/
18 | ├──── lib.sw
19 | ├── tests/
20 | ├── Cargo.toml
21 | └── Forc.toml
22 | ```
23 |
24 | The contract follows the structure of an [internal project](internal.md) however since the interface is now its own project `interface.sw` has been removed from the `src` directory and it is being imported in the manifest file.
25 |
26 | ```
27 | my_contract/
28 | ├── src/
29 | ├──── data_structures.sw
30 | ├──── errors.sw
31 | ├──── events.sw
32 | ├──── main.sw
33 | ├──── utils.sw
34 | ├── tests/
35 | ├── Cargo.toml
36 | └── Forc.toml
37 | ```
38 |
--------------------------------------------------------------------------------
/multisig-wallet/multisig-contract/tests/functions/info/balance.rs:
--------------------------------------------------------------------------------
1 | mod success {
2 |
3 | use crate::utils::{
4 | interface::info::balance,
5 | setup::{setup_env, DEFAULT_TRANSFER_AMOUNT, VALID_SIGNER_PK},
6 | };
7 | use fuels::{
8 | accounts::Account,
9 | prelude::{TxPolicies, BASE_ASSET_ID},
10 | };
11 |
12 | #[tokio::test]
13 | async fn gets_balance() {
14 | let (_private_key, deployer, _non_owner) = setup_env(VALID_SIGNER_PK).await.unwrap();
15 |
16 | let initial_balance = balance(&deployer.contract, BASE_ASSET_ID).await.value;
17 |
18 | deployer
19 | .wallet
20 | .force_transfer_to_contract(
21 | deployer.contract.contract_id(),
22 | DEFAULT_TRANSFER_AMOUNT,
23 | BASE_ASSET_ID,
24 | TxPolicies::default(),
25 | )
26 | .await
27 | .unwrap();
28 |
29 | let final_balance = balance(&deployer.contract, BASE_ASSET_ID).await.value;
30 |
31 | assert_eq!(initial_balance, 0);
32 | assert_eq!(final_balance, DEFAULT_TRANSFER_AMOUNT);
33 | assert!(final_balance > initial_balance);
34 | }
35 | }
36 |
--------------------------------------------------------------------------------
/AMM/Forc.lock:
--------------------------------------------------------------------------------
1 | [[package]]
2 | name = "AMM-contract"
3 | source = "member"
4 | dependencies = [
5 | "libraries",
6 | "std",
7 | ]
8 |
9 | [[package]]
10 | name = "atomic-add-liquidity"
11 | source = "member"
12 | dependencies = [
13 | "libraries",
14 | "std",
15 | ]
16 |
17 | [[package]]
18 | name = "core"
19 | source = "path+from-root-841ED074400F52FC"
20 |
21 | [[package]]
22 | name = "exchange-contract"
23 | source = "member"
24 | dependencies = [
25 | "libraries",
26 | "std",
27 | ]
28 |
29 | [[package]]
30 | name = "libraries"
31 | source = "path+from-root-0A0D5AF9717FBB89"
32 | dependencies = ["std"]
33 |
34 | [[package]]
35 | name = "malicious-implementation"
36 | source = "member"
37 | dependencies = [
38 | "libraries",
39 | "std",
40 | ]
41 |
42 | [[package]]
43 | name = "std"
44 | source = "git+https://github.com/fuellabs/sway?rev#4fe6f1ed5134914f1133bb7032e9fe7165255cc6"
45 | dependencies = ["core"]
46 |
47 | [[package]]
48 | name = "swap-exact-input"
49 | source = "member"
50 | dependencies = [
51 | "libraries",
52 | "std",
53 | ]
54 |
55 | [[package]]
56 | name = "swap-exact-output"
57 | source = "member"
58 | dependencies = [
59 | "libraries",
60 | "std",
61 | ]
62 |
--------------------------------------------------------------------------------
/airdrop/airdrop-contract/tests/functions/info/number_of_leaves.rs:
--------------------------------------------------------------------------------
1 | mod success {
2 |
3 | use crate::utils::{
4 | interface::{core::airdrop_constructor, info::number_of_leaves},
5 | setup::{defaults, setup},
6 | };
7 | use fuels::types::Bits256;
8 |
9 | #[tokio::test]
10 | async fn returns_end_block() {
11 | let (deploy_wallet, wallet1, wallet2, wallet3, asset_id) = setup().await;
12 | let (_, _, _, minter, _, leaf_count, asset_supply, _, claim_time, _, _) =
13 | defaults(&deploy_wallet, &wallet1, &wallet2, &wallet3).await;
14 | let root = Bits256([2u8; 32]);
15 |
16 | assert_eq!(
17 | 0,
18 | number_of_leaves(&deploy_wallet.airdrop_distributor).await,
19 | );
20 |
21 | airdrop_constructor(
22 | minter,
23 | asset_supply / 2,
24 | asset_id,
25 | claim_time,
26 | &deploy_wallet.airdrop_distributor,
27 | root,
28 | leaf_count,
29 | )
30 | .await;
31 |
32 | assert_eq!(
33 | leaf_count,
34 | number_of_leaves(&deploy_wallet.airdrop_distributor).await,
35 | );
36 | }
37 | }
38 |
--------------------------------------------------------------------------------
/airdrop/airdrop-contract/tests/functions/info/admin.rs:
--------------------------------------------------------------------------------
1 | mod success {
2 | use crate::utils::{
3 | interface::{core::airdrop_constructor, info::admin},
4 | setup::{build_tree, defaults, setup},
5 | };
6 |
7 | #[tokio::test]
8 | async fn returns_admin() {
9 | let (deploy_wallet, wallet1, wallet2, wallet3, asset_id) = setup().await;
10 | let (_, _, _, minter, key, num_leaves, asset_supply, airdrop_leaves, claim_time, _, _) =
11 | defaults(&deploy_wallet, &wallet1, &wallet2, &wallet3).await;
12 |
13 | let (_tree, root, _leaf, _) = build_tree(key, airdrop_leaves.clone()).await;
14 |
15 | assert_eq!(
16 | admin(&deploy_wallet.airdrop_distributor,).await,
17 | Option::None
18 | );
19 |
20 | airdrop_constructor(
21 | minter,
22 | asset_supply / 2,
23 | asset_id,
24 | claim_time,
25 | &deploy_wallet.airdrop_distributor,
26 | root,
27 | num_leaves,
28 | )
29 | .await;
30 |
31 | assert_eq!(
32 | admin(&deploy_wallet.airdrop_distributor,).await.unwrap(),
33 | minter
34 | );
35 | }
36 | }
37 |
--------------------------------------------------------------------------------
/name-registry/registry-contract/src/data_structures.sw:
--------------------------------------------------------------------------------
1 | library;
2 |
3 | /// Object containing data about an entry in the registry
4 | pub struct Record {
5 | /// The timestamp at which the name expires, and someone else can re-register the same name
6 | pub expiry: u64,
7 | /// The identity to which the name resolves to
8 | pub identity: Identity,
9 | /// The identity which controls the name, and can change the identity and owner
10 | pub owner: Identity,
11 | }
12 |
13 | impl Record {
14 | /// Create a new instance of a record
15 | ///
16 | /// # Arguments
17 | ///
18 | /// * `expiry`: [u64] - The timestamp at which the name expires, and someone else can re-register the same name
19 | /// * `identity`: [Identity] - The identity to which the name resolves to
20 | /// * `owner`: [Identity] - The identity which controls the name, and can change the identity and owner
21 | ///
22 | /// # Returns
23 | ///
24 | /// * [Self] - Struct containing information about a record
25 | pub fn new(expiry: u64, identity: Identity, owner: Identity) -> Self {
26 | Self {
27 | expiry,
28 | identity,
29 | owner,
30 | }
31 | }
32 | }
33 |
--------------------------------------------------------------------------------
/TicTacToe/src/hooks/useMakeMove.ts:
--------------------------------------------------------------------------------
1 | import { useWallet } from '@fuels/react';
2 | import { useMutation } from '@tanstack/react-query';
3 |
4 | import { queryClient } from '../components';
5 | import { CONTRACT_ID } from '../config';
6 | import { TictactoeContractAbi__factory } from '../contract-types';
7 |
8 | export const useMakeMove = (position: number) => {
9 | const { wallet } = useWallet();
10 |
11 | const mutation = useMutation({
12 | mutationFn: async () => {
13 | if (!wallet) throw new Error(`Cannot make move if wallet is ${wallet}`);
14 |
15 | const contract = TictactoeContractAbi__factory.connect(
16 | CONTRACT_ID,
17 | wallet
18 | );
19 |
20 | const result = await contract.functions.make_move(position).call();
21 | return result;
22 | },
23 | onSuccess: async () => {
24 | await queryClient.invalidateQueries();
25 | },
26 | onError: async (err) => {
27 | // TODO: remove once we figure out why a successful call returns an error from the ts sdk
28 | // on beta-5
29 | await queryClient.invalidateQueries();
30 | // eslint-disable-next-line no-console
31 | console.error(err);
32 | },
33 | });
34 |
35 | return mutation;
36 | };
37 |
--------------------------------------------------------------------------------
/fundraiser/fundraiser-contract/tests/functions/info/user_campaign_count.rs:
--------------------------------------------------------------------------------
1 | mod success {
2 |
3 | use crate::utils::{
4 | interface::{core::create_campaign, info::user_campaign_count},
5 | setup::{identity, setup},
6 | };
7 |
8 | #[tokio::test]
9 | async fn returns_zero() {
10 | let (author, _, _, _, _) = setup().await;
11 |
12 | assert_eq!(
13 | 0,
14 | user_campaign_count(&author.contract, identity(author.wallet.address()).await).await
15 | );
16 | }
17 |
18 | #[tokio::test]
19 | async fn returns_one() {
20 | let (author, _, _, _, defaults) = setup().await;
21 |
22 | assert_eq!(
23 | 0,
24 | user_campaign_count(&author.contract, identity(author.wallet.address()).await).await
25 | );
26 | create_campaign(
27 | &author.contract,
28 | &defaults.asset_id,
29 | &defaults.beneficiary,
30 | defaults.deadline,
31 | defaults.target_amount,
32 | )
33 | .await;
34 | assert_eq!(
35 | 1,
36 | user_campaign_count(&author.contract, identity(author.wallet.address()).await).await
37 | );
38 | }
39 | }
40 |
--------------------------------------------------------------------------------
/timelock/timelock-contract/src/events.sw:
--------------------------------------------------------------------------------
1 | library;
2 |
3 | use ::data_structures::Asset;
4 | use std::bytes::Bytes;
5 |
6 | /// Event for when a transaction is cancelled.
7 | pub struct CancelEvent {
8 | /// The id of the transaction that was cancelled.
9 | pub id: b256,
10 | }
11 |
12 | /// Event for when a transaction is executed.
13 | pub struct ExecuteEvent {
14 | /// The asset that was transferred.
15 | pub asset: Option,
16 | /// Associated payload of the transaction.
17 | pub data: Option,
18 | /// The id of the transaction that was executed.
19 | pub id: b256,
20 | /// The recipient of the transaction.
21 | pub recipient: Identity,
22 | /// The timestamp of the transaction.
23 | pub timestamp: u64,
24 | }
25 |
26 | /// Event for when a transaction is queued.
27 | pub struct QueueEvent {
28 | /// The asset to be transferred.
29 | pub asset: Option,
30 | /// Associated payload of the transaction.
31 | pub data: Option,
32 | /// The id of the transaction that was queued.
33 | pub id: b256,
34 | /// The recipient of the transaction.
35 | pub recipient: Identity,
36 | /// The timestamp of the transaction.
37 | pub timestamp: u64,
38 | }
39 |
--------------------------------------------------------------------------------
/oracle/SPECIFICATION.md:
--------------------------------------------------------------------------------
1 | # Overview
2 |
3 | This document provides an overview of the application.
4 |
5 | It outlines the use cases, i.e. desirable functionality, in addition to requirements for the smart contract and the oracle node.
6 |
7 | # Use Cases
8 |
9 | This section contains general information about the functionality of the application and thus does not touch upon any technical aspects.
10 |
11 | If you are interested in a functional overview then this is for you.
12 |
13 | ## Actions that users are able to perform
14 |
15 | This sub-section details what a user is able to do e.g. click a button and "x, y, z" happens.
16 |
17 | ### Oracle Node
18 |
19 | `set_price()`
20 |
21 | 1. The oracle's node is the only address allowed to set the price of the asset the oracle is tracking.
22 |
23 | ### Oracle Consumer
24 |
25 | `owner()`
26 | 1. Anyone can call this function to get the owner (node) of the oracle contract
27 | > **Note**
28 | > The owner is initialized to the first deterministically generated wallet using the SDK in `Forc.toml`
29 |
30 | `price()`
31 |
32 | 1. Anyone can call this function to get the asset price that the oracle is tracking
33 |
34 | ## Sequence Diagram
35 |
36 | 
37 |
--------------------------------------------------------------------------------
/airdrop/airdrop-contract/tests/functions/info/end_block.rs:
--------------------------------------------------------------------------------
1 | mod success {
2 |
3 | use crate::utils::{
4 | interface::{core::airdrop_constructor, info::end_block},
5 | setup::{defaults, setup},
6 | };
7 | use fuels::types::Bits256;
8 |
9 | #[tokio::test]
10 | async fn returns_end_block() {
11 | let (deploy_wallet, wallet1, wallet2, wallet3, asset_id) = setup().await;
12 | let (_, _, _, minter, _, num_leaves, asset_supply, _, claim_time, _, _) =
13 | defaults(&deploy_wallet, &wallet1, &wallet2, &wallet3).await;
14 | let provider = deploy_wallet.wallet.provider().unwrap();
15 | let root = Bits256([2u8; 32]);
16 |
17 | assert_eq!(0, end_block(&deploy_wallet.airdrop_distributor).await,);
18 |
19 | airdrop_constructor(
20 | minter,
21 | asset_supply / 2,
22 | asset_id,
23 | claim_time,
24 | &deploy_wallet.airdrop_distributor,
25 | root,
26 | num_leaves,
27 | )
28 | .await;
29 |
30 | assert_eq!(
31 | provider.latest_block_height().await.unwrap() + claim_time,
32 | end_block(&deploy_wallet.airdrop_distributor).await,
33 | );
34 | }
35 | }
36 |
--------------------------------------------------------------------------------
/airdrop/airdrop-contract/tests/functions/info/merkle_root.rs:
--------------------------------------------------------------------------------
1 | use crate::utils::{interface::info::merkle_root, setup::setup};
2 |
3 | mod success {
4 |
5 | use super::*;
6 | use crate::utils::{interface::core::airdrop_constructor, setup::defaults};
7 | use fuels::types::Bits256;
8 |
9 | #[tokio::test]
10 | async fn returns_root() {
11 | let (deploy_wallet, wallet1, wallet2, wallet3, asset_id) = setup().await;
12 | let (_, _, _, minter, _, num_leaves, asset_supply, _, claim_time, _, _) =
13 | defaults(&deploy_wallet, &wallet1, &wallet2, &wallet3).await;
14 | let root = Bits256([2u8; 32]);
15 |
16 | assert_eq!(
17 | merkle_root(&deploy_wallet.airdrop_distributor).await,
18 | Option::None
19 | );
20 |
21 | airdrop_constructor(
22 | minter,
23 | asset_supply / 2,
24 | asset_id,
25 | claim_time,
26 | &deploy_wallet.airdrop_distributor,
27 | root,
28 | num_leaves,
29 | )
30 | .await;
31 |
32 | assert_eq!(
33 | merkle_root(&deploy_wallet.airdrop_distributor)
34 | .await
35 | .unwrap(),
36 | root
37 | )
38 | }
39 | }
40 |
--------------------------------------------------------------------------------
/.docs/contributing-book/src/code/connect_four/src/interface.sw:
--------------------------------------------------------------------------------
1 | // ANCHOR: interface
2 | library;
3 |
4 | use ::data_structures::{Game, Player};
5 |
6 | abi ConnectFour {
7 | /// Creates a new game
8 | ///
9 | /// Creating a game allows players to sequentially take turns placing their marker in an empty
10 | /// spot until a player reaches four in a row or the board is filled and a draw is declared
11 | ///
12 | /// # Arguments
13 | ///
14 | /// - `player_one` - The first player to make a move
15 | /// - `player_two` - The second player to make a move
16 | ///
17 | /// # Reverts
18 | ///
19 | /// - When a player has been blacklisted for cheating
20 | fn create_game(player_one: Player, player_two: Player) -> Game;
21 |
22 | /// Places a marker from the next player in the game in the specified column
23 | ///
24 | /// # Arguments
25 | ///
26 | /// - `column` - The column to place a marker in, range 0 <= column < 8
27 | /// - `game` - The game to make a move in
28 | ///
29 | /// # Reverts
30 | ///
31 | /// - When a game has ended in a player winning or a draw
32 | /// - When a marker is placed into a `column` that is full
33 | fn move(column: u64, game: Game) -> Game;
34 | }
35 | // ANCHOR_END: interface
36 |
--------------------------------------------------------------------------------
/timelock/timelock-contract/tests/functions/core/execute.rs:
--------------------------------------------------------------------------------
1 | use crate::utils::{
2 | interface::core::{execute, queue},
3 | setup::setup,
4 | };
5 |
6 | mod success {
7 |
8 | use super::*;
9 | use crate::utils::{
10 | interface::info::{queued, transaction_hash},
11 | setup::ExecuteEvent,
12 | };
13 |
14 | #[tokio::test]
15 | async fn executes() {}
16 | }
17 |
18 | mod revert {
19 |
20 | use super::*;
21 |
22 | #[tokio::test]
23 | #[should_panic(expected = "AuthorizationError")]
24 | async fn when_unauthorized() {}
25 |
26 | #[tokio::test]
27 | #[should_panic(expected = "InvalidTransaction")]
28 | async fn when_transaction_not_queued() {}
29 |
30 | #[tokio::test]
31 | #[should_panic(expected = "TimestampNotInRange")]
32 | async fn when_timestamp_before_start_time() {}
33 |
34 | #[tokio::test]
35 | #[should_panic(expected = "TimestampNotInRange")]
36 | async fn when_timestamp_after_end_time() {}
37 |
38 | #[tokio::test]
39 | #[should_panic(expected = "InsufficientContractBalance")]
40 | async fn when_asset_balance_is_too_low_in_contract() {}
41 |
42 | #[tokio::test]
43 | #[should_panic(expected = "IncorrectAmountSent")]
44 | async fn when_amount_sent_does_not_match_value() {}
45 | }
46 |
--------------------------------------------------------------------------------
/TicTacToe/src/components/ConnectButton.tsx:
--------------------------------------------------------------------------------
1 | import { useIsConnected, useConnect, useDisconnect } from '@fuels/react';
2 | import { Button } from '@mui/material';
3 |
4 | import { useAppContext } from '.';
5 |
6 | export const ConnectButton = () => {
7 | const { isConnected } = useIsConnected();
8 | const { connect, isLoading: isConnectLoading } = useConnect();
9 | const { disconnect, isLoading: isDisconnectLoading } = useDisconnect();
10 | const appContext = useAppContext();
11 |
12 | function getButtonText() {
13 | if (isConnectLoading) {
14 | return 'Connecting...';
15 | }
16 | if (isDisconnectLoading) {
17 | return 'Disconnecting...';
18 | }
19 | if (isConnected) {
20 | return 'Disconnect';
21 | }
22 | return 'Connect';
23 | }
24 |
25 | return (
26 |
43 | );
44 | };
45 |
--------------------------------------------------------------------------------
/timelock/timelock-contract/tests/utils/interface/info.rs:
--------------------------------------------------------------------------------
1 | use crate::utils::setup::{Asset, ExecutionRange, Timelock};
2 | use fuels::{
3 | accounts::wallet::WalletUnlocked,
4 | prelude::{Bytes, AssetId},
5 | programs::call_response::FuelCallResponse,
6 | types::{Bits256, Identity},
7 | };
8 |
9 | pub async fn balance(
10 | contract: &Timelock,
11 | asset_id: AssetId,
12 | ) -> FuelCallResponse {
13 | contract.methods().balance(asset_id).call().await.unwrap()
14 | }
15 |
16 | pub async fn delays(contract: &Timelock) -> FuelCallResponse<(u64, u64)> {
17 | contract.methods().delays().call().await.unwrap()
18 | }
19 |
20 | pub async fn queued(
21 | contract: &Timelock,
22 | id: Bits256,
23 | ) -> FuelCallResponse