Skip to content

Commit

Permalink
fix tests
Browse files Browse the repository at this point in the history
  • Loading branch information
loic1 committed Feb 19, 2025
1 parent bea276f commit f6a88e6
Show file tree
Hide file tree
Showing 5 changed files with 9 additions and 3 deletions.
4 changes: 2 additions & 2 deletions lib/go/contracts/contracts.go
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ const (

// GenerateTopShotContract returns a copy
// of the topshot contract with the import addresses updated
func GenerateTopShotContract(ftAddr, nftAddr, metadataViewsAddr, viewResolverAddr, crossVMMetadataViewsAddr, evmAddr, topShotLockingAddr, royaltyAddr, network string) []byte {
func GenerateTopShotContract(ftAddr, nftAddr, metadataViewsAddr, viewResolverAddr, crossVMMetadataViewsAddr, evmAddr, topShotLockingAddr, royaltyAddr, network, flowEvmContractAddr string) []byte {

topShotCode := assets.MustAssetString(topshotFile)

Expand All @@ -60,7 +60,7 @@ func GenerateTopShotContract(ftAddr, nftAddr, metadataViewsAddr, viewResolverAdd

codeWithNetwork := strings.ReplaceAll(codeWithTopShotRoyaltyAddr, defaultNetwork, network)

codeWithEVMContractAddress := strings.ReplaceAll(codeWithNetwork, defaultEVMContractAddress, evmAddr)
codeWithEVMContractAddress := strings.ReplaceAll(codeWithNetwork, defaultEVMContractAddress, flowEvmContractAddr)

return []byte(codeWithEVMContractAddress)
}
Expand Down
3 changes: 2 additions & 1 deletion lib/go/contracts/contracts_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -16,9 +16,10 @@ var addrE = "0E"
var addrF = "0F"
var addrG = "0G"
var network = "mainnet"
var flowEvmContractAddr = "0x1234565789012345657890123456578901234565"

func TestTopShotContract(t *testing.T) {
contract := contracts.GenerateTopShotContract(addrA, addrA, addrA, addrA, addrA, addrA, addrA, addrA, network)
contract := contracts.GenerateTopShotContract(addrA, addrA, addrA, addrA, addrA, addrA, addrA, addrA, network, flowEvmContractAddr)
assert.NotNil(t, contract)
}

Expand Down
1 change: 1 addition & 0 deletions lib/go/test/fast_break_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -85,6 +85,7 @@ func TestFastBreak(t *testing.T) {
topShotLockingAddr.String(),
topShotRoyaltyAddr.String(),
Network,
FlowEvmContractAddr,
)
topshotAccountKey, topshotSigner := accountKeys.NewWithSigner()
topshotAddr, topshotAddrErr := adapter.CreateAccount(context.Background(), []*flow.AccountKey{topshotAccountKey}, []sdktemplates.Contract{
Expand Down
1 change: 1 addition & 0 deletions lib/go/test/locking_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -463,6 +463,7 @@ func TestTopShotLocking(t *testing.T) {
topShotLockingAddr.String(),
env.FTSwitchboardAddress,
Network,
FlowEvmContractAddr,
)
fakeTopshotAccountKey, fakeTopshotSigner := accountKeys.NewWithSigner()
fakeTopshotAddress, _ := adapter.CreateAccount(context.Background(), []*flow.AccountKey{fakeTopshotAccountKey}, []sdktemplates.Contract{
Expand Down
3 changes: 3 additions & 0 deletions lib/go/test/topshot_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -49,6 +49,7 @@ const (
MetadataViewsReplaceAddress = `"MetadataViews"`
ViewResolverReplaceAddress = `"ViewResolver"`
Network = `"mainnet"`
FlowEvmContractAddr = `"0x1234565789012345657890123456578901234565"`
)

// topshotTestContext will expose sugar for common actions needed to bootstrap testing
Expand Down Expand Up @@ -141,6 +142,7 @@ func NewTopShotTestBlockchain(t *testing.T) topshotTestBlockchain {
topShotLockingAddr.String(),
royaltyAddr.String(),
Network,
FlowEvmContractAddr,
)
topshotAccountKey, topshotSigner := accountKeys.NewWithSigner()
topshotAddr, err := adapter.CreateAccount(context.Background(), []*flow.AccountKey{topshotAccountKey}, []sdktemplates.Contract{
Expand Down Expand Up @@ -821,6 +823,7 @@ func TestTransferAdmin(t *testing.T) {
topShotLockingAddr.String(),
royaltyAddr.String(),
Network,
FlowEvmContractAddr,
)
topshotAccountKey, topshotSigner := accountKeys.NewWithSigner()
topshotAddr, _ := adapter.CreateAccount(context.Background(), []*flow.AccountKey{topshotAccountKey}, []sdktemplates.Contract{
Expand Down

0 comments on commit f6a88e6

Please sign in to comment.