Skip to content

Commit 5317c98

Browse files
committed
refactor: remame to isForwardingValue
1 parent dc75b7a commit 5317c98

File tree

8 files changed

+41
-40
lines changed

8 files changed

+41
-40
lines changed

contracts/LSP0ERC725Account/LSP0ERC725AccountCore.sol

+9-10
Original file line numberDiff line numberDiff line change
@@ -764,7 +764,7 @@ abstract contract LSP0ERC725AccountCore is
764764
/**
765765
* @dev Forwards the call to an extension mapped to a function selector.
766766
*
767-
* Calls {_getExtensionAndPayableBool} to get the address of the extension mapped to the function selector being
767+
* Calls {_getExtensionAndFowardValue} to get the address of the extension mapped to the function selector being
768768
* called on the account. If there is no extension, the `address(0)` will be returned.
769769
* Forwards the value sent with the call to the extension if the function selector is mapped to a payable extension.
770770
*
@@ -786,25 +786,24 @@ abstract contract LSP0ERC725AccountCore is
786786
bytes calldata callData
787787
) internal virtual override returns (bytes memory) {
788788
// If there is a function selector
789-
(address extension, bool isPayable) = _getExtensionAndPayableBool(
790-
msg.sig
791-
);
789+
(
790+
address extension,
791+
bool isForwardingValue
792+
) = _getExtensionAndFowardValue(msg.sig);
792793

793794
// if value is associated with the extension call and extension function selector is not payable, use the universalReceiver
794-
if (msg.value != 0 && !isPayable)
795+
if (msg.value != 0 && !isForwardingValue)
795796
universalReceiver(_TYPEID_LSP0_VALUE_RECEIVED, callData);
796797

797798
// if no extension was found for bytes4(0) return don't revert
798-
if (msg.sig == bytes4(0) && extension == address(0)) {
799-
return "";
800-
}
799+
if (msg.sig == bytes4(0) && extension == address(0)) return "";
801800

802801
// if no extension was found for other function selectors, revert
803802
if (extension == address(0))
804803
revert NoExtensionFoundForFunctionSelector(msg.sig);
805804

806805
(bool success, bytes memory result) = extension.call{
807-
value: isPayable ? msg.value : 0
806+
value: isForwardingValue ? msg.value : 0
808807
}(abi.encodePacked(callData, msg.sender, msg.value));
809808

810809
if (success) {
@@ -824,7 +823,7 @@ abstract contract LSP0ERC725AccountCore is
824823
* - {_LSP17_EXTENSION_PREFIX} + `<bytes4>` (Check [LSP2-ERC725YJSONSchema] for encoding the data key).
825824
* - If no extension is stored, returns the address(0).
826825
*/
827-
function _getExtensionAndPayableBool(
826+
function _getExtensionAndFowardValue(
828827
bytes4 functionSelector
829828
) internal view virtual override returns (address, bool) {
830829
// Generate the data key relevant for the functionSelector being called

contracts/LSP17ContractExtension/LSP17Extendable.sol

+8-7
Original file line numberDiff line numberDiff line change
@@ -44,7 +44,7 @@ abstract contract LSP17Extendable is ERC165 {
4444
function _supportsInterfaceInERC165Extension(
4545
bytes4 interfaceId
4646
) internal view virtual returns (bool) {
47-
(address erc165Extension, ) = _getExtensionAndPayableBool(
47+
(address erc165Extension, ) = _getExtensionAndFowardValue(
4848
ERC165.supportsInterface.selector
4949
);
5050
if (erc165Extension == address(0)) return false;
@@ -62,14 +62,14 @@ abstract contract LSP17Extendable is ERC165 {
6262
* To be overrided.
6363
* Up to the implementor contract to return an extension based on a function selector
6464
*/
65-
function _getExtensionAndPayableBool(
65+
function _getExtensionAndFowardValue(
6666
bytes4 functionSelector
6767
) internal view virtual returns (address, bool);
6868

6969
/**
7070
* @dev Forwards the call to an extension mapped to a function selector.
7171
*
72-
* Calls {_getExtensionAndPayableBool} to get the address of the extension mapped to the function selector being
72+
* Calls {_getExtensionAndFowardValue} to get the address of the extension mapped to the function selector being
7373
* called on the account. If there is no extension, the `address(0)` will be returned.
7474
* Forwards the value if the extension is payable.
7575
*
@@ -91,16 +91,17 @@ abstract contract LSP17Extendable is ERC165 {
9191
bytes calldata callData
9292
) internal virtual returns (bytes memory) {
9393
// If there is a function selector
94-
(address extension, bool isPayable) = _getExtensionAndPayableBool(
95-
msg.sig
96-
);
94+
(
95+
address extension,
96+
bool isForwardingValue
97+
) = _getExtensionAndFowardValue(msg.sig);
9798

9899
// if no extension was found, revert
99100
if (extension == address(0))
100101
revert NoExtensionFoundForFunctionSelector(msg.sig);
101102

102103
(bool success, bytes memory result) = extension.call{
103-
value: isPayable ? msg.value : 0
104+
value: isForwardingValue ? msg.value : 0
104105
}(abi.encodePacked(callData, msg.sender, msg.value));
105106

106107
if (success) {

contracts/LSP7DigitalAsset/LSP7DigitalAsset.sol

+3-3
Original file line numberDiff line numberDiff line change
@@ -108,7 +108,7 @@ abstract contract LSP7DigitalAsset is
108108
/**
109109
* @dev Forwards the call with the received value to an extension mapped to a function selector.
110110
*
111-
* Calls {_getExtensionAndPayableBool} to get the address of the extension mapped to the function selector being
111+
* Calls {_getExtensionAndFowardValue} to get the address of the extension mapped to the function selector being
112112
* called on the account. If there is no extension, the address(0) will be returned.
113113
* Forwards the value if the extension is payable.
114114
*
@@ -125,7 +125,7 @@ abstract contract LSP7DigitalAsset is
125125
bytes calldata callData
126126
) internal virtual override returns (bytes memory) {
127127
// If there is a function selector
128-
(address extension, ) = _getExtensionAndPayableBool(msg.sig);
128+
(address extension, ) = _getExtensionAndFowardValue(msg.sig);
129129

130130
// if no extension was found, revert
131131
if (extension == address(0))
@@ -155,7 +155,7 @@ abstract contract LSP7DigitalAsset is
155155
* - If no extension is stored, returns the address(0).
156156
* - we do not check that payable bool as in lsp7 standard we will always forward the value to the extension
157157
*/
158-
function _getExtensionAndPayableBool(
158+
function _getExtensionAndFowardValue(
159159
bytes4 functionSelector
160160
) internal view virtual override returns (address, bool) {
161161
// Generate the data key relevant for the functionSelector being called

contracts/LSP7DigitalAsset/LSP7DigitalAssetInitAbstract.sol

+3-3
Original file line numberDiff line numberDiff line change
@@ -103,7 +103,7 @@ abstract contract LSP7DigitalAssetInitAbstract is
103103
/**
104104
* @dev Forwards the call with the received value to an extension mapped to a function selector.
105105
*
106-
* Calls {_getExtensionAndPayableBool} to get the address of the extension mapped to the function selector being
106+
* Calls {_getExtensionAndFowardValue} to get the address of the extension mapped to the function selector being
107107
* called on the account. If there is no extension, the address(0) will be returned.
108108
* Forwards the value if the extension is payable.
109109
*
@@ -120,7 +120,7 @@ abstract contract LSP7DigitalAssetInitAbstract is
120120
bytes calldata callData
121121
) internal virtual override returns (bytes memory) {
122122
// If there is a function selector
123-
(address extension, ) = _getExtensionAndPayableBool(msg.sig);
123+
(address extension, ) = _getExtensionAndFowardValue(msg.sig);
124124

125125
// if no extension was found, revert
126126
if (extension == address(0))
@@ -150,7 +150,7 @@ abstract contract LSP7DigitalAssetInitAbstract is
150150
* - If no extension is stored, returns the address(0).
151151
* - We do not check that payable bool as in lsp7 standard we will always forward the value to the extension
152152
*/
153-
function _getExtensionAndPayableBool(
153+
function _getExtensionAndFowardValue(
154154
bytes4 functionSelector
155155
) internal view virtual override returns (address, bool) {
156156
// Generate the data key relevant for the functionSelector being called

contracts/LSP8IdentifiableDigitalAsset/LSP8IdentifiableDigitalAsset.sol

+3-3
Original file line numberDiff line numberDiff line change
@@ -130,7 +130,7 @@ abstract contract LSP8IdentifiableDigitalAsset is
130130
/**
131131
* @dev Forwards the call with the received value to an extension mapped to a function selector.
132132
*
133-
* Calls {_getExtensionAndPayableBool} to get the address of the extension mapped to the function selector being
133+
* Calls {_getExtensionAndFowardValue} to get the address of the extension mapped to the function selector being
134134
* called on the account. If there is no extension, the address(0) will be returned.
135135
* We will always forward the value to the extension, as the LSP8 contract is not supposed to hold any native tokens.
136136
*
@@ -147,7 +147,7 @@ abstract contract LSP8IdentifiableDigitalAsset is
147147
bytes calldata callData
148148
) internal virtual override returns (bytes memory) {
149149
// If there is a function selector
150-
(address extension, ) = _getExtensionAndPayableBool(msg.sig);
150+
(address extension, ) = _getExtensionAndFowardValue(msg.sig);
151151

152152
// if no extension was found, revert
153153
if (extension == address(0))
@@ -176,7 +176,7 @@ abstract contract LSP8IdentifiableDigitalAsset is
176176
* - {_LSP17_EXTENSION_PREFIX} + `<bytes4>` (Check [LSP2-ERC725YJSONSchema] for encoding the data key).
177177
* - If no extension is stored, returns the address(0).
178178
*/
179-
function _getExtensionAndPayableBool(
179+
function _getExtensionAndFowardValue(
180180
bytes4 functionSelector
181181
) internal view virtual override returns (address, bool) {
182182
// Generate the data key relevant for the functionSelector being called

contracts/LSP8IdentifiableDigitalAsset/LSP8IdentifiableDigitalAssetInitAbstract.sol

+3-3
Original file line numberDiff line numberDiff line change
@@ -133,7 +133,7 @@ abstract contract LSP8IdentifiableDigitalAssetInitAbstract is
133133
/**
134134
* @dev Forwards the call with the received value to an extension mapped to a function selector.
135135
*
136-
* Calls {_getExtensionAndPayableBool} to get the address of the extension mapped to the function selector being
136+
* Calls {_getExtensionAndFowardValue} to get the address of the extension mapped to the function selector being
137137
* called on the account. If there is no extension, the address(0) will be returned.
138138
* We will always forward the value to the extension, as the LSP8 contract is not supposed to hold any native tokens.
139139
*
@@ -150,7 +150,7 @@ abstract contract LSP8IdentifiableDigitalAssetInitAbstract is
150150
bytes calldata callData
151151
) internal virtual override returns (bytes memory) {
152152
// If there is a function selector
153-
(address extension, ) = _getExtensionAndPayableBool(msg.sig);
153+
(address extension, ) = _getExtensionAndFowardValue(msg.sig);
154154

155155
// if no extension was found, revert
156156
if (extension == address(0))
@@ -179,7 +179,7 @@ abstract contract LSP8IdentifiableDigitalAssetInitAbstract is
179179
* - {_LSP17_EXTENSION_PREFIX} + `<bytes4>` (Check [LSP2-ERC725YJSONSchema] for encoding the data key).
180180
* - If no extension is stored, returns the address(0).
181181
*/
182-
function _getExtensionAndPayableBool(
182+
function _getExtensionAndFowardValue(
183183
bytes4 functionSelector
184184
) internal view virtual override returns (address, bool) {
185185
// Generate the data key relevant for the functionSelector being called

contracts/LSP9Vault/LSP9VaultCore.sol

+8-7
Original file line numberDiff line numberDiff line change
@@ -527,7 +527,7 @@ contract LSP9VaultCore is
527527
/**
528528
* @dev Forwards the call to an extension mapped to a function selector.
529529
*
530-
* Calls {_getExtensionAndPayableBool} to get the address of the extension mapped to the function selector being
530+
* Calls {_getExtensionAndFowardValue} to get the address of the extension mapped to the function selector being
531531
* called on the account. If there is no extension, the `address(0)` will be returned.
532532
* Forwards the value if the extension is payable.
533533
*
@@ -549,12 +549,13 @@ contract LSP9VaultCore is
549549
bytes calldata callData
550550
) internal virtual override returns (bytes memory) {
551551
// If there is a function selector
552-
(address extension, bool isPayable) = _getExtensionAndPayableBool(
553-
msg.sig
554-
);
552+
(
553+
address extension,
554+
bool isForwardingValue
555+
) = _getExtensionAndFowardValue(msg.sig);
555556

556557
// if value is associated with the extension call and function selector is not payable, use the universalReceiver
557-
if (msg.value != 0 && !isPayable)
558+
if (msg.value != 0 && !isForwardingValue)
558559
universalReceiver(_TYPEID_LSP9_VALUE_RECEIVED, callData);
559560

560561
// if no extension was found for bytes4(0) return don't revert
@@ -565,7 +566,7 @@ contract LSP9VaultCore is
565566
revert NoExtensionFoundForFunctionSelector(msg.sig);
566567

567568
(bool success, bytes memory result) = extension.call{
568-
value: isPayable ? msg.value : 0
569+
value: isForwardingValue ? msg.value : 0
569570
}(abi.encodePacked(callData, msg.sender, msg.value));
570571

571572
if (success) {
@@ -587,7 +588,7 @@ contract LSP9VaultCore is
587588
* - {_LSP17_EXTENSION_PREFIX} + `<bytes4>` (Check [LSP2-ERC725YJSONSchema] for encoding the data key).
588589
* - If no extension is stored, returns the address(0).
589590
*/
590-
function _getExtensionAndPayableBool(
591+
function _getExtensionAndFowardValue(
591592
bytes4 functionSelector
592593
) internal view virtual override returns (address, bool) {
593594
// Generate the data key relevant for the functionSelector being called

contracts/Mocks/LSP17ExtendableTester.sol

+4-4
Original file line numberDiff line numberDiff line change
@@ -35,16 +35,16 @@ contract LSP17ExtendableTester is LSP17Extendable {
3535
function getExtension(
3636
bytes4 functionSelector
3737
) public view returns (address, bool) {
38-
return _getExtensionAndPayableBool(functionSelector);
38+
return _getExtensionAndFowardValue(functionSelector);
3939
}
4040

4141
function setExtension(
4242
bytes4 functionSelector,
4343
address extensionContract,
44-
bool isPayable
44+
bool isForwardingValue
4545
) public {
4646
_extensions[functionSelector] = extensionContract;
47-
_payableExtensions[functionSelector] = isPayable;
47+
_payableExtensions[functionSelector] = isForwardingValue;
4848
}
4949

5050
function getStorageData() public view returns (string memory) {
@@ -63,7 +63,7 @@ contract LSP17ExtendableTester is LSP17Extendable {
6363
_anotherStorageData = newData;
6464
}
6565

66-
function _getExtensionAndPayableBool(
66+
function _getExtensionAndFowardValue(
6767
bytes4 functionSelector
6868
) internal view override returns (address, bool) {
6969
return (

0 commit comments

Comments
 (0)