Skip to content

Commit

Permalink
fix: remove lens from search (#25)
Browse files Browse the repository at this point in the history
  • Loading branch information
martines3000 authored Sep 12, 2024
1 parent eace52f commit 624d07d
Show file tree
Hide file tree
Showing 9 changed files with 127 additions and 69 deletions.
8 changes: 6 additions & 2 deletions packages/contracts/src/Core/Donations/DonationsImpl.sol
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,9 @@ contract DonationsImpl is DonationsStorage {
* @param amount the amount to withdraw
* @dev withdraws the given amount from the storage
*/
function _withdraw(uint256 amount) internal {
function _withdraw(
uint256 amount
) internal {
require(amount > 0, "Insufficient balance");
DonationsStorage.Donations storage donations = _getDonationsStorage();
donations._withdraw(amount);
Expand All @@ -42,7 +44,9 @@ contract DonationsImpl is DonationsStorage {
* @dev retrieves the balance from the storage
* @return balance balance of the given account
*/
function _getBalance(address account) internal view returns (uint256) {
function _getBalance(
address account
) internal view returns (uint256) {
DonationsStorage.Donations storage donations = _getDonationsStorage();
return donations._getBalance(account);
}
Expand Down
12 changes: 9 additions & 3 deletions packages/contracts/src/Core/EAS/EASImpl.sol
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,9 @@ contract EASImpl is Initializable {
* @dev Sets the EAS address
* @param newEasAddress the new EAS address
*/
function _setNewEasAddress(address newEasAddress) internal {
function _setNewEasAddress(
address newEasAddress
) internal {
if (address(newEasAddress) == address(0)) {
revert InvalidEAS();
}
Expand All @@ -54,7 +56,9 @@ contract EASImpl is Initializable {
* @dev sets new schema uid
* @param newSchemaUid the new schema uid
*/
function _setNewSchemaUid(bytes32 newSchemaUid) internal {
function _setNewSchemaUid(
bytes32 newSchemaUid
) internal {
_schemaUid = newSchemaUid;
}

Expand All @@ -63,7 +67,9 @@ contract EASImpl is Initializable {
* @param data the attestation data
* @return uid the uid of the new attestation
*/
function _attest(AttestationRequestData memory data) internal returns (bytes32 uid) {
function _attest(
AttestationRequestData memory data
) internal returns (bytes32 uid) {
uid = _eas.attest(AttestationRequest({schema: _schemaUid, data: data}));
}

Expand Down
32 changes: 24 additions & 8 deletions packages/contracts/src/Core/EESCore.sol
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,9 @@ contract EESCore is
}

/// @inheritdoc UUPSUpgradeable
function _authorizeUpgrade(address newImplementation) internal override onlyOwner {}
function _authorizeUpgrade(
address newImplementation
) internal override onlyOwner {}

/// @inheritdoc IEESCore
function initialize(address easAddress, bytes32 schemaUid) external initializer {
Expand Down Expand Up @@ -67,7 +69,9 @@ contract EESCore is
}

/// @inheritdoc IEESCore
function getBalance(address account) public view returns (uint256 balance) {
function getBalance(
address account
) public view returns (uint256 balance) {
return _getBalance(account);
}

Expand All @@ -77,23 +81,31 @@ contract EESCore is
}

/// @inheritdoc IEESCore
function withdrawEndorsementFees(uint256 amount) external onlyOwner nonReentrant {
function withdrawEndorsementFees(
uint256 amount
) external onlyOwner nonReentrant {
_withdrawEndorsementFees(amount);
}

/// @inheritdoc IEESCore
function withdrawDonationFees(uint256 amount) external onlyOwner nonReentrant {
function withdrawDonationFees(
uint256 amount
) external onlyOwner nonReentrant {
_withdrawDonationFees(amount);
}

/// @inheritdoc IEESCore
function setDonationFeePercentage(uint256 newFee) external onlyOwner {
function setDonationFeePercentage(
uint256 newFee
) external onlyOwner {
require(newFee <= MAXIMUM_FEE_PERCENTAGE, "Donation fee percentage cannot exceed 3%");
_setNewDonationFeePercentage(newFee);
}

/// @inheritdoc IEESCore
function setEndorsementPrice(uint256 newPrice) external onlyOwner {
function setEndorsementPrice(
uint256 newPrice
) external onlyOwner {
require(newPrice < _getEndorsementPrice(), "Endorsement price cannot exceed previous price");
_setNewEndorsementPrice(newPrice);
}
Expand All @@ -109,12 +121,16 @@ contract EESCore is
}

/// @inheritdoc IEESCore
function setNewEasAddress(address newEasAddress) external onlyOwner {
function setNewEasAddress(
address newEasAddress
) external onlyOwner {
_setNewEasAddress(newEasAddress);
}

/// @inheritdoc IEESCore
function setNewSchemaUid(bytes32 newSchemaUid) external onlyOwner {
function setNewSchemaUid(
bytes32 newSchemaUid
) external onlyOwner {
_setNewSchemaUid(newSchemaUid);
}

Expand Down
24 changes: 18 additions & 6 deletions packages/contracts/src/Core/Fees/FeesImpl.sol
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,9 @@ contract FeesImpl is FeesStorage, Initializable {
* @dev Sets the new endorsement fee
* @param newPrice The new endorsement fee
*/
function _setNewEndorsementPrice(uint256 newPrice) internal {
function _setNewEndorsementPrice(
uint256 newPrice
) internal {
require(newPrice < _getEndorsementPrice(), "New endorsement price cannot be higher than the current one");
FeesStorage.Fees storage fees = _getFeesStorage();
fees._setNewEndorsementPrice(newPrice);
Expand All @@ -47,7 +49,9 @@ contract FeesImpl is FeesStorage, Initializable {
* @dev Sets the new donation fee percentage
* @param newDonationFeePercentage The new donation fee percentage
*/
function _setNewDonationFeePercentage(uint256 newDonationFeePercentage) internal {
function _setNewDonationFeePercentage(
uint256 newDonationFeePercentage
) internal {
require(newDonationFeePercentage <= MAXIMUM_FEE_PERCENTAGE, "Donation fee percentage cannot exceed 3%");
FeesStorage.Fees storage fees = _getFeesStorage();
fees._donationFeePercentage = newDonationFeePercentage;
Expand Down Expand Up @@ -95,7 +99,9 @@ contract FeesImpl is FeesStorage, Initializable {
* @dev Stores the endorsement fee
* @param amount The amount of fees to store
*/
function _storeEndorsementFee(uint256 amount) private {
function _storeEndorsementFee(
uint256 amount
) private {
FeesStorage.Fees storage fees = _getFeesStorage();
fees._storeEndorsementFee(amount);
}
Expand All @@ -104,7 +110,9 @@ contract FeesImpl is FeesStorage, Initializable {
* @dev Stores the donation fee
* @param amount The amount of fees to store
*/
function _storeDonationFee(uint256 amount) private {
function _storeDonationFee(
uint256 amount
) private {
FeesStorage.Fees storage fees = _getFeesStorage();
fees._storeDonationFee(amount);
}
Expand All @@ -122,7 +130,9 @@ contract FeesImpl is FeesStorage, Initializable {
* @dev Withdraws the fees from endorsements
* @param amount The amount of fees to withdraw
*/
function _withdrawEndorsementFees(uint256 amount) internal {
function _withdrawEndorsementFees(
uint256 amount
) internal {
FeesStorage.Fees storage fees = _getFeesStorage();
fees._withdrawEndorsementFees(amount);
}
Expand All @@ -131,7 +141,9 @@ contract FeesImpl is FeesStorage, Initializable {
* @dev Withdraws the fees from donations
* @param amount The amount of fees to withdraw
*/
function _withdrawDonationFees(uint256 amount) internal {
function _withdrawDonationFees(
uint256 amount
) internal {
FeesStorage.Fees storage fees = _getFeesStorage();
fees._withdrawDonationFees(amount);
}
Expand Down
32 changes: 18 additions & 14 deletions packages/contracts/src/Core/Fees/FeesLib.sol
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,9 @@ library FeesLib {
* Withdraws all fees (revenue to admins)
* @param feesStorage the storage to use
*/
function _withdrawAll(FeesStorage.Fees storage feesStorage) internal {
function _withdrawAll(
FeesStorage.Fees storage feesStorage
) internal {
uint256 donationsFees = feesStorage._donationFees;
uint256 endorsementsFees = feesStorage._endorsementFees;
feesStorage._donationFees = 0;
Expand Down Expand Up @@ -92,11 +94,9 @@ library FeesLib {
* @dev retrieves the donation fees balance from the storage
* @return balance of the fees received by donations
*/
function _getEndorsementsFeesBalance(FeesStorage.Fees storage feesStorage)
internal
view
returns (uint256 balance)
{
function _getEndorsementsFeesBalance(
FeesStorage.Fees storage feesStorage
) internal view returns (uint256 balance) {
return feesStorage._endorsementFees;
}

Expand All @@ -106,7 +106,9 @@ library FeesLib {
* @dev retrieves the donation fees balance from the storage
* @return balance of the fees received by donations
*/
function _getDonationsFeesBalance(FeesStorage.Fees storage feesStorage) internal view returns (uint256 balance) {
function _getDonationsFeesBalance(
FeesStorage.Fees storage feesStorage
) internal view returns (uint256 balance) {
return feesStorage._donationFees;
}

Expand All @@ -116,7 +118,9 @@ library FeesLib {
* @dev retrieves the total fees balance from the storage
* @return balance of the fees received by donations and endorsements
*/
function _getTotalFeesBalance(FeesStorage.Fees storage feesStorage) internal view returns (uint256 balance) {
function _getTotalFeesBalance(
FeesStorage.Fees storage feesStorage
) internal view returns (uint256 balance) {
return feesStorage._endorsementFees + feesStorage._donationFees;
}

Expand All @@ -125,7 +129,9 @@ library FeesLib {
* @param feesStorage the storage to use
* @dev retrieves the endorsement price from the storage
*/
function _getEndorsementPrice(FeesStorage.Fees storage feesStorage) internal view returns (uint256 price) {
function _getEndorsementPrice(
FeesStorage.Fees storage feesStorage
) internal view returns (uint256 price) {
return feesStorage._endorsementPrice;
}

Expand All @@ -134,11 +140,9 @@ library FeesLib {
* @param feesStorage the storage to use
* @dev retrieves the donation fee percentage from the storage
*/
function _getDonationFeePercentage(FeesStorage.Fees storage feesStorage)
internal
view
returns (uint256 percentage)
{
function _getDonationFeePercentage(
FeesStorage.Fees storage feesStorage
) internal view returns (uint256 percentage) {
return feesStorage._donationFeePercentage;
}

Expand Down
28 changes: 21 additions & 7 deletions packages/contracts/src/Core/interfaces/IEESCore.sol
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,9 @@ interface IEESCore {
* @dev retrieves the balance from the storage
* @return balance balance of the given account
*/
function getBalance(address account) external view returns (uint256 balance);
function getBalance(
address account
) external view returns (uint256 balance);

/**
* @notice Withdraws all revenue received as fees from endorsements and donations
Expand All @@ -54,13 +56,17 @@ interface IEESCore {
* @notice Withdraws the fees from endorsements
* @param amount The amount of fees to withdraw
*/
function withdrawEndorsementFees(uint256 amount) external;
function withdrawEndorsementFees(
uint256 amount
) external;

/**
* @notice Withdraws the fees from donations
* @param amount The amount of fees to withdraw
*/
function withdrawDonationFees(uint256 amount) external;
function withdrawDonationFees(
uint256 amount
) external;

/**
* @notice Set donation fee percentage
Expand All @@ -69,13 +75,17 @@ interface IEESCore {
* 1% = 100,
* 100% = 10_000
*/
function setDonationFeePercentage(uint256 newFee) external;
function setDonationFeePercentage(
uint256 newFee
) external;

/**
* @notice Set the endorsement price
* @param newPrice The new endorsement price
*/
function setEndorsementPrice(uint256 newPrice) external;
function setEndorsementPrice(
uint256 newPrice
) external;

/**
* @notice Returns the balance of the given account
Expand All @@ -101,13 +111,17 @@ interface IEESCore {
* @notice Set new core EAS deployment address
* @param newAddress The new EAS address
*/
function setNewEasAddress(address newAddress) external;
function setNewEasAddress(
address newAddress
) external;

/**
* @notice Set new EAS Schema UID
* @param newSchemaUid The new Schema UID
*/
function setNewSchemaUid(bytes32 newSchemaUid) external;
function setNewSchemaUid(
bytes32 newSchemaUid
) external;

/**
* @notice Returns the endorsement price
Expand Down
Loading

0 comments on commit 624d07d

Please sign in to comment.