Skip to content

Version 0.3.0 - Composability w/Tracker Tokens (ERC1155Tracker)

Pre-release
Pre-release
Compare
Choose a tag to compare
@toledoroy toledoroy released this 17 Jun 21:35
· 207 commits to main since this release

Summary

Roles will now be assigned to tokens instead of accounts (using ERC1155Tracker)

Jurisdiction & Case roles will be attached to existing Avatar tokens

  • Accounts must have an Avatar to receive a role
  • Roles track the Avatar token owner [TBT]

Added Functionality

Role for Token

Cases & Jurisdictions would now assign roles to Avatar tokens instead of accounts. Allowing to assign roles to un-owned tokens & track the owner once Avatars are claimed.

This change is backward compatible and existing functionality is maintained. However, still prefer to use Token ID instead of account for fully support all profile types.

/// Assign Tethered Token to a Role
function roleAssignToToken(uint256 toToken, string memory role) external;

/// Remove Tethered Token from a Role
function roleRemoveFromToken(uint256 ownerToken, string memory role) external;

Added Transfer Events

/// Single Token Transfer
event TransferByToken(address indexed operator, uint256 indexed fromOwnerToken, uint256 indexed toOwnerToken, uint256 id, uint256 value);

/// Batch Token Transfer
event TransferBatchByToken(
    address indexed operator,
    uint256 indexed fromOwnerToken, 
    uint256 indexed toOwnerToken,
    uint256[] ids,
    uint256[] values
);

Contract URI

Cases & Jurisdictions now have a function for setting contract URI (by admin)

await caseContract.setContractURI("IPFS_URI");

Event

emit ContractURI(uri);

Secondary Avatar Owners

/// Map Account to Existing Token
function tokenOwnerAdd(address owner, uint256 tokenId) external;

/// Remove Account from Existing Token
function tokenOwnerRemove(address owner, uint256 tokenId) external;

Event

 Emits a faux Transfer() event (burn or mint)

Functionality Changes

Case Maker

New cases will now receive a URI parameter and no symbol

/// Make a new Case
function caseMake(
    string calldata name_, 
    string calldata uri_, 
    DataTypes.RuleRef[] calldata addRules, 
    DataTypes.InputRoleToken[] calldata assignRoles, 
    PostInput[] calldata posts
) external returns (address);

function caseMakeOpen(
    string calldata name_, 
    string calldata uri_, 
    DataTypes.RuleRef[] calldata addRules, 
    DataTypes.InputRoleToken[] calldata assignRoles, 
    PostInput[] calldata posts
) external returns (address);

Example

    let ruleRefArr = [
        {
          jurisdiction: jurisdictionContract.address, 
          ruleId: 1,
        }
      ];

      let roleRefArr = [
        {
          role: "subject",
          tokenId: user1SoulId,
        },
        {
          role: "witness",
          tokenId: user2SoulId,
        }
      ];

      let posts = [
        {
          entRole: "admin",
          uri: test_uri,
        }
      ];

    let caseAddr = await jurisdictionContract.caseMake("CASE_NAME", "IPFS_URI", ruleRefArr, roleRefArr, posts);