-
-
Save hensha256/e0799ae33fcab8270714a23f1b0b5a4f to your computer and use it in GitHub Desktop.
BarnBridge C01 Example Test
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
it('barnbridge c01 example test', async function () { | |
const { pool, smartYield, oracle, bondModel, cToken, underlying, controller, seniorBond, juniorBond, moveTime, buyTokens, buyBond, buyJuniorBond, redeemJuniorBond, junior1, junior2, junior3, senior1, senior2 } = await bbFixtures(fixture(decimals)); | |
await buyTokens(junior1, e18(1000)); | |
await buyTokens(junior2, e18(1500)); | |
await buyTokens(junior3, e18(2500)); | |
for (let i = 0; i < 3; i++) { | |
await moveTime(A_DAY); | |
await oracle.update(); | |
console.log(i, 'oracle (vs realish)', (await oracle.consult(A_DAY)).toString(), '(', supplyRatePerBlock.mul(BLOCKS_PER_DAY).toString(), ')'); | |
} | |
await buyBond(senior1, e18(2000), 0, 30); | |
await moveTime(A_DAY * 1); | |
await buyBond(senior2, e18(2500), 0, 30); | |
await buyJuniorBond(junior1, e18(1000), currentTime().add(2000 * A_DAY).add(1)); | |
await buyJuniorBond(junior2, e18(1500), currentTime().add(2000 * A_DAY).add(1)); | |
await buyJuniorBond(junior3, e18(2500), currentTime().add(2000 * A_DAY).add(1)); | |
const underlyingtotal = await smartYield.underlyingTotal(); | |
const loanable = await smartYield.underlyingLoanable(); | |
const abond = await smartYield.abond(); | |
const tokensinjuniorbonds = await smartYield.tokensInJuniorBonds(); | |
const pricetest = await smartYield.price(); | |
console.log('--------------------------------------') | |
console.log('underlyingtotal: ' + underlyingtotal) | |
console.log('loanable: ' + loanable) | |
console.log('abond: ' + abond) | |
console.log('tokensInJuniorBonds: ' + tokensinjuniorbonds) | |
console.log('price: ' + pricetest) | |
console.log('--------------------------------------') | |
}); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment