Git Product home page Git Product logo

sweat-near's Introduction

SWEAT the TOKEN

๐Ÿ“ฆ Dependencies

  • Install near-cli: npm install -g near-cli
  • Install Rust (>= 1.60.0) curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | sh
  • rustup target add wasm32-unknown-unknown

Build & Run tests

./sweat/build.sh
//The wasm file will be at `res/sweat.wasm`

cargo test -- --nocapture
cargo run --example mint
cargo run --example transfer
cargo run --example formula

Usage

export TOKEN_ACCOUNT_ID=your-token-account-id

Deploy and initialize the contract:

near deploy --accountId=$TOKEN_ACCOUNT_ID --wasmFile=res/sweat.wasm --initArgs '{"postfix": ".u.sweat.testnet"}' --initFunction new

Add an oracle

export ORACLE_ACCOUNT_ID=your-oracle-account-id
near call $TOKEN_ACCOUNT_ID add_oracle `{"account_id":"${ORACLE_ACCOUNT_ID}"}` --accountId $TOKEN_ACCOUNT_ID --gas=2428088695050
near view sweat_testing_11.testnet get_oracles
[ 'your-oracle-account-id' ]

Call view methods

near view $TOKEN_ACCOUNT_ID get_steps_from_tge
'0'

near view $TOKEN_ACCOUNT_ID formula '{"steps_from_tge":"1", "steps":1000}'
'999999999912699776'

near view $TOKEN_ACCOUNT_ID ft_balance_of '{"account_id":"some-random-account.testnet"}'
'0'

Send steps as an Oracle

near call $TOKEN_ACCOUNT_ID record_batch '{"steps_batch": [["random-guy-1.testnet", 10000],["random-gal-2.testnet", 20000] ]}' --accountId $ORACLE_ACCOUNT_ID --gas=300000000000000

Transfer tokens

# not necessarily $ORACLE_ACCOUNT_ID, can be any local account
near call $TOKEN_ACCOUNT_ID ft_transfer '{"receiver_id":"<receiver id>", "amount":"100", "memo":"hello world!"}' --accountId $ORACLE_ACCOUNT_ID --depositYocto 1

Pay for storage

# not necessarily $ORACLE_ACCOUNT_ID, can be any local account
near call $TOKEN_ACCOUNT_ID storage_deposit '{"account_id":"random-guy-1.testnet"}' --accountId $ORACLE_ACCOUNT_ID --depositYocto 2350000000000000000000

near view $TOKEN_ACCOUNT_ID storage_balance_of '{"account_id":"random-guy-1.testnet"}' --accountId $ORACLE_ACCOUNT_ID

Mint tokens

near call $TOKEN_ACCOUNT_ID mint_tge '{"amount":"100", "account_for":"<account_for>"}' --accountId $TOKEN_ACCOUNT_ID --gas=300000000000000

Deferring tokens

Smart contracts interaction

For information about claiming tokens from Holding account refer to the Sweat Claim repo.

sweat-near's People

Contributors

intmainreturn00 avatar vasyafromrussia avatar vladasz avatar austinabell avatar achernik avatar ilblackdragon avatar egorkhmelev avatar poddubnyoleg avatar maierru avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.