Skip to content

Commit

Permalink
Merge branch 'develop' into missing-existence-check
Browse files Browse the repository at this point in the history
  • Loading branch information
CJ42 authored Jan 11, 2024
2 parents 23465f3 + 7538b89 commit ba3f8ad
Showing 1 changed file with 8 additions and 9 deletions.
17 changes: 8 additions & 9 deletions contracts/LSP7DigitalAsset/LSP7DigitalAssetCore.sol
Original file line number Diff line number Diff line change
Expand Up @@ -482,13 +482,12 @@ abstract contract LSP7DigitalAssetCore is ILSP7DigitalAsset {
revert LSP7CannotSendWithAddressZero();
}

_beforeTokenTransfer(from, address(0), amount, data);

uint256 balance = _tokenOwnerBalances[from];
if (amount > balance) {
revert LSP7AmountExceedsBalance(balance, from, amount);
}

_beforeTokenTransfer(from, address(0), amount, data);

// tokens being burnt
_existingTokens -= amount;

Expand Down Expand Up @@ -594,13 +593,13 @@ abstract contract LSP7DigitalAssetCore is ILSP7DigitalAsset {
revert LSP7CannotSendWithAddressZero();
}

_beforeTokenTransfer(from, to, amount, data);

uint256 balance = _tokenOwnerBalances[from];
if (amount > balance) {
revert LSP7AmountExceedsBalance(balance, from, amount);
}

_beforeTokenTransfer(from, to, amount, data);

_tokenOwnerBalances[from] -= amount;
_tokenOwnerBalances[to] += amount;

Expand Down Expand Up @@ -657,8 +656,8 @@ abstract contract LSP7DigitalAssetCore is ILSP7DigitalAsset {
* @dev Attempt to notify the operator `operator` about the `amount` tokens being authorized with.
* This is done by calling its {universalReceiver} function with the `_TYPEID_LSP7_TOKENOPERATOR` as typeId, if `operator` is a contract that supports the LSP1 interface.
* If `operator` is an EOA or a contract that does not support the LSP1 interface, nothing will happen and no notification will be sent.
* @param operator The address to call the {universalReceiver} function on.
* @param operator The address to call the {universalReceiver} function on.
* @param lsp1Data the data to be sent to the `operator` address in the `universalReceiver` call.
*/
function _notifyTokenOperator(
Expand All @@ -676,8 +675,8 @@ abstract contract LSP7DigitalAssetCore is ILSP7DigitalAsset {
* @dev Attempt to notify the token sender `from` about the `amount` of tokens being transferred.
* This is done by calling its {universalReceiver} function with the `_TYPEID_LSP7_TOKENSSENDER` as typeId, if `from` is a contract that supports the LSP1 interface.
* If `from` is an EOA or a contract that does not support the LSP1 interface, nothing will happen and no notification will be sent.
* @param from The address to call the {universalReceiver} function on.
* @param from The address to call the {universalReceiver} function on.
* @param lsp1Data the data to be sent to the `from` address in the `universalReceiver` call.
*/
function _notifyTokenSender(
Expand Down

0 comments on commit ba3f8ad

Please sign in to comment.