-
Notifications
You must be signed in to change notification settings - Fork 2.2k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
refactor(protocol): apply multiple improvements based on feedback fro…
…m Open Zeppelin (#18305)
- Loading branch information
Showing
11 changed files
with
58 additions
and
23 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -11,6 +11,16 @@ import "./TaikoData.sol"; | |
/// @notice A library that offers helper functions to handle bonds. | ||
/// @custom:security-contact [email protected] | ||
library LibBonds { | ||
/// @dev Emitted when tokens are deposited into a user's bond balance. | ||
/// @param user The address of the user who deposited the tokens. | ||
/// @param amount The amount of tokens deposited. | ||
event BondDeposited(address indexed user, uint256 amount); | ||
|
||
/// @dev Emitted when tokens are withdrawn from a user's bond balance. | ||
/// @param user The address of the user who withdrew the tokens. | ||
/// @param amount The amount of tokens withdrawn. | ||
event BondWithdrawn(address indexed user, uint256 amount); | ||
|
||
/// @dev Emitted when a token is credited back to a user's bond balance. | ||
/// @param user The address of the user whose bond balance is credited. | ||
/// @param blockId The ID of the block to credit for. | ||
|
@@ -34,6 +44,7 @@ library LibBonds { | |
) | ||
internal | ||
{ | ||
emit BondDeposited(msg.sender, _amount); | ||
_state.bondBalance[msg.sender] += _amount; | ||
_tko(_resolver).transferFrom(msg.sender, address(this), _amount); | ||
} | ||
|
@@ -49,6 +60,7 @@ library LibBonds { | |
) | ||
internal | ||
{ | ||
emit BondWithdrawn(msg.sender, _amount); | ||
_state.bondBalance[msg.sender] -= _amount; | ||
_tko(_resolver).transfer(msg.sender, _amount); | ||
} | ||
|
@@ -76,6 +88,7 @@ library LibBonds { | |
_state.bondBalance[_user] = balance - _amount; | ||
} | ||
} else { | ||
emit BondDeposited(msg.sender, _amount); | ||
_tko(_resolver).transferFrom(_user, address(this), _amount); | ||
} | ||
emit BondDebited(_user, _blockId, _amount); | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -8,7 +8,7 @@ import "./TaikoData.sol"; | |
/// @notice A library that offers helper functions. | ||
/// @custom:security-contact [email protected] | ||
library LibData { | ||
function blockV2toV1(TaikoData.BlockV2 memory _v2) | ||
function blockV2ToV1(TaikoData.BlockV2 memory _v2) | ||
internal | ||
pure | ||
returns (TaikoData.Block memory) | ||
|
@@ -25,7 +25,7 @@ library LibData { | |
}); | ||
} | ||
|
||
function verifierContextV2toV1(IVerifier.ContextV2 memory _v2) | ||
function verifierContextV2ToV1(IVerifier.ContextV2 memory _v2) | ||
internal | ||
pure | ||
returns (IVerifier.Context memory) | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -11,10 +11,26 @@ import "./TaikoData.sol"; | |
/// L1 libraries. | ||
/// @custom:security-contact [email protected] | ||
abstract contract TaikoEvents { | ||
/// @dev Emitted when token is credited back to a user's bond balance. | ||
/// @dev Emitted when tokens are deposited into a user's bond balance. | ||
/// @param user The address of the user who deposited the tokens. | ||
/// @param amount The amount of tokens deposited. | ||
event BondDeposited(address indexed user, uint256 amount); | ||
|
||
/// @dev Emitted when tokens are withdrawn from a user's bond balance. | ||
/// @param user The address of the user who withdrew the tokens. | ||
/// @param amount The amount of tokens withdrawn. | ||
event BondWithdrawn(address indexed user, uint256 amount); | ||
|
||
/// @dev Emitted when a token is credited back to a user's bond balance. | ||
/// @param user The address of the user whose bond balance is credited. | ||
/// @param blockId The ID of the block to credit for. | ||
/// @param amount The amount of tokens credited. | ||
event BondCredited(address indexed user, uint256 blockId, uint256 amount); | ||
|
||
/// @dev Emitted when token is debited from a user's bond balance. | ||
/// @dev Emitted when a token is debited from a user's bond balance. | ||
/// @param user The address of the user whose bond balance is debited. | ||
/// @param blockId The ID of the block to debit for. | ||
/// @param amount The amount of tokens debited. | ||
event BondDebited(address indexed user, uint256 blockId, uint256 amount); | ||
|
||
/// @dev DEPRECATED but used by node/client for syncing old blocks | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters