This repository contains various design patterns implemented in Solidity for the Tron blockchain. It serves as a reference for developers looking to understand and utilize design patterns such as the Diamond Pattern, which allows for modular and flexible contract design.
-
Clone the repository:
git clone https://github.com/adeelch9/tron-solidity-design-patterns.git
-
Go to the project directory:
cd tron-solidity-design-patterns
-
Go to the
projects
directory:cd projects
-
Go to the pattern you want to use:
cd Diamond
-
Copy
.env.example
to.env
and fill in your credentials.
To deploy the contracts, follow these steps:
- Install dependencies:
npm install -g tronbox npm install
- Set environment variables in the
.env
file. - Deploy the contracts using:
npx tronbox migrate --network nile
/projects/Diamond
├── contracts
│ ├── facets # Facet contracts implementing specific functionalities
│ │ ├── DiamondLoupeFacet.sol
│ │ └── OwnershipFacet.sol
│ ├── interfaces # Interface contracts
│ │ ├── IDiamondLoupe.sol
│ │ └── IERC165.sol
│ ├── libraries # Library contracts
│ │ └── LibDiamond.sol
│ └── Diamond # Main diamond contract
├── migrations # Migration scripts for deploying contracts
└── tronbox.js # Configuration for TronBox
Refer to the individual README files in the project directories for more specific instructions and details on each design pattern.