Skip to content

Commit

Permalink
fix: partially change memory params to calldata
Browse files Browse the repository at this point in the history
  • Loading branch information
rkolpakov committed Oct 24, 2023
1 parent f4efe8e commit dc03baa
Show file tree
Hide file tree
Showing 3 changed files with 21 additions and 21 deletions.
22 changes: 11 additions & 11 deletions contracts/AllowedRecipientsBuilder.sol
Original file line number Diff line number Diff line change
Expand Up @@ -36,17 +36,17 @@ interface IRemoveAllowedRecipient {
interface IAllowedRecipientsFactory {
function deployAllowedRecipientsRegistry(
address _admin,
address[] memory _addRecipientToAllowedListRoleHolders,
address[] memory _removeRecipientFromAllowedListRoleHolders,
address[] memory _setLimitParametersRoleHolders,
address[] memory _updateSpentAmountRoleHolders,
address[] calldata _addRecipientToAllowedListRoleHolders,
address[] calldata _removeRecipientFromAllowedListRoleHolders,
address[] calldata _setLimitParametersRoleHolders,
address[] calldata _updateSpentAmountRoleHolders,
address bokkyPooBahsDateTimeContract
) external returns (IAllowedRecipientsRegistry);

function deployAllowedTokensRegistry(
address _defaultAdmin,
address[] memory _addTokensToAllowedListRoleHolders,
address[] memory _removeTokensFromAllowedListRoleHolders
address[] calldata _addTokensToAllowedListRoleHolders,
address[] calldata _removeTokensFromAllowedListRoleHolders
) external returns (IAllowedTokensRegistry registry);

function deployTopUpAllowedRecipients(
Expand Down Expand Up @@ -260,9 +260,9 @@ contract AllowedRecipientsBuilder {
address _trustedCaller,
uint256 _limit,
uint256 _periodDurationMonths,
address[] memory _tokens,
address[] memory _recipients,
string[] memory _titles,
address[] calldata _tokens,
address[] calldata _recipients,
string[] calldata _titles,
uint256 _spentAmount
) public {
IAllowedRecipientsRegistry allowedRecipientsRegistry =
Expand All @@ -278,8 +278,8 @@ contract AllowedRecipientsBuilder {

function deploySingleRecipientTopUpOnlySetup(
address _recipient,
string memory _title,
address[] memory _tokens,
string calldata _title,
address[] calldata _tokens,
uint256 _limit,
uint256 _periodDurationMonths,
uint256 _spentAmount
Expand Down
12 changes: 6 additions & 6 deletions contracts/AllowedRecipientsFactory.sol
Original file line number Diff line number Diff line change
Expand Up @@ -57,10 +57,10 @@ contract AllowedRecipientsFactory {

function deployAllowedRecipientsRegistry(
address _defaultAdmin,
address[] memory _addRecipientToAllowedListRoleHolders,
address[] memory _removeRecipientFromAllowedListRoleHolders,
address[] memory _setLimitParametersRoleHolders,
address[] memory _updateSpentAmountRoleHolders,
address[] calldata _addRecipientToAllowedListRoleHolders,
address[] calldata _removeRecipientFromAllowedListRoleHolders,
address[] calldata _setLimitParametersRoleHolders,
address[] calldata _updateSpentAmountRoleHolders,
IBokkyPooBahsDateTimeContract _bokkyPooBahsDateTimeContract
) external returns (AllowedRecipientsRegistry registry) {
registry = new AllowedRecipientsRegistry(
Expand All @@ -86,8 +86,8 @@ contract AllowedRecipientsFactory {

function deployAllowedTokensRegistry(
address _defaultAdmin,
address[] memory _addTokensToAllowedListRoleHolders,
address[] memory _removeTokensFromAllowedListRoleHolders
address[] calldata _addTokensToAllowedListRoleHolders,
address[] calldata _removeTokensFromAllowedListRoleHolders
) external returns (AllowedTokensRegistry registry) {
registry = new AllowedTokensRegistry(
_defaultAdmin,
Expand Down
8 changes: 4 additions & 4 deletions contracts/EVMScriptFactories/TopUpAllowedRecipients.sol
Original file line number Diff line number Diff line change
Expand Up @@ -74,7 +74,7 @@ contract TopUpAllowedRecipients is TrustedCaller, IEVMScriptFactory {
/// recipients - addresses of recipients to top up
/// amounts - corresponding amounts of token to transfer
/// @dev note that the arrays below has one extra element to store limit enforcement calls
function createEVMScript(address _creator, bytes memory _evmScriptCallData)
function createEVMScript(address _creator, bytes calldata _evmScriptCallData)
external
view
override
Expand Down Expand Up @@ -109,7 +109,7 @@ contract TopUpAllowedRecipients is TrustedCaller, IEVMScriptFactory {
/// @return token Address of payout token
/// @return recipients Addresses of recipients to top up
/// @return amounts Amounts of token to transfer
function decodeEVMScriptCallData(bytes memory _evmScriptCallData)
function decodeEVMScriptCallData(bytes calldata _evmScriptCallData)
external
pure
returns (address token, address[] memory recipients, uint256[] memory amounts)
Expand All @@ -130,7 +130,7 @@ contract TopUpAllowedRecipients is TrustedCaller, IEVMScriptFactory {
require(_recipients.length > 0, ERROR_EMPTY_DATA);
require(allowedTokensRegistry.isTokenAllowed(token), ERROR_TOKEN_NOT_ALLOWED);

uint256 totalAmount = 0;
uint256 totalAmount;

for (uint256 i = 0; i < _recipients.length; ++i) {
require(_amounts[i] > 0, ERROR_ZERO_AMOUNT);
Expand All @@ -144,7 +144,7 @@ contract TopUpAllowedRecipients is TrustedCaller, IEVMScriptFactory {
_validateSpendableBalance(normalizedAmount);
}

function _decodeEVMScriptCallData(bytes memory _evmScriptCallData)
function _decodeEVMScriptCallData(bytes calldata _evmScriptCallData)
private
pure
returns (address token, address[] memory recipients, uint256[] memory amounts)
Expand Down

0 comments on commit dc03baa

Please sign in to comment.