Skip to content
Testnet

Organizations ​

One registry holds every organization. It is not upgradeable. version() is 3. Call name() for the label. The name is UTN Organizations.

Installed on testnet: 0xD8e6dCEd3a78B510be5fa351E6faA07EE6D3C424

That address is organizations in /utn-config.js. It is the CREATE2 address of this source. A change to the contract source, including a comment, changes the bytecode and therefore the CREATE2 address.

The interface in the repository is IOrganizations. Registering is Register a company. What an owner, an admin, and a member are is on Organizations.

Register ​

CallWhat it does
register(string orgName)Returns an id and a new organization account. The caller becomes the owner.
profile(uint256 id)The profile struct: name, country, registration number, website, logo, contact email, email domain, role bitmask, owner, and account. Scan uses this for the organization page and the list.
orgsByCountry(bytes2 country)Organization ids with that ISO 3166-1 alpha-2 country. Scan's country filter calls this.
orgsByRole(uint8 roleIndex)Organization ids that declared that network role. Index 0 is Manufacturer, then Importer, Distributor, Exporter, Service / Repairer, Recycler.
metadata(uint256 id, bytes32 key)One metadata value. Scan lists values from MetadataSet.
orgOf(address account)The id for an account. 0 means the address is not an organization.
accountOf(uint256 id)The organization account for an id.
orgCount()How many organizations have been registered.

People ​

CallWhat it does
members(uint256 id)The member accounts.
isAdmin(uint256 id, address account)True for the owner and for an admin.
isMember(uint256 id, address account)True while the account is a member.
setAdmin / addMember / removeMemberThe owner and admins manage people.
leave(uint256 id)The caller leaves. The owner cannot.
acceptInvite / cancelInviteA signed invite adds the caller. The owner or an admin can revoke the nonce. See Membership.
setRole / grantRole / revokeRoleNamed roles. There is no list function. Scan reads RoleSet and MemberRoleSet.
hasRole(uint256 id, bytes32 role, address account)True when that role is enabled for the account.

The organization account itself exposes owner(), isAdmin(address), and hasRole(bytes32,address). Those read the registry. Pass the account address into OrgGate and into a template constructor.

Vault and act ​

CallWhat it does
send coins to the accountAnyone. The account emits Deposit.
withdraw(uint256 id, address to, uint256 amount)Owner only.
setAllowance(uint256 id, address member, uint256 amount, uint256 period)Gas refund cap. Period 0 does not reset.
allowanceLeft(uint256 id, address member)What remains.
act(uint256 id, address target, uint256 value, bytes data)The organization account calls target. The vault refunds the payer up to the allowance.

act emits ActedOnBehalf(uint256 indexed orgId, address indexed member, address indexed target, bytes4 selector, uint256 cost). Scan uses that event. The cost is the amount actually refunded.

Verification ​

LevelverificationLevel
0None
1Test
2Basic
3Enhanced

A verifier calls setVerificationLevel. Scan shows a shield when the level is above 0, with the level name: Test, Basic, or Enhanced. The registry owner grants and revokes verifiers and does not move funds or edit members.

profile(uint256) returns the current profile. Country is an ISO 3166-1 alpha-2 code in bytes2. Network roles are a bitmask. Bit 0 is Manufacturer, then Importer, Distributor, Exporter, Service / Repairer, Recycler. Any subset is valid, including none. The owner declares them. Scan shows the flag and country name, the role names, whether those roles are verified, the website, the logo, the contact email, and the registration number when the profile has them. The list filters call orgsByCountry and orgsByRole.

verifiedRoles(address) is the mask a verifier approved. It matches the declared roles at the moment setVerificationLevel set a non-zero level. Scan prints Verified on each role in that mask.

setProfile emits ProfileSet for the name, country, registration number, email domain, and roles, and ProfileDetailsSet for the website, logo, and contact email. setMetadata emits MetadataSet. Changing the name, country, registration number, email domain, or roles resets verification to none and clears verifiedRoles. Website, logo, contact email, and metadata do not.

A verifier approves the organization only when documents cover every declared role. That check is off chain. The contract stores one level and one mask for the whole set.

T-RAIN · chain 20261021