@@ -89,15 +89,15 @@ contract CustomStablecoin is
8989 initializer
9090 {
9191 // Decimals must be set before granting mint role.
92- MetadataStorage.setDecimals (tokenDecimals);
92+ MetadataStorage.setDecimals ({value: tokenDecimals} );
9393 __ERC20_init (name, symbol);
9494 __ERC20Pausable_init ();
9595 __AccessControlDefaultAdminRules_init (adminDelay, admin);
96- _grantRole (MINT_ALLOWANCE_ROLE, admin);
97- _grantRole (MINT_ROLE, admin);
98- _grantRole (BURN_ROLE, admin);
99- _grantRole (PAUSE_ROLE, admin);
100- _grantRole (BLACKLIST_ROLE, admin);
96+ _grantRole ({role: MINT_ALLOWANCE_ROLE, account: admin} );
97+ _grantRole ({role: MINT_ROLE, account: admin} );
98+ _grantRole ({role: BURN_ROLE, account: admin} );
99+ _grantRole ({role: PAUSE_ROLE, account: admin} );
100+ _grantRole ({role: BLACKLIST_ROLE, account: admin} );
101101 }
102102
103103 /// @notice Mints `amount` tokens to `to`.
@@ -106,7 +106,7 @@ contract CustomStablecoin is
106106 /// @param amount Number of tokens to mint.
107107 function mint (address to , uint256 amount ) external onlyRole (MINT_ROLE) {
108108 if (to == address (0 )) revert MintToZeroAddress ();
109- MintAllowanceStorage.consume (msg .sender , amount);
109+ MintAllowanceStorage.consume ({minter: msg .sender , amount: amount} );
110110 _mint (to, amount);
111111 emit Minted ({minter: msg .sender , to: to, amount: amount});
112112 }
@@ -126,17 +126,6 @@ contract CustomStablecoin is
126126 MintAllowanceStorage.configureMinter (minter, maxAllowance, interval);
127127 }
128128
129- /// @notice Returns the estimated current mint allowance for `caller`.
130- ///
131- /// @dev Includes any pending replenishment that would apply at the current timestamp.
132- ///
133- /// @param caller Address to query.
134- ///
135- /// @return Current allowance including any pending replenishment.
136- function estimatedAllowance (address caller ) external view returns (uint256 ) {
137- return MintAllowanceStorage.estimatedAllowance (caller);
138- }
139-
140129 /// @notice Burns `amount` tokens from the caller's balance.
141130 ///
142131 /// @param amount Number of tokens to burn.
@@ -169,6 +158,17 @@ contract CustomStablecoin is
169158 BlacklistStorage.unBlacklist (account);
170159 }
171160
161+ /// @notice Returns the estimated current mint allowance for `caller`.
162+ ///
163+ /// @dev Includes any pending replenishment that would apply at the current timestamp.
164+ ///
165+ /// @param caller Address to query.
166+ ///
167+ /// @return Current allowance including any pending replenishment.
168+ function estimatedAllowance (address caller ) external view returns (uint256 ) {
169+ return MintAllowanceStorage.estimatedAllowance ({minter: caller});
170+ }
171+
172172 /// @notice Returns whether `account` is blacklisted.
173173 ///
174174 /// @param account Address to query.
@@ -201,7 +201,9 @@ contract CustomStablecoin is
201201 bool granted = super ._grantRole (role, account);
202202 if (granted && role == MINT_ROLE) {
203203 uint256 allowance = DEFAULT_MINT_ALLOWANCE * 10 ** decimals ();
204- MintAllowanceStorage.configureMinter (account, allowance, DEFAULT_MINT_INTERVAL);
204+ MintAllowanceStorage.configureMinter ({
205+ minter: account, maxAllowance: allowance, interval: DEFAULT_MINT_INTERVAL
206+ });
205207 }
206208 return granted;
207209 }
@@ -215,7 +217,7 @@ contract CustomStablecoin is
215217 function _revokeRole (bytes32 role , address account ) internal override returns (bool ) {
216218 bool revoked = super ._revokeRole (role, account);
217219 if (revoked && role == MINT_ROLE) {
218- MintAllowanceStorage.removeMinter (account);
220+ MintAllowanceStorage.removeMinter ({minter: account} );
219221 }
220222 return revoked;
221223 }
@@ -229,9 +231,9 @@ contract CustomStablecoin is
229231 internal
230232 override (ERC20Upgradeable , ERC20PausableUpgradeable )
231233 {
232- BlacklistStorage.requireNotBlacklisted (msg .sender );
233- BlacklistStorage.requireNotBlacklisted (from);
234- BlacklistStorage.requireNotBlacklisted (to );
234+ BlacklistStorage.requireNotBlacklisted ({account: msg .sender } );
235+ BlacklistStorage.requireNotBlacklisted ({account: from} );
236+ BlacklistStorage.requireNotBlacklisted ({account: to} );
235237 super ._update (from, to, value);
236238 }
237239}
0 commit comments