Skip to content

Commit

Permalink
add post-condition for vault type
Browse files Browse the repository at this point in the history
  • Loading branch information
joshuahannan committed Feb 1, 2024
1 parent 58ef81b commit 9141cd6
Show file tree
Hide file tree
Showing 5 changed files with 19 additions and 18 deletions.
1 change: 1 addition & 0 deletions contracts/FungibleToken.cdc
Original file line number Diff line number Diff line change
Expand Up @@ -182,6 +182,7 @@ access(all) contract interface FungibleToken: ViewResolver {
"Amount withdrawn must be less than or equal than the balance of the Vault"
}
post {
result.getType() == self.getType(): "Must return the same vault type as self"
// use the special function `before` to get the value of the `balance` field
// at the beginning of the function execution
//
Expand Down
4 changes: 2 additions & 2 deletions lib/go/contracts/contracts_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -11,12 +11,12 @@ import (
const addrA = "0A"

func TestFungibleTokenContract(t *testing.T) {
contract := contracts.FungibleToken()
contract := contracts.FungibleToken(addrA, addrA)
assert.NotNil(t, contract)
}

func TestExampleTokenContract(t *testing.T) {
contract := contracts.ExampleToken(addrA, addrA, addrA)
contract := contracts.ExampleToken(addrA, addrA, addrA, addrA)
assert.NotNil(t, contract)
assert.Contains(t, string(contract), addrA)
}
Expand Down
Loading

0 comments on commit 9141cd6

Please sign in to comment.