Transpile 7bce2b72
This commit is contained in:
@ -0,0 +1,51 @@
|
||||
// SPDX-License-Identifier: MIT
|
||||
// OpenZeppelin Contracts (last updated v4.5.0-rc.0) (token/ERC721/extensions/draft-ERC721Votes.sol)
|
||||
|
||||
pragma solidity ^0.8.0;
|
||||
|
||||
import "../ERC721Upgradeable.sol";
|
||||
import "../../../governance/utils/VotesUpgradeable.sol";
|
||||
import "../../../proxy/utils/Initializable.sol";
|
||||
|
||||
/**
|
||||
* @dev Extension of ERC721 to support voting and delegation as implemented by {Votes}, where each individual NFT counts
|
||||
* as 1 vote unit.
|
||||
*
|
||||
* Tokens do not count as votes until they are delegated, because votes must be tracked which incurs an additional cost
|
||||
* on every transfer. Token holders can either delegate to a trusted representative who will decide how to make use of
|
||||
* the votes in governance decisions, or they can delegate to themselves to be their own representative.
|
||||
*
|
||||
* _Available since v4.5._
|
||||
*/
|
||||
abstract contract ERC721VotesUpgradeable is Initializable, ERC721Upgradeable, VotesUpgradeable {
|
||||
function __ERC721Votes_init() internal onlyInitializing {
|
||||
__Context_init_unchained();
|
||||
__ERC165_init_unchained();
|
||||
__Votes_init_unchained();
|
||||
__ERC721Votes_init_unchained();
|
||||
}
|
||||
|
||||
function __ERC721Votes_init_unchained() internal onlyInitializing {
|
||||
}
|
||||
/**
|
||||
* @dev Adjusts votes when tokens are transferred.
|
||||
*
|
||||
* Emits a {Votes-DelegateVotesChanged} event.
|
||||
*/
|
||||
function _afterTokenTransfer(
|
||||
address from,
|
||||
address to,
|
||||
uint256 tokenId
|
||||
) internal virtual override {
|
||||
_transferVotingUnits(from, to, 1);
|
||||
super._afterTokenTransfer(from, to, tokenId);
|
||||
}
|
||||
|
||||
/**
|
||||
* @dev Returns the balance of `account`.
|
||||
*/
|
||||
function _getVotingUnits(address account) internal virtual override returns (uint256) {
|
||||
return balanceOf(account);
|
||||
}
|
||||
uint256[50] private __gap;
|
||||
}
|
||||
Reference in New Issue
Block a user