Skip to content

agentx101/StarbetAI

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

1 Commit
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

👋 Welcome Flow Developer!

This project is a starting point for you to develop smart contracts on the Flow Blockchain. It comes with example contracts, scripts, transactions, and tests to help you get started.

🔨 Getting Started

Here are some essential resources to help you hit the ground running:

  • Flow Documentation - The official Flow Documentation is a great starting point to start learning about about building on Flow.
  • Cadence Documentation - Cadence is the native language for the Flow Blockchain. It is a resource-oriented programming language that is designed for developing smart contracts. The documentation is a great place to start learning about the language.
  • Visual Studio Code and the Cadence Extension - It is recommended to use the Visual Studio Code IDE with the Cadence extension installed. This will provide syntax highlighting, code completion, and other features to support Cadence development.
  • Flow Clients - There are clients available in multiple languages to interact with the Flow Blockchain. You can use these clients to interact with your smart contracts, run transactions, and query data from the network.
  • Block Explorers - Block explorers are tools that allow you to explore on-chain data. You can use them to view transactions, accounts, events, and other information. Flowser is a powerful block explorer for local development on the Flow Emulator.

📦 Project Structure

Your project has been set up with the following structure:

  • flow.json - This is the configuration file for your project (analogous to a package.json file for NPM). It has been initialized with a basic configuration and your selected Core Contract dependencies to get started.

    Your project has also been configured with the following dependencies. You can add more dependencies using the flow deps add command:

    • FlowServiceAccount
    • FungibleToken
    • ViewResolver
    • Burner
    • FlowToken
    • MetadataViews
    • NonFungibleToken
    • FungibleTokenMetadataViews
    • FlowFees
    • FlowStorageFees
    • FlowExecutionParameters
    • NodeVersionBeacon
    • RandomBeaconHistory
    • FungibleTokenSwitchboard
    • EVM
  • /cadence - This is where your Cadence smart contracts code lives

Inside the cadence folder you will find:

  • /contracts - This folder contains your Cadence contracts (these are deployed to the network and contain the business logic for your application)
    • Counter.cdc
  • /scripts - This folder contains your Cadence scripts (read-only operations)
    • GetCounter.cdc
  • /transactions - This folder contains your Cadence transactions (state-changing operations)
    • IncrementCounter.cdc
  • /tests - This folder contains your Cadence tests (integration tests for your contracts, scripts, and transactions to verify they behave as expected)
    • Counter_test.cdc

Running the Existing Project

Executing the GetCounter Script

To run the GetCounter script, use the following command:

flow scripts execute cadence/scripts/GetCounter.cdc

Sending the IncrementCounter Transaction

To run the IncrementCounter transaction, use the following command:

flow transactions send cadence/transactions/IncrementCounter.cdc

To learn more about using the CLI, check out the Flow CLI Documentation.

👨‍💻 Start Developing

Creating a New Contract

To add a new contract to your project, run the following command:

flow generate contract

This command will create a new contract file and add it to the flow.json configuration file.

Creating a New Script

To add a new script to your project, run the following command:

flow generate script

This command will create a new script file. Scripts are used to read data from the blockchain and do not modify state (i.e. get the current balance of an account, get a user's NFTs, etc).

You can import any of your own contracts or installed dependencies in your script file using the import keyword. For example:

import "Counter"

Creating a New Transaction

To add a new transaction to your project you can use the following command:

flow generate transaction

This command will create a new transaction file. Transactions are used to modify the state of the blockchain (i.e purchase an NFT, transfer tokens, etc).

You can import any dependencies as you would in a script file.

Creating a New Test

To add a new test to your project you can use the following command:

flow generate test

This command will create a new test file. Tests are used to verify that your contracts, scripts, and transactions are working as expected.

Installing External Dependencies

If you want to use external contract dependencies (such as NonFungibleToken, FlowToken, FungibleToken, etc.) you can install them using Flow CLI Dependency Manager.

For example, to install the NonFungibleToken contract you can use the following command:

flow deps add mainnet://1d7e57aa55817448.NonFungibleToken

Contracts can be found using ContractBrowser, but be sure to verify the authenticity before using third-party contracts in your project.

🧪 Testing

To verify that your project is working as expected you can run the tests using the following command:

flow test

This command will run all tests with the _test.cdc suffix (these can be found in the cadence/tests folder). You can add more tests here using the flow generate test command (or by creating them manually).

To learn more about testing in Cadence, check out the Cadence Test Framework Documentation.

🚀 Deploying Your Project

To deploy your project to the Flow network, you must first have a Flow account and have configured your deployment targets in the flow.json configuration file.

You can create a new Flow account using the following command:

flow accounts create

Learn more about setting up deployment targets in the Flow CLI documentation.

Deploying to the Flow Emulator

To deploy your project to the Flow Emulator, start the emulator using the following command:

flow emulator --start

To deploy your project, run the following command:

flow project deploy --network=emulator

This command will start the Flow Emulator and deploy your project to it. You can now interact with your project using the Flow CLI or alternate client.

Deploying to Flow Testnet

To deploy your project to Flow Testnet you can use the following command:

flow project deploy --network=testnet

This command will deploy your project to Flow Testnet. You can now interact with your project on this network using the Flow CLI or any other Flow client.

Deploying to Flow Mainnet

To deploy your project to Flow Mainnet you can use the following command:

flow project deploy --network=mainnet

This command will deploy your project to Flow Mainnet. You can now interact with your project using the Flow CLI or alternate client.

📚 Other Resources

🤝 Community

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors