From e87422cdb4d6d20d0605922e5ec9f6a3029175b8 Mon Sep 17 00:00:00 2001 From: Daniel Lima Date: Mon, 23 Oct 2023 12:13:40 -0300 Subject: [PATCH] update utils --- src/utils/helper.ts | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/src/utils/helper.ts b/src/utils/helper.ts index 6a34b86..2c65c04 100644 --- a/src/utils/helper.ts +++ b/src/utils/helper.ts @@ -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()