Skip to main content

Registry

Registry#

Maintains a whitelist of financial contract creators that are allowed to register new financial contracts and stores party members of a financial contract.

Functions#

constructor() (public)

Construct the Registry contract.

registerContract(address[] parties, address contractAddress) (external)

Registers a new financial contract.

Only authorized contract creators can call this method.

Parameters:#

  • parties: array of addresses who become parties in the contract.
  • contractAddress: address of the contract against which the parties are registered.
addPartyToContract(address party) (external)

Adds a party member to the calling contract.

msg.sender will be used to determine the contract that this party is added to.

Parameters:#

  • party: new party for the calling contract.
removePartyFromContract(address partyAddress) (external)

Removes a party member from the calling contract.

msg.sender will be used to determine the contract that this party is removed from.

Parameters:#

  • partyAddress: address to be removed from the calling contract.
isContractRegistered(address contractAddress) โ†’ bool (external)

Returns whether the contract has been registered with the registry.

If it is registered, it is an authorized participant in the UMA system.

Parameters:#

  • contractAddress: address of the financial contract.
getRegisteredContracts(address party) โ†’ address[] (external)

Returns a list of all contracts that are associated with a particular party.

Parameters:#

  • party: address of the party.
getAllRegisteredContracts() โ†’ address[] (external)

Returns all registered contracts.

isPartyMemberOfContract(address party, address contractAddress) โ†’ bool (public)

checks if an address is a party of a contract.

Parameters:#

  • party: party to check.
  • contractAddress: address to check against the party.
_addPartyToContract(address party, address contractAddress) (internal)
holdsRole(uint256 roleId, address memberToCheck) โ†’ bool (public)

Whether memberToCheck is a member of roleId.

Reverts if roleId does not correspond to an initialized role.

Parameters:#

  • roleId: the Role to check.
  • memberToCheck: the address to check.
resetMember(uint256 roleId, address newMember) (public)

Changes the exclusive role holder of roleId to newMember.

Reverts if the caller is not a member of the managing role for roleId or if roleId is not an initialized, ExclusiveRole.

Parameters:#

  • roleId: the ExclusiveRole membership to modify.
  • newMember: the new ExclusiveRole member.
getMember(uint256 roleId) โ†’ address (public)

Gets the current holder of the exclusive role, roleId.

Reverts if roleId does not represent an initialized, exclusive role.

Parameters:#

  • roleId: the ExclusiveRole membership to check.
addMember(uint256 roleId, address newMember) (public)

Adds newMember to the shared role, roleId.

Reverts if roleId does not represent an initialized, SharedRole or if the caller is not a member of the managing role for roleId.

Parameters:#

  • roleId: the SharedRole membership to modify.
  • newMember: the new SharedRole member.
removeMember(uint256 roleId, address memberToRemove) (public)

Removes memberToRemove from the shared role, roleId.

Reverts if roleId does not represent an initialized, SharedRole or if the caller is not a member of the managing role for roleId.

Parameters:#

  • roleId: the SharedRole membership to modify.
  • memberToRemove: the current SharedRole member to remove.
renounceMembership(uint256 roleId) (public)

Removes caller from the role, roleId.

Reverts if the caller is not a member of the role for roleId or if roleId is not an initialized, SharedRole.

Parameters:#

  • roleId: the SharedRole membership to modify.
_createSharedRole(uint256 roleId, uint256 managingRoleId, address[] initialMembers) (internal)

Internal method to initialize a shared role, roleId, which will be managed by managingRoleId. initialMembers will be immediately added to the role.

Should be called by derived contracts, usually at construction time. Will revert if the role is already initialized.

_createExclusiveRole(uint256 roleId, uint256 managingRoleId, address initialMember) (internal)

Internal method to initialize an exclusive role, roleId, which will be managed by managingRoleId. initialMember will be immediately added to the role.

Should be called by derived contracts, usually at construction time. Will revert if the role is already initialized.

Events#

NewContractRegistered(address contractAddress, address creator, address[] parties)
PartyAdded(address contractAddress, address party)
PartyRemoved(address contractAddress, address party)
ResetExclusiveMember(uint256 roleId, address newMember, address manager)
AddedSharedMember(uint256 roleId, address newMember, address manager)
RemovedSharedMember(uint256 roleId, address oldMember, address manager)

Modifiers#

onlyRoleHolder(uint256 roleId)

Reverts unless the caller is a member of the specified roleId.

onlyRoleManager(uint256 roleId)

Reverts unless the caller is a member of the manager role for the specified roleId.

onlyExclusive(uint256 roleId)

Reverts unless the roleId represents an initialized, exclusive roleId.

onlyShared(uint256 roleId)

Reverts unless the roleId represents an initialized, shared roleId.

onlyValidRole(uint256 roleId)

Reverts if roleId is not initialized.

onlyInvalidRole(uint256 roleId)

Reverts if roleId is initialized.