Skip to content

Commit

Permalink
Update contarcts
Browse files Browse the repository at this point in the history
  • Loading branch information
SupunS committed Sep 15, 2023
1 parent e4f5f3f commit 2538c2a
Show file tree
Hide file tree
Showing 15 changed files with 114 additions and 184 deletions.
2 changes: 1 addition & 1 deletion contracts/BasicNFT-v2.cdc
Original file line number Diff line number Diff line change
Expand Up @@ -76,7 +76,7 @@ access(all) contract BasicNFT {

init() {
let minter <- create NFTMinter()
self.account.save(<-minter, to: /storage/flowBasicNFTMinterPath)
self.account.storage.save(<-minter, to: /storage/flowBasicNFTMinterPath)
}
}

10 changes: 4 additions & 6 deletions contracts/ExampleNFT-v2.cdc
Original file line number Diff line number Diff line change
Expand Up @@ -424,17 +424,15 @@ access(all) contract ExampleNFT: MultipleNFT, ViewResolver {
let collection <- create Collection()
let defaultStoragePath = collection.getDefaultStoragePath()!
let defaultPublicPath = collection.getDefaultPublicPath()!
self.account.save(<-collection, to: defaultStoragePath)
self.account.storage.save(<-collection, to: defaultStoragePath)

// create a public capability for the collection
self.account.link<&ExampleNFT.Collection>(
defaultPublicPath,
target: defaultStoragePath
)
let examplNFTCap = self.account.capabilities.issue<&ExampleNFT.Collection>(defaultStoragePath)
self.account.capabilities.publish(examplNFTCap, at: defaultPublicPath)

// Create a Minter resource and save it to storage
let minter <- create NFTMinter()
self.account.save(<-minter, to: self.MinterStoragePath)
self.account.storage.save(<-minter, to: self.MinterStoragePath)
}
}

6 changes: 4 additions & 2 deletions lib/go/contracts/contracts_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -22,8 +22,9 @@ func TestExampleNFTContract(t *testing.T) {
addressA := addresses.New()
addressB := addresses.New()
addressC := addresses.New()
addressD := addresses.New()

contract := contracts.ExampleNFT(addressA, addressB, addressC)
contract := contracts.ExampleNFT(addressA, addressB, addressC, addressD)
assert.NotNil(t, contract)

assert.Contains(t, string(contract), addressA.String())
Expand All @@ -35,6 +36,7 @@ func TestMetadataViewsContract(t *testing.T) {
addresses := test.AddressGenerator()
addressA := addresses.New()
addressB := addresses.New()
contract := contracts.MetadataViews(addressA, addressB)
addressC := addresses.New()
contract := contracts.MetadataViews(addressA, addressB, addressC)
assert.NotNil(t, contract)
}
2 changes: 1 addition & 1 deletion lib/go/contracts/go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,6 @@ go 1.16

require (
github.com/kevinburke/go-bindata v3.22.0+incompatible
github.com/onflow/flow-go-sdk v0.44.0-stable-cadence.1.0.20230912230115-25ad6f515ce6
github.com/onflow/flow-go-sdk v0.44.0-stable-cadence.1.0.20230915213126-68e7ffb5595f
github.com/stretchr/testify v1.8.4
)
92 changes: 16 additions & 76 deletions lib/go/contracts/go.sum

Large diffs are not rendered by default.

12 changes: 6 additions & 6 deletions lib/go/contracts/internal/assets/assets.go

Large diffs are not rendered by default.

24 changes: 12 additions & 12 deletions lib/go/test/go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -3,10 +3,10 @@ module github.com/onflow/flow-nft/lib/go/test
go 1.18

require (
github.com/onflow/cadence v0.39.13-stable-cadence.0.20230815215130-fc15617946a1
github.com/onflow/flow-emulator v0.54.1-0.20230815221351-758e3a5bb92a
github.com/onflow/flow-go-sdk v0.41.10-0.20230815215544-c3e9ce914aee
github.com/onflow/flow-nft/lib/go/contracts v1.1.1-0.20230726191152-4293bb676808
github.com/onflow/cadence v0.41.0-stable-cadence.1.0.20230908213403-8f1134670ed0
github.com/onflow/flow-emulator v0.54.1-0.20230912234944-690e2ed31cb4
github.com/onflow/flow-go-sdk v0.44.0-stable-cadence.1.0.20230915213126-68e7ffb5595f
github.com/onflow/flow-nft/lib/go/contracts v1.1.1-0.20230913160722-e4f5f3f4b87a
github.com/onflow/flow-nft/lib/go/templates v0.0.0-00010101000000-000000000000
github.com/rs/zerolog v1.29.0
github.com/stretchr/testify v1.8.4
Expand Down Expand Up @@ -84,15 +84,15 @@ require (
github.com/multiformats/go-multihash v0.2.3 // indirect
github.com/multiformats/go-multistream v0.4.1 // indirect
github.com/multiformats/go-varint v0.0.7 // indirect
github.com/onflow/atree v0.6.0 // indirect
github.com/onflow/flow-core-contracts/lib/go/contracts v1.2.4-0.20230808220007-f00e74ca675b // indirect
github.com/onflow/flow-core-contracts/lib/go/templates v1.2.4-0.20230808220007-f00e74ca675b // indirect
github.com/onflow/flow-ft/lib/go/contracts v0.7.1-0.20230726183918-f90805445bfa // indirect
github.com/onflow/flow-go v0.31.1-0.20230815221159-accf10b9fbaa // indirect
github.com/onflow/atree v0.6.1-0.20230711151834-86040b30171f // indirect
github.com/onflow/flow-core-contracts/lib/go/contracts v1.2.4-0.20230914204805-221dba9d6b45 // indirect
github.com/onflow/flow-core-contracts/lib/go/templates v1.2.4-0.20230914204805-221dba9d6b45 // indirect
github.com/onflow/flow-ft/lib/go/contracts v0.7.1-0.20230913160646-09adc7d3b513 // indirect
github.com/onflow/flow-go v0.31.1-0.20230915214237-df61e0d3c342 // indirect
github.com/onflow/flow-go/crypto v0.24.9 // indirect
github.com/onflow/flow/protobuf/go/flow v0.3.2-0.20230628215638-83439d22e0ce // indirect
github.com/onflow/nft-storefront/lib/go/contracts v0.0.0-20221222181731-14b90207cead // indirect
github.com/onflow/sdks v0.5.0 // indirect
github.com/onflow/sdks v0.5.1-0.20230912225508-b35402f12bba // indirect
github.com/onsi/gomega v1.27.7 // indirect
github.com/opentracing/opentracing-go v1.2.0 // indirect
github.com/pbnjay/memory v0.0.0-20210728143218-7b4eea64cf58 // indirect
Expand Down Expand Up @@ -138,10 +138,10 @@ require (
go.uber.org/multierr v1.11.0 // indirect
go.uber.org/zap v1.24.0 // indirect
golang.org/x/crypto v0.10.0 // indirect
golang.org/x/exp v0.0.0-20230321023759-10a507213a29 // indirect
golang.org/x/exp v0.0.0-20230626212559-97b1e661b5df // indirect
golang.org/x/net v0.10.0 // indirect
golang.org/x/sync v0.2.0 // indirect
golang.org/x/sys v0.9.0 // indirect
golang.org/x/sys v0.11.0 // indirect
golang.org/x/text v0.10.0 // indirect
golang.org/x/xerrors v0.0.0-20220907171357-04be3eba64a2 // indirect
gonum.org/v1/gonum v0.13.0 // indirect
Expand Down
Loading

0 comments on commit 2538c2a

Please sign in to comment.