Diff
checker
Texte
Texte
Images
Documents
Excel
Dossiers
Legal
Enterprise
Application de bureau
Prix
Se connecter
Télécharger Diffchecker Desktop
Comparer le texte
Trouver la différence entre deux fichiers texte
Outils
Historique
Éditeur live
Cacher identiques
Sans retour à la ligne
Vue
Divisé
Unifié
Niveau de précision
Intelligent
Mot
Caractère
Coloration syntaxique
Choisir la syntaxe
Ignorer
Transformer le texte
Aller au premier écart
Modifier l'entrée
Diffchecker Desktop
La façon la plus sécurisée d'utiliser Diffchecker. Obtenez l'application Diffchecker Desktop : vos diffs ne quittent jamais votre ordinateur !
Obtenir Desktop
HOG
Créé
l’année dernière
Le diff n'expire jamais
Effacer
Exporter
Partager
Expliquer
224 suppressions
Lignes
Total
Supprimé
Caractères
Total
Supprimé
Pour continuer à utiliser cette fonctionnalité, passez à
Diff
checker
Pro
Voir les prix
262 lignes
Copier tout
37 ajouts
Lignes
Total
Ajouté
Caractères
Total
Ajouté
Pour continuer à utiliser cette fonctionnalité, passez à
Diff
checker
Pro
Voir les prix
89 lignes
Copier tout
Copier
Copié
Copier
Copié
contract
Tomb
is ERC20Burnable, Operator {
contract
HOG
is ERC20Burnable, Operator {
using SafeMath8 for uint8;
using SafeMath8 for uint8;
using SafeMath for uint256;
using SafeMath for uint256;
Copier
Copié
Copier
Copié
// Initial distribution for the first 24h genesis pools
uint256 public constant INITIAL_
DAOFUND
_DISTRIBUTION =
1000 ether;
//
1000 HOG
uint256 public constant INITIAL_
GENESIS_POOL
_DISTRIBUTION =
1
1000 ether;
uint256 public constant
GENESIS
_DISTRIBUTION =
7
14000
ether;
//
714k HOG for genesis pool
//
Initial distribution for the day 2-5 TOMB-WFTM LP -> TOMB pool
uint256 public constant
INITIAL_TOMB_POOL
_DISTRIBUTION =
14000
0
ether;
//
Distribution for airdrops wallet
uint256 public constant INITIAL_AIRDROP_WALLET_DISTRIBUTION = 9000 ether;
Copier
Copié
Copier
Copié
// Have the rewards been distributed to the pools
bool public reward
s
Distributed = false;
bool public reward
Pool
Distributed = false;
Copier
Copié
Copier
Copié
/* ================= Taxation =============== */
// Address of the Oracle
// Address of the Oracle
Copier
Copié
Copier
Copié
address public
tomb
Oracle;
address public
hog
Oracle;
// Address of the Tax Office
address public taxOffice;
// Current tax rate
uint256 public taxRate;
// Price threshold below which taxes will get burned
uint256 public burnThreshold = 1.10e18;
// Address of the tax collector wallet
address public taxCollectorAddress;
// Should the taxes be calculated using the tax tiers
bool public autoCalculateTax;
// Tax Tiers
uint256[] public taxTiersTwaps = [0, 5e17, 6e17, 7e17, 8e17, 9e17, 9.5e17, 1e18, 1.05e18, 1.10e18, 1.20e18, 1.30e18, 1.40e18, 1.50e18];
uint256[] public taxTiersRates = [2000, 1900, 1800, 1700, 1600, 1500, 1500, 1500, 1500, 1400, 900, 400, 200, 100];
// Sender addresses excluded from Tax
mapping(address => bool) public excludedAddresses;
event TaxOfficeTransferred(address oldAddress, address newAddress);
modifier onlyTaxOffice() {
require(taxOffice == msg.sender, "Caller is not the tax office");
_;
}
modifier onlyOperatorOrTaxOffice() {
require(isOperator() || taxOffice == msg.sender, "Caller is not the operator or the tax office");
_;
}
/**
/**
Copier
Copié
Copier
Copié
* @notice Constructs the
TOMB
ERC-20 contract.
* @notice Constructs the
HOG
ERC-20 contract.
*/
*/
Copier
Copié
Copier
Copié
constructor(
uint256 _taxRate, address _taxCollectorAddress) public
ERC20("
TOMB
", "
TOMB
") {
constructor(
)
ERC20("
HOG
", "
HOG
") {
// Mints
1 TOMB
to contract creator for initial pool setup
// Mints
200 HOG
to contract creator for initial pool setup
require(_taxRate < 10000, "tax equal or bigger to 100%");
require(_taxCollectorAddress != address(0), "tax collector address must be non-zero address");
excludeAddress(address(this));
_mint(msg.sender, 1 ether);
taxRate = _taxRate;
taxCollectorAddress = _taxCollectorAddress;
}
/* ============= Taxation ============= */
function getTaxTiersTwapsCount() public view returns (uint256 count) {
return taxTiersTwaps.length;
}
function getTaxTiersRatesCount() public view returns (uint256 count) {
return taxTiersRates.length;
}
function isAddressExcluded(address _address) public view returns (bool) {
return excludedAddresses[_address];
}
function setTaxTiersTwap(uint8 _index, uint256 _value) public onlyTaxOffice returns (bool) {
require(_index >= 0, "Index has to be higher than 0");
require(_index < getTaxTiersTwapsCount(), "Index has to lower than count of tax tiers");
if (_index > 0) {
require(_value > taxTiersTwaps[_index - 1]);
}
if (_index < getTaxTiersTwapsCount().sub(1)) {
require(_value < taxTiersTwaps[_index + 1]);
}
taxTiersTwaps[_index] = _value;
return true;
}
function setTaxTiersRate(uint8 _index, uint256 _value) public onlyTaxOffice returns (bool) {
require(_index >= 0, "Index has to be higher than 0");
require(_index < getTaxTiersRatesCount(), "Index has to lower than count of tax tiers");
taxTiersRates[_index] = _value;
return true;
}
Copier
Copié
Copier
Copié
function setBurnThreshold(uint256 _burnThreshold) public onlyTaxOffice returns (bool) {
_mint(msg.sender, 200 ether)
;
burnThreshold = _burnThreshold
;
}
}
Copier
Copié
Copier
Copié
function _get
Tomb
Price() internal view returns (uint256 _
tomb
Price) {
function _get
Hog
Price() internal view returns (uint256 _
hog
Price) {
try IOracle(
tomb
Oracle).consult(address(this), 1e18) returns (
uint144
_price) {
try IOracle(
hog
Oracle).consult(address(this), 1e18) returns (
uint256
_price) {
return uint256(_price);
return uint256(_price);
} catch {
} catch {
Copier
Copié
Copier
Copié
revert("
Tomb
: failed to fetch
TOMB
price from Oracle");
revert("
Hog
: failed to fetch
HOG
price from Oracle");
}
}
function _updateTaxRate(uint256 _tombPrice) internal returns (uint256){
if (autoCalculateTax) {
for (uint8 tierId = uint8(getTaxTiersTwapsCount()).sub(1); tierId >= 0; --tierId) {
if (_tombPrice >= taxTiersTwaps[tierId]) {
require(taxTiersRates[tierId] < 10000, "tax equal or bigger to 100%");
taxRate = taxTiersRates[tierId];
return taxTiersRates[tierId];
}
}
}
}
}
}
Copier
Copié
Copier
Copié
function enableAutoCalculateTax() public onlyTaxOffice {
function set
Hog
Oracle(address _
hog
Oracle) public onlyOperator
{
autoCalculateTax = true;
require(_
hog
Oracle != address(0), "oracle address cannot be 0 address");
}
hog
Oracle = _
hog
Oracle;
function disableAutoCalculateTax() public onlyTaxOffice {
autoCalculateTax = false;
}
function set
Tomb
Oracle(address _
tomb
Oracle) public onlyOperator
OrTaxOffice
{
require(_
tomb
Oracle != address(0), "oracle address cannot be 0 address");
tomb
Oracle = _
tomb
Oracle;
}
function setTaxOffice(address _taxOffice) public onlyOperatorOrTaxOffice {
require(_taxOffice != address(0), "tax office address cannot be 0 address");
emit TaxOfficeTransferred(taxOffice, _taxOffice);
taxOffice = _taxOffice;
}
function setTaxCollectorAddress(address _taxCollectorAddress) public onlyTaxOffice {
require(_taxCollectorAddress != address(0), "tax collector address must be non-zero address");
taxCollectorAddress = _taxCollectorAddress;
}
function setTaxRate(uint256 _taxRate) public onlyTaxOffice {
require(!autoCalculateTax, "auto calculate tax cannot be enabled");
require(_taxRate < 10000, "tax equal or bigger to 100%");
taxRate = _taxRate;
}
function excludeAddress(address _address) public onlyOperatorOrTaxOffice returns (bool) {
require(!excludedAddresses[_address], "address can't be excluded");
excludedAddresses[_address] = true;
return true;
}
function includeAddress(address _address) public onlyOperatorOrTaxOffice returns (bool) {
require(excludedAddresses[_address], "address can't be included");
excludedAddresses[_address] = false;
return true;
}
}
/**
/**
Copier
Copié
Copier
Copié
* @notice Operator mints
TOMB
to a recipient
* @notice Operator mints
HOG
to a recipient
* @param recipient_ The address of recipient
* @param recipient_ The address of recipient
Copier
Copié
Copier
Copié
* @param amount_ The amount of
TOMB
to mint to
* @param amount_ The amount of
HOG
to mint to
* @return whether the process has been done
* @return whether the process has been done
*/
*/
function mint(address recipient_, uint256 amount_) public onlyOperator returns (bool) {
function mint(address recipient_, uint256 amount_) public onlyOperator returns (bool) {
uint256 balanceBefore = balanceOf(recipient_);
uint256 balanceBefore = balanceOf(recipient_);
_mint(recipient_, amount_);
_mint(recipient_, amount_);
uint256 balanceAfter = balanceOf(recipient_);
uint256 balanceAfter = balanceOf(recipient_);
return balanceAfter > balanceBefore;
return balanceAfter > balanceBefore;
}
}
function burn(uint256 amount) public override {
function burn(uint256 amount) public override {
super.burn(amount);
super.burn(amount);
}
}
function burnFrom(address account, uint256 amount) public override onlyOperator {
function burnFrom(address account, uint256 amount) public override onlyOperator {
super.burnFrom(account, amount);
super.burnFrom(account, amount);
}
}
function transferFrom(
function transferFrom(
address sender,
address sender,
address recipient,
address recipient,
uint256 amount
uint256 amount
) public override returns (bool) {
) public override returns (bool) {
Copier
Copié
Copier
Copié
uint256 currentTaxRate = 0;
_transfer(sender, recipient, amount);
bool burnTax = false;
if (autoCalculateTax) {
uint256 currentTombPrice = _getTombPrice();
currentTaxRate = _updateTaxRate(currentTombPrice);
if (currentTombPrice < burnThreshold) {
burnTax = true;
}
}
if (currentTaxRate == 0 || excludedAddresses[sender]) {
_transfer(sender, recipient, amount);
} else {
_transferWithTax(sender, recipient, amount, burnTax);
}
_approve(sender, _msgSender(), allowance(sender, _msgSender()).sub(amount, "ERC20: transfer amount exceeds allowance"));
_approve(sender, _msgSender(), allowance(sender, _msgSender()).sub(amount, "ERC20: transfer amount exceeds allowance"));
return true;
return true;
}
}
Copier
Copié
Copier
Copié
function _transferWithTax(
address sender,
address recipient,
uint256 amount,
bool burnTax
) internal returns (bool) {
uint256 taxAmount = amount.mul(taxRate).div(10000);
uint256 amountAfterTax = amount.sub(taxAmount);
if(burnTax) {
// Burn tax
super.burnFrom(sender, taxAmount);
} else {
// Transfer tax to tax collector
_transfer(sender, taxCollectorAddress, taxAmount);
}
// Transfer amount after tax to recipient
_transfer(sender, recipient, amountAfterTax);
return true;
}
/**
/**
* @notice distribute to reward pool (only once)
* @notice distribute to reward pool (only once)
*/
*/
function distributeReward(
function distributeReward(
Copier
Copié
Copier
Copié
address _
genesisPool
,
address _
daoFund
,
address _
tombPool,
address _
genesis
address _airdropWallet
) external onlyOperator {
) external onlyOperator {
Copier
Copié
Copier
Copié
require(!reward
Pool
Distributed, "only can distribute once");
require(_daoFund != address(0), "!_treasury");
require(_genesisPool != address(0), "!_genesisPool");
require(_genesis != address(0), "!_genesis");
require(_tombPool != address(0), "!_tombPool");
require(!reward
s
Distributed, "only can distribute once");
require(_airdropWallet != address(0), "!_airdropWallet");
reward
s
Distributed = true;
reward
Pool
Distributed = true;
_mint(_
daoFund
, INITIAL_
DAOFUND
_DISTRIBUTION);
_mint(_
genesisPool
, INITIAL_
GENESIS_POOL_DISTRIBUTION);
_mint(_
genesis, GENESIS
_DISTRIBUTION);
_mint(_tombPool, INITIAL_TOMB_POOL
_DISTRIBUTION);
_mint(_
airdropWallet, INITIAL_AIRDROP_WALLET
_DISTRIBUTION);
}
}
function governanceRecoverUnsupported(
function governanceRecoverUnsupported(
IERC20 _token,
IERC20 _token,
uint256 _amount,
uint256 _amount,
address _to
address _to
) external onlyOperator {
) external onlyOperator {
_token.transfer(_to, _amount);
_token.transfer(_to, _amount);
}
}
}
}
Différences enregistrées
Texte d'origine
Ouvrir un fichier
contract Tomb is ERC20Burnable, Operator { using SafeMath8 for uint8; using SafeMath for uint256; // Initial distribution for the first 24h genesis pools uint256 public constant INITIAL_GENESIS_POOL_DISTRIBUTION = 11000 ether; // Initial distribution for the day 2-5 TOMB-WFTM LP -> TOMB pool uint256 public constant INITIAL_TOMB_POOL_DISTRIBUTION = 140000 ether; // Distribution for airdrops wallet uint256 public constant INITIAL_AIRDROP_WALLET_DISTRIBUTION = 9000 ether; // Have the rewards been distributed to the pools bool public rewardPoolDistributed = false; /* ================= Taxation =============== */ // Address of the Oracle address public tombOracle; // Address of the Tax Office address public taxOffice; // Current tax rate uint256 public taxRate; // Price threshold below which taxes will get burned uint256 public burnThreshold = 1.10e18; // Address of the tax collector wallet address public taxCollectorAddress; // Should the taxes be calculated using the tax tiers bool public autoCalculateTax; // Tax Tiers uint256[] public taxTiersTwaps = [0, 5e17, 6e17, 7e17, 8e17, 9e17, 9.5e17, 1e18, 1.05e18, 1.10e18, 1.20e18, 1.30e18, 1.40e18, 1.50e18]; uint256[] public taxTiersRates = [2000, 1900, 1800, 1700, 1600, 1500, 1500, 1500, 1500, 1400, 900, 400, 200, 100]; // Sender addresses excluded from Tax mapping(address => bool) public excludedAddresses; event TaxOfficeTransferred(address oldAddress, address newAddress); modifier onlyTaxOffice() { require(taxOffice == msg.sender, "Caller is not the tax office"); _; } modifier onlyOperatorOrTaxOffice() { require(isOperator() || taxOffice == msg.sender, "Caller is not the operator or the tax office"); _; } /** * @notice Constructs the TOMB ERC-20 contract. */ constructor(uint256 _taxRate, address _taxCollectorAddress) public ERC20("TOMB", "TOMB") { // Mints 1 TOMB to contract creator for initial pool setup require(_taxRate < 10000, "tax equal or bigger to 100%"); require(_taxCollectorAddress != address(0), "tax collector address must be non-zero address"); excludeAddress(address(this)); _mint(msg.sender, 1 ether); taxRate = _taxRate; taxCollectorAddress = _taxCollectorAddress; } /* ============= Taxation ============= */ function getTaxTiersTwapsCount() public view returns (uint256 count) { return taxTiersTwaps.length; } function getTaxTiersRatesCount() public view returns (uint256 count) { return taxTiersRates.length; } function isAddressExcluded(address _address) public view returns (bool) { return excludedAddresses[_address]; } function setTaxTiersTwap(uint8 _index, uint256 _value) public onlyTaxOffice returns (bool) { require(_index >= 0, "Index has to be higher than 0"); require(_index < getTaxTiersTwapsCount(), "Index has to lower than count of tax tiers"); if (_index > 0) { require(_value > taxTiersTwaps[_index - 1]); } if (_index < getTaxTiersTwapsCount().sub(1)) { require(_value < taxTiersTwaps[_index + 1]); } taxTiersTwaps[_index] = _value; return true; } function setTaxTiersRate(uint8 _index, uint256 _value) public onlyTaxOffice returns (bool) { require(_index >= 0, "Index has to be higher than 0"); require(_index < getTaxTiersRatesCount(), "Index has to lower than count of tax tiers"); taxTiersRates[_index] = _value; return true; } function setBurnThreshold(uint256 _burnThreshold) public onlyTaxOffice returns (bool) { burnThreshold = _burnThreshold; } function _getTombPrice() internal view returns (uint256 _tombPrice) { try IOracle(tombOracle).consult(address(this), 1e18) returns (uint144 _price) { return uint256(_price); } catch { revert("Tomb: failed to fetch TOMB price from Oracle"); } } function _updateTaxRate(uint256 _tombPrice) internal returns (uint256){ if (autoCalculateTax) { for (uint8 tierId = uint8(getTaxTiersTwapsCount()).sub(1); tierId >= 0; --tierId) { if (_tombPrice >= taxTiersTwaps[tierId]) { require(taxTiersRates[tierId] < 10000, "tax equal or bigger to 100%"); taxRate = taxTiersRates[tierId]; return taxTiersRates[tierId]; } } } } function enableAutoCalculateTax() public onlyTaxOffice { autoCalculateTax = true; } function disableAutoCalculateTax() public onlyTaxOffice { autoCalculateTax = false; } function setTombOracle(address _tombOracle) public onlyOperatorOrTaxOffice { require(_tombOracle != address(0), "oracle address cannot be 0 address"); tombOracle = _tombOracle; } function setTaxOffice(address _taxOffice) public onlyOperatorOrTaxOffice { require(_taxOffice != address(0), "tax office address cannot be 0 address"); emit TaxOfficeTransferred(taxOffice, _taxOffice); taxOffice = _taxOffice; } function setTaxCollectorAddress(address _taxCollectorAddress) public onlyTaxOffice { require(_taxCollectorAddress != address(0), "tax collector address must be non-zero address"); taxCollectorAddress = _taxCollectorAddress; } function setTaxRate(uint256 _taxRate) public onlyTaxOffice { require(!autoCalculateTax, "auto calculate tax cannot be enabled"); require(_taxRate < 10000, "tax equal or bigger to 100%"); taxRate = _taxRate; } function excludeAddress(address _address) public onlyOperatorOrTaxOffice returns (bool) { require(!excludedAddresses[_address], "address can't be excluded"); excludedAddresses[_address] = true; return true; } function includeAddress(address _address) public onlyOperatorOrTaxOffice returns (bool) { require(excludedAddresses[_address], "address can't be included"); excludedAddresses[_address] = false; return true; } /** * @notice Operator mints TOMB to a recipient * @param recipient_ The address of recipient * @param amount_ The amount of TOMB to mint to * @return whether the process has been done */ function mint(address recipient_, uint256 amount_) public onlyOperator returns (bool) { uint256 balanceBefore = balanceOf(recipient_); _mint(recipient_, amount_); uint256 balanceAfter = balanceOf(recipient_); return balanceAfter > balanceBefore; } function burn(uint256 amount) public override { super.burn(amount); } function burnFrom(address account, uint256 amount) public override onlyOperator { super.burnFrom(account, amount); } function transferFrom( address sender, address recipient, uint256 amount ) public override returns (bool) { uint256 currentTaxRate = 0; bool burnTax = false; if (autoCalculateTax) { uint256 currentTombPrice = _getTombPrice(); currentTaxRate = _updateTaxRate(currentTombPrice); if (currentTombPrice < burnThreshold) { burnTax = true; } } if (currentTaxRate == 0 || excludedAddresses[sender]) { _transfer(sender, recipient, amount); } else { _transferWithTax(sender, recipient, amount, burnTax); } _approve(sender, _msgSender(), allowance(sender, _msgSender()).sub(amount, "ERC20: transfer amount exceeds allowance")); return true; } function _transferWithTax( address sender, address recipient, uint256 amount, bool burnTax ) internal returns (bool) { uint256 taxAmount = amount.mul(taxRate).div(10000); uint256 amountAfterTax = amount.sub(taxAmount); if(burnTax) { // Burn tax super.burnFrom(sender, taxAmount); } else { // Transfer tax to tax collector _transfer(sender, taxCollectorAddress, taxAmount); } // Transfer amount after tax to recipient _transfer(sender, recipient, amountAfterTax); return true; } /** * @notice distribute to reward pool (only once) */ function distributeReward( address _genesisPool, address _tombPool, address _airdropWallet ) external onlyOperator { require(!rewardPoolDistributed, "only can distribute once"); require(_genesisPool != address(0), "!_genesisPool"); require(_tombPool != address(0), "!_tombPool"); require(_airdropWallet != address(0), "!_airdropWallet"); rewardPoolDistributed = true; _mint(_genesisPool, INITIAL_GENESIS_POOL_DISTRIBUTION); _mint(_tombPool, INITIAL_TOMB_POOL_DISTRIBUTION); _mint(_airdropWallet, INITIAL_AIRDROP_WALLET_DISTRIBUTION); } function governanceRecoverUnsupported( IERC20 _token, uint256 _amount, address _to ) external onlyOperator { _token.transfer(_to, _amount); } }
Texte modifié
Ouvrir un fichier
contract HOG is ERC20Burnable, Operator { using SafeMath8 for uint8; using SafeMath for uint256; uint256 public constant INITIAL_DAOFUND_DISTRIBUTION = 1000 ether; // 1000 HOG uint256 public constant GENESIS_DISTRIBUTION = 714000 ether; // 714k HOG for genesis pool bool public rewardsDistributed = false; // Address of the Oracle address public hogOracle; /** * @notice Constructs the HOG ERC-20 contract. */ constructor() ERC20("HOG", "HOG") { // Mints 200 HOG to contract creator for initial pool setup _mint(msg.sender, 200 ether); } function _getHogPrice() internal view returns (uint256 _hogPrice) { try IOracle(hogOracle).consult(address(this), 1e18) returns (uint256 _price) { return uint256(_price); } catch { revert("Hog: failed to fetch HOG price from Oracle"); } } function setHogOracle(address _hogOracle) public onlyOperator { require(_hogOracle != address(0), "oracle address cannot be 0 address"); hogOracle = _hogOracle; } /** * @notice Operator mints HOG to a recipient * @param recipient_ The address of recipient * @param amount_ The amount of HOG to mint to * @return whether the process has been done */ function mint(address recipient_, uint256 amount_) public onlyOperator returns (bool) { uint256 balanceBefore = balanceOf(recipient_); _mint(recipient_, amount_); uint256 balanceAfter = balanceOf(recipient_); return balanceAfter > balanceBefore; } function burn(uint256 amount) public override { super.burn(amount); } function burnFrom(address account, uint256 amount) public override onlyOperator { super.burnFrom(account, amount); } function transferFrom( address sender, address recipient, uint256 amount ) public override returns (bool) { _transfer(sender, recipient, amount); _approve(sender, _msgSender(), allowance(sender, _msgSender()).sub(amount, "ERC20: transfer amount exceeds allowance")); return true; } /** * @notice distribute to reward pool (only once) */ function distributeReward( address _daoFund, address _genesis ) external onlyOperator { require(_daoFund != address(0), "!_treasury"); require(_genesis != address(0), "!_genesis"); require(!rewardsDistributed, "only can distribute once"); rewardsDistributed = true; _mint(_daoFund, INITIAL_DAOFUND_DISTRIBUTION); _mint(_genesis, GENESIS_DISTRIBUTION); } function governanceRecoverUnsupported( IERC20 _token, uint256 _amount, address _to ) external onlyOperator { _token.transfer(_to, _amount); } }
Trouver la différence