Skip to content

Commit

Permalink
Update Storage.sol
Browse files Browse the repository at this point in the history
update function visibility to save gas
  • Loading branch information
audsssy committed Oct 9, 2023
1 parent b6247cc commit 61cf68d
Showing 1 changed file with 7 additions and 7 deletions.
14 changes: 7 additions & 7 deletions src/Storage.sol
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ pragma solidity >=0.8.4;
import {IStorage} from "src/interface/IStorage.sol";

/// @notice An extensible DAO-managed storage
/// @author audsssy.eth
/// @author audsssy.eth
/// credit: inspired by RocketPool (https://github.com/rocket-pool/rocketpool/blob/6a9dbfd85772900bb192aabeb0c9b8d9f6e019d1/contracts/contract/RocketStorage.sol)
contract Storage {
/// -----------------------------------------------------------------------
Expand Down Expand Up @@ -80,22 +80,22 @@ contract Storage {
/// -----------------------------------------------------------------------

/// @param _key The key for the record.
function deleteAddress(bytes32 _key) external onlyOperator {
function deleteAddress(bytes32 _key) internal {
delete addressStorage[_key];
}

/// @param _key The key for the record.
function deleteUint(bytes32 _key) external onlyOperator {
function deleteUint(bytes32 _key) internal {
delete uintStorage[_key];
}

/// @param _key The key for the record.
function deleteString(bytes32 _key) external onlyOperator {
function deleteString(bytes32 _key) internal {
delete stringStorage[_key];
}

/// @param _key The key for the record.
function deleteBool(bytes32 _key) external onlyOperator {
function deleteBool(bytes32 _key) internal {
delete booleanStorage[_key];
}

Expand All @@ -105,13 +105,13 @@ contract Storage {

/// @param _key The key for the record.
/// @param _amount An amount to add to the record's value
function addUint(bytes32 _key, uint256 _amount) external onlyOperator returns (uint256) {
function addUint(bytes32 _key, uint256 _amount) internal returns (uint256) {
return uintStorage[_key] = uintStorage[_key] + _amount;
}

/// @param _key The key for the record.
/// @param _amount An amount to subtract from the record's value
function subUint(bytes32 _key, uint256 _amount) external onlyOperator returns (uint256) {
function subUint(bytes32 _key, uint256 _amount) internal returns (uint256) {
return uintStorage[_key] = uintStorage[_key] - _amount;
}

Expand Down

0 comments on commit 61cf68d

Please sign in to comment.