Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 2 additions & 10 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,11 +1,3 @@
# ApeHaven Contract
# Base ERC-20 Contract

Link to white paper: [ApeHaven White Paper](https://apehaven.com/apehaven.pdf)

Link to contract: [$APES Contract](https://github.com/apehaven/contract/blob/main/contract.sol)

## Join the Ape Tribe

- Telegram - https://t.me/apehaven
- Twitter - https://twitter.com/apehaven
- Reddit - https://reddit.com/r/apehaven
This contract is the next iteration of [Drew Roberts](https://github.com/drewroberts) tokenomics for [Tipoff](https://github.com/tipoff) releases. It builds on the success of the [ApeHaven](https://github.com/apehaven) project and adds additional flexibility with reduced gas fees. It is the new base structure for future projects led by [Drew Roberts](https://drewroberts.com) and the [Tipoff](https://tipoff.com) Team.
64 changes: 28 additions & 36 deletions contract.sol
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,6 @@
*
*

"$APES to the moon" -Elon Musk

Contract features:
7% fee auto added to the liquidity pool and locked forever
2% fee auto distributed to all holders
Expand Down Expand Up @@ -764,8 +762,8 @@ contract ApeHaven is Context, IERC20, Ownable {
uint256 public _taxFee = 2;
uint256 private _previousTaxFee = _taxFee;

uint256 public _devFee = 1; // 1% to charity wallet
uint256 private _previousDevFee = _devFee;
uint256 public _charityFee = 1; // 1% to charity wallet
uint256 private _previousCharityFee = _charityFee;
address public charityWallet = address(0x7c87DdAc05c5146876cc0f9e335ce125B15d6893); // Donated to the Center for Great Apes

uint256 public _liquidityFee = 7;
Expand Down Expand Up @@ -932,7 +930,7 @@ contract ApeHaven is Context, IERC20, Ownable {
_tOwned[recipient] = _tOwned[recipient].add(tTransferAmount);
_rOwned[recipient] = _rOwned[recipient].add(rTransferAmount);
_takeLiquidity(tLiquidity);
_takeDevFee(sender, tAmount);
_takeCharityFee(sender, tAmount);
_reflectFee(rFee, tFee);
emit Transfer(sender, recipient, tTransferAmount);
}
Expand Down Expand Up @@ -992,26 +990,26 @@ contract ApeHaven is Context, IERC20, Ownable {
_tFeeTotal = _tFeeTotal.add(tFee);
}

function _takeDevFee(address sender, uint256 tAmount) private {
uint256 tDevFee = _getTDevFeeValues(tAmount);
uint256 rDevFee = _getRDevFeeValues(tDevFee, _getRate());
function _takeCharityFee(address sender, uint256 tAmount) private {
uint256 tCharityFee = _getTCharityFeeValues(tAmount);
uint256 rCharityFee = _getRCharityFeeValues(tCharityFee, _getRate());
if (_isExcluded[charityWallet]) {
_tOwned[charityWallet] = _tOwned[charityWallet].add(tDevFee);
_rOwned[charityWallet] = _rOwned[charityWallet].add(rDevFee);
_tOwned[charityWallet] = _tOwned[charityWallet].add(tCharityFee);
_rOwned[charityWallet] = _rOwned[charityWallet].add(rCharityFee);
} else {
_rOwned[charityWallet] = _rOwned[charityWallet].add(rDevFee);
_rOwned[charityWallet] = _rOwned[charityWallet].add(rCharityFee);
}
emit Transfer(sender, charityWallet, tDevFee);
emit Transfer(sender, charityWallet, tCharityFee);
}


function _getValues(uint256 tAmount) private view returns (uint256, uint256, uint256, uint256, uint256, uint256) {
(uint256 tTransferAmount, uint256 tFee, uint256 tLiquidity) = _getTValues(tAmount);
(uint256 rAmount, uint256 rTransferAmount, uint256 rFee) = _getRValues(tAmount, tFee, tLiquidity);
uint256 tDevFee = _getTDevFeeValues(tAmount);
uint256 rDevFee = _getRDevFeeValues(tDevFee, _getRate());
tTransferAmount = tTransferAmount.sub(tDevFee);
rTransferAmount = rTransferAmount.sub(rDevFee);
uint256 tCharityFee = _getTCharityFeeValues(tAmount);
uint256 rCharityFee = _getRCharityFeeValues(tCharityFee, _getRate());
tTransferAmount = tTransferAmount.sub(tCharityFee);
rTransferAmount = rTransferAmount.sub(rCharityFee);
return (rAmount, rTransferAmount, rFee, tTransferAmount, tFee, tLiquidity);
}

Expand All @@ -1023,9 +1021,9 @@ contract ApeHaven is Context, IERC20, Ownable {
return (tTransferAmount, tFee, tLiquidity);
}

function _getTDevFeeValues(uint256 tAmount) private view returns (uint256) {
uint256 tDevFee = calculateDevFee(tAmount);
return tDevFee;
function _getTCharityFeeValues(uint256 tAmount) private view returns (uint256) {
uint256 tCharityFee = calculateCharityFee(tAmount);
return tCharityFee;
}

function _getRValues(uint256 tAmount, uint256 tFee, uint256 tLiquidity) private view returns (uint256, uint256, uint256) {
Expand All @@ -1037,9 +1035,9 @@ contract ApeHaven is Context, IERC20, Ownable {
return (rAmount, rTransferAmount, rFee);
}

function _getRDevFeeValues(uint256 tDevFee, uint256 currentRate) private pure returns (uint256) {
uint256 rDevFee = tDevFee.mul(currentRate);
return rDevFee;
function _getRCharityFeeValues(uint256 tCharityFee, uint256 currentRate) private pure returns (uint256) {
uint256 rCharityFee = tCharityFee.mul(currentRate);
return rCharityFee;
}

function _getRate() private view returns (uint256) {
Expand Down Expand Up @@ -1074,8 +1072,8 @@ contract ApeHaven is Context, IERC20, Ownable {
);
}

function calculateDevFee(uint256 _amount) private view returns (uint256) {
return _amount.mul(_devFee).div(
function calculateCharityFee(uint256 _amount) private view returns (uint256) {
return _amount.mul(_charityFee).div(
10 ** 2
);
}
Expand All @@ -1091,17 +1089,17 @@ contract ApeHaven is Context, IERC20, Ownable {

_previousTaxFee = _taxFee;
_previousLiquidityFee = _liquidityFee;
_previousDevFee = _devFee;
_previousCharityFee = _charityFee;

_taxFee = 0;
_liquidityFee = 0;
_devFee = 0;
_charityFee = 0;
}

function restoreAllFee() private {
_taxFee = _previousTaxFee;
_liquidityFee = _previousLiquidityFee;
_devFee = _previousDevFee;
_charityFee = _previousCharityFee;
}

function isExcludedFromFee(address account) public view returns (bool) {
Expand Down Expand Up @@ -1250,7 +1248,7 @@ contract ApeHaven is Context, IERC20, Ownable {
_rOwned[sender] = _rOwned[sender].sub(rAmount);
_rOwned[recipient] = _rOwned[recipient].add(rTransferAmount);
_takeLiquidity(tLiquidity);
_takeDevFee(sender, tAmount);
_takeCharityFee(sender, tAmount);
_reflectFee(rFee, tFee);
emit Transfer(sender, recipient, tTransferAmount);
}
Expand All @@ -1261,7 +1259,7 @@ contract ApeHaven is Context, IERC20, Ownable {
_tOwned[recipient] = _tOwned[recipient].add(tTransferAmount);
_rOwned[recipient] = _rOwned[recipient].add(rTransferAmount);
_takeLiquidity(tLiquidity);
_takeDevFee(sender, tAmount);
_takeCharityFee(sender, tAmount);
_reflectFee(rFee, tFee);
emit Transfer(sender, recipient, tTransferAmount);
}
Expand All @@ -1272,7 +1270,7 @@ contract ApeHaven is Context, IERC20, Ownable {
_rOwned[sender] = _rOwned[sender].sub(rAmount);
_rOwned[recipient] = _rOwned[recipient].add(rTransferAmount);
_takeLiquidity(tLiquidity);
_takeDevFee(sender, tAmount);
_takeCharityFee(sender, tAmount);
_reflectFee(rFee, tFee);
emit Transfer(sender, recipient, tTransferAmount);
}
Expand Down Expand Up @@ -1316,10 +1314,4 @@ contract ApeHaven is Context, IERC20, Ownable {
function AppendStr(string memory a, string memory b, string memory c, string memory d) internal pure returns (string memory) {
return string(abi.encodePacked(a, b, c, d));
}

// "Florida supports fintech sandbox." -Ron DeSantis

// "For the People." -John Morgan

// "As for me, I like the tokenomics." -DFV from WSB
}