Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/filecoin-station/spark-evaluations-recent-participants
Smart contract exposing recent participant ids in the Spark network
https://github.com/filecoin-station/spark-evaluations-recent-participants
Last synced: 2 months ago
JSON representation
Smart contract exposing recent participant ids in the Spark network
- Host: GitHub
- URL: https://github.com/filecoin-station/spark-evaluations-recent-participants
- Owner: filecoin-station
- License: other
- Created: 2024-09-11T18:14:55.000Z (4 months ago)
- Default Branch: main
- Last Pushed: 2024-09-12T08:34:26.000Z (4 months ago)
- Last Synced: 2024-10-13T14:13:14.602Z (3 months ago)
- Language: Rust
- Size: 204 KB
- Stars: 0
- Watchers: 1
- Forks: 0
- Open Issues: 1
-
Metadata Files:
- Readme: README.md
- License: LICENSE.md
Awesome Lists containing this project
README
# spark-evaluations: Recent Participants
Smart contract exposing recent participant ids in the Spark network.
Contract deployed at `0xffac3d46e0adfd7806c454b23c3c74d95e09bb02`.
## API
### constructor (address owner)
### .get() public view (address[])
Get all recent participants.
### .set(uint date, address[] participants) public
Owner only. Set participants for given date (0-30).
## Development
This repo requires Rust and Cargo, which can be installed from
[here](https://doc.rust-lang.org/book/ch01-01-installation.html)##### Install Foundry
We recommend you install it from source:
```bash
git clone https://github.com/foundry-rs/foundry
cd foundry
git checkout 9a4bb7f5
# install cast + forge
cargo install --path ./cli --profile local --bins --locked --force
# install anvil
cargo install --path ./anvil --profile local --locked --force
```##### Clone Repo and Install
```bash
git clone https://github.com/filecoin-station/spark-impact-evaluator.git
cd spark-impact-evaluator
git submodule update --init --recursive
forge test
```## Node.js API
```js
import * as SparkEvaluationsRecentParticipants from '@filecoin-station/spark-evaluations-recent-participants'console.log({
abi: SparkEvaluationsRecentParticipants.ABI,
address: SparkEvaluationsRecentParticipants.ADDRESS
})
```## Deployment
The deployment relies on contract bindings generated in the `/contract-bindings`
directory. If you make changes to the contracts, run:```bash
rm -rf contract-bindings
forge bind --crate-name contract-bindings -b ./contract-bindings
```This will create new bindings with the modified contracts.
Deployment can then proceed either with a locally stored mnemonic or a connected
ethereum ledger wallet. To use with a mnemonic, create a `secrets/mnemonic` file
in the root directory.To deploy, run:
```bash
(cd contract-utils && cargo run)
```## Tests
#### Integration Tests
Integration tests run on the filecoin calibration net and require a wallet with
test FIL to pay for gas fees on the calibration net. Test FIL is free and can be
obtained using the [faucet](https://faucet.calibration.fildev.network/).Before running integration tests, these env vars are required:
```bash
export TEST_RPC_URL=https://api.calibration.node.glif.io/rpc/v1
export TEST_MNEMONIC={insert wallet mnemonic here}
export TEST_CONTRACT_ADDRESS={this can be an empty string}
```To run tests, run:
```bash
cd contract-utils
cargo test -- --nocapture --test-threads 1
```