-
Notifications
You must be signed in to change notification settings - Fork 10
Description
Description
For example for the Pausable
plugin there is a basically identical Counter
contract in the following locations:
- README.md
- near-plugins/src/pausable.rs (in
mod tests
) - examples/pausable-examples/README.md
- examples/pausable-examples/pausable-base/src/lib.rs
Problem
This duplication makes updates very cumbersome and it carries the risk of the contracts getting out of sync.
Proposed solution
Have only one contract per plugin which is used in tests and serves as example.
For instance the contract in near-plugins/tests/contracts/access_controllable/
is compiled, deployed and interacted with by integration tests in near-plugins/tests/access_controllable.rs
. This happens via cargo test
and is hooked up with CI.
If this contract is polished I think we can remove the AccessControllable
example in the README and instead add a link to this contract's lib.rs
.
According to this pattern, contracts in near-plugins/tests/contracts/
are integrated with cargo test
and CI. Therefore I would argue no additional contracts are needed in examples/**
. Instead examples link to near-plugins/tests/contracts/
too.
In addition, unit tests in /near-plugins/src/*.rs
can be replaced by the integration tests mentioned above.