Hi, I have a token which is similar to Safemoon, but has an added fee for charity. Originally it was deployed on the BSC mainnet, but now we are going to redeploy on the Ethereum mainnet.
I am looking to get advice on how to properly implement upgradeable smart contracts, because down the line I would like to remove the burn once x-amount of tokens in circulating supply has been reached, or make any necessary changes/updates overtime for the longevity of the coin.
The issue I’m running into is importing the libraries below
import "@openzeppelin/contracts-upgradeable/token/ERC20/ERC20Upgradeable.sol";
import "@openzeppelin/contracts-upgradeable/security/PausableUpgradeable.sol";
import "@openzeppelin/contracts-upgradeable/access/OwnableUpgradeable.sol";
import "@openzeppelin/contracts-upgradeable/proxy/utils/Initializable.sol";
import "@openzeppelin/contracts-upgradeable/proxy/utils/UUPSUpgradeable.sol";
When I combine the Safemoon code with the code I get from wizard.openzepplin.com, I run into a lot of compiling errors. When I fix one error, multiple more pop up and it's never ending.
Is it possible to make a code like Safemoon upgradeable using the upgrade libraries provided by OpenZepplin?
Below is the code I get from the wizard.
pragma solidity ^0.8.2;
import "@openzeppelin/contracts-upgradeable/token/ERC20/ERC20Upgradeable.sol";
import "@openzeppelin/contracts-upgradeable/security/PausableUpgradeable.sol";
import "@openzeppelin/contracts-upgradeable/access/OwnableUpgradeable.sol";
import "@openzeppelin/contracts-upgradeable/proxy/utils/Initializable.sol";
import "@openzeppelin/contracts-upgradeable/proxy/utils/UUPSUpgradeable.sol";
contract MyCoin is Initializable, ERC20Upgradeable, PausableUpgradeable, OwnableUpgradeable, UUPSUpgradeable {
/// @custom:oz-upgrades-unsafe-allow constructor
constructor() initializer {}
function initialize() initializer public {
__ERC20_init("My Coin", "Coin");
__Pausable_init();
__Ownable_init();
__UUPSUpgradeable_init();
_mint(msg.sender, 1000000000000000 * 10 ** decimals());
}
function pause() public onlyOwner {
_pause();
}
function unpause() public onlyOwner {
_unpause();
}
function _beforeTokenTransfer(address from, address to, uint256 amount)
internal
whenNotPaused
override
{
super._beforeTokenTransfer(from, to, amount);
}
function _authorizeUpgrade(address newImplementation)
internal
onlyOwner
override
{}
}