Skip to content

ulduz114/fuel-deploy-contract

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

1 Commit
 
 

Repository files navigation

fuel-deploy-contract

Install Dependencies

sudo apt update
sudo apt upgrade -y
sudo apt-get install curl screen -y 

Installing RUST

source $HOME/.cargo/env
rustc --version
rustup install stable
rustup update stable
rustup default stable

Install GIT

sudo apt install git -y 

Install Fuel Toolchain

curl https://install.fuel.network | sh
source /root/.bashrc

Setting FUELUP

fuelup toolchain install latest
fuelup self update
fuelup update && fuelup default latest

Creating PROJECT

mkdir fuel-project && cd fuel-project
forc new counter-contract
nano counter-contract/src/main.sw

Clear everything and paste below code

contract;
 
storage {
    counter: u64 = 0,
}
 
abi Counter {
    #[storage(read, write)]
    fn increment();
 
    #[storage(read)]
    fn count() -> u64;
}
 
impl Counter for Contract {
    #[storage(read)]
    fn count() -> u64 {
        storage.counter.read()
    }
 
    #[storage(read, write)]
    fn increment() {
        let incremented = storage.counter.read() + 1;
        storage.counter.write(incremented);
    }
}

##Save and exit with Ctrl X + y and click ENTER ##

Build Contract

cd counter-contract
forc build

create wallet

you will need your FUEL wallet here, i will be importing my seed pharse , if you dont have wallet , install and create it in your local machine and import it here

forc wallet import

forc wallet account new

forc wallet accounts

deploy contract

forc deploy --testnet

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published