$SWEAT staking smart contract.
- Read the Product description.
- Read the Project documentation page.
If you already have rustup
installed, you can ensure that the correct version of the compiler and the NEAR CLI is installed as well:
make install
To learn how to build the project, deploy it, and run tests run the following command:
make help
First build the contract using provided make
command:
make build
Then deploy and initialize it. Rename dev.env.example
to dev.env
and define variable values there. To deploy the contract to dev-account on Testnet use the following command:
make deploy
Once finished, check the neardev/dev-account
file to find the address in which the contract was deployed:
cat ./neardev/dev-account
# e.g. dev-1659899566943-21539992274727
If you build your contract on two different machines, it's highly likely that you'll obtain two binaries that are similar but not exactly identical. Your build outcome can be influenced by various factors in your build environment, such as the locale, timezone, build path, and numerous other variables.
To obtain an identical build artifact on any machine, matching the one deployed on NEAR, you can build it using Docker:
make build-in-docker
Integration tests crate contains measure
module which can be used to measure required amount of gas for each method.
- Create a method:
(Input) -> anyhow::Result<Gas>
. - In this method prepere context and everything required for the call.
- Wrap the call you want to measure in
OutcomeStorage::measure
. - Pass a label, it is any text which can be found in logs of this method and identify it.
- Pass calling account id.
- Return
Gas
value returned byOutcomeStorage::measure
.
See example: integration-tests/src/measure/withdraw.rs::measure_one_withdraw
.
- Use
generate_permutations
method for generating all possible value combinations you want to test. - Pass the data and your method to
scoped_command_measure
, it will collect all the data and return the report for each call and permutation.
See example: integration-tests/src/measure/withdraw.rs::measure_withdraw_test
.