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

fix: add delegation token id #1453

Closed
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -71,6 +71,11 @@ module iota_identity::controller {
self.permissions
}

/// Returns the ID of this `DelegationToken`.
public fun delegation_token_id(self: &DelegationToken): &UID {
&self.id
}

/// Returns true if this `DelegationToken` has permission `permission`.
public fun has_permission(self: &DelegationToken, permission: u32): bool {
self.permissions & permission != 0
Expand Down
20 changes: 10 additions & 10 deletions identity_iota_core/packages/iota_identity/sources/identity.move
Original file line number Diff line number Diff line change
Expand Up @@ -181,7 +181,7 @@ module iota_identity::identity {
self.execute_deactivation(cap, proposal_id, clock, ctx);
option::none()
} else {
emit_proposal_event(self.id().to_inner(), cap.id().to_inner(), proposal_id, false);
emit_proposal_event(self.id().to_inner(), cap.delegation_token_id().to_inner(), proposal_id, false);
option::some(proposal_id)
}
}
Expand All @@ -202,7 +202,7 @@ module iota_identity::identity {
self.did_doc.set_controlled_value(vector[]);
self.updated = clock.timestamp_ms();

emit_proposal_event(self.id().to_inner(), cap.id().to_inner(), proposal_id, true);
emit_proposal_event(self.id().to_inner(), cap.delegation_token_id().to_inner(), proposal_id, true);
}

/// Proposes an update to the DID Document contained in this `Identity`.
Expand Down Expand Up @@ -232,7 +232,7 @@ module iota_identity::identity {
self.execute_update(cap, proposal_id, clock, ctx);
option::none()
} else {
emit_proposal_event(self.id().to_inner(), cap.id().to_inner(), proposal_id, false);
emit_proposal_event(self.id().to_inner(), cap.delegation_token_id().to_inner(), proposal_id, false);
option::some(proposal_id)
}
}
Expand All @@ -253,7 +253,7 @@ module iota_identity::identity {
);

self.updated = clock.timestamp_ms();
emit_proposal_event(self.id().to_inner(), cap.id().to_inner(), proposal_id, true);
emit_proposal_event(self.id().to_inner(), cap.delegation_token_id().to_inner(), proposal_id, true);
}

/// Proposes to update this `Identity`'s AC.
Expand Down Expand Up @@ -287,7 +287,7 @@ module iota_identity::identity {
self.execute_config_change(cap, proposal_id, ctx);
option::none()
} else {
emit_proposal_event(self.id().to_inner(), cap.id().to_inner(), proposal_id, false);
emit_proposal_event(self.id().to_inner(), cap.delegation_token_id().to_inner(), proposal_id, false);
option::some(proposal_id)
}
}
Expand All @@ -305,7 +305,7 @@ module iota_identity::identity {
proposal_id,
ctx,
);
emit_proposal_event(self.id().to_inner(), cap.id().to_inner(), proposal_id, true);
emit_proposal_event(self.id().to_inner(), cap.delegation_token_id().to_inner(), proposal_id, true);
}

/// Proposes the transfer of a set of objects owned by this `Identity`.
Expand All @@ -325,7 +325,7 @@ module iota_identity::identity {
recipients,
ctx
);
emit_proposal_event(self.id().to_inner(), cap.id().to_inner(), proposal_id, false);
emit_proposal_event(self.id().to_inner(), cap.delegation_token_id().to_inner(), proposal_id, false);
}

/// Sends one object among the one specified in a `Send` proposal.
Expand Down Expand Up @@ -355,7 +355,7 @@ module iota_identity::identity {
identity_address,
ctx,
);
emit_proposal_event(self.id().to_inner(), cap.id().to_inner(), proposal_id, false);
emit_proposal_event(self.id().to_inner(), cap.delegation_token_id().to_inner(), proposal_id, false);
}

/// Takes one of the borrowed assets.
Expand All @@ -375,7 +375,7 @@ module iota_identity::identity {
expiration: Option<u64>,
new_controller_addr: address,
voting_power: u64,
ctx: &mut TxContext,
ctx: &mut TxContext,
): Option<ID> {
let mut new_controllers = vec_map::empty();
new_controllers.insert(new_controller_addr, voting_power);
Expand All @@ -390,7 +390,7 @@ module iota_identity::identity {
proposal_id: ID,
ctx: &mut TxContext,
): Action<T> {
emit_proposal_event(self.id().to_inner(), cap.id().to_inner(), proposal_id, true);
emit_proposal_event(self.id().to_inner(), cap.delegation_token_id().to_inner(), proposal_id, true);
self.did_doc.execute_proposal(cap, proposal_id, ctx)
}

Expand Down
Loading