0xFutures protocol
0xFutures 协议实现
Setup
> npm i -g truffle
> npm i
Test
npm run publish-abi
npm test
Deploy Contracts (local node)
此部署命令将重新编译合约、更新 ABI、运行测试并使用本地同步以太坊将合约部署到区块链节点。
// eg. kovan
> npm run deploy-kovan
注意:第一次将合约部署到新网络时,部署者应该运行“npm run deploy--first-time”而不是“npm run deploy-” 因为这将安装所有未来部署共享的永久注册表合同。 它包含曾经创建的所有差价合约的映射以及最新的 CFDFactory 合约的地址。
Deploy Contracts (Infura)
运行与上面“本地节点”部署相同的步骤,但将使用远程 infura 节点进行部署。
有关示例配置,请参阅 config.kovan.infura.json.template。 将你的 Infura apikey 和 HD 钱包助记词放在配置文件中。
// eg. kovan with infura config
> npm run deploy-kovan-infura
请参阅上面关于“首次”部署的说明。 这也适用于 Infura 部署。
Publish NPM
// ensure repo has latest abi
> npm run publish-abi
> git add abi && git commit -m "updated ABI" abi
// ensure tests are passing
> npm test
// publish NPM
> npm version patch # bumps the version number and tags the commit
> npm publish # see package.json scripts prepare - this will run the tests before publishing
> git push --tags
npm
该包与合约 ABI JSON 文件 (abi/) 和 js 库 (lib/) 一起发布到 @0xfutures/protocol< /a>。
0xFutures protocol
0xFutures protocol implementation
Setup
> npm i -g truffle
> npm i
Test
npm run publish-abi
npm test
Deploy Contracts (local node)
This deployment command will recompile contracts, update ABI, run tests and deploy contracts to the blockchain using a local synchronised Ethereum node.
// eg. kovan
> npm run deploy-kovan
NOTE: the very first time the contracts are deployed to a new network the deployer should run 'npm run deploy-<network>-first-time' instead of 'npm run deploy-<network>' as this will install the permanent Registry contract that all future deployments share. It contains a mapping of all CFDs ever created as well as the address of the most recent CFDFactory contract.
Deploy Contracts (Infura)
Runs the same steps as the 'local node' deploy above but will deploy using a remote infura node.
See config.kovan.infura.json.template for an example configuration. Put your Infura apikey and HD wallet mnemonic phrase in the config file.
// eg. kovan with infura config
> npm run deploy-kovan-infura
See the note about 'first-time' deployment above. This applies to Infura deployment also.
Publish NPM
// ensure repo has latest abi
> npm run publish-abi
> git add abi && git commit -m "updated ABI" abi
// ensure tests are passing
> npm test
// publish NPM
> npm version patch # bumps the version number and tags the commit
> npm publish # see package.json scripts prepare - this will run the tests before publishing
> git push --tags
npm
The package is published with the contract ABI JSON files (abi/) and js libraries (lib/) to @0xfutures/protocol.