Skip to content
This repository has been archived by the owner on Jan 16, 2022. It is now read-only.

Commit

Permalink
transfer mint test
Browse files Browse the repository at this point in the history
  • Loading branch information
realisation committed Nov 25, 2021
1 parent a1a71d0 commit b82bbb5
Showing 1 changed file with 35 additions and 0 deletions.
35 changes: 35 additions & 0 deletions tests/token/test_mint_burn.py
Original file line number Diff line number Diff line change
Expand Up @@ -96,5 +96,40 @@ def test_transfer_mint(token, market, gov, alice, bob):

assert total_supply_after_transfer_mint == total_supply_before_transfer_mint + 1e18, 'total supply after != +1'

def test_transfer_from_mint(token, market, gov, alice, bob):

mint_amount = 2e18

token.mint(alice, mint_amount, { 'from': market })

token.approve(bob, 2e18, { 'from': alice })

bob_before = token.balanceOf(bob)

alice_before = token.balanceOf(alice)

alice_approve_bob_before = token.allowance(alice, bob)

total_supply_before = token.totalSupply()

token.grantRole(token.MINTER_ROLE(), bob, { 'from': gov })

token.transferFromMint(alice, bob, 2e18, 2e18, { 'from': bob })

alice_after = token.balanceOf(alice)

bob_after = token.balanceOf(bob)

alice_approve_bob_after = token.allowance(alice, bob)

total_supply_after = token.totalSupply()

assert alice_after == alice_before - 2e18

assert bob_after == bob_before + 4e18

assert alice_approve_bob_after == alice_approve_bob_before - 2e18

assert total_supply_after == total_supply_before + 2e18


0 comments on commit b82bbb5

Please sign in to comment.