Contract requirements
Bot interacting with these functions:
onlyOwner()
openTrading()
decimals()
approve()
getBalances()
totalSupply()
symbol()
checkIsAddressWhitelistedGroup()
addToWhitelistGroup()
balanceOf()
As you can see most of them are basic but its important to check if naming of those functions is correct in your contract and if there is no different logic of solidity SC. However, we have few functions that are unique and made by us:
checkIsAddressWhitelistedGroup()
If your contract has whitelisting functionality, replace this _isExcludedFromFee
variable with one that contains the list of whitelisted addresses in your contract:
function checkIsAddressWhitelistedGroup(address[] memory checkAddresses) public view returns (bool[] memory) {
bool[] memory result = new bool[](checkAddresses.length);
for (uint index = 0; index < checkAddresses.length; index++) {
result[index] = _isExcludedFromFee[checkAddresses[index]];
}
return result;
}
Otherwise, create this variable:
mapping (address => bool) private _isExcludedFromFee;
addToWhitelistGroup()
Similar to the example above:
function addToWhitelistGroup(address[] calldata newAddresses) public onlyOwner {
for (uint256 i = 0; i < newAddresses.length; i++) {
_isExcludedFromFee[newAddresses[i]] = true;
}
}
openTrading()
Calling this function is for convenience and is not required for the application to function.
If your contract does not provide for opening trades through a function, simply create an empty function with the specified name like this:
function openTrading() external onlyOwner() {
// pass
}
If your contract has a trading opening function:
if you want to call it yourself, just add an empty
openTrading
function as in the example above (if your original function is also calledopenTrading
, you should rename it);if you want the application to call this function automatically right before creating a liquidity pool and sending bundle transactions, make sure that it has the specified name
openTrading
:
function openTrading() external onlyOwner() {
uniswapV2Router = IUniswapV2Router02(0x7a250d5630B4cF539739dF2C5dAcb4c659F2488D);
_approve(address(this), address(uniswapV2Router), _totalSupply);
uniswapV2Pair = IUniswapV2Factory(uniswapV2Router.factory()).createPair(address(this), uniswapV2Router.WETH());
IERC20(uniswapV2Pair).approve(address(uniswapV2Router), type(uint).max);
swapEnabled = true;
}
getBalances()
if in your contract the variable containing the balance of tokens on wallets is called differently, replace this _balances
with the correct name:
function getBalances(address[] memory wallets) public view returns (uint256[] memory) {
uint256[] memory balancesLocal = new uint256[](wallets.length);
for (uint index = 0; index < wallets.length; index++) {
balancesLocal[index] = _balances[wallets[index]];
}
return balancesLocal;
}
Those functions must be in your contract, you can take a look at our contract (Pinned to top of page) with function's logic and modify your contract.
If you have special need for contract and want to make sure it wont have any problems - DM developers or mods of Primum. (all contacts in link section)
Last updated