ATTRIBUTE¶
Overview¶
ATTRIBUTE is the user attribute storage library. It manages key-value attributes for users identified by Soul ID, supporting both generic attributes and address/Bao aliases.
- Kind: Contract
- License: Sharia
- Solidity: ^0.8.21
- Source:
lib/attribute.sol
Inheritance Chain (C3 Linearized)¶
- self — ATTRIBUTE
- DYSNOMIA
- MultiOwnable
Immediate Parents¶
What This Means For Players¶
Plain English Summary: ATTRIBUTE is your player profile storage - it saves your username, aliases, and other settings. When you set your username or create nicknames for addresses, ATTRIBUTE stores them permanently linked to your Soul ID.
Real-World Analogy: Think of ATTRIBUTE like the settings menu in a video game. You can set your display name, create shortcuts for frequently-used addresses (like saving contacts in your phone), and the game remembers all your preferences.
How It Affects Your Gameplay: - Username storage - Your display name is stored here - Address aliases - Give nicknames to addresses like "My Wallet" or "Bob's LAU" - Soul-linked - All data is tied to your Soul ID, not your wallet address - Length limits - Usernames max 64 chars, aliases max 32 chars
State Variables¶
| Variable | Type | Visibility | Mutability | Initial Value | NatSpec |
|---|---|---|---|---|---|
Type |
string |
public | constant | LibAttribute |
|
Void |
VOID |
public | mutable | `` | |
_attributes |
mapping(string => uint8) |
private | mutable | `` | |
_userAttributes |
mapping(uint64 => mapping(string => string)) |
private | mutable | `` | |
_userGrades |
mapping(uint64 => mapping(address => string)) |
private | mutable | `` |
Errors¶
| Error | Parameters | NatSpec |
|---|---|---|
MaximumLength |
string value, uint256 length, uint8 maxLength | |
AttributeNotFound |
string name | |
AliasNotFound |
address name |
Constructor¶
constructor¶
constructor(address VoidAddress) DYSNOMIA(unicode"CHATLOG LibAttribute", unicode"LibAttribute", address(DYSNOMIA(VoidAddress).Xiao()))
- Modifiers:
DYSNOMIA(unicode"CHATLOG LibAttribute", unicode"LibAttribute", address(DYSNOMIA(VoidAddress).Xiao())) - Parameters: address VoidAddress
Functions¶
External & Public¶
addAttribute¶
- Visibility: public
- Modifiers:
onlyOwners - Parameters: string memory name, uint8 maxLength
removeAttribute¶
- Visibility: public
- Modifiers:
onlyOwners - Parameters: string memory name
Set¶
- Visibility: public
- Modifiers:
onlyOwners - Parameters: uint64 Soul, string memory name, string memory value
Get¶
- Visibility: public
- State Mutability: view
- Modifiers:
onlyOwners - Parameters: uint64 Soul, string memory name
- Returns: string memory _a
Alias¶
- Visibility: public
- Modifiers:
onlyOwners - Parameters: uint64 Soul, address name, string memory value
Alias¶
- Visibility: public
- State Mutability: view
- Modifiers:
onlyOwners - Parameters: uint64 Soul, address name
- Returns: string memory _a
Alias¶
- Visibility: public
- Modifiers:
onlyOwners - Parameters: uint64 Soul, Bao memory entity, string memory value
Alias¶
- Visibility: public
- State Mutability: view
- Modifiers:
onlyOwners - Parameters: uint64 Soul, Bao memory entity
- Returns: string memory _a
Inherited Members¶
This contract inherits the members below from its parents. See each parent's dedicated MD for full signatures, NatSpec, and semantics.
From DYSNOMIA¶
External & Public Functions
| Function | Signature | State Mutability |
|---|---|---|
Rename |
function Rename(string memory newName, string memory newSymbol) public onlyOwners |
nonpayable |
mintToCap |
function mintToCap() public onlyOwners |
nonpayable |
GetMarketRate |
function GetMarketRate(address _a) public view returns (uint256) |
view |
Purchase |
function Purchase(address _t, uint256 _a) public |
nonpayable |
Redeem |
function Redeem(address _t, uint256 _a) public |
nonpayable |
name |
function name() public view virtual returns (string memory) |
view |
symbol |
function symbol() public view virtual returns (string memory) |
view |
decimals |
function decimals() public view virtual returns (uint8) |
view |
totalSupply |
function totalSupply() public view virtual returns (uint256) |
view |
balanceOf |
function balanceOf(address account) public view virtual returns (uint256) |
view |
transfer |
function transfer(address to, uint256 value) public virtual returns (bool) |
nonpayable |
allowance |
function allowance(address owner, address spender) public view virtual returns (uint256) |
view |
approve |
function approve(address spender, uint256 value) public virtual returns (bool) |
nonpayable |
transferFrom |
function transferFrom(address from, address to, uint256 value) public virtual returns (bool) |
nonpayable |
Internal Functions
| Function | Signature |
|---|---|
_mintToCap |
function _mintToCap() internal |
AddMarketRate |
function AddMarketRate(address _a, uint256 _r) internal |
_transfer |
function _transfer(address from, address to, uint256 value) internal |
_update |
function _update(address from, address to, uint256 value) internal virtual |
_mint |
function _mint(address account, uint256 value) internal |
_approve |
function _approve(address owner, address spender, uint256 value) internal |
_spendAllowance |
function _spendAllowance(address owner, address spender, uint256 value) internal virtual |
log10 |
function log10(uint256 value) internal pure returns (uint256) |
String |
function String(uint256 value) internal pure returns (string memory buffer) |
Hex |
function Hex(address account) internal pure returns (string memory) |
Events
| Event | Parameters |
|---|---|
Transfer |
address indexed from, address indexed to, uint256 value |
Approval |
address indexed owner, address indexed spender, uint256 value |
Errors
| Error | Parameters |
|---|---|
MarketRateNotFound |
address asset |
DysnomiaInsufficientBalance |
address origin, address sender, address from, address to, address what, uint256 balance, uint256 needed |
DysnomiaInsufficientAllowance |
address origin, address sender, address owner, address spender, address what, uint256 allowance, uint256 needed |
State Variables (private parent storage is not reachable and is omitted)
| Variable | Type | Visibility | Mutability |
|---|---|---|---|
__name |
string |
internal | mutable |
__symbol |
string |
internal | mutable |
MotzkinPrime |
uint64 |
public | constant |
Xiao |
atropaMath |
public | mutable |
maxSupply |
uint256 |
public | mutable |
From MultiOwnable¶
External & Public Functions
| Function | Signature | State Mutability |
|---|---|---|
owner |
function owner() external view virtual returns (address) |
view |
renounceOwnership |
function renounceOwnership(address toRemove) public virtual onlyOwners |
nonpayable |
addOwner |
function addOwner(address newOwner) public virtual onlyOwners |
nonpayable |
Internal Functions
| Function | Signature |
|---|---|
_checkOwner |
function _checkOwner() internal view virtual |
_changeOwnership |
function _changeOwnership(address cOwner, bool cState) internal virtual |
Events
| Event | Parameters |
|---|---|
OwnershipUpdate |
address indexed newOwner, bool indexed state |
Errors
| Error | Parameters |
|---|---|
OwnableUnauthorizedAccount |
address origin, address account, address what |
OwnableInvalidOwner |
address origin, address owner, address what |
Modifiers
| Modifier | Parameters |
|---|---|
onlyOwners |
(none) |
Contract Interactions¶
Depends On¶
Registered In¶
- VOID library registry as "libattribute"
Used By¶
- VOID - User attribute operations
Special Mechanisms¶
Attribute Validation¶
Only registered attribute names can be used:
Length Limits¶
- Attributes: 64 character maximum
- Aliases: 32 character maximum
if(bytes(value).length > 64) revert MaximumLength(64, value);
if(bytes(value).length > 32) revert MaximumLength(32, value);
Default Attributes¶
Constructor registers: - "Username" - User's display name - "TestAttribute" - For testing
Soul-Indexed Storage¶
All data is indexed by Soul ID (uint64), not by address:
Usage Pattern¶
// Via VOID (user context)
void.SetAttribute("Username", "Alice");
string memory name = void.GetAttribute("Username");
void.Alias(someAddress, "Bob's Wallet");
// Direct (admin context)
attribute.addAttribute("CustomField");
attribute.Set(soul, "CustomField", "CustomValue");
Storage Structure¶
_attributes:
├── "Username" → true
├── "TestAttribute" → true
└── "CustomField" → true
_userAttributes:
├── Soul123:
│ ├── "Username" → "Alice"
│ └── "TestAttribute" → "hello"
└── Soul456:
└── "Username" → "Bob"
_userGrades:
├── Soul123:
│ └── 0x1234... → "My Wallet"
└── Soul456:
└── 0xABCD... → "Treasury"
Contract Verification¶
| Property | Value |
|---|---|
| Keccak256 Hash | 0xf999af65b81710496e2a8c6cfba3d2794539b54bd0fe4481b4b56b5e5a44efa1 |
| Source URL | https://raw.githubusercontent.com/busytoby/atropa_pulsechain/main/solidity/dysnomia/lib/attribute.sol |
| Hash Generated | 2026-04-17T20:48:16Z |