Skip to content

Commit

Permalink
use only one version of USDCFlow with string replacement
Browse files Browse the repository at this point in the history
  • Loading branch information
joshuahannan committed Oct 30, 2024
1 parent 895b7d9 commit bdced15
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 238 deletions.
212 changes: 0 additions & 212 deletions contracts/utility/USDCFlowBasic.cdc

This file was deleted.

12 changes: 9 additions & 3 deletions lib/go/contracts/contracts.go
Original file line number Diff line number Diff line change
Expand Up @@ -26,8 +26,7 @@ var (
)

const (
filenameUSDCFlow = "USDCFlow.cdc"
filenameUSDCFlowBasic = "utility/USDCFlowBasic.cdc"
filenameUSDCFlow = "USDCFlow.cdc"
)

// USDCFlow returns the USDCFlow contract.
Expand All @@ -53,13 +52,20 @@ func USDCFlow(

// USDCFlowBasic returns the USDCFlowBasic contract.
func USDCFlowBasic(ftAddr, metadataAddr, ftMetadataAddr, viewResolverAddr, burnerAddr string) []byte {
code := assets.MustAssetString(filenameUSDCFlowBasic)
code := assets.MustAssetString(filenameUSDCFlow)

code = placeholderFungibleToken.ReplaceAllString(code, fungibleTokenImport+"0x"+ftAddr)
code = placeholderMetadataViews.ReplaceAllString(code, metadataViewsImport+"0x"+metadataAddr)
code = placeholderFTMetadataViews.ReplaceAllString(code, ftMetadataViewsImport+"0x"+ftMetadataAddr)
code = placeholderViewResolver.ReplaceAllString(code, viewResolverImport+"0x"+viewResolverAddr)
code = placeholderBurner.ReplaceAllString(code, burnerImport+"0x"+burnerAddr)

bridgeInterfacesFullImport := regexp.MustCompile(`import \"FlowEVMBridgeHandlerInterfaces\"`)
code = bridgeInterfacesFullImport.ReplaceAllString(code, "")
minterDefinition := regexp.MustCompile(`Minter: FlowEVMBridgeHandlerInterfaces.TokenMinter {`)
code = minterDefinition.ReplaceAllString(code, "Minter {")
mintEntitlement := regexp.MustCompile(`access(FlowEVMBridgeHandlerInterfaces.Mint)`)
code = mintEntitlement.ReplaceAllString(code, "access(all)")

return []byte(code)
}
Loading

0 comments on commit bdced15

Please sign in to comment.