forked from zama-ai/fhevm-contracts
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request zama-ai#65 from PacificYield/various-fixes
fix: Various fixes
- Loading branch information
Showing
20 changed files
with
1,272 additions
and
775 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -9,6 +9,8 @@ fhEVM contracts is a Solidity library for secure smart-contract development usin | |
|
||
### Installation | ||
|
||
You can import this repo using your package manager. | ||
|
||
```bash | ||
# Using npm | ||
npm install fhevm-contracts | ||
|
@@ -20,29 +22,64 @@ yarn add fhevm-contracts | |
pnpm add fhevm-contracts | ||
``` | ||
|
||
### A Simple Example | ||
### Simple contract | ||
|
||
To write Solidity contracts that use `TFHE` and/or `Gateway`, it is required to set different contract addresses. | ||
|
||
Fortunately, [the fhevm repo)](https://github.com/zama-ai/fhevm), one of this repo's dependencies, exports config files | ||
that can be inherited to simplify the process. | ||
|
||
#### Using the mock network (for testing) | ||
|
||
```solidity | ||
// SPDX-License-Identifier: BSD-3-Clause-Clear | ||
pragma solidity ^0.8.24; | ||
import { MockZamaFHEVMConfig } from "fhevm/config/ZamaFHEVMConfig.sol"; | ||
import { EncryptedERC20 } from "fhevm-contracts/contracts/token/ERC20/EncryptedERC20.sol"; | ||
contract MyERC20 is MockZamaFHEVMConfig, EncryptedERC20 { | ||
constructor() EncryptedERC20("MyToken", "MYTOKEN") { | ||
_unsafeMint(1000000, msg.sender); | ||
} | ||
} | ||
``` | ||
|
||
#### Using Sepolia | ||
|
||
```solidity | ||
// SPDX-License-Identifier: BSD-3-Clause-Clear | ||
pragma solidity ^0.8.24; | ||
import "fhevm/lib/TFHE.sol"; | ||
import "fhevm-contracts/contracts/token/ERC20/EncryptedERC20.sol"; | ||
import { SepoliaZamaFHEVMConfig } from "fhevm/config/ZamaFHEVMConfig.sol"; | ||
import { EncryptedERC20 } from "fhevm-contracts/contracts/token/ERC20/EncryptedERC20.sol"; | ||
contract MyERC20 is EncryptedERC20 { | ||
contract MyERC20 is SepoliaZamaFHEVMConfig, EncryptedERC20 { | ||
constructor() EncryptedERC20("MyToken", "MYTOKEN") { | ||
TFHE.setFHEVM(FHEVMConfig.defaultConfig()); | ||
_unsafeMint(1000000, msg.sender); | ||
} | ||
} | ||
``` | ||
|
||
## Resources | ||
## Available contracts | ||
|
||
As of version 0.2, these Solidity templates include governance-related and token-related contracts. | ||
|
||
### Documentation | ||
### Token | ||
|
||
The full documentation is available [here](https://docs.zama.ai/fhevm). | ||
- [EncryptedERC20](./contracts/token/ERC20/EncryptedERC20.sol) | ||
- [EncryptedERC20Mintable](./contracts/token/ERC20/extensions/EncryptedERC20Mintable.sol) | ||
- [EncryptedERC20WithErrors](./contracts/token/ERC20/extensions/EncryptedERC20WithErrors.sol) | ||
- [EncryptedERC20WithErrorsMintable](./contracts/token/ERC20/extensions/EncryptedERC20WithErrorsMintable.sol) | ||
|
||
### Governance | ||
|
||
- [Comp](./contracts/governance/Comp.sol) | ||
- [GovernorAlphaZama](./contracts/governance/GovernorAlphaZama.sol) | ||
|
||
### Utils | ||
|
||
- [EncryptedErrors](./contracts/utils/EncryptedErrors.sol) | ||
|
||
### Contributing | ||
|
||
|
@@ -57,5 +94,8 @@ can send pull requests, so please make sure to get in touch before you do. | |
|
||
### License | ||
|
||
> [!CAUTION] Smart contracts are a nascent technology that carry a high level of technical risk and uncertainty. You are | ||
> solely responsible for any use of the fhEVM Contracts and you assume all risks associated with any such use. | ||
This software is distributed under the **BSD-3-Clause-Clear** license. If you have any question about the license, | ||
please contact us at [email protected]. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.