Skip to content

filecoin-station/spark-evaluations-recent-participants

Repository files navigation

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

Install Foundry

We recommend you install it from source:

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
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

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:

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:

(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.

Before running integration tests, these env vars are required:

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:

cd contract-utils
cargo test  -- --nocapture --test-threads 1

About

Smart contract exposing recent participant ids in the Spark network

Resources

License

Stars

Watchers

Forks

Packages

No packages published

Languages