Skip to content

Commit

Permalink
fix asset path prefix stripping
Browse files Browse the repository at this point in the history
  • Loading branch information
turbolent committed Dec 14, 2020
1 parent fe77a92 commit 38179e6
Show file tree
Hide file tree
Showing 9 changed files with 1,237 additions and 1,254 deletions.
22 changes: 11 additions & 11 deletions lib/go/contracts/contracts.go
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
package contracts

//go:generate go run github.com/kevinburke/go-bindata/go-bindata -prefix ../../../contracts/... -o internal/assets/assets.go -pkg assets -nometadata -nomemcopy ../../../contracts/...
//go:generate go run github.com/kevinburke/go-bindata/go-bindata -prefix ../../../contracts -o internal/assets/assets.go -pkg assets -nometadata -nomemcopy ../../../contracts/...

import (
"fmt"
Expand All @@ -12,18 +12,18 @@ import (
)

const (
flowFeesFilename = "../../../contracts/FlowFees.cdc"
flowServiceAccountFilename = "../../../contracts/FlowServiceAccount.cdc"
flowTokenFilename = "../../../contracts/FlowToken.cdc"
flowIdentityTableFilename = "../../../contracts/FlowIDTableStaking.cdc"
flowQCFilename = "../../../contracts/epochs/FlowQuorumCertificate.cdc"
flowDKGFilename = "../../../contracts/epochs/FlowDKG.cdc"
flowEpochFilename = "../../../contracts/epochs/FlowEpoch.cdc"
flowLockedTokensFilename = "../../../contracts/LockedTokens.cdc"
flowStakingProxyFilename = "../../../contracts/StakingProxy.cdc"
flowFeesFilename = "FlowFees.cdc"
flowServiceAccountFilename = "FlowServiceAccount.cdc"
flowTokenFilename = "FlowToken.cdc"
flowIdentityTableFilename = "FlowIDTableStaking.cdc"
flowQCFilename = "epochs/FlowQuorumCertificate.cdc"
flowDKGFilename = "epochs/FlowDKG.cdc"
flowEpochFilename = "epochs/FlowEpoch.cdc"
flowLockedTokensFilename = "LockedTokens.cdc"
flowStakingProxyFilename = "StakingProxy.cdc"

// Test contracts
TESTFlowIdentityTableFilename = "../../../contracts/testContracts/TestFlowIDTableStaking.cdc"
TESTFlowIdentityTableFilename = "testContracts/TestFlowIDTableStaking.cdc"

placeholderFungibleTokenAddress = "0xFUNGIBLETOKENADDRESS"
placeholderFlowTokenAddress = "0xFLOWTOKENADDRESS"
Expand Down
136 changes: 64 additions & 72 deletions lib/go/contracts/internal/assets/assets.go

Large diffs are not rendered by default.

32 changes: 16 additions & 16 deletions lib/go/templates/delegator_templates.go
Original file line number Diff line number Diff line change
Expand Up @@ -27,101 +27,101 @@ const (
)

func GenerateCreateDelegationScript(env Environment) []byte {
code := assets.MustAssetString(filePath + createDelegationFilename)
code := assets.MustAssetString(createDelegationFilename)

return []byte(replaceAddresses(code, env))
}

func GenerateRegisterDelegatorScript(env Environment) []byte {
code := assets.MustAssetString(filePath + delegatorRegisterFilename)
code := assets.MustAssetString(delegatorRegisterFilename)

return []byte(replaceAddresses(code, env))
}

func GenerateDelegatorStakeNewScript(env Environment) []byte {
code := assets.MustAssetString(filePath + delegatorStakeNewFilename)
code := assets.MustAssetString(delegatorStakeNewFilename)

return []byte(replaceAddresses(code, env))
}

func GenerateDelegatorStakeUnstakedScript(env Environment) []byte {
code := assets.MustAssetString(filePath + delegatorStakeUnstakedFilename)
code := assets.MustAssetString(delegatorStakeUnstakedFilename)

return []byte(replaceAddresses(code, env))
}

func GenerateDelegatorStakeRewardedScript(env Environment) []byte {
code := assets.MustAssetString(filePath + delegatorStakeRewardedFilename)
code := assets.MustAssetString(delegatorStakeRewardedFilename)

return []byte(replaceAddresses(code, env))
}

func GenerateDelegatorRequestUnstakeScript(env Environment) []byte {
code := assets.MustAssetString(filePath + delegatorRequestUnstakeFilename)
code := assets.MustAssetString(delegatorRequestUnstakeFilename)

return []byte(replaceAddresses(code, env))
}

func GenerateDelegatorWithdrawUnstakedScript(env Environment) []byte {
code := assets.MustAssetString(filePath + delegatorWithdrawUnstakedFilename)
code := assets.MustAssetString(delegatorWithdrawUnstakedFilename)

return []byte(replaceAddresses(code, env))
}

func GenerateDelegatorWithdrawRewardsScript(env Environment) []byte {
code := assets.MustAssetString(filePath + delegatorWithdrawRewardsFilename)
code := assets.MustAssetString(delegatorWithdrawRewardsFilename)

return []byte(replaceAddresses(code, env))
}

// Scripts

func GenerateGetDelegatorCommittedScript(env Environment) []byte {
code := assets.MustAssetString(filePath + getDelegatorCommittedFilename)
code := assets.MustAssetString(getDelegatorCommittedFilename)

return []byte(replaceAddresses(code, env))
}

func GenerateGetDelegatorStakedScript(env Environment) []byte {
code := assets.MustAssetString(filePath + getDelegatorStakedFilename)
code := assets.MustAssetString(getDelegatorStakedFilename)

return []byte(replaceAddresses(code, env))
}

func GenerateGetDelegatorUnstakingRequestScript(env Environment) []byte {
code := assets.MustAssetString(filePath + getDelegatorUnstakingRequestFilename)
code := assets.MustAssetString(getDelegatorUnstakingRequestFilename)

return []byte(replaceAddresses(code, env))
}

func GenerateGetDelegatorUnstakingScript(env Environment) []byte {
code := assets.MustAssetString(filePath + getDelegatorUnstakingFilename)
code := assets.MustAssetString(getDelegatorUnstakingFilename)

return []byte(replaceAddresses(code, env))
}

func GenerateGetDelegatorUnstakedScript(env Environment) []byte {
code := assets.MustAssetString(filePath + getDelegatorUnstakedFilename)
code := assets.MustAssetString(getDelegatorUnstakedFilename)

return []byte(replaceAddresses(code, env))
}

func GenerateGetDelegatorRewardsScript(env Environment) []byte {
code := assets.MustAssetString(filePath + getDelegatorRewardedFilename)
code := assets.MustAssetString(getDelegatorRewardedFilename)

return []byte(replaceAddresses(code, env))
}

func GenerateGetDelegatorRequestScript(env Environment) []byte {
code := assets.MustAssetString(filePath + getDelegatorRequestFilename)
code := assets.MustAssetString(getDelegatorRequestFilename)

return []byte(replaceAddresses(code, env))
}

// Only for testing

func GenerateRegisterManyDelegatorsScript(env Environment) []byte {
code := assets.MustAssetString(filePath + registerManyDelegatorsFilename)
code := assets.MustAssetString(registerManyDelegatorsFilename)

return []byte(replaceAddresses(code, env))
}
Loading

0 comments on commit 38179e6

Please sign in to comment.