Skip to content
This repository was archived by the owner on Dec 8, 2022. It is now read-only.

Commit

Permalink
Better output
Browse files Browse the repository at this point in the history
  • Loading branch information
PatrickMogul committed Sep 26, 2021
1 parent d4095cb commit e886d72
Show file tree
Hide file tree
Showing 4 changed files with 394 additions and 59 deletions.
1 change: 1 addition & 0 deletions env_sample
Original file line number Diff line number Diff line change
Expand Up @@ -3,4 +3,5 @@ PRIVATE_KEY=84985998afe8f98EXAMPLE9999999
TOKEN_ADDRESS="0xc0431Ddcc0D213Bf27EcEcA8C2362c0d0208c6DC"
WALLET_ADDRESS="0xXXXXX"
FARM_PID=11
CYCLE_TIME=600000
OSWAP_MASTERCHEF_CONTRACT="0xaC71B617a58B3CC136D1f6A118252f331faB44fC"
16 changes: 13 additions & 3 deletions index.js
Original file line number Diff line number Diff line change
Expand Up @@ -45,9 +45,16 @@ return balanceBN

let currently_compounding = false

let ts = Date.now();

let date_ob = new Date(ts);
let seconds = date_ob.getSeconds();
let minutes = date_ob.getMinutes();
let hours = date_ob.getHours();

async function compound(amountOswap){
if(currently_compounding) return
console.log('\nRun Compounding')
console.log(`\nRun Compounding Cycle\nCurrent Time: ` + hours + ":" + minutes + ":" + seconds)
try{

const gasLimit = 200000 //(await web3.eth.getBlock('latest')).gasLimit
Expand All @@ -61,6 +68,7 @@ async function compound(amountOswap){
}
)
console.log(`Deposit Completed: ${depositTx.status}\n`)
console.log(`Next run in ${process.env.CYCLE_TIME/60000} Minutes.\n`)
} catch (err){
currently_compounding = false
console.log(`Deposit OSWAP Error: ${err.message}\n`)
Expand Down Expand Up @@ -88,7 +96,7 @@ compound(result)
console.log(`Pending oSwap to deposit ${resultRound.toFixed(8)}`)
});

const POLLING_INTERVAL = 600000 // 10 minutes
const POLLING_INTERVAL = process.env.CYCLE_TIME // 10 minutes
setInterval(async () => { await getBalance().then(function (result) {

compound(result)
Expand All @@ -107,4 +115,6 @@ compound(result)
*/
resultRound = result * 0.000000000000000001
console.log(`Pending oSwap to deposit ${resultRound.toFixed(8)}`)
});}, POLLING_INTERVAL)
});}, POLLING_INTERVAL)


Loading

0 comments on commit e886d72

Please sign in to comment.