Skip to content

Commit

Permalink
fix(RNSCommission): fix naming
Browse files Browse the repository at this point in the history
  • Loading branch information
tringuyenskymavis committed Jun 6, 2024
1 parent b706102 commit cad6124
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 6 deletions.
9 changes: 4 additions & 5 deletions src/RNSCommission.sol
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@ pragma solidity ^0.8.19;
import { Initializable } from "@openzeppelin/contracts/proxy/utils/Initializable.sol";
import { AccessControlEnumerable } from "@openzeppelin/contracts/access/AccessControlEnumerable.sol";
import { INSCommission } from "./interfaces/INSCommission.sol";
import { Math } from "@openzeppelin/contracts/utils/math/Math.sol";
import { RONTransferHelper } from "./libraries/transfers/RONTransferHelper.sol";

contract RNSCommission is Initializable, AccessControlEnumerable, INSCommission {
Expand Down Expand Up @@ -61,7 +60,7 @@ contract RNSCommission is Initializable, AccessControlEnumerable, INSCommission
}

/// @inheritdoc INSCommission
function setCommissionInfo(uint256 commissionIdx, address payable newRecipient, string calldata name)
function setCommissionInfo(uint256 commissionIdx, address payable newRecipient, string calldata newName)
external
onlyRole(COMMISSION_SETTER_ROLE)
{
Expand All @@ -70,8 +69,8 @@ contract RNSCommission is Initializable, AccessControlEnumerable, INSCommission
}

_commissionInfos[commissionIdx].recipient = newRecipient;
_commissionInfos[commissionIdx].name = name;
emit CommissionInfoUpdated(msg.sender, newRecipient, name, commissionIdx);
_commissionInfos[commissionIdx].name = newName;
emit CommissionInfoUpdated(msg.sender, commissionIdx, newRecipient, newName);
}

/**
Expand Down Expand Up @@ -138,7 +137,7 @@ contract RNSCommission is Initializable, AccessControlEnumerable, INSCommission

// Calculate amount of money based on commission's ratio
function _computePercentage(uint256 value, uint256 percentage) internal pure virtual returns (uint256) {
return Math.mulDiv(value, percentage, MAX_PERCENTAGE);
return (value * percentage) / MAX_PERCENTAGE;
}

function _fallback() internal {
Expand Down
2 changes: 1 addition & 1 deletion src/interfaces/INSCommission.sol
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ interface INSCommission {
event CommissionsUpdated(address indexed updatedBy, Commission[] commissionInfos);
/// @dev Emitted when specific commission info is updated.
event CommissionInfoUpdated(
address indexed updatedBy, address payable newRecipient, string name, uint256 indexed commissionIdx
address indexed updatedBy, uint256 indexed commissionIdx, address payable newRecipient, string newName
);

/// @dev Revert when index is out of range
Expand Down

0 comments on commit cad6124

Please sign in to comment.