Skip to content

Commit 6cd3bb2

Browse files
feat: Rename batch functions and add RegulatedTransfer events
- Renamed transferFromBatch to transferFromRegulated for clarity - Renamed burnFromBatch to burnFromRegulated for consistency - Added RegulatedTransfer event emissions for better tracking - Updated both regular and upgradeable contracts - Aligned with updated ERC-1450 standard BREAKING CHANGE: Function names have changed. Update all calls from transferFromBatch/burnFromBatch to transferFromRegulated/burnFromRegulated. Co-Authored-By: Claude <noreply@anthropic.com>
1 parent 24fa86b commit 6cd3bb2

3 files changed

Lines changed: 22 additions & 9 deletions

File tree

contracts/ERC1450.sol

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -202,7 +202,7 @@ contract ERC1450 is IERC1450, IERC20Metadata, ERC165, Ownable, ReentrancyGuard {
202202
* @param issuanceDate Original issuance date of the transferred tokens
203203
* @dev Callable only by the transfer agent after compliance checks
204204
*/
205-
function transferFromBatch(
205+
function transferFromRegulated(
206206
address from,
207207
address to,
208208
uint256 amount,
@@ -399,7 +399,7 @@ contract ERC1450 is IERC1450, IERC20Metadata, ERC165, Ownable, ReentrancyGuard {
399399
* @param regulationType Type of regulation for the tokens to burn
400400
* @param issuanceDate Original issuance date of the tokens to burn
401401
*/
402-
function burnFromBatch(
402+
function burnFromRegulated(
403403
address from,
404404
uint256 amount,
405405
uint16 regulationType,
@@ -535,7 +535,7 @@ contract ERC1450 is IERC1450, IERC20Metadata, ERC165, Ownable, ReentrancyGuard {
535535

536536
for (uint256 i = 0; i < froms.length; i++) {
537537
// Reuse burnFromBatch logic
538-
this.burnFromBatch(froms[i], amounts[i], regulationTypes[i], issuanceDates[i]);
538+
this.burnFromRegulated(froms[i], amounts[i], regulationTypes[i], issuanceDates[i]);
539539
}
540540

541541
return true;
@@ -835,6 +835,7 @@ contract ERC1450 is IERC1450, IERC20Metadata, ERC165, Ownable, ReentrancyGuard {
835835

836836
found = true;
837837
emit Transfer(from, to, amount);
838+
emit RegulatedTransfer(from, to, amount, regulationType, issuanceDate);
838839
break;
839840
}
840841
}

contracts/interfaces/IERC1450.sol

Lines changed: 14 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -53,6 +53,17 @@ interface IERC1450 is IERC20, IERC165 {
5353
uint256 issuanceDate
5454
);
5555

56+
/**
57+
* @notice Emitted when tokens are transferred with specific regulation tracking
58+
*/
59+
event RegulatedTransfer(
60+
address indexed from,
61+
address indexed to,
62+
uint256 amount,
63+
uint16 indexed regulationType,
64+
uint256 issuanceDate
65+
);
66+
5667
// Transfer request events
5768
event TransferRequested(
5869
uint256 indexed requestId,
@@ -139,7 +150,7 @@ interface IERC1450 is IERC20, IERC165 {
139150
/**
140151
* @notice Transfer tokens - DISABLED for security tokens
141152
* @dev Must always revert with ERC1450TransferDisabled()
142-
* Use transferFromBatch() for actual transfers with regulation tracking
153+
* Use transferFromRegulated() for actual transfers with regulation tracking
143154
*/
144155
function transferFrom(address from, address to, uint256 amount) external returns (bool);
145156

@@ -154,7 +165,7 @@ interface IERC1450 is IERC20, IERC165 {
154165
* @dev Only callable by the registered transfer agent
155166
* MUST revert if sender has insufficient tokens of the specified regulation/issuance
156167
*/
157-
function transferFromBatch(address from, address to, uint256 amount, uint16 regulationType, uint256 issuanceDate) external returns (bool);
168+
function transferFromRegulated(address from, address to, uint256 amount, uint16 regulationType, uint256 issuanceDate) external returns (bool);
158169

159170
/**
160171
* @notice Mint new tokens with regulation tracking (RTA only)
@@ -199,7 +210,7 @@ interface IERC1450 is IERC20, IERC165 {
199210
* @return bool Success status
200211
* @dev MUST revert if holder has insufficient tokens of the specified regulation/issuance
201212
*/
202-
function burnFromBatch(address from, uint256 amount, uint16 regulationType, uint256 issuanceDate) external returns (bool);
213+
function burnFromRegulated(address from, uint256 amount, uint16 regulationType, uint256 issuanceDate) external returns (bool);
203214

204215
/**
205216
* @notice Burn tokens of a specific regulation type (RTA only)

contracts/upgradeable/ERC1450Upgradeable.sol

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -226,7 +226,7 @@ contract ERC1450Upgradeable is
226226
* @param issuanceDate Original issuance date of the transferred tokens
227227
* @dev Callable only by the transfer agent after compliance checks
228228
*/
229-
function transferFromBatch(
229+
function transferFromRegulated(
230230
address from,
231231
address to,
232232
uint256 amount,
@@ -394,7 +394,7 @@ contract ERC1450Upgradeable is
394394
/**
395395
* @notice Burn tokens from an account with regulation tracking (RTA only)
396396
*/
397-
function burnFromBatch(
397+
function burnFromRegulated(
398398
address from,
399399
uint256 amount,
400400
uint16 regulationType,
@@ -480,7 +480,7 @@ contract ERC1450Upgradeable is
480480

481481
for (uint256 i = 0; i < froms.length; i++) {
482482
// Reuse burnFromBatch logic
483-
this.burnFromBatch(froms[i], amounts[i], regulationTypes[i], issuanceDates[i]);
483+
this.burnFromRegulated(froms[i], amounts[i], regulationTypes[i], issuanceDates[i]);
484484
}
485485

486486
return true;
@@ -850,6 +850,7 @@ contract ERC1450Upgradeable is
850850

851851
found = true;
852852
emit Transfer(from, to, amount);
853+
emit RegulatedTransfer(from, to, amount, regulationType, issuanceDate);
853854
break;
854855
}
855856
}

0 commit comments

Comments
 (0)