Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: adds getter functions for address constants #563

Merged
merged 1 commit into from
Oct 9, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion codegen/payments.ts
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ export function generateFHEPayment(priceData: PriceData): string {
uint256 private constant MAJOR_VERSION = 0;
uint256 private constant MINOR_VERSION = 1;
uint256 private constant PATCH_VERSION = 0;
address public constant tfheExecutorAddress = tfheExecutorAdd;
address private constant tfheExecutorAddress = tfheExecutorAdd;

uint256 private constant FHE_GAS_BLOCKLIMIT = 10_000_000;
uint256 private constant MIN_FHE_GASPRICE = 0; // eg: 10_000_000 means a minimum of 0.01 Gwei
Expand Down
1 change: 1 addition & 0 deletions lib/ACL.sol
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,7 @@ contract ACL is UUPSUpgradeable, Ownable2StepUpgradeable {
}
}

/// @notice Getter function for the TFHEExecutor contract address
function getTFHEExecutorAddress() public view virtual returns (address) {
return tfheExecutorAddress;
}
Expand Down
3 changes: 2 additions & 1 deletion lib/FHEPayment.sol
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ contract FHEPayment is UUPSUpgradeable, Ownable2StepUpgradeable {
uint256 private constant MAJOR_VERSION = 0;
uint256 private constant MINOR_VERSION = 1;
uint256 private constant PATCH_VERSION = 0;
address public constant tfheExecutorAddress = tfheExecutorAdd;
address private constant tfheExecutorAddress = tfheExecutorAdd;

uint256 private constant FHE_GAS_BLOCKLIMIT = 10_000_000;
uint256 private constant MIN_FHE_GASPRICE = 0; // eg: 10_000_000 means a minimum of 0.01 Gwei
Expand All @@ -53,6 +53,7 @@ contract FHEPayment is UUPSUpgradeable, Ownable2StepUpgradeable {
}
}

/// @notice Getter function for the TFHEExecutor contract address
function getTFHEExecutorAddress() public view virtual returns (address) {
return tfheExecutorAddress;
}
Expand Down
12 changes: 11 additions & 1 deletion lib/InputVerifier.coprocessor.sol
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ contract InputVerifier is UUPSUpgradeable, Ownable2StepUpgradeable, EIP712Upgrad
/// @notice Handle version
uint8 public constant HANDLE_VERSION = 0;

address constant coprocessorAddress = coprocessorAdd;
address private constant coprocessorAddress = coprocessorAdd;

KMSVerifier public constant kmsVerifier = KMSVerifier(kmsVerifierAdd);
string public constant CIPHERTEXTVERIFICATION_COPRO_TYPE =
Expand All @@ -51,6 +51,16 @@ contract InputVerifier is UUPSUpgradeable, Ownable2StepUpgradeable, EIP712Upgrad
return CIPHERTEXTVERIFICATION_COPRO_TYPE;
}

/// @notice Getter function for the Coprocessor account address
function getCoprocessorAddress() public view virtual returns (address) {
return coprocessorAddress;
}

/// @notice Getter function for the KMSVerifier contract address
function getKMSVerifierAddress() public view virtual returns (address) {
return address(kmsVerifier);
}

/// @custom:oz-upgrades-unsafe-allow constructor
constructor() {
_disableInitializers();
Expand Down
5 changes: 5 additions & 0 deletions lib/InputVerifier.native.sol
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,11 @@ contract InputVerifier is UUPSUpgradeable, Ownable2StepUpgradeable {

function _authorizeUpgrade(address _newImplementation) internal virtual override onlyOwner {}

/// @notice Getter function for the KMSVerifier contract address
function getKMSVerifierAddress() public view virtual returns (address) {
return address(kmsVerifier);
}

/// @custom:oz-upgrades-unsafe-allow constructor
constructor() {
_disableInitializers();
Expand Down
15 changes: 15 additions & 0 deletions lib/TFHEExecutor.sol
Original file line number Diff line number Diff line change
Expand Up @@ -58,6 +58,21 @@ contract TFHEExecutor is UUPSUpgradeable, Ownable2StepUpgradeable {

function _authorizeUpgrade(address _newImplementation) internal virtual override onlyOwner {}

/// @notice Getter function for the ACL contract address
function getACLAddress() public view virtual returns (address) {
return address(acl);
}

/// @notice Getter function for the FHEPayment contract address
function getFHEPaymentAddress() public view virtual returns (address) {
return address(fhePayment);
}

/// @notice Getter function for the InputVerifier contract address
function getInputVerifierAddress() public view virtual returns (address) {
return address(inputVerifier);
}

/// @custom:oz-upgrades-unsafe-allow constructor
constructor() {
_disableInitializers();
Expand Down