Skip to content

Commit

Permalink
🥢 nits
Browse files Browse the repository at this point in the history
  • Loading branch information
audsssy committed Oct 20, 2023
1 parent 0d6a4e0 commit 44cc126
Show file tree
Hide file tree
Showing 2 changed files with 30 additions and 6 deletions.
10 changes: 5 additions & 5 deletions src/KaliBerger.sol
Original file line number Diff line number Diff line change
Expand Up @@ -185,8 +185,8 @@ contract KaliBerger is Storage {
uint256 count = this.getBergerCount();
address payable impactDao = payable(
KaliDAOfactory(this.getKaliDaoFactory()).deployKaliDAO(
string.concat("BergerTime #", LibString.toString(count)),
string.concat("BT #", LibString.toString(count)),
string.concat("ImpactDAO #", LibString.toString(count)),
string.concat("ID #", LibString.toString(count)),
" ",
true,
extensions,
Expand Down Expand Up @@ -530,19 +530,19 @@ contract KaliBerger is Storage {
/// -----------------------------------------------------------------------

function deletePrice(address token, uint256 tokenId) internal {
return deleteUint(keccak256(abi.encode(token, tokenId, ".price")));
deleteUint(keccak256(abi.encode(token, tokenId, ".price")));
}

function deleteDeposit(address token, uint256 tokenId) internal {
return deleteUint(keccak256(abi.encode(token, tokenId, ".deposit")));
deleteUint(keccak256(abi.encode(token, tokenId, ".deposit")));
}

function deleteUnclaimed(address user) internal {
deleteUint(keccak256(abi.encode(user, ".unclaimed")));
}

function deleteTokenPurchaseStatus(address token, uint256 tokenId) internal {
return deleteBool(keccak256(abi.encode(token, tokenId, ".forSale")));
deleteBool(keccak256(abi.encode(token, tokenId, ".forSale")));
}

/// -----------------------------------------------------------------------
Expand Down
26 changes: 25 additions & 1 deletion src/Storage.sol
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ contract Storage {
/// -----------------------------------------------------------------------

function init(address dao, address target) internal {
addressStorage[keccak256(abi.encodePacked("dao"))] = dao;
_setDao(dao);
if (target != address(0)) booleanStorage[keccak256(abi.encodePacked("playground.", target))] = true;
}

Expand Down Expand Up @@ -75,6 +75,30 @@ contract Storage {
booleanStorage[_key] = _value;
}

/// @param dao The DAO address.
function _setDao(address dao) internal {
addressStorage[keccak256(abi.encodePacked("dao"))] = dao;
}

/// @param _key The key for the record.
function _setAddress(bytes32 _key, address _value) internal {
addressStorage[_key] = _value;
}

/// @param _key The key for the record.
function _setUint(bytes32 _key, uint256 _value) internal {
uintStorage[_key] = _value;
}

/// @param _key The key for the record.
function _setString(bytes32 _key, string calldata _value) internal {
stringStorage[_key] = _value;
}

/// @param _key The key for the record.
function _setBool(bytes32 _key, bool _value) internal {
booleanStorage[_key] = _value;
}
/// -----------------------------------------------------------------------
/// General Sotrage - Delete Logic
/// -----------------------------------------------------------------------
Expand Down

0 comments on commit 44cc126

Please sign in to comment.