So i'm trying to build most of the stuff from scratch to get a understanding of the inner workings of farms.
I am testing out the calculations by using a existing farm. SaltSwap
window.chef is = to web3.eth.Contract(MasterChef, "0xB4405445fFAcF2B86BC2bD7D1C874AC739265658");
var totalAllocPoints = await window.chef.methods.totalAllocPoint().call(); // Get totalAlloc from Contract
var tokensPerBlock = await window.chef.methods.saltPerBlock().call(); // Get TokensPerBlock from Contract
var poolInfo = await window.chef.methods.poolInfo(pool).call();
var poolAlloc = ((tokensPerBlock * poolInfo['allocPoint']) / totalAllocPoints);
var lpTokenContract = new window.w3.eth.Contract(IERC20.abi, poolInfo["lpToken"]);
var chefLPBalance = await lpTokenContract.methods.balanceOf("0xB4405445fFAcF2B86BC2bD7D1C874AC739265658").call();
console.log("PoolID: " + pool);
console.log("LP Address: " + poolInfo["lpToken"]);
console.log("Total Allocation Points: " + totalAllocPoints);
console.log("Total Tokens Per Block: " + window.w3.utils.fromWei(tokensPerBlock.toString(), 'ether'));
console.log("Pool Allocation Points: " + poolInfo['allocPoint']);
console.log("Pool Allocation Tokens Per Block: " + window.w3.utils.fromWei(poolAlloc.toString(), 'ether'));
console.log("Pool Allocation Tokens Per Year: " + (window.w3.utils.fromWei(poolAlloc.toString(), 'ether') * 28800 * 365));
console.log("Master Chef LP Balance: " + window.w3.utils.fromWei(chefLPBalance.toString(), 'ether'));
How would i calculate the APR for the pools?