Skip to content

Commit

Permalink
Merge branch 'master' into contract_metadata
Browse files Browse the repository at this point in the history
  • Loading branch information
sczembor committed Oct 9, 2023
2 parents c0dc458 + aecc7cd commit 2dfabcb
Show file tree
Hide file tree
Showing 4 changed files with 18 additions and 5 deletions.
2 changes: 1 addition & 1 deletion contracts/Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

11 changes: 10 additions & 1 deletion contracts/registry/CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -21,11 +21,20 @@ Change log entries are to be added to the Unreleased section. Example entry:

### Features

### Breaking Changes

### Bug Fixes

## v1.6.0 (2023-10-08)

### Features

- New `GovBan` flag. Reserved for accounts with a history of misconduct, limiting their governance role while maintaining their voting rights as valued members of the Voting Body.
- `sbt_revoke_by_owner` returns true if the issuer should continue to call the method to revoke all tokens. Otherwise the function return false. Moreover, the method has been improved and optimized.

### Breaking Changes

### Bug Fixes
- `sbt_mint` will set `issue_at` to the current time in milliseconds, if the value was not provided.

## v1.5.0 (2023-09-07)

Expand Down
2 changes: 1 addition & 1 deletion contracts/registry/Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[package]
name = "registry"
version = "1.5.0"
version = "1.6.0"
authors = ["Robert Zaremba 'https://zaremba.ch/'"]
edition = { workspace = true }
repository = { workspace = true }
Expand Down
8 changes: 6 additions & 2 deletions contracts/registry/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -715,6 +715,7 @@ impl Contract {
let ret_token_ids = (token..token + num_tokens).collect();
let mut supply_by_class = HashMap::new();
let mut per_recipient: HashMap<AccountId, Vec<TokenId>> = HashMap::new();
let now = env::block_timestamp_ms();

for (owner, metadatas) in token_spec {
// no need to check ongoing_soult_tx, because it will automatically ban the source account
Expand All @@ -723,8 +724,11 @@ impl Contract {
let recipient_tokens = per_recipient.entry(owner.clone()).or_default();
let metadatas_len = metadatas.len();

for metadata in metadatas {
for mut metadata in metadatas {
require!(metadata.class > 0, "Class must be > 0");
if metadata.issued_at.is_none() {
metadata.issued_at = Some(now);
}
let prev = self.balances.insert(
&balance_key(owner.clone(), issuer_id, metadata.class),
&token,
Expand Down Expand Up @@ -937,7 +941,7 @@ mod tests {
fn mk_metadata(class: ClassId, expires_at: Option<u64>) -> TokenMetadata {
TokenMetadata {
class,
issued_at: None,
issued_at: Some(START),
expires_at,
reference: Some("abc".to_owned()),
reference_hash: Some(vec![61, 61].into()),
Expand Down

0 comments on commit 2dfabcb

Please sign in to comment.