Skip to content

Commit

Permalink
clippy fixes
Browse files Browse the repository at this point in the history
  • Loading branch information
ovstinga committed Jun 28, 2023
1 parent b3e3107 commit 4e4b28b
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 29 deletions.
25 changes: 0 additions & 25 deletions vm/src/tx_execution/system_sc/system_sc_issue.rs
Original file line number Diff line number Diff line change
Expand Up @@ -61,28 +61,3 @@ pub fn issue_non_fungible(tx_context: TxContext) -> (TxContext, TxResult) {

(tx_context, tx_result)
}

// todo#1: generate token identifier randomly
// - - - - - - - - - - - - - - - - - - - - - - - - -
// code from mx-chain-go
// - - - - - - - - - - - - - - - - - - - - - - - - -

// newRandomBase := append(caller, e.eei.BlockChainHook().CurrentRandomSeed()...)
// newRandom := e.hasher.Compute(string(newRandomBase))
// newRandomForTicker := newRandom[:tickerRandomSequenceLength]

// tickerPrefix := append(ticker, []byte(tickerSeparator)...)
// newRandomAsBigInt := big.NewInt(0).SetBytes(newRandomForTicker)

// one := big.NewInt(1)
// for i := 0; i < numOfRetriesForIdentifier; i++ {
// encoded := fmt.Sprintf("%06x", newRandomAsBigInt)
// newIdentifier := append(tickerPrefix, encoded...)
// buff := e.eei.GetStorage(newIdentifier)
// if len(buff) == 0 {
// return newIdentifier, nil
// }
// newRandomAsBigInt.Add(newRandomAsBigInt, one)
// }

// return nil, vm.ErrCouldNotCreateNewTokenIdentifier
6 changes: 2 additions & 4 deletions vm/src/world_mock/esdt_data.rs
Original file line number Diff line number Diff line change
Expand Up @@ -168,10 +168,8 @@ impl AccountEsdt {
pub fn set_special_role(&mut self, token_identifier: &[u8], role: &[u8]) {
if let Some(esdt_data) = self.get_mut_by_identifier(token_identifier) {
let roles = esdt_data.roles.get();
if roles.contains(role.to_vec().as_ref()) {
return;
} else {
let mut new_roles = roles.clone();
if !roles.contains(role.to_vec().as_ref()) {
let mut new_roles = roles;
new_roles.push(role.to_vec());
esdt_data.roles = EsdtRoles::new(new_roles);
}
Expand Down

0 comments on commit 4e4b28b

Please sign in to comment.