OpenZeppelin
-
Implementing RBAC Patterns in Solidity
We can implement role based access control or RBAC patterns in Solidity using OpenZeppelin’s AccessControl.sol library. This allows developers to manage different roles and assign permissions dynamically. Here’s a step by step guide based on the information provided. Understanding Roles in Access Control The essence of RBAC in Solidity involves defining roles, where each role…
-
NFT Token Vault Solidity
This was inspired by the CryptoKitties WG0 token vault which accepts gen zero CryptoKitty deposits and mints 1 ERC20 token for each. Users can then buy tokens on exchange and claim NFT’s from the vault. The code is open source and available at: https://github.com/jamesbachini/NFTvault How The NFTvault Contract Works When you deposit your NFTs into…
-
OpenZeppelin Libraries | Solidity Tips & Examples
OpenZeppelin libraries are popular for building secure smart contracts on top of pre-audited code in Solidity. The framework includes a number of reusable smart contract components, such as token contracts, access control contracts, and math libraries. In this article we will explore the various Libraries available within the OpenZeppelin framework to give you a tool…
-
Solidity Tutorial | Fixed Rate Staking Contract
In this tutorial we will create a fixed rate staking contract that pays out 1 token for every 1 token staked per year. The contract will be built on an OpenZeppelin ERC20 token library with additional functionality for staking. The user will stake their tokens which will lock them in the smart contract at what…