Skip to content

Commit

Permalink
Merge pull request #858 from multiversx/separate-flag-multi-transfer-…
Browse files Browse the repository at this point in the history
…by-user

adding separate flag for MultiESDTNFTTransferAndExecuteByUserFlag
  • Loading branch information
sstanculeanu authored Jul 29, 2024
2 parents c4890f3 + e3e50b6 commit 1a6d87a
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 0 deletions.
3 changes: 3 additions & 0 deletions vmhost/flags.go
Original file line number Diff line number Diff line change
Expand Up @@ -5,4 +5,7 @@ import "github.com/multiversx/mx-chain-core-go/core"
const (
// CryptoOpcodesV2Flag defines the flag that activates the new crypto APIs for RC1.7
CryptoOpcodesV2Flag core.EnableEpochFlag = "CryptoOpcodesV2Flag"

// MultiESDTNFTTransferAndExecuteByUserFlag defines the flag that activates the enshrined sovereign functions
MultiESDTNFTTransferAndExecuteByUserFlag core.EnableEpochFlag = "MultiESDTNFTTransferAndExecuteByUserFlag"
)
5 changes: 5 additions & 0 deletions vmhost/hostCore/host.go
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,7 @@ const internalVMErrors = "internalVMErrors"
// allFlags must have all flags used by mx-chain-vm-go in the current version
var allFlags = []core.EnableEpochFlag{
vmhost.CryptoOpcodesV2Flag,
vmhost.MultiESDTNFTTransferAndExecuteByUserFlag,
}

// vmHost implements HostContext interface.
Expand Down Expand Up @@ -544,6 +545,10 @@ func (host *vmHost) AreInSameShard(leftAddress []byte, rightAddress []byte) bool

// IsAllowedToExecute returns true if the special opcode is allowed to be run by the address
func (host *vmHost) IsAllowedToExecute(opcode string) bool {
if !host.enableEpochsHandler.IsFlagEnabled(vmhost.MultiESDTNFTTransferAndExecuteByUserFlag) {
return false
}

mapAddresses, ok := host.mapOpcodeAddressIsAllowed[opcode]
if !ok {
return false
Expand Down

0 comments on commit 1a6d87a

Please sign in to comment.