Commit cb1e61da by github-actions

Transpile 32d70eaa

parent 24eb03ed
...@@ -17,6 +17,10 @@ ...@@ -17,6 +17,10 @@
* `Governor`: enable receiving Ether when a Timelock contract is not used. ([#2748](https://github.com/OpenZeppelin/openzeppelin-contracts/pull/2748)) * `Governor`: enable receiving Ether when a Timelock contract is not used. ([#2748](https://github.com/OpenZeppelin/openzeppelin-contracts/pull/2748))
* `GovernorTimelockCompound`: fix ability to use Ether stored in the Timelock contract. ([#2748](https://github.com/OpenZeppelin/openzeppelin-contracts/pull/2748)) * `GovernorTimelockCompound`: fix ability to use Ether stored in the Timelock contract. ([#2748](https://github.com/OpenZeppelin/openzeppelin-contracts/pull/2748))
## 4.3.3
* `ERC1155Supply`: Handle `totalSupply` changes by hooking into `_beforeTokenTransfer` to ensure consistency of balances and supply during `IERC1155Receiver.onERC1155Received` calls.
## 4.3.2 (2021-09-14) ## 4.3.2 (2021-09-14)
* `UUPSUpgradeable`: Add modifiers to prevent `upgradeTo` and `upgradeToAndCall` being executed on any contract that is not the active ERC1967 proxy. This prevents these functions being called on implementation contracts or minimal ERC1167 clones, in particular. * `UUPSUpgradeable`: Add modifiers to prevent `upgradeTo` and `upgradeToAndCall` being executed on any contract that is not the active ERC1967 proxy. This prevents these functions being called on implementation contracts or minimal ERC1167 clones, in particular.
......
...@@ -18,38 +18,15 @@ contract ERC1155SupplyMockUpgradeable is Initializable, ERC1155MockUpgradeable, ...@@ -18,38 +18,15 @@ contract ERC1155SupplyMockUpgradeable is Initializable, ERC1155MockUpgradeable,
function __ERC1155SupplyMock_init_unchained(string memory uri) internal initializer {} function __ERC1155SupplyMock_init_unchained(string memory uri) internal initializer {}
function _mint( function _beforeTokenTransfer(
address account, address operator,
uint256 id, address from,
uint256 amount,
bytes memory data
) internal virtual override(ERC1155Upgradeable, ERC1155SupplyUpgradeable) {
super._mint(account, id, amount, data);
}
function _mintBatch(
address to, address to,
uint256[] memory ids, uint256[] memory ids,
uint256[] memory amounts, uint256[] memory amounts,
bytes memory data bytes memory data
) internal virtual override(ERC1155Upgradeable, ERC1155SupplyUpgradeable) { ) internal virtual override(ERC1155Upgradeable, ERC1155SupplyUpgradeable) {
super._mintBatch(to, ids, amounts, data); super._beforeTokenTransfer(operator, from, to, ids, amounts, data);
}
function _burn(
address account,
uint256 id,
uint256 amount
) internal virtual override(ERC1155Upgradeable, ERC1155SupplyUpgradeable) {
super._burn(account, id, amount);
}
function _burnBatch(
address account,
uint256[] memory ids,
uint256[] memory amounts
) internal virtual override(ERC1155Upgradeable, ERC1155SupplyUpgradeable) {
super._burnBatch(account, ids, amounts);
} }
uint256[50] private __gap; uint256[50] private __gap;
} }
...@@ -40,56 +40,28 @@ abstract contract ERC1155SupplyUpgradeable is Initializable, ERC1155Upgradeable ...@@ -40,56 +40,28 @@ abstract contract ERC1155SupplyUpgradeable is Initializable, ERC1155Upgradeable
} }
/** /**
* @dev See {ERC1155-_mint}. * @dev See {ERC1155-_beforeTokenTransfer}.
*/ */
function _mint( function _beforeTokenTransfer(
address account, address operator,
uint256 id, address from,
uint256 amount,
bytes memory data
) internal virtual override {
super._mint(account, id, amount, data);
_totalSupply[id] += amount;
}
/**
* @dev See {ERC1155-_mintBatch}.
*/
function _mintBatch(
address to, address to,
uint256[] memory ids, uint256[] memory ids,
uint256[] memory amounts, uint256[] memory amounts,
bytes memory data bytes memory data
) internal virtual override { ) internal virtual override {
super._mintBatch(to, ids, amounts, data); super._beforeTokenTransfer(operator, from, to, ids, amounts, data);
for (uint256 i = 0; i < ids.length; ++i) {
_totalSupply[ids[i]] += amounts[i];
}
}
/** if (from == address(0)) {
* @dev See {ERC1155-_burn}. for (uint256 i = 0; i < ids.length; ++i) {
*/ _totalSupply[ids[i]] += amounts[i];
function _burn( }
address account, }
uint256 id,
uint256 amount
) internal virtual override {
super._burn(account, id, amount);
_totalSupply[id] -= amount;
}
/** if (to == address(0)) {
* @dev See {ERC1155-_burnBatch}. for (uint256 i = 0; i < ids.length; ++i) {
*/ _totalSupply[ids[i]] -= amounts[i];
function _burnBatch( }
address account,
uint256[] memory ids,
uint256[] memory amounts
) internal virtual override {
super._burnBatch(account, ids, amounts);
for (uint256 i = 0; i < ids.length; ++i) {
_totalSupply[ids[i]] -= amounts[i];
} }
} }
uint256[49] private __gap; uint256[49] private __gap;
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment