Skip to content

Commit

Permalink
Merge branch 'main' into update-imports-preview-34
Browse files Browse the repository at this point in the history
  • Loading branch information
bjartek authored Jun 18, 2024
2 parents 5d85638 + c54f5f1 commit 7f65a99
Show file tree
Hide file tree
Showing 12 changed files with 103 additions and 130 deletions.
28 changes: 14 additions & 14 deletions .github/workflows/ci.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -12,35 +12,35 @@ jobs:
runs-on: ubuntu-latest
steps:
- name: Checkout code
uses: actions/checkout@v3
- uses: actions/setup-go@v4
uses: actions/checkout@v4
- uses: actions/setup-go@v5
with:
go-version: "1.21.*"
go-version: "1.22.*"
- name: golangci-lint
uses: golangci/golangci-lint-action@v2
uses: golangci/golangci-lint-action@v6
with:
args: --timeout=3m

tidy:
runs-on: ubuntu-latest
steps:
- name: Checkout code
uses: actions/checkout@v3
- uses: actions/setup-go@v4
uses: actions/checkout@v4
- uses: actions/setup-go@v5
with:
go-version: "1.21.*"
go-version: "1.22.*"
- uses: zencargo/github-action-go-mod-tidy@v1
with:
go-version: "1.21"
go-version: "1.22"

test:
runs-on: ubuntu-latest
steps:
- name: Checkout code
uses: actions/checkout@v3
- uses: actions/setup-go@v4
uses: actions/checkout@v4
- uses: actions/setup-go@v5
with:
go-version: "1.21"
go-version: "1.22"
- run: make test-report
- name: Publish Unit Test Results
uses: EnricoMi/publish-unit-test-result-action@v1
Expand All @@ -52,10 +52,10 @@ jobs:
runs-on: ubuntu-latest
steps:
- name: Checkout code
uses: actions/checkout@v3
- uses: actions/setup-go@v4
uses: actions/checkout@v4
- uses: actions/setup-go@v5
with:
go-version: "1.21"
go-version: "1.22"
- run: make coveralls
- uses: shogo82148/actions-goveralls@v1
if: always()
Expand Down
2 changes: 1 addition & 1 deletion contracts/Debug.cdc
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import NonFungibleToken from "NonFungibleToken.cdc"
import "NonFungibleToken"

access(all) contract Debug {

Expand Down
14 changes: 7 additions & 7 deletions event.go
Original file line number Diff line number Diff line change
Expand Up @@ -77,7 +77,7 @@ func (me OverflowEvent) GetStakeholders() map[string][]string {
strings.Contains(eventName, "FungibleToken.Deposited") ||
strings.Contains(eventName, "NonFungibleToken.Deposited") ||
strings.Contains(eventName, "NonFungibleToken.Withdrawn") {
vaultType := me.Fields["type"].(string)
vaultType, _ := me.Fields["type"].(string)
existing = append(existing, fmt.Sprintf("%s/%s", vaultType, name))
} else {
existing = append(existing, fmt.Sprintf("%s/%s", me.Name, name))
Expand Down Expand Up @@ -241,11 +241,11 @@ func (overflowEvents OverflowEvents) FilterFees(fee float64, payer string) Overf
if strings.HasSuffix(name, ".FungibleToken.Withdrawn") {
withDrawnEvents := []OverflowEvent{}
for _, value := range events {
ftType := value.Fields["type"].(string)
ftType, _ := value.Fields["type"].(string)
if !strings.HasSuffix(ftType, "FlowToken.Vault") {
continue
}
amount := value.Fields["amount"].(float64)
amount, _ := value.Fields["amount"].(float64)
from, ok := value.Fields["from"].(string)

if ok && amount == fee && from == payer {
Expand All @@ -264,11 +264,11 @@ func (overflowEvents OverflowEvents) FilterFees(fee float64, payer string) Overf
if strings.HasSuffix(name, ".FungibleToken.Deposited") {
depositEvents := []OverflowEvent{}
for _, value := range events {
ftType := value.Fields["type"].(string)
ftType, _ := value.Fields["type"].(string)
if !strings.HasSuffix(ftType, "FlowToken.Vault") {
continue
}
amount := value.Fields["amount"].(float64)
amount, _ := value.Fields["amount"].(float64)
to, ok := value.Fields["to"].(string)

if ok && amount == fee && slices.Contains(feeReceipients, to) {
Expand All @@ -288,7 +288,7 @@ func (overflowEvents OverflowEvents) FilterFees(fee float64, payer string) Overf
withDrawnEvents := []OverflowEvent{}
for _, value := range events {

amount := value.Fields["amount"].(float64)
amount, _ := value.Fields["amount"].(float64)
from, ok := value.Fields["from"].(string)

if ok && amount == fee && from == payer {
Expand All @@ -308,7 +308,7 @@ func (overflowEvents OverflowEvents) FilterFees(fee float64, payer string) Overf
depositEvents := []OverflowEvent{}
for _, value := range events {

amount := value.Fields["amount"].(float64)
amount, _ := value.Fields["amount"].(float64)
to, ok := value.Fields["to"].(string)

if ok && amount == fee && slices.Contains(feeReceipients, to) {
Expand Down
4 changes: 2 additions & 2 deletions go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -6,9 +6,10 @@ toolchain go1.22.3

require (
github.com/araddon/dateparse v0.0.0-20210429162001-6b43995a97de
github.com/bjartek/underflow v1.3.0
github.com/bjartek/underflow v1.5.0
github.com/enescakir/emoji v1.0.0
github.com/fatih/color v1.16.0
github.com/hashicorp/go-multierror v1.1.1
github.com/hexops/autogold v1.3.1
github.com/onflow/cadence v1.0.0-preview.34
github.com/onflow/flixkit-go v1.2.1-cadence-v1-preview.18
Expand Down Expand Up @@ -97,7 +98,6 @@ require (
github.com/grpc-ecosystem/go-grpc-middleware/v2 v2.1.0 // indirect
github.com/grpc-ecosystem/grpc-gateway/v2 v2.19.0 // indirect
github.com/hashicorp/errwrap v1.1.0 // indirect
github.com/hashicorp/go-multierror v1.1.1 // indirect
github.com/hashicorp/golang-lru v1.0.2 // indirect
github.com/hashicorp/golang-lru/v2 v2.0.7 // indirect
github.com/hashicorp/hcl v1.0.0 // indirect
Expand Down
4 changes: 2 additions & 2 deletions go.sum
Original file line number Diff line number Diff line change
Expand Up @@ -1074,8 +1074,8 @@ github.com/bits-and-blooms/bitset v1.5.0/go.mod h1:gIdJ4wp64HaoK2YrL1Q5/N7Y16edY
github.com/bits-and-blooms/bitset v1.7.0/go.mod h1:gIdJ4wp64HaoK2YrL1Q5/N7Y16edYb8uY+O0FJTyyDA=
github.com/bits-and-blooms/bitset v1.10.0 h1:ePXTeiPEazB5+opbv5fr8umg2R/1NlzgDsyepwsSr88=
github.com/bits-and-blooms/bitset v1.10.0/go.mod h1:7hO7Gc7Pp1vODcmWvKMRA9BNmbv6a/7QIWpPxHddWR8=
github.com/bjartek/underflow v1.3.0 h1:HOE1ZEuAMkFUXCsXwV+gCFUHjyJA9d9nTIJu+RHI7SI=
github.com/bjartek/underflow v1.3.0/go.mod h1:JO6QNXSxgqr1CeegDk3DXbNhffRP1K/+DPBvB8Q+/N8=
github.com/bjartek/underflow v1.5.0 h1:0EJK6DmueoO+ffKzH8uhXkuVPL6FHiAQdzBsfrQ9s5Q=
github.com/bjartek/underflow v1.5.0/go.mod h1:M+rSteYN7KtCDUIjILxxUJRFyhpgOM1WFujJzyTDIP4=
github.com/bmizerany/pat v0.0.0-20170815010413-6226ea591a40/go.mod h1:8rLXio+WjiTceGBHIoTvn60HIbs7Hm7bcHjyrSqYB9c=
github.com/boltdb/bolt v1.3.1/go.mod h1:clJnj/oiGkjum5o1McbSZDSLxVThjynRyGBgiAx27Ps=
github.com/boombuler/barcode v1.0.0/go.mod h1:paBWMcWSl3LHKBqUq+rly7CNSldXjb2rDl3JlRe0mD8=
Expand Down
2 changes: 1 addition & 1 deletion interaction_builder.go
Original file line number Diff line number Diff line change
Expand Up @@ -75,7 +75,7 @@ type OverflowInteractionBuilder struct {
// Event filters to apply to the interaction
EventFilter OverflowEventFilter

// Wheter to ignore global event filters from OverflowState or not
// Whether to ignore global event filters from OverflowState or not
IgnoreGlobalEventFilters bool

// Options to use when printing results
Expand Down
4 changes: 2 additions & 2 deletions parse_integration_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -11,8 +11,8 @@ import (
)

func TestParseConfig(t *testing.T) {
g, err := OverflowTesting()
require.NoError(t, err)
g, err2 := OverflowTesting()
require.NoError(t, err2)
require.NotNil(t, g)

t.Run("parse", func(t *testing.T) {
Expand Down
2 changes: 1 addition & 1 deletion result.go
Original file line number Diff line number Diff line change
Expand Up @@ -384,7 +384,7 @@ func getByteArray(data interface{}) ([]byte, error) {
if !ok {
return nil, fmt.Errorf("unexpected type at index %d", i)
}
byteSlice[i] = byte(b)
byteSlice[i] = b
}
return byteSlice, nil
}
18 changes: 15 additions & 3 deletions setup.go
Original file line number Diff line number Diff line change
Expand Up @@ -176,8 +176,21 @@ func (o *OverflowBuilder) StartResult() *OverflowState {
if o.InputResolver != nil {
overflow.InputResolver = *o.InputResolver
} else {
overflow.InputResolver = func(name string) (string, error) {
return overflow.QualifiedIdentifierFromSnakeCase(name)
overflow.InputResolver = func(name string, resolveType underflow.ResolveType) (string, error) {
if resolveType == underflow.Identifier {
return overflow.QualifiedIdentifierFromSnakeCase(name)
}

adr, err2 := hexToAddress(name)
if err2 == nil {
return adr.String(), nil
}

address, err2 := overflow.FlowAddressE(name)
if err2 != nil {
return "", errors.Wrapf(err2, "could not parse %s into an address", name)
}
return address.HexWithPrefix(), nil
}
}
network, err := state.Networks().ByName(o.Network)
Expand Down Expand Up @@ -242,7 +255,6 @@ func (o *OverflowBuilder) StartResult() *OverflowState {
return overflow
}
}

if o.DeployContracts {
overflow = overflow.InitializeContracts(o.Ctx)
if overflow.Error != nil {
Expand Down
Loading

0 comments on commit 7f65a99

Please sign in to comment.