Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Wegld fee #65

Merged
merged 79 commits into from
Jul 12, 2024
Merged

Wegld fee #65

merged 79 commits into from
Jul 12, 2024

Conversation

andreiblt1304
Copy link
Contributor

@andreiblt1304 andreiblt1304 commented Jun 28, 2024

  • Created a separate endpoint to register tokens
  • Added registered tokens mapper
  • Modified init endpoint with optional values for WEGLD and Sovereign Token Prefix Identifiers

@andreiblt1304 andreiblt1304 marked this pull request as ready for review July 8, 2024 13:46
return false;
}

let dash = b'-';
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Have this as a const instead.


let dash = b'-';
let buffer = token_id.as_managed_buffer();
let mut array_buffer = [0u8; 32];
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

"32" can also be a const, like "MAX_TOKEN_ID_LEN"

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Should also do the same in the above function btw.

);

for token_id in tokens {
self.register_token(token_id);
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

If this makes token issue, it won't work. You can only make one legacy async call per call, which is what the token issue framework uses.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

register_token just saves the TokenIdentifier to the paid_issued_tokens mapper

Comment on lines 36 to 54
if !is_sovereign_chain {
match wegld_identifier {
Some(identifier) => {
require!(
identifier.is_valid_esdt_identifier(),
"Sent Identifier is not valid"
);

self.wegld_identifier().set(identifier);
}

None => sc_panic!("WEGLG identifier must be set in Mainchain"),
}

match sov_token_prefix {
Some(prefix) => self.sovereign_tokens_prefix().set(prefix),
None => sc_panic!("Sovereign Token Prefix must be set in Mainchain"),
}
}
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can revert condition here to do some de-nesting, i.e.

if is_sovereign_chain {
    return;
}

// code that was inside if

Also, since you need "Some" for both Option, why not take "TokenIdentifier" and "ManagedBuffer" directly in the init call?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

i agree with the de-nesting but I don't quite understand what you mean by taking those directly in the init call

@andreiblt1304 andreiblt1304 merged commit c02420b into enshrine-esdt Jul 12, 2024
2 checks passed
@dorin-iancu dorin-iancu deleted the wegld-fee branch July 12, 2024 11:40
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

4 participants