witnet / witnet-solidity-bridge

Witnet Bridge for EVM-compatible blockchains
MIT License
60 stars 24 forks source link
data-feed ethereum oracle price-feed random-generation solidity witnet

witnet-solidity-bridge

Solidity source code of the smart contracts composing the Witnet EVM Bridge framework. This framework enables smart contracts operating in a long range of EVM-compatible chains to interact with the Witnet Oracle Blockchain for retrieving and aggregating offchain public data, or as an entropy source for randomness generation.

Install the package

$ pnpm install

Deploying the Witnet EVM Bridge on a new chain

Pre-assessment

Should any artifact require customized contract implementations:

Prepare the environment

Run the script

$ pnpm run migrate <ecosytem>:<chain-name>

Upgrding the Witnet EVM Bridge on an existing chain

When modifying the existing source code, or the contents of settings/artifacts or settings/specs, you may need to upgrade some of the artifacts on certain networks. Just add the --artifacts parameter and a comma-separated list of the artifacts you need to upgrade. For instance:

$ pnpm run migrate <ecosystem>:<chain-name> WitnetErrorsLib,WitnetPriceFeeds

When specifying deployable library artifacts, the depending contracts will be attempted to be upgraded as well.

With respect to deployable contracts, you shall be asked to confirm manually before actually performing a contract upgrade. You can automate all potentially involved upgrades by adding the parameter --upgrade-all.

Reasons for an upgrade to fail:

Package exported modules

require("witnet-solidity-bridge")

Javacript methods and resources:

require("witnet-solidity-bridge/utils")

Javascript utils methods: