Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

chore(script): merge from release/v0.3.5 #250

Merged
merged 17 commits into from
Jun 25, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
17 commits
Select commit Hold shift + click to select a range
251408b
chore(`multi-treasury`): merge from `release/v0.3.5` (#227)
TuDo1403 Jun 24, 2024
b58743a
Merge branch 'feature/multi-treasury' into merge/release/v0.3.5-featu…
TuDo1403 Jun 25, 2024
c3c34b0
chore(`multi-treasury`): merge from `release/v0.3.5` (#231)
TuDo1403 Jun 25, 2024
b95e559
chore(`multi-treasury`): merge from `release/v0.3.5` (#236)
TuDo1403 Jun 25, 2024
4b70374
Merge branch 'feature/multi-treasury' into merge/release/v0.3.5-featu…
TuDo1403 Jun 25, 2024
56bb9c2
chore(`multi-treasury`): merge from `release/v0.3.5` (#241)
TuDo1403 Jun 25, 2024
ef2adf6
chore: fix typo
tringuyenskymavis Jun 25, 2024
127716f
chore: add null address error
tringuyenskymavis Jun 25, 2024
255b5ba
Update src/RNSCommission.sol
TuDo1403 Jun 25, 2024
3bd1dea
feat(multi-treasury): implement `add-null-address-error` (#247)
TuDo1403 Jun 25, 2024
17bedad
chore(`multi-treasury`): merge from `release/v0.3.5` (#246)
TuDo1403 Jun 25, 2024
62509fb
fix(RNSCommission): fix typo and revert if commission recipient is n…
TuDo1403 Jun 25, 2024
f2628d7
chore(`multi-treasury`): merge from `release/v0.3.5` (#251)
TuDo1403 Jun 25, 2024
b2bd46e
script: upgrade controller + migrate auction treasury + RNSCommission…
tringuyenskymavis Jun 25, 2024
7601fb9
feat(multi-treasury): implement `upgrade-controller-and-deploy-rnscom…
TuDo1403 Jun 25, 2024
4bb6a99
feat(multi-treasury): upgrade controller (#253)
tringuyenskymavis Jun 25, 2024
6b385d8
Merge branch 'feature/script' into merge/release/v0.3.5-feature/script
TuDo1403 Jun 25, 2024
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -16,8 +16,8 @@ contract Migration__20240624_MigrateAuctionAndControllerTreasuryAndDeployRNSComm
address private _defaultAdmin;

function run() public {
_controller = RONRegistrarController(loadContract(Contract.RONRegistrarController.key()));
_auction = RNSAuction(loadContract(Contract.RNSAuction.key()));
_controller = RONRegistrarController(_upgradeProxy(Contract.RONRegistrarController.key()));

_rnsCommission = new RNSCommissionDeploy().run();
_defaultAdmin = 0x968D0Cd7343f711216817E617d3f92a23dC91c07;
Expand Down
8 changes: 6 additions & 2 deletions src/RNSCommission.sol
Original file line number Diff line number Diff line change
Expand Up @@ -12,9 +12,9 @@ contract RNSCommission is Initializable, AccessControlEnumerable, INSCommission
/// @dev Role for accounts that can send RON for this contract.
bytes32 public constant SENDER_ROLE = keccak256("SENDER_ROLE");

/// @dev Gap for upgradability.
/// @dev Gap for upgradeability.
uint256[50] private ____gap;
/// @dev Array of `Commission` structs that store commissions infomation.
/// @dev Array of `Commission` structs that store commissions information.
Commission[] internal _commissionInfos;

constructor() {
Expand Down Expand Up @@ -55,6 +55,8 @@ contract RNSCommission is Initializable, AccessControlEnumerable, INSCommission
onlyRole(DEFAULT_ADMIN_ROLE)
{
if (commissionIdx >= _commissionInfos.length) revert InvalidArrayLength();
// TODO: should fix to not duplicate logic in set commision info
if (newRecipient == address(0)) revert NullAddress();

_commissionInfos[commissionIdx].recipient = newRecipient;
_commissionInfos[commissionIdx].name = newName;
Expand Down Expand Up @@ -98,6 +100,8 @@ contract RNSCommission is Initializable, AccessControlEnumerable, INSCommission
uint256 sum;

for (uint256 i; i < length; ++i) {
if (commissionInfos[i].recipient == address(0)) revert NullAddress();

sum += commissionInfos[i].ratio;
_commissionInfos.push(commissionInfos[i]);
}
Expand Down
6 changes: 4 additions & 2 deletions src/interfaces/INSCommission.sol
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ interface INSCommission {
event CommissionInfoUpdated(
address indexed updatedBy, uint256 indexed commissionIdx, address payable newRecipient, string newName
);
/// @dev Emiited when transfer RON to commission's recipient.
/// @dev Emitted when transfer RON to commission's recipient.
event Distributed(address indexed recipient, uint256 commissionAmount);

/// @dev Revert when index is out of range
Expand All @@ -23,6 +23,8 @@ interface INSCommission {
error InvalidRatio();
/// @dev Revert when amount of RON is invalid
error InvalidAmountOfRON();
/// @dev Revert when recipient address is null
error NullAddress();

/**
* @dev Maximum commission percentage.
Expand All @@ -35,7 +37,7 @@ interface INSCommission {
function SENDER_ROLE() external pure returns (bytes32);

/**
* @dev Returns comissions information.
* @dev Returns commissions information.
*/
function getCommissions() external view returns (Commission[] memory commissionInfos);

Expand Down
Loading