Skip to content

Commit

Permalink
SGT: add batchDepositForAll (#121)
Browse files Browse the repository at this point in the history
* SGT: add batchDepositForAll

* follow op coding convention

* address comment
  • Loading branch information
blockchaindevsh authored Dec 10, 2024
1 parent 0ac5eeb commit 79703f6
Showing 1 changed file with 10 additions and 0 deletions.
10 changes: 10 additions & 0 deletions packages/contracts-bedrock/src/L2/SoulGasToken.sol
Original file line number Diff line number Diff line change
Expand Up @@ -80,6 +80,16 @@ contract SoulGasToken is ERC20Upgradeable, OwnableUpgradeable {
require(msg.value == totalValue, "SGT: unexpected msg.value");
}

/// @notice batchDepositForAll is similar to batchDepositFor, but the value is the same for all accounts.
function batchDepositForAll(address[] calldata _accounts, uint256 _value) external payable {
require(IS_BACKED_BY_NATIVE, "SGT: batchDepositForAll should only be called when IS_BACKED_BY_NATIVE");

for (uint256 i = 0; i < _accounts.length; i++) {
_mint(_accounts[i], _value);
}
require(msg.value == _value * _accounts.length, "SGT: unexpected msg.value");
}

/// @notice withdrawFrom is called by the burner to burn SoulGasToken and return the native token when
/// IS_BACKED_BY_NATIVE.
function withdrawFrom(address _account, uint256 _value) external {
Expand Down

0 comments on commit 79703f6

Please sign in to comment.