Skip to content

Commit a9b5cc6

Browse files
committed
Test that BalV2 factory deploys feed successfully
1 parent d509204 commit a9b5cc6

File tree

1 file changed

+57
-0
lines changed

1 file changed

+57
-0
lines changed
Lines changed: 57 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,57 @@
1+
from brownie import interface
2+
from collections import OrderedDict
3+
4+
5+
def test_deploy_feed_creates_quanto_feed(factory, weth, bal, dai, alice,
6+
pool_balweth, pool_daiweth,
7+
balv2_tokens):
8+
'''
9+
Tests that the deployFeed function in the OverlayV1BalancerV2Factory
10+
contract deploys a new feed successfully.
11+
Inputs:
12+
factory [Contract]: OverlayV1BalancerV2Factory contract instance
13+
weth [Contract]: WETH token contract instance
14+
bal [Contract]: BAL token contract instance representing the OVL
15+
token
16+
dai [Contract]: DAI token contract instance
17+
alice [Account]: Brownie provided eth account address for Alice
18+
the trader
19+
pool_balweth [Contract]: Balancer V2 WeightedPool2Tokens contract
20+
instance for the BAL/WETH pool, representing the
21+
OVL/WETH token pair
22+
pool_daiweth [Contract]: Balancer V2 WeightedPool2Tokens contract
23+
instance for the DAI/WETH pool
24+
balv2_tokens [tuple]: BalancerV2Tokens struct field variables
25+
'''
26+
market_pool = pool_daiweth
27+
ovlweth_pool = pool_balweth
28+
ovl = bal
29+
market_base_token = weth
30+
market_quote_token = dai
31+
market_base_amount = 1000000000000000000 # 1e18
32+
33+
# TODO: check is not feed prior to deploy
34+
35+
tx = factory.deployFeed(market_pool, market_base_token, market_quote_token,
36+
market_base_amount, balv2_tokens, {"from": alice})
37+
actual_feed = tx.return_value
38+
39+
# check feed is added to registry
40+
assert factory.getFeed(market_pool, market_base_token, market_quote_token,
41+
market_base_amount) == actual_feed
42+
assert factory.isFeed(actual_feed) is True
43+
44+
# check event emitted
45+
assert 'FeedDeployed' in tx.events
46+
expect_event = OrderedDict({"user": alice.address, "feed": actual_feed})
47+
actual_event = tx.events['FeedDeployed']
48+
assert actual_event == expect_event
49+
50+
# check contract deployed with correct constructor params
51+
feed_contract = interface.IOverlayV1BalancerV2Feed(actual_feed)
52+
assert feed_contract.marketPool() == market_pool
53+
assert feed_contract.ovlWethPool() == ovlweth_pool
54+
assert feed_contract.ovl() == ovl
55+
assert feed_contract.marketBaseToken() == market_base_token
56+
assert feed_contract.marketQuoteToken() == market_quote_token
57+
assert feed_contract.marketBaseAmount() == market_base_amount

0 commit comments

Comments
 (0)