Skip to content

Commit

Permalink
Merge pull request #59 from ElrondNetwork/EN-11437-Freeze_unfreeze_bu…
Browse files Browse the repository at this point in the history
…iltin_func

FEAT: Add freeze/unfreeze builtin function
  • Loading branch information
mariusmihaic authored Feb 2, 2022
2 parents fcd8a1f + efd3009 commit 4c34233
Show file tree
Hide file tree
Showing 3 changed files with 17 additions and 11 deletions.
6 changes: 6 additions & 0 deletions core/constants.go
Original file line number Diff line number Diff line change
Expand Up @@ -108,6 +108,12 @@ const BuiltInFunctionMultiESDTNFTTransfer = "MultiESDTNFTTransfer"
// BuiltInFunctionSetGuardian is the key for setting a guardian built-in function
const BuiltInFunctionSetGuardian = "SetGuardian"

// BuiltInFunctionFreezeAccount is the built-in function key for freezing an account
const BuiltInFunctionFreezeAccount = "FreezeAccount"

// BuiltInFunctionUnfreezeAccount is the built-in function key for unfreezing an account
const BuiltInFunctionUnfreezeAccount = "UnfreezeAccount"

// ESDTRoleLocalMint is the constant string for the local role of mint for ESDT tokens
const ESDTRoleLocalMint = "ESDTRoleLocalMint"

Expand Down
20 changes: 10 additions & 10 deletions data/block/economicsHandler.go
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ func (e *Economics) SetTotalSupply(totalSupply *big.Int) error {
if e == nil {
return data.ErrNilPointerReceiver
}
if totalSupply == nil{
if totalSupply == nil {
return data.ErrInvalidValue
}
if e.TotalSupply == nil {
Expand Down Expand Up @@ -45,10 +45,10 @@ func (e *Economics) SetTotalNewlyMinted(totalNewlyMinted *big.Int) error {
if e == nil {
return data.ErrNilPointerReceiver
}
if totalNewlyMinted == nil{
if totalNewlyMinted == nil {
return data.ErrInvalidValue
}
if e.TotalNewlyMinted == nil{
if e.TotalNewlyMinted == nil {
e.TotalNewlyMinted = big.NewInt(0)
}

Expand All @@ -60,12 +60,12 @@ func (e *Economics) SetTotalNewlyMinted(totalNewlyMinted *big.Int) error {
// SetRewardsPerBlock sets the rewards per block
func (e *Economics) SetRewardsPerBlock(rewardsPerBlock *big.Int) error {
if e == nil {
return data.ErrNilPointerReceiver
return data.ErrNilPointerReceiver
}
if rewardsPerBlock == nil{
if rewardsPerBlock == nil {
return data.ErrInvalidValue
}
if e.RewardsPerBlock == nil{
if e.RewardsPerBlock == nil {
e.RewardsPerBlock = big.NewInt(0)
}

Expand All @@ -79,10 +79,10 @@ func (e *Economics) SetRewardsForProtocolSustainability(rewardsForProtocolSustai
if e == nil {
return data.ErrNilPointerReceiver
}
if rewardsForProtocolSustainability == nil{
if rewardsForProtocolSustainability == nil {
return data.ErrInvalidValue
}
if e.RewardsForProtocolSustainability == nil{
if e.RewardsForProtocolSustainability == nil {
e.RewardsForProtocolSustainability = big.NewInt(0)
}

Expand All @@ -96,10 +96,10 @@ func (e *Economics) SetNodePrice(nodePrice *big.Int) error {
if e == nil {
return data.ErrNilPointerReceiver
}
if nodePrice == nil{
if nodePrice == nil {
return data.ErrInvalidValue
}
if e.NodePrice == nil{
if e.NodePrice == nil {
e.NodePrice = big.NewInt(0)
}

Expand Down
2 changes: 1 addition & 1 deletion data/block/trigger_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -456,7 +456,7 @@ func TestShardTriggerRegistryV2_SetEpochStartHeaderHandlerNilHeaderToSet(t *test

str := createDefaultShardTriggerRegistryV2()
str.EpochStartShardHeader = &HeaderV2{
Header: &Header{},
Header: &Header{},
ScheduledRootHash: []byte("scheduled root hash"),
}
setHeader := data.HeaderHandler(nil)
Expand Down

0 comments on commit 4c34233

Please sign in to comment.