OpenZeppelin / openzeppelin-sdk

OpenZeppelin SDK repository for CLI and upgrades.js. No longer actively developed.
MIT License
432 stars 200 forks source link

error :Cannot read property 'value' of undefined when deploy the contract #1557

Closed wangyuyuer closed 4 years ago

wangyuyuer commented 4 years ago

Now I want to develop my own access control scheme based on access library,but when i try to compile @openzeppelin/contracts/access/Ownable.sol in my computer,i meet with the following mistake: please tell me how i can do to solve this error,thank you

💻 Environment

i use 2.8.2 for OpenZeppelin ,use 5.1.30 for truffle 📝 Details

图片

🔢 Code to reproduce bug

nventuro commented 4 years ago

I've transferred the issue to the SDK repo, since this seems to be a problem with the CLI.

wangyuyuer commented 4 years ago

I've transferred the issue to the SDK repo, since this seems to be a problem with the CLI.

but when i deploy the contract i write ,it seems like go well. 图片 So i think this is maybe not with CLI

abcoathup commented 4 years ago

Hi @wangyuyuer,

I’m sorry that you had this issue.

Were you trying to deploy Ownable.sol by itself?

Most OpenZeppelin Contracts are designed to be used by inheritance. See the documentation for details: https://docs.openzeppelin.com/contracts/3.x/extending-contracts

wangyuyuer commented 4 years ago

yes , i was tring to deploy Ownable.sol itself...I want to finish my own RBAC schem, its need to inherit Ownable.sol and Access Control.sol ,but when i deploy these two contract ,there always has a error:Cannot read property 'value' of undefined

abcoathup commented 4 years ago

Hi @wangyuyuer,

Ownable.sol and AccessControl.sol aren't designed to be deployed by themselves, they are designed to be used by inheritance.

For an example see: https://docs.openzeppelin.com/contracts/3.x/access-control#ownership-and-ownable and https://docs.openzeppelin.com/contracts/3.x/access-control#using-access-control

If there are no contracts that can be deployed we get the error Cannot read property 'value' of undefined

wangyuyuer commented 4 years ago

Hi @wangyuyuer,

Ownable.sol and AccessControl.sol aren't designed to be deployed by themselves, they are designed to be used by inheritance.

For an example see: https://docs.openzeppelin.com/contracts/3.x/access-control#ownership-and-ownable and https://docs.openzeppelin.com/contracts/3.x/access-control#using-access-control

If there are no contracts that can be deployed we get the error Cannot read property 'value' of undefined

I see...thank you so much!!!!!