From dcae54a8f859aadb4ede4df054cab976984573af Mon Sep 17 00:00:00 2001 From: Daniel Wang <99078276+dantaik@users.noreply.github.com> Date: Thu, 14 Mar 2024 15:49:01 +0800 Subject: [PATCH] fix(protocol): make `snapshot` return value (#16436) Co-authored-by: D <51912515+adaki2004@users.noreply.github.com> --- packages/protocol/contracts/L1/TaikoToken.sol | 14 +++++++------- .../protocol/contracts/L1/gov/TaikoGovernor.sol | 2 +- .../contracts/tokenvault/BridgedERC20.sol | 16 ++++++++-------- 3 files changed, 16 insertions(+), 16 deletions(-) diff --git a/packages/protocol/contracts/L1/TaikoToken.sol b/packages/protocol/contracts/L1/TaikoToken.sol index 85796162898..f9b54ef40d2 100644 --- a/packages/protocol/contracts/L1/TaikoToken.sol +++ b/packages/protocol/contracts/L1/TaikoToken.sol @@ -47,12 +47,12 @@ contract TaikoToken is EssentialContract, ERC20SnapshotUpgradeable, ERC20VotesUp /// @param _from The address to burn tokens from. /// @param _amount The amount of tokens to burn. function burn(address _from, uint256 _amount) public onlyOwner { - _burn(_from, _amount); + return _burn(_from, _amount); } /// @notice Creates a new token snapshot. - function snapshot() public onlyFromOwnerOrNamed("snapshooter") { - _snapshot(); + function snapshot() public onlyFromOwnerOrNamed("snapshooter") returns (uint256) { + return _snapshot(); } /// @notice Transfers tokens to a specified address. @@ -90,7 +90,7 @@ contract TaikoToken is EssentialContract, ERC20SnapshotUpgradeable, ERC20VotesUp internal override(ERC20Upgradeable, ERC20SnapshotUpgradeable) { - super._beforeTokenTransfer(_from, _to, _amount); + return super._beforeTokenTransfer(_from, _to, _amount); } function _afterTokenTransfer( @@ -101,7 +101,7 @@ contract TaikoToken is EssentialContract, ERC20SnapshotUpgradeable, ERC20VotesUp internal override(ERC20Upgradeable, ERC20VotesUpgradeable) { - super._afterTokenTransfer(_from, _to, _amount); + return super._afterTokenTransfer(_from, _to, _amount); } function _mint( @@ -111,7 +111,7 @@ contract TaikoToken is EssentialContract, ERC20SnapshotUpgradeable, ERC20VotesUp internal override(ERC20Upgradeable, ERC20VotesUpgradeable) { - super._mint(_to, _amount); + return super._mint(_to, _amount); } function _burn( @@ -121,6 +121,6 @@ contract TaikoToken is EssentialContract, ERC20SnapshotUpgradeable, ERC20VotesUp internal override(ERC20Upgradeable, ERC20VotesUpgradeable) { - super._burn(_from, _amount); + return super._burn(_from, _amount); } } diff --git a/packages/protocol/contracts/L1/gov/TaikoGovernor.sol b/packages/protocol/contracts/L1/gov/TaikoGovernor.sol index 6fbfe9d6d55..cfb420eaf01 100644 --- a/packages/protocol/contracts/L1/gov/TaikoGovernor.sol +++ b/packages/protocol/contracts/L1/gov/TaikoGovernor.sol @@ -120,7 +120,7 @@ contract TaikoGovernor is internal override(GovernorUpgradeable, GovernorTimelockControlUpgradeable) { - super._execute(_proposalId, _targets, _values, _calldatas, _descriptionHash); + return super._execute(_proposalId, _targets, _values, _calldatas, _descriptionHash); } function _cancel( diff --git a/packages/protocol/contracts/tokenvault/BridgedERC20.sol b/packages/protocol/contracts/tokenvault/BridgedERC20.sol index a490d1921e6..523d7f0eb01 100644 --- a/packages/protocol/contracts/tokenvault/BridgedERC20.sol +++ b/packages/protocol/contracts/tokenvault/BridgedERC20.sol @@ -81,8 +81,8 @@ contract BridgedERC20 is } /// @notice Creates a new token snapshot. - function snapshot() external onlyOwnerOrSnapshooter { - _snapshot(); + function snapshot() external onlyOwnerOrSnapshooter returns (uint256) { + return _snapshot(); } /// @notice Gets the name of the token. @@ -126,11 +126,11 @@ contract BridgedERC20 is } function _mintToken(address _account, uint256 _amount) internal override { - _mint(_account, _amount); + return _mint(_account, _amount); } function _burnToken(address _from, uint256 _amount) internal override { - _burn(_from, _amount); + return _burn(_from, _amount); } /// @dev For ERC20SnapshotUpgradeable and ERC20VotesUpgradeable, need to implement the following @@ -145,7 +145,7 @@ contract BridgedERC20 is { if (_to == address(this)) revert BTOKEN_CANNOT_RECEIVE(); if (paused()) revert INVALID_PAUSE_STATUS(); - super._beforeTokenTransfer(_from, _to, _amount); + return super._beforeTokenTransfer(_from, _to, _amount); } function _afterTokenTransfer( @@ -156,7 +156,7 @@ contract BridgedERC20 is internal override(ERC20Upgradeable, ERC20VotesUpgradeable) { - super._afterTokenTransfer(_from, _to, _amount); + return super._afterTokenTransfer(_from, _to, _amount); } function _mint( @@ -166,7 +166,7 @@ contract BridgedERC20 is internal override(ERC20Upgradeable, ERC20VotesUpgradeable) { - super._mint(_to, _amount); + return super._mint(_to, _amount); } function _burn( @@ -176,6 +176,6 @@ contract BridgedERC20 is internal override(ERC20Upgradeable, ERC20VotesUpgradeable) { - super._burn(_from, _amount); + return super._burn(_from, _amount); } }