Skip to content

Commit

Permalink
fix: reuse variables
Browse files Browse the repository at this point in the history
  • Loading branch information
amarinkovic committed Apr 26, 2023
1 parent 12f6feb commit 2e27613
Show file tree
Hide file tree
Showing 3 changed files with 3 additions and 13 deletions.
1 change: 0 additions & 1 deletion src/diamonds/nayms/libs/LibEntity.sol
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,6 @@ library LibEntity {
require(entity.maxCapacity >= updatedUtilizedCapacity, "not enough available capacity");

// The entity's balance must be >= to the updated capacity requirement
// todo: business only wants to count the entity's balance that was raised from the participation token sale and not its total balance
require(LibTokenizedVault._internalBalanceOf(_entityId, simplePolicy.asset) >= updatedUtilizedCapacity, "not enough capital");

require(simplePolicy.startDate >= block.timestamp, "start date < block.timestamp");
Expand Down
13 changes: 2 additions & 11 deletions src/diamonds/nayms/libs/LibObject.sol
Original file line number Diff line number Diff line change
Expand Up @@ -18,29 +18,20 @@ library LibObject {
bytes32 _dataHash
) internal {
AppStorage storage s = LibAppStorage.diamondStorage();

// Check if the objectId is already being used by another object
require(!s.existingObjects[_objectId], "objectId is already being used by another object");

s.existingObjects[_objectId] = true;
_createObject(_objectId);
s.objectParent[_objectId] = _parentId;
s.objectDataHashes[_objectId] = _dataHash;
}

function _createObject(bytes32 _objectId, bytes32 _dataHash) internal {
AppStorage storage s = LibAppStorage.diamondStorage();

require(!s.existingObjects[_objectId], "objectId is already being used by another object");

s.existingObjects[_objectId] = true;
_createObject(_objectId);
s.objectDataHashes[_objectId] = _dataHash;
}

function _createObject(bytes32 _objectId) internal {
AppStorage storage s = LibAppStorage.diamondStorage();

require(!s.existingObjects[_objectId], "objectId is already being used by another object");

s.existingObjects[_objectId] = true;
}

Expand Down
2 changes: 1 addition & 1 deletion src/diamonds/nayms/libs/LibSimplePolicy.sol
Original file line number Diff line number Diff line change
Expand Up @@ -89,7 +89,7 @@ library LibSimplePolicy {

LibObject._createObject(_claimId);

LibTokenizedVault._internalTransfer(LibObject._getParent(_policyId), _insuredEntityId, simplePolicy.asset, _amount);
LibTokenizedVault._internalTransfer(entityId, _insuredEntityId, simplePolicy.asset, _amount);

emit SimplePolicyClaimPaid(_claimId, _policyId, _insuredEntityId, _amount);
}
Expand Down

0 comments on commit 2e27613

Please sign in to comment.