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

Feature idea: Build ID #76

Open
encody opened this issue Oct 11, 2022 · 0 comments
Open

Feature idea: Build ID #76

encody opened this issue Oct 11, 2022 · 0 comments
Labels
enhancement New feature or request

Comments

@encody
Copy link
Member

encody commented Oct 11, 2022

Macro that adds an external method that returns the commit hash of the build.

This should be possible because macros run at compile time.

Existing similar NEP: https://github.com/near/NEPs/blob/master/neps/nep-0330.md

Possible Example Usage

trait BuildId {
    fn build_id(&self) -> String;
}

#[derive(BuildId)]
#[derive(BorshSerialize, BorshDeserialize, PanicOnDefault)]
#[near_bindgen]
pub struct MyContract {
    // ...
}

let contract = MyContract::new();
println!("{}", contract.build_id()); // 6a5992033dc4a092a5d45d64b4f205ce9aeb2939
@encody encody added the enhancement New feature or request label Oct 11, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

1 participant