Skip to content

Commit

Permalink
update utils
Browse files Browse the repository at this point in the history
  • Loading branch information
Daniel Lima committed Oct 23, 2023
1 parent 285bd65 commit e87422c
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions src/utils/helper.ts
Original file line number Diff line number Diff line change
Expand Up @@ -56,10 +56,11 @@ export function findOrCreateRoleAssignment(
}

export function findOrCreateRole(nft: Nft, roleHash: Bytes): Role {
let role = Role.load(generateRoleId(nft, roleHash))
const roleId = generateRoleId(nft, roleHash)
let role = Role.load(roleId)

if (!role) {
role = new Role(generateRoleId(nft, roleHash))
role = new Role(roleId)
role.roleHash = roleHash
role.nft = nft.id
role.save()
Expand Down

0 comments on commit e87422c

Please sign in to comment.