Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/joticajulian/mana-meter
contract to measure the consumption of mana
https://github.com/joticajulian/mana-meter
Last synced: about 1 month ago
JSON representation
contract to measure the consumption of mana
- Host: GitHub
- URL: https://github.com/joticajulian/mana-meter
- Owner: joticajulian
- Created: 2024-04-27T20:52:42.000Z (9 months ago)
- Default Branch: main
- Last Pushed: 2024-05-13T06:41:47.000Z (8 months ago)
- Last Synced: 2024-10-18T07:24:11.830Z (3 months ago)
- Language: JavaScript
- Size: 134 KB
- Stars: 0
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
# Generic Contract
This generic contract stores user data in the blockchain.
### Create the code
The code is located at `packages/contract/src/assembly/ManaMeter.ts`. With this contract you will be able to define get methods, write methods, and define custom proto buffers.
### Install and build
Install and build the contract:
```sh
yarn install
yarn build
```The WASM file will be generated in `packages/contract/src/build/release`.
### Deploy the contract
To deploy the contract you need a private key. If you need to generate new keys run:
```sh
yarn keys
```different keys and the corresponding mnemonic phrase will be displayed in the console. Copy one of them for the following step.
Open the `.env` file and define the following values:
- `USE_FREE_MANA`: Set true or false. When "true" it will use free mana provided by Kondor to deploy the contract. If it is false then define the private key of an account with funds in order to use its mana.
- `HARBINGER_MANA_SHARER_PRIVATE_KEY`: Private key of an account with funds in harbinger. You can skip this value if `USE_FREE_MANA` is set to true.
- `MAINNET_MANA_SHARER_PRIVATE_KEY`: Private key of an account with funds in mainnet. You can skip this value if `USE_FREE_MANA` is set to true.
- `HARBINGER_CONTRACT_PRIVATE_KEY`: Private key of the new contract in harbinger.
- `MAINNET_CONTRACT_PRIVATE_KEY`: Private key of the new contract in mainnet.To deploy the contract in harbinger run:
```sh
yarn deploy
```To deploy the contract in mainnet run:
```sh
yarn deploy mainnet
```### Set data
Now run the following script to write some data:
```sh
yarn setdata
```For mainnet run:
```sh
yarn setdata mainnet
```