Hi,
I tested implementing this contract, with the openzeppelin-solidity 2.5 includes and it worked very well
Later, testing other things, I updated the includes openzeppelin-solidity 3X and my previous code did not work
I’m trying to adjust the code so that, taking advantage of the openzeppelin-solidity 3.x libraries, it works, but I’m not moving from here:
contract MyToken is ERC20 {
uint256 private _minimumSupply = 2000 * (10 ** 18);
/**
* @dev Constructor that gives msg.sender all of existing tokens.
*/
constructor () public ERC20( "MyToken", "MTN") {
_mint(msg.sender, 10000 * (10 ** uint256(decimals())));
}
function transfer(address to, uint256 amount) public returns (bool) {
return super.transfer(to, _partialBurn(amount));
}
function transferFrom(address from, address to, uint256 amount) public returns (bool) {
return super.transferFrom(from, to, _partialBurn(amount));
}
function _partialBurn(uint256 amount) internal returns (uint256) {
uint256 burnAmount = _calculateBurnAmount(amount);
if (burnAmount > 0) {
_burn(msg.sender, burnAmount);
}
return amount.sub(burnAmount);
}
function _calculateBurnAmount(uint256 amount) internal view returns (uint256) {
uint256 burnAmount = 0;
// burn amount calculations
if (totalSupply() > _minimumSupply) {
burnAmount = amount.div(100);
uint256 availableBurn = totalSupply().sub(_minimumSupply);
if (burnAmount > availableBurn) {
burnAmount = availableBurn;
}
}
return burnAmount;
}
}
I am testing in remix, and I try to include the files corresponding to version 2.5 again, they do not work,
I understand that they were overwritten and only the includes from version 3.x are kept
Can you explain to me what the difference is and how to correct it
Thank you very much