@@ -60,7 +60,8 @@ contract ATokenVaultRevenueSplitterOwner is Ownable {
6060 * @dev Constructor.
6161 * @param vault The address of the aToken Vault to own, whose revenue is split.
6262 * @param owner The address owning this contract, the effective owner of the vault.
63- * @param recipients The recipients to set for the revenue split. Cannot be modified afterwards.
63+ * @param recipients The recipients to set for the revenue split. It is the caller's responsibility to avoid
64+ * duplicates in the recipients array. The recipients configuration cannot be modified afterwards.
6465 */
6566 constructor (address vault , address owner , Recipient[] memory recipients ) {
6667 VAULT = IATokenVault (vault);
@@ -69,6 +70,9 @@ contract ATokenVaultRevenueSplitterOwner is Ownable {
6970 _transferOwnership (owner);
7071 }
7172
73+ /**
74+ * @dev Rejects native currency transfers.
75+ */
7276 receive () external payable {
7377 revert ("NATIVE_CURRENCY_NOT_SUPPORTED " );
7478 }
@@ -110,6 +114,9 @@ contract ATokenVaultRevenueSplitterOwner is Ownable {
110114 for (uint256 i = 0 ; i < assets.length ; i++ ) {
111115 uint256 amountToSplit = IERC20 (assets[i]).balanceOf (address (this ));
112116 for (uint256 j = 0 ; j < recipients.length ; j++ ) {
117+ // Due to floor-rounding in integer division, the sum of the amounts transferred may be less than the
118+ // total amount to split. This can leave up to `N - 1` units of each asset undistributed in this
119+ // contract's balance, where `N` is the number of recipients.
113120 uint256 amountForRecipient = amountToSplit * recipients[j].shareInBps / TOTAL_SHARE_IN_BPS;
114121 if (amountForRecipient > 0 ) {
115122 IERC20 (assets[i]).safeTransfer (recipients[j].addr, amountForRecipient);
0 commit comments