Skip to content

Commit

Permalink
Add inclusion vote test
Browse files Browse the repository at this point in the history
  • Loading branch information
0xkorin committed Feb 14, 2024
1 parent b129cb1 commit f9d3dcc
Showing 1 changed file with 28 additions and 0 deletions.
28 changes: 28 additions & 0 deletions tests/governance/test_inclusion_vote.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
VOTE_START = 3 * WEEK
EPOCH_LENGTH = 4 * WEEK
UNIT = 1_000_000_000_000_000_000
MAX = 2**256 - 1
ZERO_ADDRESS = '0x0000000000000000000000000000000000000000'
RATE_PROVIDER = '0x1234123412341234123412341234123412341234'
RATE_PROVIDER2 = '0x5678567856785678567856785678567856785678'
Expand Down Expand Up @@ -66,6 +67,33 @@ def test_apply_subsequent_fee(chain, deployer, alice, bob, fee_token, token, vot
voting.apply(token, sender=bob)
assert fee_token.balanceOf(voting) == 3 * UNIT

def test_apply_disabled(deployer, alice, token, voting):
voting.disable(sender=deployer)
assert voting.applications(token) == 0
voting.apply(token, sender=alice)
assert voting.applications(token) == MAX
assert voting.has_applied(token)

# cant apply more than once
with ape.reverts():
voting.apply(token, sender=alice)

# setting rate provider doesnt whitelist the token
voting.set_rate_provider(token, RATE_PROVIDER, sender=deployer)
assert voting.candidates_map(1, token) == 0

# cant whitelist token when contract is not enabled
with ape.reverts():
voting.whitelist([token], sender=deployer)

voting.enable(sender=deployer)
voting.whitelist([token], sender=deployer)
assert voting.candidates_map(1, token) == 1

# cant whitelist more than once
with ape.reverts():
voting.whitelist([token], sender=deployer)

def test_sweep_fee(deployer, alice, bob, fee_token, token, voting):
voting.set_application_fees(2 * UNIT, UNIT, sender=deployer)
fee_token.mint(alice, 2 * UNIT, sender=deployer)
Expand Down

0 comments on commit f9d3dcc

Please sign in to comment.