SolidState Contracts – 固态合同区块链毕设代写

区块链毕设代写本文提供国外最新区块链项目源码下载,包括solidity,eth,fabric等blockchain区块链,SolidState Contracts – 固态合同区块链毕设代写 是一篇很好的国外资料

SolidState Contracts

Upgradable-first Solidity smart contract development library.

Warning: this library is in a pre-release state; contracts are not sufficiently tested for production use, documentation may be missing or inaccurate, and the API may change at any time.

Usage

Install the package as a development dependency:

npm install --save-dev @solidstate/contracts # or yarn add --dev @solidistate/contracts

Contracts

All contracts are designed to either be deployed through the standard constructor method, or referenced by a proxy. To this end, the diamond storage pattern is employed exclusively.

Portable Tests

Where possible, automated tests are designed to be imported by repositories which make use of SolidState and run against any derived contracts. This is to help prevent unintended changes to to the base contract behavior.

For example, consider a custom ERC20Base implementation:

import '@solidstate/contracts/token/ERC20/ERC20Base.sol';  contract CustomToken is ERC20Base {   // custom code... }

Rather than rewrite the ERC20Base tests or assume that all core behavior remains untouched, one can import the included tests and run them against the custom implementation:

describe('CustomToken', function () {   let deploy = async function () {     let factory = await ethers.getContractFactory('CustomToken');     let instance = await factory.deploy();     return await instance.deployed();   }    // eslint-disable-next-line mocha/no-setup-in-describe   describeBehaviorOfERC20Base({ deploy });    // custom tests... });

Development

Install dependencies via Yarn:

yarn install

Compile contracts via Hardhat:

yarn run hardhat compile

Networks

By default, Hardhat uses the Hardhat Network in-process.

To use an external network via URL, set the URL environment variable and append commands with --network generic:

URL="[NODE_URL]" yarn run hardhat test --network generic

Testing

Test contracts via Hardhat:

yarn run hardhat test

We use optional third-party analytics cookies to understand how you use GitHub.com so we can build better products. Learn more.


固态合同

可升级的first Solidity智能合约开发库。

警告:此库处于预发布状态;未对合同进行充分测试以供生产使用,文档可能丢失或不准确,API可能随时更改。

使用情况

将包作为开发依赖项安装:

npm install --save-dev @solidstate/contracts # or yarn add --dev @solidistate/contracts

合同

所有协定都设计为通过标准构造函数方法部署,或由代理引用。为此,专门采用钻石储存模式。

便携式测试

在可能的情况下,自动测试被设计为由使用SolidState的存储库导入,并根据任何派生的契约运行。这有助于防止对基本契约行为的意外更改。

例如,考虑一个定制的ERC20Base实现:

import '@solidstate/contracts/token/ERC20/ERC20Base.sol';  contract CustomToken is ERC20Base {   // custom code... }

而不是重写ERC20Base测试或假设所有核心行为保持不变,您可以导入包含的测试并针对自定义实现运行它们:

describe('CustomToken', function () {   let deploy = async function () {     let factory = await ethers.getContractFactory('CustomToken');     let instance = await factory.deploy();     return await instance.deployed();   }    // eslint-disable-next-line mocha/no-setup-in-describe   describeBehaviorOfERC20Base({ deploy });    // custom tests... });

开发

通过Yarn安装依赖项:

yarn install

通过Hardhat编译契约:

yarn run hardhat compile

网络

默认情况下,Hardhat使用正在处理的Hardhat网络。

要通过URL使用外部网络,请设置URL环境变量并附加命令–network generic:

URL="[NODE_URL]" yarn run hardhat test --network generic

测试

通过Hardhat测试合同:

yarn run hardhat test

我们使用可选的第三方分析cookie来了解您如何使用GitHub.com网站所以我们可以制造更好的产品。了解更多。

部分转自网络,侵权联系删除区块链源码网

www.interchains.cc

https://www.interchains.cc/18829.html

区块链毕设网(www.interchains.cc)全网最靠谱的原创区块链毕设代做网站 部分资料来自网络,侵权联系删除! 最全最大的区块链源码站 ! QQ3039046426
区块链知识分享网, 以太坊dapp资源网, 区块链教程, fabric教程下载, 区块链书籍下载, 区块链资料下载, 区块链视频教程下载, 区块链基础教程, 区块链入门教程, 区块链资源 » SolidState Contracts – 固态合同区块链毕设代写

提供最优质的资源集合

立即查看 了解详情