@@ -51,7 +51,7 @@ contract MultiBridgeToken is ERC20, Ownable {
5151 }
5252
5353 /**
54- * @notice Burns tokens from an address. Decreases total amount minted by the calling bridge.
54+ * @notice Burns tokens from an address. Decreases total amount minted if called by a bridge.
5555 * Alternative to {burnFrom} for compatibility with some bridge implementations.
5656 * See {_burnFrom}.
5757 * @param _from The address to burn tokens from.
@@ -62,7 +62,7 @@ contract MultiBridgeToken is ERC20, Ownable {
6262 }
6363
6464 /**
65- * @notice Burns tokens from an address. Decreases total amount minted by the calling bridge.
65+ * @notice Burns tokens from an address. Decreases total amount minted if called by a bridge.
6666 * See {_burnFrom}.
6767 * @param _from The address to burn tokens from.
6868 * @param _amount The amount to burn.
@@ -72,16 +72,18 @@ contract MultiBridgeToken is ERC20, Ownable {
7272 }
7373
7474 /**
75- * @dev Burns tokens from an address. Decreases total amount minted by the calling bridge.
75+ * @dev Burns tokens from an address, deducting from the caller's allowance. Decreases total amount minted if called
76+ * by a bridge.
7677 * @param _from The address to burn tokens from.
7778 * @param _amount The amount to burn.
7879 */
7980 function _burnFrom (address _from , uint256 _amount ) internal returns (bool ) {
8081 Supply storage b = bridges[msg .sender ];
81- require (b.cap > 0 , "invalid caller " );
82- require (b.total >= _amount, "exceeds bridge minted amount " );
83- unchecked {
84- b.total -= _amount;
82+ if (b.cap > 0 || b.total > 0 ) {
83+ require (b.total >= _amount, "exceeds bridge minted amount " );
84+ unchecked {
85+ b.total -= _amount;
86+ }
8587 }
8688 _spendAllowance (_from, msg .sender , _amount);
8789 _burn (_from, _amount);
0 commit comments