Skip to content

Commit

Permalink
Merge pull request #58 from onflow/improvement/expose-go-contract
Browse files Browse the repository at this point in the history
Add version support
  • Loading branch information
sideninja authored Jul 14, 2022
2 parents bb95697 + fb173a8 commit cd7b6cb
Showing 1 changed file with 8 additions and 3 deletions.
11 changes: 8 additions & 3 deletions lib/go/contracts/contracts.go
Original file line number Diff line number Diff line change
Expand Up @@ -11,13 +11,18 @@ import (
//go:generate go run github.com/kevinburke/go-bindata/go-bindata -prefix ../../../contracts -o internal/assets/assets.go -pkg assets -nometadata -nomemcopy ../../../contracts

const (
storefrontFilename = "NFTStorefrontV2.cdc"
storefrontFilename = "NFTStorefront%d.cdc"
placeholderFungibleTokenAddress = "./utility/FungibleToken.cdc"
placeholderNonfungibleTokenAddress = "./utility/NonFungibleToken.cdc"
)

func NFTStorefront(fungibleTokenAddress string, nonfungibleTokenAddress string) []byte {
code := assets.MustAssetString(storefrontFilename)
func NFTStorefront(version int, fungibleTokenAddress string, nonfungibleTokenAddress string) []byte {
if version != 1 && version != 2 {
panic("storefront contract version doesn't exist")
}
contractFile := fmt.Sprintf(storefrontFilename, version)

code := assets.MustAssetString(contractFile)

// Replace the fungible token address
code = strings.ReplaceAll(
Expand Down

0 comments on commit cd7b6cb

Please sign in to comment.