diff --git a/README.md b/README.md index 75c2453..b759870 100644 --- a/README.md +++ b/README.md @@ -46,10 +46,10 @@ contract MyUniswapV2FeeToken is UniswapV2FeeToken constructor() UniswapV2FeeToken( "My Token", "MTKN", // Name and Symbol 1_000_000_000 ether, // 1 billion supply - address(this), // Vault Address - 100, 200, 0, // Fees: 2% buy 1% sell 0% P2P - 0x7a250d5630B4cF539739dF2C5dAcb4c659F2488D, // Router Address - 0xA0b86991c6218b36c1d19D4a2e9Eb0cE3606eB48) // Base Token Address + 100, 200, 50, // Fees: 1% buy 2% sell 0.5% P2P + msg.sender, // Fee Receiver + 0x7a250d5630B4cF539739dF2C5dAcb4c659F2488D, // Router Address: Uniswap V2 + 0xA0b86991c6218b36c1d19D4a2e9Eb0cE3606eB48) // Base Token Address: USDC { } } @@ -71,10 +71,10 @@ contract MyUniswapV2AutoSwapToken is UniswapV2AutoSwapToken constructor() UniswapV2AutoSwapToken( "My Token", "MTKN", // Name and Symbol 1_000_000_000 ether, // 1 billion supply - 100, 200, 0, // Fees: 2% buy 1% sell 0% P2P - 0x7a250d5630B4cF539739dF2C5dAcb4c659F2488D, // Router Address - 0xA0b86991c6218b36c1d19D4a2e9Eb0cE3606eB48, // Base Token Address - msg.sender, // AutoSwap Recipient + 100, 200, 50, // Fees: 1% buy 2% sell 0.5% P2P + msg.sender, // AutoSwap Receiver + 0x7a250d5630B4cF539739dF2C5dAcb4c659F2488D, // Router Address: Uniswap V2 + 0xA0b86991c6218b36c1d19D4a2e9Eb0cE3606eB48, // Base Token Address: USDC 100) // 1% in tokens before swap percent { } @@ -96,8 +96,8 @@ contract MyBalancerFeeToken is BalancerV2FeeToken constructor() BalancerV2FeeToken( "My Token", "MTKN", // Name and Symbol 1_000_000_000 ether, // 1 billion supply - address(this), // Vault Address - 100, 200, 0) // Fees: 2% buy 1% sell 0% P2P + 100, 200, 50, // Fees: 2% buy 1% sell 0.5% P2P + msg.sender) // Fee Receiver { } } @@ -118,10 +118,10 @@ contract MyUniswapV3FeeToken is UniswapV3FeeToken constructor() UniswapV3FeeToken( "My Token", "MTKN", // Name and Symbol 1_000_000_000 ether, // 1 billion supply - msg.sender, // Vault Address 100, 200, // Fees: 1% buy 2% P2P + msg.sender, // Vault Address 0xC02aaA39b223FE8D0A0e5C4F27eAD9083C756Cc2, // Base token: WETH - 1000) // Initial rate: 1 Base Tokens = 1000 tokens + 1000) // Initial rate: 1 WETH = 1000 tokens { } } diff --git a/contracts/ERC20/BalancerV2FeeToken.sol b/contracts/ERC20/BalancerV2FeeToken.sol index e9afdd5..c2daf90 100644 --- a/contracts/ERC20/BalancerV2FeeToken.sol +++ b/contracts/ERC20/BalancerV2FeeToken.sol @@ -4,12 +4,12 @@ pragma solidity ^0.8.0; import "./ERC20.sol"; -import "./BalancerInterfaces.sol"; +import "./interfaces/BalancerInterfaces.sol"; abstract contract BalancerV2FeeToken is ERC20 { mapping(address => bool) public isTaxless; - address public tokenVaultAddress; + address public feeReceiver; bool public isFeeActive; uint[] public fees; uint public feeDecimals = 2; @@ -17,20 +17,20 @@ abstract contract BalancerV2FeeToken is ERC20 constructor(string memory name, string memory symbol, uint totalSupply_, - address tokenVaultAddress_, - uint buyFee, uint sellFee, uint p2pFee) + uint buyFeePercentage, uint sellFeePercentage, uint p2pFeePercentage, + address feeReceiver_) ERC20(name, symbol, totalSupply_) { - tokenVaultAddress = tokenVaultAddress_; + feeReceiver = feeReceiver_; isTaxless[msg.sender] = true; isTaxless[address(this)] = true; - isTaxless[tokenVaultAddress] = true; + isTaxless[feeReceiver] = true; isTaxless[address(0)] = true; - fees.push(buyFee); - fees.push(sellFee); - fees.push(p2pFee); + fees.push(buyFeePercentage); + fees.push(sellFeePercentage); + fees.push(p2pFeePercentage); isFeeActive = true; } @@ -50,9 +50,9 @@ abstract contract BalancerV2FeeToken is ERC20 amount -= feesCollected; _balances[from] -= feesCollected; - _balances[tokenVaultAddress] += feesCollected; + _balances[feeReceiver] += feesCollected; - emit Transfer(from, tokenVaultAddress, amount); + emit Transfer(from, feeReceiver, amount); super._transfer(from, to, amount); } diff --git a/contracts/ERC20/UniswapV2AutoSwapToken.sol b/contracts/ERC20/UniswapV2AutoSwapToken.sol index b550feb..692f708 100644 --- a/contracts/ERC20/UniswapV2AutoSwapToken.sol +++ b/contracts/ERC20/UniswapV2AutoSwapToken.sol @@ -4,30 +4,30 @@ pragma solidity ^0.8.0; import "./UniswapV2FeeToken.sol"; -import "./UniswapV2Interfaces.sol"; +import "./interfaces/UniswapV2Interfaces.sol"; abstract contract UniswapV2AutoSwapToken is UniswapV2FeeToken { uint256 public minTokensBeforeSwap; - address public autoSwapRecipient; + address public autoSwapReciever; bool lastFeeActive; event Swap(uint amountSent); constructor(string memory name, string memory symbol, uint totalSupply_, - uint buyFee, uint sellFee, uint p2pFee, + uint buyFeePercentage, uint sellFeePercentage, uint p2pFeePercentage, + address autoSwapReciever_, address routerAddress, address baseTokenAddress, - address autoSwapRecipient_, uint minTokensBeforeSwapPercent) UniswapV2FeeToken(name, symbol, totalSupply_, + buyFeePercentage, sellFeePercentage, p2pFeePercentage, address(this), - buyFee, sellFee, p2pFee, routerAddress, baseTokenAddress ) { - autoSwapRecipient = autoSwapRecipient_; + autoSwapReciever = autoSwapReciever_; setMinTokensBeforeSwapPercent(minTokensBeforeSwapPercent); } @@ -52,7 +52,7 @@ abstract contract UniswapV2AutoSwapToken is UniswapV2FeeToken totalSwap, 0, sellPath, - autoSwapRecipient, + autoSwapReciever, block.timestamp ); diff --git a/contracts/ERC20/UniswapV2FeeToken.sol b/contracts/ERC20/UniswapV2FeeToken.sol index 18c74bf..9d6ba15 100644 --- a/contracts/ERC20/UniswapV2FeeToken.sol +++ b/contracts/ERC20/UniswapV2FeeToken.sol @@ -4,12 +4,12 @@ pragma solidity ^0.8.0; import "./ERC20.sol"; -import "./UniswapV2Interfaces.sol"; +import "./interfaces/UniswapV2Interfaces.sol"; abstract contract UniswapV2FeeToken is ERC20 { mapping(address => bool) public isTaxless; - address public feeReceiverAddress; + address public feeReceiver; bool public isFeeActive; uint[] public fees; uint public feeDecimals = 2; @@ -20,8 +20,8 @@ abstract contract UniswapV2FeeToken is ERC20 constructor(string memory name, string memory symbol, uint totalSupply_, - address feeReceiverAddress_, uint buyFeePercentage, uint sellFeePercentage, uint p2pFeePercentage, + address feeReceiver_, address routerAddress, address baseTokenAddress) ERC20(name, symbol, totalSupply_) { @@ -29,11 +29,11 @@ abstract contract UniswapV2FeeToken is ERC20 pair = ISwapFactory(router.factory()).createPair(address(this), baseTokenAddress); baseToken = IERC20(baseTokenAddress); - feeReceiverAddress = feeReceiverAddress_; + feeReceiver = feeReceiver_; isTaxless[msg.sender] = true; isTaxless[address(this)] = true; - isTaxless[feeReceiverAddress] = true; + isTaxless[feeReceiver] = true; isTaxless[address(0)] = true; fees.push(buyFeePercentage); @@ -59,9 +59,9 @@ abstract contract UniswapV2FeeToken is ERC20 amount -= feesCollected; _balances[from] -= feesCollected; - _balances[feeReceiverAddress] += feesCollected; + _balances[feeReceiver] += feesCollected; - emit Transfer(from, feeReceiverAddress, amount); + emit Transfer(from, feeReceiver, amount); super._transfer(from, to, amount); } @@ -71,9 +71,9 @@ abstract contract UniswapV2FeeToken is ERC20 isTaxless[account] = isTaxless_; } - function _setFeeReceiverAddress(address feeReceiverAddress_) internal + function _setFeeReceiver(address feeReceiver_) internal { - feeReceiverAddress = feeReceiverAddress_; + feeReceiver = feeReceiver_; } function _setFeeActive(bool isFeeActive_) internal diff --git a/contracts/ERC20/UniswapV3FeeToken.sol b/contracts/ERC20/UniswapV3FeeToken.sol index 9acf2cc..f1c38c5 100644 --- a/contracts/ERC20/UniswapV3FeeToken.sol +++ b/contracts/ERC20/UniswapV3FeeToken.sol @@ -4,15 +4,15 @@ pragma solidity ^0.8.0; import "./ERC20.sol"; -import "./UniswapV3Interfaces.sol"; +import "./interfaces/UniswapV3Interfaces.sol"; abstract contract UniswapV3FeeToken is ERC20 { mapping(address => bool) public isTaxless; - address public tokenVaultAddress; + address public feeReceiver; bool public isFeeActive; - uint buyFee; - uint p2pFee; + uint buyFeePercentage; + uint p2pFeePercentage; uint public feeDecimals = 2; IERC20 baseToken; address public pool1; @@ -25,26 +25,21 @@ abstract contract UniswapV3FeeToken is ERC20 constructor(string memory name, string memory symbol, uint totalSupply_, - address tokenVaultAddress_, - uint buyFee_, uint p2pFee_, + uint buyFeePercentage_, uint p2pFeePercentage_, + address feeReceiver_, address baseTokenAddress, uint160 rate) ERC20(name, symbol, totalSupply_) { - tokenVaultAddress = tokenVaultAddress_; + feeReceiver = feeReceiver_; baseToken = IERC20(baseTokenAddress); isTaxless[msg.sender] = true; isTaxless[address(this)] = true; - isTaxless[tokenVaultAddress] = true; + isTaxless[feeReceiver] = true; isTaxless[address(0)] = true; - p2pFee = p2pFee_; - buyFee = buyFee_; - - isTaxless[msg.sender] = true; - isTaxless[address(this)] = true; - isTaxless[tokenVaultAddress] = true; - isTaxless[address(0)] = true; + p2pFeePercentage = p2pFeePercentage_; + buyFeePercentage = buyFeePercentage_; address token0; address token1; @@ -106,18 +101,18 @@ abstract contract UniswapV3FeeToken is ERC20 if (!isTaxless[from] && !isTaxless[to]) { if(isPool(from)) { - feesCollected = (amount * buyFee) / (10**(feeDecimals + 2)); + feesCollected = (amount * buyFeePercentage) / (10**(feeDecimals + 2)); }else if(!isPool(to)) { - feesCollected = (amount * p2pFee) / (10**(feeDecimals + 2)); + feesCollected = (amount * p2pFeePercentage) / (10**(feeDecimals + 2)); } } amount -= feesCollected; _balances[from] -= feesCollected; - _balances[tokenVaultAddress] += feesCollected; + _balances[feeReceiver] += feesCollected; - emit Transfer(from, tokenVaultAddress, amount); + emit Transfer(from, feeReceiver, amount); super._transfer(from, to, amount); } diff --git a/contracts/ERC20/BalancerInterfaces.sol b/contracts/ERC20/interfaces/BalancerInterfaces.sol similarity index 98% rename from contracts/ERC20/BalancerInterfaces.sol rename to contracts/ERC20/interfaces/BalancerInterfaces.sol index 0427eb0..56659b0 100644 --- a/contracts/ERC20/BalancerInterfaces.sol +++ b/contracts/ERC20/interfaces/BalancerInterfaces.sol @@ -3,7 +3,7 @@ pragma solidity ^0.8.0; -import "./ERC20.sol"; +import "../ERC20.sol"; struct JoinPoolRequest { address[] assets; diff --git a/contracts/ERC20/BibliotecaInterfaces.sol b/contracts/ERC20/interfaces/IWETH.sol similarity index 91% rename from contracts/ERC20/BibliotecaInterfaces.sol rename to contracts/ERC20/interfaces/IWETH.sol index fbc172a..40fa02b 100644 --- a/contracts/ERC20/BibliotecaInterfaces.sol +++ b/contracts/ERC20/interfaces/IWETH.sol @@ -3,7 +3,7 @@ pragma solidity ^0.8.0; -import "./ERC20.sol"; +import "../ERC20.sol"; interface IWETH is IERC20 { function deposit() external payable; diff --git a/contracts/ERC20/UniswapV2Interfaces.sol b/contracts/ERC20/interfaces/UniswapV2Interfaces.sol similarity index 100% rename from contracts/ERC20/UniswapV2Interfaces.sol rename to contracts/ERC20/interfaces/UniswapV2Interfaces.sol diff --git a/contracts/ERC20/UniswapV3Interfaces.sol b/contracts/ERC20/interfaces/UniswapV3Interfaces.sol similarity index 100% rename from contracts/ERC20/UniswapV3Interfaces.sol rename to contracts/ERC20/interfaces/UniswapV3Interfaces.sol diff --git a/contracts/Examples/MyBalancerFeeToken.sol b/contracts/examples/ERC20/MyBalancerFeeToken.sol similarity index 62% rename from contracts/Examples/MyBalancerFeeToken.sol rename to contracts/examples/ERC20/MyBalancerFeeToken.sol index 198b3d6..2854967 100644 --- a/contracts/Examples/MyBalancerFeeToken.sol +++ b/contracts/examples/ERC20/MyBalancerFeeToken.sol @@ -1,15 +1,15 @@ // SPDX-License-Identifier: MIT pragma solidity 0.8.17; -import "../ERC20/BalancerV2FeeToken.sol"; +import "../../ERC20/BalancerV2FeeToken.sol"; contract MyBalancerFeeToken is BalancerV2FeeToken { constructor() BalancerV2FeeToken( "My Token", "MTKN", // Name and Symbol 1_000_000_000 ether, // 1 billion supply - address(this), // Vault Address - 100, 200, 50) // Fees: 2% buy 1% sell 0.5% P2P + 100, 200, 50, // Fees: 2% buy 1% sell 0.5% P2P + msg.sender) // Fee Receiver { } } \ No newline at end of file diff --git a/contracts/Examples/MyUniswapV2AutoSwapToken.sol b/contracts/examples/ERC20/MyUniswapV2AutoSwapToken.sol similarity index 90% rename from contracts/Examples/MyUniswapV2AutoSwapToken.sol rename to contracts/examples/ERC20/MyUniswapV2AutoSwapToken.sol index 617071e..4fbac6c 100644 --- a/contracts/Examples/MyUniswapV2AutoSwapToken.sol +++ b/contracts/examples/ERC20/MyUniswapV2AutoSwapToken.sol @@ -1,7 +1,7 @@ // SPDX-License-Identifier: MIT pragma solidity 0.8.17; -import "../ERC20/UniswapV2AutoSwapToken.sol"; +import "../../ERC20/UniswapV2AutoSwapToken.sol"; contract MyUniswapV2AutoSwapToken is UniswapV2AutoSwapToken { @@ -9,9 +9,9 @@ contract MyUniswapV2AutoSwapToken is UniswapV2AutoSwapToken "My Token", "MTKN", // Name and Symbol 1_000_000_000 ether, // 1 billion supply 100, 200, 50, // Fees: 1% buy 2% sell 0.5% P2P - 0x7a250d5630B4cF539739dF2C5dAcb4c659F2488D, // Router Address + msg.sender, // AutoSwap Receiver + 0x7a250d5630B4cF539739dF2C5dAcb4c659F2488D, // Router Address: Uniswap V2 0xA0b86991c6218b36c1d19D4a2e9Eb0cE3606eB48, // Base Token Address: USDC - msg.sender, // AutoSwap Recipient 100) // 1% in tokens before swap percent { } diff --git a/contracts/Examples/MyUniswapV2FeeToken.sol b/contracts/examples/ERC20/MyUniswapV2FeeToken.sol similarity index 80% rename from contracts/Examples/MyUniswapV2FeeToken.sol rename to contracts/examples/ERC20/MyUniswapV2FeeToken.sol index 59ffe87..d3b8b9a 100644 --- a/contracts/Examples/MyUniswapV2FeeToken.sol +++ b/contracts/examples/ERC20/MyUniswapV2FeeToken.sol @@ -1,16 +1,16 @@ // SPDX-License-Identifier: MIT pragma solidity 0.8.17; -import "../ERC20/UniswapV2FeeToken.sol"; +import "../../ERC20/UniswapV2FeeToken.sol"; contract MyUniswapV2FeeToken is UniswapV2FeeToken { constructor() UniswapV2FeeToken( "My Token", "MTKN", // Name and Symbol 1_000_000_000 ether, // 1 billion supply - msg.sender, // Vault Address 100, 200, 50, // Fees: 1% buy 2% sell 0.5% P2P - 0x7a250d5630B4cF539739dF2C5dAcb4c659F2488D, // Router Address + msg.sender, // Fee Receiver + 0x7a250d5630B4cF539739dF2C5dAcb4c659F2488D, // Router Address: Uniswap V2 0xA0b86991c6218b36c1d19D4a2e9Eb0cE3606eB48) // Base Token Address: USDC { } diff --git a/contracts/Examples/MyUniswapV3FeeToken.sol b/contracts/examples/ERC20/MyUniswapV3FeeToken.sol similarity index 88% rename from contracts/Examples/MyUniswapV3FeeToken.sol rename to contracts/examples/ERC20/MyUniswapV3FeeToken.sol index ce1fafa..edd7225 100644 --- a/contracts/Examples/MyUniswapV3FeeToken.sol +++ b/contracts/examples/ERC20/MyUniswapV3FeeToken.sol @@ -1,17 +1,17 @@ // SPDX-License-Identifier: MIT pragma solidity 0.8.17; -import "../ERC20/UniswapV3FeeToken.sol"; +import "../../ERC20/UniswapV3FeeToken.sol"; contract MyUniswapV3FeeToken is UniswapV3FeeToken { constructor() UniswapV3FeeToken( "My Token", "MTKN", // Name and Symbol 1_000_000_000 ether, // 1 billion supply - msg.sender, // Vault Address 100, 200, // Fees: 1% buy 2% P2P + msg.sender, // Vault Address 0xC02aaA39b223FE8D0A0e5C4F27eAD9083C756Cc2, // Base token: WETH - 1000) // Initial rate: 1 Base Tokens = 1000 tokens + 1000) // Initial rate: 1 WETH = 1000 tokens { } } \ No newline at end of file diff --git a/contracts/Examples/MyERC721aCollection.sol b/contracts/examples/ERC721/MyERC721aCollection.sol similarity index 90% rename from contracts/Examples/MyERC721aCollection.sol rename to contracts/examples/ERC721/MyERC721aCollection.sol index c1c35b8..e591971 100644 --- a/contracts/Examples/MyERC721aCollection.sol +++ b/contracts/examples/ERC721/MyERC721aCollection.sol @@ -1,7 +1,7 @@ // SPDX-License-Identifier: MIT pragma solidity 0.8.17; -import "../ERC721/ERC721aCollection.sol"; +import "../../ERC721/ERC721aCollection.sol"; contract MyERC721aCollection is ERC721aCollection { diff --git a/contracts/Examples/MyOpenZeppelinNFTCollection.sol b/contracts/examples/ERC721/MyOpenZeppelinNFTCollection.sol similarity index 89% rename from contracts/Examples/MyOpenZeppelinNFTCollection.sol rename to contracts/examples/ERC721/MyOpenZeppelinNFTCollection.sol index bbce938..752f929 100644 --- a/contracts/Examples/MyOpenZeppelinNFTCollection.sol +++ b/contracts/examples/ERC721/MyOpenZeppelinNFTCollection.sol @@ -1,7 +1,7 @@ // SPDX-License-Identifier: MIT pragma solidity 0.8.17; -import "../ERC721/OpenZeppelinNFTCollection.sol"; +import "../../ERC721/OpenZeppelinNFTCollection.sol"; contract MyOpenZeppelinNFTCollection is OpenZeppelinNFTCollection { diff --git a/docs/UniswapV2FeeToken.md b/docs/UniswapV2FeeToken.md index 46eebb5..c69e062 100644 --- a/docs/UniswapV2FeeToken.md +++ b/docs/UniswapV2FeeToken.md @@ -4,7 +4,7 @@ Token that main liquidity will be added to a Uniswap V2 or to an equivalent fork ## Technical contract overview -The UniswapV2FeeToken is a type of token very common in DeFi. It collects fees depending on the transaction type (Sell, Buy or P2P peer to peer). Fees are sent to a `feeReceiverAddress`. In the constructor a `router` and `baseToken` is set in order to create a uniswap `pair`. The `pair` helps us detecting wheter a transaction is Sell, Buy or P2P. +The UniswapV2FeeToken is a type of token very common in DeFi. It collects fees depending on the transaction type (Sell, Buy or P2P peer to peer). Fees are sent to a `feeReceiver`. In the constructor a `router` and `baseToken` is set in order to create a uniswap `pair`. The `pair` helps us detecting wheter a transaction is Sell, Buy or P2P. ## Constructing a UniswapV2FeeToken contract @@ -30,13 +30,13 @@ contract MyUniswapV2FeeToken is UniswapV2FeeToken ## API -### **constructor**(string memory name, string memory symbol, uint totalSupply\_, address feeReceiverAddress\_, uint buyFeePercentage, uint sellFeePercentage, uint p2pFeePercentage, address routerAddress, address baseTokenAddress) +### **constructor**(string memory name, string memory symbol, uint totalSupply\_, address feeReceiver\_, uint buyFeePercentage, uint sellFeePercentage, uint p2pFeePercentage, address routerAddress, address baseTokenAddress) Constructor parameters: * **name**: Token name * **symbol**: Token symbol * **totalSupply**: Initial supply in wei -* **feeReceiverAddress**: Address that will receive fees collected +* **feeReceiver**: Address that will receive fees collected * **buyFeePercentage**: Fee percentange collected when tokens are sent from the pair * **sellFeePercentage**: Fee percentange collected when the tokens are sent to the pair * **p2pFeePercentage**: Fee percentange collected when tokens are not sent from nor to the pair @@ -66,14 +66,14 @@ function setTaxless(address account, bool isTaxless_) internal onlyOwner } ``` -### **\_setFeeReceiverAddress**(address feeReceiverAddress\_) internal +### **\_setFeeReceiver**(address feeReceiver\_) internal Address that will receive the token Fees collected. ```solidity -function setFeeReceiverAddress(address feeReceiverAddress_) internal onlyOwner +function setFeeReceiver(address feeReceiver_) internal onlyOwner { - _setFeeReceiverAddress(feeReceiverAddress_); + _setFeeReceiver(feeReceiver_); } ``` diff --git a/docs/UniswapV3FeeToken.md b/docs/UniswapV3FeeToken.md index 91cbc77..1ab6710 100644 --- a/docs/UniswapV3FeeToken.md +++ b/docs/UniswapV3FeeToken.md @@ -4,7 +4,7 @@ Token that main liquidity will be added to a Uniswap V3. Takes fees on transfer ## Technical contract overview -The UniswapV3FeeToken collects fees depending on the transaction type: buy or P2P (peer to peer). Fees are sent to a `feeReceiverAddress`. In the constructor a `baseToken` is set in order to create a uniswap `pair`. The `pair` helps us detecting wheter a transaction is Sell, Buy or P2P. Keep in mind that fees on sell can't be added due to Uniswap V3 technical limitation. +The UniswapV3FeeToken collects fees depending on the transaction type: buy or P2P (peer to peer). Fees are sent to a `feeReceiver`. In the constructor a `baseToken` is set in order to create a uniswap `pair`. The `pair` helps us detecting wheter a transaction is Sell, Buy or P2P. Keep in mind that fees on sell can't be added due to Uniswap V3 technical limitation. ## Constructing a UniswapV2FeeToken contract @@ -30,13 +30,13 @@ contract MyUniswapV3FeeToken is UniswapV3FeeToken ## API -### **constructor**(string memory name, string memory symbol, uint totalSupply\_, address feeReceiverAddress\_, uint buyFeePercentage, uint sellFeePercentage, uint p2pFeePercentage, address routerAddress, address baseTokenAddress) +### **constructor**(string memory name, string memory symbol, uint totalSupply\_, address feeReceiver\_, uint buyFeePercentage, uint sellFeePercentage, uint p2pFeePercentage, address routerAddress, address baseTokenAddress) Constructor parameters: * **name**: Token name * **symbol**: Token symbol * **totalSupply**: Initial supply in wei -* **feeReceiverAddress**: Address that will receive fees collected +* **feeReceiver**: Address that will receive fees collected * **buyFeePercentage**: Fee percentange collected when tokens are sent from the pair * **sellFeePercentage**: Fee percentange collected when the tokens are sent to the pair * **p2pFeePercentage**: Fee percentange collected when tokens are not sent from nor to the pair @@ -66,14 +66,14 @@ function setTaxless(address account, bool isTaxless_) internal onlyOwner } ``` -### **\_setFeeReceiverAddress**(address feeReceiverAddress\_) internal +### **\_setFeeReceiver**(address feeReceiver\_) internal Address that will receive the token Fees collected. ```solidity -function setFeeReceiverAddress(address feeReceiverAddress_) internal onlyOwner +function setFeeReceiver(address feeReceiver_) internal onlyOwner { - _setFeeReceiverAddress(feeReceiverAddress_); + _setFeeReceiver(feeReceiver_); } ``` diff --git a/test/BalancerFeeToken.js b/test/BalancerFeeToken.js index 828d8c8..11db1a4 100644 --- a/test/BalancerFeeToken.js +++ b/test/BalancerFeeToken.js @@ -108,7 +108,7 @@ const { await myBalancerFeeToken.connect(walletA).transfer(walletB.address, ethers.utils.parseEther("100.0")) expect( - await myBalancerFeeToken.balanceOf(await myBalancerFeeToken.tokenVaultAddress()) + await myBalancerFeeToken.balanceOf(await myBalancerFeeToken.feeReceiver()) ).to.greaterThan( 0 ); @@ -141,7 +141,7 @@ const { timestamp + 100); // Deadline expect( - await myBalancerFeeToken.balanceOf(await myBalancerFeeToken.tokenVaultAddress()) + await myBalancerFeeToken.balanceOf(await myBalancerFeeToken.feeReceiver()) ).to.greaterThan( 0 ); @@ -176,7 +176,7 @@ const { timestamp + 100); // Deadline expect( - await myBalancerFeeToken.balanceOf(await myBalancerFeeToken.tokenVaultAddress()) + await myBalancerFeeToken.balanceOf(await myBalancerFeeToken.feeReceiver()) ).to.greaterThan( 0 ); diff --git a/test/UniswapV2AutoSwapToken.js b/test/UniswapV2AutoSwapToken.js index 3837bcb..2efb65e 100644 --- a/test/UniswapV2AutoSwapToken.js +++ b/test/UniswapV2AutoSwapToken.js @@ -60,7 +60,7 @@ describe("Uniswap V2 AutoSwap Token", function () { expect( ethers.utils.parseUnits("1000.0",6) ).to.lessThan( - await usdc.balanceOf(await myUniswapV2AutoSwapToken.autoSwapRecipient()) + await usdc.balanceOf(await myUniswapV2AutoSwapToken.autoSwapReciever()) ); }); @@ -87,7 +87,7 @@ describe("Uniswap V2 AutoSwap Token", function () { expect( ethers.utils.parseUnits("990.0",6) ).to.lessThan( - await usdc.balanceOf(await myUniswapV2AutoSwapToken.autoSwapRecipient()) + await usdc.balanceOf(await myUniswapV2AutoSwapToken.autoSwapReciever()) ); }); it("Should collect fees on Sell", async function () { @@ -109,12 +109,12 @@ describe("Uniswap V2 AutoSwap Token", function () { expect( ethers.utils.parseEther("0.0") ).to.lessThan( - await usdc.balanceOf(await myUniswapV2AutoSwapToken.autoSwapRecipient()) + await usdc.balanceOf(await myUniswapV2AutoSwapToken.autoSwapReciever()) ); expect( ethers.utils.parseUnits("1000.0",6) ).to.lessThan( - await usdc.balanceOf(await myUniswapV2AutoSwapToken.autoSwapRecipient()) + await usdc.balanceOf(await myUniswapV2AutoSwapToken.autoSwapReciever()) ); }); }); diff --git a/test/UniswapV2FeeToken.js b/test/UniswapV2FeeToken.js index bd6c84e..1fc1ec5 100644 --- a/test/UniswapV2FeeToken.js +++ b/test/UniswapV2FeeToken.js @@ -57,7 +57,7 @@ const { expect( ethers.utils.parseUnits("1000.0",6) ).to.lessThan( - await usdc.balanceOf(await myUniswapV2FeeToken.feeReceiverAddress()) + await usdc.balanceOf(await myUniswapV2FeeToken.feeReceiver()) ); }); @@ -81,7 +81,7 @@ const { expect( ethers.utils.parseUnits("990.0",6) ).to.lessThan( - await usdc.balanceOf(await myUniswapV2FeeToken.feeReceiverAddress()) + await usdc.balanceOf(await myUniswapV2FeeToken.feeReceiver()) ); }); it("Should collect fees on Sell", async function () { @@ -99,12 +99,12 @@ const { expect( ethers.utils.parseEther("0.0") ).to.lessThan( - await usdc.balanceOf(await myUniswapV2FeeToken.feeReceiverAddress()) + await usdc.balanceOf(await myUniswapV2FeeToken.feeReceiver()) ); expect( ethers.utils.parseUnits("1000.0",6) ).to.lessThan( - await usdc.balanceOf(await myUniswapV2FeeToken.feeReceiverAddress()) + await usdc.balanceOf(await myUniswapV2FeeToken.feeReceiver()) ); }); }); diff --git a/test/UniswapV3FeeToken.js b/test/UniswapV3FeeToken.js index e3ff80b..5234a6c 100644 --- a/test/UniswapV3FeeToken.js +++ b/test/UniswapV3FeeToken.js @@ -124,7 +124,7 @@ describe("Uniswap V3 Fee Token", function () { it("Vault should collect about 10 tokens in fees", async function () { const { myUniswapV3FeeToken, nonfungiblePositionManager, router, pool, weth, deployer, user1, user2, user3 } = await loadFixture(addLiquidityFixiture); - var vaultTokenBeforeBuy = ethers.utils.formatEther(await myUniswapV3FeeToken.balanceOf(await myUniswapV3FeeToken.tokenVaultAddress())) + var vaultTokenBeforeBuy = ethers.utils.formatEther(await myUniswapV3FeeToken.balanceOf(await myUniswapV3FeeToken.feeReceiver())) buyParams = { tokenIn: weth.address, tokenOut: myUniswapV3FeeToken.address, @@ -137,7 +137,7 @@ describe("Uniswap V3 Fee Token", function () { } await weth.connect(user1).approve(router.address, ethers.utils.parseEther("1")) await router.connect(user1).exactInputSingle(buyParams) - var vaultTokenAfterBuy = ethers.utils.formatEther(await myUniswapV3FeeToken.balanceOf(await myUniswapV3FeeToken.tokenVaultAddress())) + var vaultTokenAfterBuy = ethers.utils.formatEther(await myUniswapV3FeeToken.balanceOf(await myUniswapV3FeeToken.feeReceiver())) expect(vaultTokenAfterBuy - vaultTokenBeforeBuy).to.above(9); }); }); @@ -172,7 +172,7 @@ describe("Uniswap V3 Fee Token", function () { await myUniswapV3FeeToken.transfer(user1.address, ethers.utils.parseEther("900")) - var vaultTokenBeforeSell = ethers.utils.formatEther(await myUniswapV3FeeToken.balanceOf(await myUniswapV3FeeToken.tokenVaultAddress())) + var vaultTokenBeforeSell = ethers.utils.formatEther(await myUniswapV3FeeToken.balanceOf(await myUniswapV3FeeToken.feeReceiver())) sellParams = { tokenIn: myUniswapV3FeeToken.address, @@ -188,7 +188,7 @@ describe("Uniswap V3 Fee Token", function () { await myUniswapV3FeeToken.connect(user1).approve(router.address, ethers.utils.parseEther("1000")) await router.connect(user1).exactInputSingle(sellParams) - var vaultTokenAfterSell = ethers.utils.formatEther(await myUniswapV3FeeToken.balanceOf(await myUniswapV3FeeToken.tokenVaultAddress())) + var vaultTokenAfterSell = ethers.utils.formatEther(await myUniswapV3FeeToken.balanceOf(await myUniswapV3FeeToken.feeReceiver())) expect(vaultTokenAfterSell - vaultTokenBeforeSell).to.equal(0); }); }); @@ -211,9 +211,9 @@ describe("Uniswap V3 Fee Token", function () { await myUniswapV3FeeToken.transfer(user1.address, ethers.utils.parseEther("1000")) - var vaultTokenBeforeSell = ethers.utils.formatEther(await myUniswapV3FeeToken.balanceOf(await myUniswapV3FeeToken.tokenVaultAddress())) + var vaultTokenBeforeSell = ethers.utils.formatEther(await myUniswapV3FeeToken.balanceOf(await myUniswapV3FeeToken.feeReceiver())) await myUniswapV3FeeToken.connect(user1).transfer(user2.address, ethers.utils.parseEther("1000")) - var vaultTokenAfterSell = ethers.utils.formatEther(await myUniswapV3FeeToken.balanceOf(await myUniswapV3FeeToken.tokenVaultAddress())) + var vaultTokenAfterSell = ethers.utils.formatEther(await myUniswapV3FeeToken.balanceOf(await myUniswapV3FeeToken.feeReceiver())) expect(vaultTokenAfterSell - vaultTokenBeforeSell).to.equal(20); });