-
Notifications
You must be signed in to change notification settings - Fork 585
Expand file tree
/
Copy pathPool.js
More file actions
48 lines (41 loc) · 1.7 KB
/
Copy pathPool.js
File metadata and controls
48 lines (41 loc) · 1.7 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
const { expect, use } = require("chai")
const { solidity } = require("ethereum-waffle")
const { deployContract } = require("../shared/fixtures")
const { expandDecimals, getBlockTime, increaseTime, mineBlock, reportGasUsed } = require("../shared/utilities")
const { toChainlinkPrice } = require("../shared/chainlink")
const { toUsd, toNormalizedPrice } = require("../shared/units")
const { initVault, getBnbConfig, getBtcConfig, getDaiConfig, validateVaultBalance } = require("./Vault/helpers")
use(solidity)
const USD_PRECISION = expandDecimals(1, 30)
describe("Pool", function () {
const provider = waffle.provider
const [wallet, user0, user1, user2, user3] = provider.getWallets()
let eth
let pool
beforeEach(async () => {
eth = await deployContract("Token", [])
pool = await deployContract("Pool", [])
})
it("increasePosition", async () => {
await pool.increasePosition(user0.address, eth.address, 17, true, 1000, 200)
let position = await pool.getPosition(user0.address, eth.address, 17, true)
console.log("position",
position.size.toString(),
position.collateralAmount.toString(),
position.averagePrice.toString(),
position.entryFundingRate.toString(),
position.reserveAmount.toString(),
position.updatedAt.toString()
)
await pool.increasePosition(user0.address, eth.address, 17, true, 500, 100)
position = await pool.getPosition(user0.address, eth.address, 17, true)
console.log("position",
position.size.toString(),
position.collateralAmount.toString(),
position.averagePrice.toString(),
position.entryFundingRate.toString(),
position.reserveAmount.toString(),
position.updatedAt.toString()
)
})
})