### Verify MkDocs Installation Source: https://github.com/aboutcircles/circles-contracts-v2/blob/beta/docs/README.md Check if MkDocs has been installed correctly by verifying its version. This command confirms the installation. ```bash mkdocs --version ``` -------------------------------- ### Install Project Dependencies Source: https://github.com/aboutcircles/circles-contracts-v2/blob/beta/README.md Install the necessary dependencies for the Circles contracts project using Forge. Ensure you have Forge installed as a prerequisite. ```bash forge install ``` -------------------------------- ### Install NPM Dependencies for Deployment Source: https://github.com/aboutcircles/circles-contracts-v2/blob/beta/README.md Install Node.js dependencies required for the deployment scripts. This should be run before executing the mainnet deployment script. ```bash npm install ``` -------------------------------- ### Install MkDocs with Conda Source: https://github.com/aboutcircles/circles-contracts-v2/blob/beta/docs/README.md Install MkDocs and its dependencies from the conda-forge channel using a requirements file. This command should be run after activating the conda environment. ```bash conda install -c conda-forge --file requirements.txt ``` -------------------------------- ### Solidity ERC20 Wrapping (Lift) Example Source: https://context7.com/aboutcircles/circles-contracts-v2/llms.txt Demonstrates wrapping ERC1155 Circles tokens into ERC20 format using the Hub contract. Shows how to wrap with Demurrage or Inflation types, and how to unwrap. ```solidity // CirclesType enum enum CirclesType { Demurrage, Inflation } // Wrap Circles into ERC20 via Hub address erc20Wrapper = hub.wrap( avatarAddress, // Circles avatar to wrap amount, // amount to wrap CirclesType.Demurrage // or CirclesType.Inflation ); // Alternative: Ensure ERC20 wrapper exists then transfer directly ERC20Lift lift = ERC20Lift(LIFT_ADDRESS); address demurrageERC20 = lift.ensureERC20(avatarAddress, CirclesType.Demurrage); address inflationaryERC20 = lift.ensureERC20(avatarAddress, CirclesType.Inflation); // Transfer ERC1155 to wrapper contract to wrap hub.safeTransferFrom( msg.sender, demurrageERC20, toTokenId(avatarAddress), amount, "" ); // Unwrap back to ERC1155 DemurrageCircles(demurrageERC20).unwrap(amount); InflationaryCircles(inflationaryERC20).unwrap(amount); // Query wrapped balance uint256 balance = IERC20(demurrageERC20).balanceOf(userAddress); // Events emitted: // ERC20WrapperDeployed(address indexed avatar, address indexed erc20Wrapper, CirclesType circlesType) // DepositDemurraged(address indexed account, uint256 amount, uint256 inflationaryAmount) // WithdrawDemurraged(address indexed account, uint256 amount, uint256 inflationaryAmount) ``` -------------------------------- ### Solidity Flow Matrix Components and Example Source: https://context7.com/aboutcircles/circles-contracts-v2/llms.txt Defines the structures for Flow Matrix, enabling multi-hop transfers through trust networks. Includes an example of Alice sending tokens to David through Bob and Charlie. ```solidity // Flow Matrix components struct FlowEdge { uint16 streamSinkId; // 0 for non-terminal, >0 references stream uint192 amount; // transfer amount } struct Stream { uint16 sourceCoordinate; // index of sender in flowVertices uint16[] flowEdgeIds; // terminal flow edge indices bytes data; // data for receiver's acceptance call } // Example: Alice sends to David through Bob and Charlie // Trust graph: Alice <- Bob <-> Charlie <-> David address[] memory flowVertices = new address[](4); flowVertices[0] = alice; // coordinate 0 flowVertices[1] = bob; // coordinate 1 flowVertices[2] = charlie; // coordinate 2 flowVertices[3] = david; // coordinate 3 // Note: must be sorted in ascending address order FlowEdge[] memory flow = new FlowEdge[](3); flow[0] = FlowEdge({streamSinkId: 0, amount: 100}); // Alice -> Bob (Alice's CRC) flow[1] = FlowEdge({streamSinkId: 0, amount: 100}); // Bob -> Charlie (Bob's CRC) flow[2] = FlowEdge({streamSinkId: 1, amount: 100}); // Charlie -> David (terminal) // Coordinates: packed as bytes, 6 bytes per edge (3 x uint16) // Each triplet: (circlesId, sender, receiver) as indices into flowVertices bytes memory packedCoordinates = abi.encodePacked( uint16(0), uint16(0), uint16(1), // Alice's CRC, Alice -> Bob uint16(1), uint16(1), uint16(2), // Bob's CRC, Bob -> Charlie uint16(2), uint16(2), uint16(3) // Charlie's CRC, Charlie -> David ); Stream[] memory streams = new Stream[](1); uint16[] memory edgeIds = new uint16[](1); edgeIds[0] = 2; // terminal edge index streams[0] = Stream({ sourceCoordinate: 0, // Alice is source flowEdgeIds: edgeIds, data: "" }); // Execute the path transfer hub.operateFlowMatrix(flowVertices, flow, streams, packedCoordinates); // Events emitted: // FlowEdgesScopeSingleStarted(uint256 indexed flowEdgeId, uint16 streamId) // FlowEdgesScopeLastEnded() // StreamCompleted(address indexed operator, address indexed from, address indexed to, uint256[] ids, uint256[] amounts) ``` -------------------------------- ### Create and Activate Conda Environment Source: https://github.com/aboutcircles/circles-contracts-v2/blob/beta/docs/README.md Use this command to create a new conda environment for the project and activate it. Ensure Python 3.9 is installed. ```bash conda create --name protocol-docs python=3.9 conda activate protocol-docs ``` -------------------------------- ### Clone Circles Contracts Repository Source: https://github.com/aboutcircles/circles-contracts-v2/blob/beta/README.md Clone the Circles contracts v2 repository to your local machine. This is the first step before installing dependencies and building the project. ```bash git clone https://github.com/aboutcircles/circles-contracts-v2 cd circles-contracts-v2 ``` -------------------------------- ### Day Calculation Function Source: https://github.com/aboutcircles/circles-contracts-v2/blob/beta/docs/docs/advanced-topics/inflation-demurrage.md Converts a Unix timestamp into a 'day' number relative to a fixed starting point ('inflationDayZero'). This day number is used in demurrage calculations. ```Solidity function day(uint256 timestamp) internal view returns (uint64) { return uint64((timestamp - inflationDayZero) / 1 days); } ``` -------------------------------- ### Serve MkDocs Documentation Locally Source: https://github.com/aboutcircles/circles-contracts-v2/blob/beta/docs/README.md Preview the documentation locally by running the MkDocs serve command. Access the preview at http://localhost:8000. ```bash mkdocs serve ``` -------------------------------- ### Build MkDocs Documentation Source: https://github.com/aboutcircles/circles-contracts-v2/blob/beta/docs/README.md Generate static HTML files for the documentation by running the MkDocs build command. The output will be in the 'site/' directory. ```bash mkdocs build ``` -------------------------------- ### Compile Contracts with Forge Source: https://github.com/aboutcircles/circles-contracts-v2/blob/beta/README.md Compile the smart contracts for the Circles Protocol using the Forge build command. This step is necessary before testing or deploying. ```bash forge build ``` -------------------------------- ### Deploy to Chiado Testnet Source: https://github.com/aboutcircles/circles-contracts-v2/blob/beta/README.md Deploy the Circles contracts to the Chiado testnet. This script requires setting up environment variables for private keys and API keys. ```bash ./script/deployments/chiadoDeploy.sh ``` -------------------------------- ### Deploy to Gnosis Chain Mainnet Source: https://github.com/aboutcircles/circles-contracts-v2/blob/beta/README.md Execute the mainnet deployment script for the Circles Protocol on Gnosis Chain. Ensure your `.env` file is configured with the necessary private key. ```bash cd script/deployments ./gnosisChainDeploy.sh ``` -------------------------------- ### Solidity Migration Contract Interface and Usage Source: https://context7.com/aboutcircles/circles-contracts-v2/llms.txt Defines the interface for migrating v1 Circles tokens to v2. Shows how to approve tokens, prepare migration arrays, execute the migration, and preview conversion rates. ```solidity // Migration contract interface interface IMigration { function migrate(address[] calldata avatars, uint256[] calldata amounts) external returns (uint256[] memory); function convertFromV1ToDemurrage(uint256 amount) external view returns (uint256); } Migration migration = Migration(MIGRATION_ADDRESS); // First approve v1 tokens for the migration contract ITokenV1(v1TokenAddress).approve(address(migration), amount); // Prepare arrays for migration address[] memory avatars = new address[](1); avatars[0] = v1AvatarAddress; uint256[] memory amounts = new uint256[](1); amounts[0] = 1000 * 10**18; // v1 inflationary amount // Execute migration uint256[] memory convertedAmounts = migration.migrate(avatars, amounts); // convertedAmounts contains demurraged v2 amounts // v1 tokens are locked in migration contract // v2 tokens are minted to msg.sender // Preview conversion rate uint256 v2Amount = migration.convertFromV1ToDemurrage(v1Amount); ``` -------------------------------- ### Checkout Release Candidate for Mainnet Deployment Source: https://github.com/aboutcircles/circles-contracts-v2/blob/beta/README.md Checkout the release candidate branch `rc-v1.0.0-beta` before deploying to the Gnosis Chain mainnet. This ensures you are deploying a stable version. ```bash git checkout rc-v1.0.0-beta ``` -------------------------------- ### Interact with Name Registry Source: https://context7.com/aboutcircles/circles-contracts-v2/llms.txt Use this to manage names, symbols, and metadata for avatars. Requires the NAME_REGISTRY_ADDRESS to be set. ```solidity INameRegistry nameRegistry = INameRegistry(NAME_REGISTRY_ADDRESS); // Register a short name (12 char base58) nameRegistry.registerShortName(); // Register with specific nonce nameRegistry.registerShortNameWithNonce(nonce); // Search for available short name (uint72 shortName, uint256 nonce) = nameRegistry.searchShortName(avatarAddress); // Update metadata digest (IPFS CID) nameRegistry.updateMetadataDigest( 0x1234567890abcdef1234567890abcdef1234567890abcdef1234567890abcdef ); // Query name and symbol string memory avatarName = nameRegistry.name(avatarAddress); string memory avatarSymbol = nameRegistry.symbol(avatarAddress); // Validate name/symbol format bool validName = nameRegistry.isValidName("MyCircles"); // max 32 bytes, ASCII bool validSymbol = nameRegistry.isValidSymbol("MYC"); // max 16 bytes // Events emitted: // RegisterShortName(address indexed avatar, uint72 shortName, uint256 nonce) // UpdateMetadataDigest(address indexed avatar, bytes32 metadataDigest) ``` -------------------------------- ### Query Balance with Discount Cost Source: https://context7.com/aboutcircles/circles-contracts-v2/llms.txt Retrieves the current balance of an owner's token and the associated discount cost for a given day. Requires the Hub contract, owner address, and token ID. ```Solidity // Query balance with discount cost (uint256 currentBalance, uint256 discountCost) = hub.balanceOfOnDay( ownerAddress, toTokenId(avatarAddress), day(block.timestamp) ); ``` -------------------------------- ### Generate Gas Report with Forge Source: https://github.com/aboutcircles/circles-contracts-v2/blob/beta/README.md Run the test suite and generate a gas report using Forge. This is useful for analyzing the gas consumption of contract functions. ```bash forge test --gas-report ``` -------------------------------- ### Run Test Suite with Forge Source: https://github.com/aboutcircles/circles-contracts-v2/blob/beta/README.md Execute the test suite for the Circles contracts using Forge. This command runs all defined tests to ensure contract functionality. ```bash forge test ``` -------------------------------- ### Mint Lookup Table (64x64 Fixed Int) Source: https://github.com/aboutcircles/circles-contracts-v2/blob/beta/specifications/TCIP009-demurrage.md This table provides pre-calculated values for mint calculations based on the number of days (n) over which minting occurs. These values are represented in a 64x64 fixed-point integer format for gas efficiency in Solidity. The table is derived from a daily demurrage rate of 7% p.a. ```plaintext n T(n) (up to 25 decimals) 64x64 Fixed Int (rounded) --------------------------------------------------------------------------- 0 24.0000000000000000000000000 442721857769029238784 1 47.9952319682063749783347218 885355760875826166476 2 71.9856968518744243107975483 1327901726794166863126 3 95.9713955980712580655108804 1770359772994355928788 4 119.9523291536758343901178951 2212729916943227173193 5 143.9284984653789968915466652 2655012176104144305282 6 167.8999044796835120083481164 3097206567937001622606 7 191.8665481429041063756092976 3539313109898224700583 8 215.8284304011675041824434382 3981331819440771081628 9 239.7855522004124645220582683 4423262714014130964135 10 263.7379144863898187344040757 4865105811064327891331 11 287.6855182046625077414029740 5306861128033919439986 12 311.6283643006056193747608561 5748528682361997908993 13 335.5664537194064256963635055 6190108491484191007805 14 359.4997874060644203112583400 6631600572832662544739 ``` -------------------------------- ### ERC1155 Balance Query with Discount Cost Source: https://github.com/aboutcircles/circles-contracts-v2/blob/beta/docs/docs/advanced-topics/inflation-demurrage.md Returns the demurraged balance for an account and token ID as of a specified day, along with the discount cost (tokens burned due to demurrage). ```Solidity function balanceOfOnDay(address account, uint256 id, uint64 day) public view returns (uint256 balance, uint256 discountCost) ``` -------------------------------- ### Flatten Source Code with Forge Source: https://github.com/aboutcircles/circles-contracts-v2/blob/beta/README.md Use this command to generate a single flattened source code file for a given Solidity file, which is often required for manual verification on block explorers like Gnosisscan. ```bash forge flatten ./src/hub/Hub.sol -o flattened_hub.sol ``` -------------------------------- ### Register Human Avatar Source: https://context7.com/aboutcircles/circles-contracts-v2/llms.txt Registers a new human avatar. Self-registration is possible during bootstrap, otherwise, an invitation from a trusted existing user is required. Inviter pays a fee and the new user receives a welcome bonus after the bootstrap period. ```solidity // Self-registration for stopped v1 users (during bootstrap period) // Pass address(0) as inviter to self-register hub.registerHuman( address(0), // inviter - zero address for self-registration bytes32(0) // metadataDigest - optional IPFS CIDv0 for avatar metadata ); // Registration via invitation // The inviter must have already trusted the new user // After bootstrap period: inviter pays 96 CRC, new user receives 48 CRC welcome bonus hub.registerHuman( inviterAddress, 0x1234567890abcdef1234567890abcdef1234567890abcdef1234567890abcdef // IPFS metadata hash ); // Events emitted: // RegisterHuman(address indexed avatar, address indexed inviter) ``` -------------------------------- ### Daily Demurrage Factor Calculation Source: https://github.com/aboutcircles/circles-contracts-v2/blob/beta/docs/docs/advanced-topics/inflation-demurrage.md Illustrates the approximate daily factor used to reduce token balances due to demurrage. This factor is derived from the annual rate of 7%. ```Shell Daily Factor = (1 - 0.07)^(1/365.25) ≈ 0.99980813 ``` -------------------------------- ### Implement Custom Mint Policy Source: https://context7.com/aboutcircles/circles-contracts-v2/llms.txt Extend the base mint policy interface to implement custom group minting rules. This contract provides hooks for beforeMintPolicy, beforeBurnPolicy, and beforeRedeemPolicy. ```solidity // SPDX-License-Identifier: AGPL-3.0-only pragma solidity >=0.8.24; import "@circles/circles-contracts-v2/src/groups/IMintPolicy.sol"; contract CustomMintPolicy is IMintPolicy { // Called before minting group Circles function beforeMintPolicy( address _minter, address _group, uint256[] calldata _collateral, uint256[] calldata _amounts, bytes calldata _data ) external override returns (bool) { // Custom validation logic // Return true to allow mint, false to reject // Example: require minimum collateral amount uint256 total = 0; for (uint256 i = 0; i < _amounts.length; i++) { total += _amounts[i]; } return total >= 100 * 10**18; // minimum 100 CRC } // Called before burning group Circles function beforeBurnPolicy( address _burner, address _group, uint256 _amount, bytes calldata _data ) external override returns (bool) { return true; // allow all burns } // Called when redeeming group Circles for collateral function beforeRedeemPolicy( address _operator, address _redeemer, address _group, uint256 _value, bytes calldata _data ) external override returns ( uint256[] memory redemptionIds, uint256[] memory redemptionValues, uint256[] memory burnIds, uint256[] memory burnValues ) { // Decode requested redemption from data BaseMintPolicyDefinitions.BaseRedemptionPolicy memory request = abi.decode(_data, (BaseMintPolicyDefinitions.BaseRedemptionPolicy)); // Return collateral to redeem and amounts to burn burnIds = new uint256[](0); burnValues = new uint256[](0); return (request.redemptionIds, request.redemptionValues, burnIds, burnValues); } } ``` -------------------------------- ### Calculate Day from Timestamp Source: https://context7.com/aboutcircles/circles-contracts-v2/llms.txt Calculates the number of days elapsed since a specific inflation day zero timestamp. Used for time-dependent balance calculations. ```Solidity // Day calculation from timestamp // inflationDayZero = 1602720000 (Oct 15, 2020 00:00:00 UTC) function day(uint256 timestamp) internal view returns (uint64) { return uint64((timestamp - inflationDayZero) / 1 days); } ``` -------------------------------- ### Establish Trust Relationships Source: https://context7.com/aboutcircles/circles-contracts-v2/llms.txt Manage trust relationships between avatars. Trust can be set indefinitely using `type(uint96).max` or for a specific duration. Revoke trust by setting the expiry to the current timestamp. Use `isTrusted` to check existing trust. ```solidity // Trust another avatar indefinitely uint96 INDEFINITE_FUTURE = type(uint96).max; hub.trust( trustedAddress, // address to trust INDEFINITE_FUTURE // expiry timestamp (max uint96 for indefinite) ); // Trust with expiration (1 year from now) uint96 oneYearFromNow = uint96(block.timestamp + 365 days); hub.trust( trustedAddress, oneYearFromNow ); // Revoke trust (set expiry to current time) hub.trust( previouslyTrustedAddress, uint96(block.timestamp) ); // Check if trust exists bool trusted = hub.isTrusted(trusterAddress, trusteeAddress); // Events emitted: // Trust(address indexed truster, address indexed trustee, uint256 expiryTime) ``` -------------------------------- ### Register Organization Avatar Source: https://context7.com/aboutcircles/circles-contracts-v2/llms.txt Registers an organization avatar. Organizations can join trust networks but cannot mint personal Circles. Requires a name and metadata digest. ```solidity // Register an organization hub.registerOrganization( "My Organization", // name - max 32 bytes, ASCII alphanumeric 0x1234567890abcdef1234567890abcdef1234567890abcdef1234567890abcdef // metadata digest ); // Events emitted: // RegisterOrganization(address indexed organization, string name) ``` -------------------------------- ### Base Mint Policy Contract Source: https://github.com/aboutcircles/circles-contracts-v2/blob/beta/docs/docs/architecture.md A reference implementation for group mint policies, allowing all mints/burns and user-specified collateral for redemptions. Developers can build custom policies based on this. ```Solidity contract BaseMintPolicy is IBaseMintPolicy { function beforeMint(address _group, address _to, uint256 _value, bytes calldata _data) external virtual override { // No-op } function beforeBurn(address _group, address _from, uint256 _value, bytes calldata _data) external virtual override { // No-op } function beforeRedeem(address _group, address _from, uint256 _value, bytes calldata _data) external virtual override { // No-op } } ``` -------------------------------- ### Custom Mint Policy API Source: https://context7.com/aboutcircles/circles-contracts-v2/llms.txt Implement custom group minting rules by extending the base mint policy interface. ```APIDOC ## Custom Mint Policy Implement custom group minting rules by extending the base mint policy interface. ### Interface This contract implements the `IMintPolicy` interface. ### Functions - **beforeMintPolicy(address _minter, address _group, uint256[] calldata _collateral, uint256[] calldata _amounts, bytes calldata _data)**: Called before minting group Circles. - Returns: `bool` - `true` to allow mint, `false` to reject. - Example logic: require minimum collateral amount. - **beforeBurnPolicy(address _burner, address _group, uint256 _amount, bytes calldata _data)**: Called before burning group Circles. - Returns: `bool` - `true` to allow burn, `false` to reject. - Default implementation allows all burns. - **beforeRedeemPolicy(address _operator, address _redeemer, address _group, uint256 _value, bytes calldata _data)**: Called when redeeming group Circles for collateral. - Decodes the requested redemption from `_data`. - Returns: `(uint256[] memory redemptionIds, uint256[] memory redemptionValues, uint256[] memory burnIds, uint256[] memory burnValues)` - Collateral to redeem and amounts to burn. ``` -------------------------------- ### Hub Contract - Core Entry Point Source: https://context7.com/aboutcircles/circles-contracts-v2/llms.txt The Hub contract serves as the central entry point for interacting with the Circles Protocol. It manages avatar registrations, personal currency minting, trust relationships, and group currencies, adhering to the ERC1155 standard. ```APIDOC ## Hub Contract - Core Entry Point ### Description The Hub contract is the central contract in the Circles ecosystem, managing avatar registration, personal currency minting, trust relationships, and group currencies. It implements the ERC1155 standard for multi-token handling. ### Interface ICirclesHub #### View Functions - **isHuman(address avatar)** (bool) - Checks if an avatar is registered as a human. - **isGroup(address avatar)** (bool) - Checks if an avatar is registered as a group. - **isOrganization(address avatar)** (bool) - Checks if an avatar is registered as an organization. - **isTrusted(address truster, address trustee)** (bool) - Checks if `truster` trusts `trustee`. - **avatars(address avatar)** (address) - Returns the address of the avatar. - **mintPolicies(address group)** (address) - Returns the mint policy address for a group. - **treasuries(address group)** (address) - Returns the treasury address for a group. ### Example Usage ```solidity // SPDX-License-License-Identifier: AGPL-3.0-only pragma solidity >=0.8.24; import "@circles/circles-contracts-v2/src/hub/Hub.sol"; // Hub contract interface for reading state interface ICirclesHub { function isHuman(address avatar) external view returns (bool); function isGroup(address avatar) external view returns (bool); function isOrganization(address avatar) external view returns (bool); function isTrusted(address truster, address trustee) external view returns (bool); function avatars(address avatar) external view returns (address); function mintPolicies(address group) external view returns (address); function treasuries(address group) external view returns (address); } // Example: Check avatar status Hub hub = Hub(HUB_ADDRESS); bool isRegisteredHuman = hub.isHuman(userAddress); bool isRegisteredGroup = hub.isGroup(groupAddress); bool hasTrust = hub.isTrusted(trusterAddress, trusteeAddress); ``` ``` -------------------------------- ### Group Minting in Path Transactions Source: https://github.com/aboutcircles/circles-contracts-v2/blob/beta/docs/docs/advanced-topics/path-based-transactions.md Explains how group Circles can be minted as part of path-based transactions. ```APIDOC ## Group Minting ### Description Allows for the minting of group Circles dynamically within path-based transactions. ### How it Works 1. **Flow Edge to Group Avatar**: If a flow edge's receiver is a registered group avatar, it triggers a group minting operation. 2. **Collateral**: Tokens sent to the group avatar in such a flow edge act as collateral for minting new group Circles. 3. **Automatic Minting**: The internal `_groupMint` function is invoked to create new group Circles based on the provided collateral. 4. **Mint Policies**: The minting process adheres to the rules defined in the associated mint policy contract for each group. ``` -------------------------------- ### Convert Inflationary to Demurrage Value Source: https://github.com/aboutcircles/circles-contracts-v2/blob/beta/docs/docs/advanced-topics/inflation-demurrage.md Converts an inflationary amount to its demurraged equivalent as of the specified day. Use this when you need to know the actual time-dependent value of an inflationary amount. ```Solidity function convertInflationaryToDemurrageValue(uint256 _amount, uint64 _day) public view returns (uint256) ``` -------------------------------- ### Convert Demurrage to Inflationary Value Source: https://github.com/aboutcircles/circles-contracts-v2/blob/beta/docs/docs/advanced-topics/inflation-demurrage.md Converts a demurraged amount as of the day provided to its inflationary equivalent. Use this to represent a time-dependent balance in a static, inflationary format. ```Solidity function convertDemurrageToInflationaryValue(uint256 _amount, uint64 _dayUpdated) public view returns (uint256) ``` -------------------------------- ### R(n) Table for Validation Source: https://github.com/aboutcircles/circles-contracts-v2/blob/beta/specifications/TCIP009-demurrage.md This table lists values for R(n) = Beta^(-n) in both decimal and 64x64 fixed-point formats, used for validating calculations related to minting adjustments. ```plaintext n R(n) = Beta^(-n) 64x64 Fixed (20 or 21 digits) --------------------------------------------------------------------------- 0 1.0000000000000000000000000 18446744073709551616 1 0.9998013320085989574306134 18443079296116538654 2 0.9996027034861687221859511 18439415246597529027 3 0.9994041144248680731130555 18435751925007877736 4 0.9992055648168573468586256 18432089331202968517 5 0.9990070546542984375595321 18428427465038213837 6 0.9988085839293547965333938 18424766326369054888 7 0.9986101526341914319692159 18421105915050961582 8 0.9984117607609749086180892 18417446230939432544 9 0.9982134083018733474839513 18413787273889995104 10 0.9980150952490564255144086 18410129043758205300 11 0.9978168215946953752916208 18406471540399647861 12 0.9976185873309629847232451 18402814763669936209 13 0.9974203924500335967334437 18399158713424712450 14 0.9972222369440831089539514 18395503389519647372 ``` -------------------------------- ### Convert Demurraged to Inflationary Value Source: https://context7.com/aboutcircles/circles-contracts-v2/llms.txt Converts a demurraged amount to its equivalent inflationary value based on the current day. Requires the Hub contract and the current day's calculation. ```Solidity // Convert demurraged amount to inflationary value uint256 inflationaryValue = hub.convertDemurrageToInflationaryValue( demurragedAmount, day(block.timestamp) ); ``` -------------------------------- ### Enable Consented Flow Source: https://context7.com/aboutcircles/circles-contracts-v2/llms.txt Enables the consented flow for an avatar, requiring bidirectional trust for path-based transfers. This is an irreversible action once set. ```Solidity // Enable consented flow for your avatar bytes32 ENABLE_CONSENTEDFLOW = bytes32(uint256(1)); hub.setAdvancedUsageFlag(ENABLE_CONSENTEDFLOW); ``` -------------------------------- ### Personal Minting API Source: https://context7.com/aboutcircles/circles-contracts-v2/llms.txt Mints personal Circles for registered human avatars at a rate of 1 Circle per hour, with retroactive claiming up to 14 days. ```APIDOC ## Personal Minting Mints personal Circles for registered human avatars at a rate of 1 Circle per hour, with retroactive claiming up to 14 days. ### Mint personal Circles (claims all available issuance) ```solidity hub.personalMint(); ``` ### Calculate available issuance without minting ```solidity (uint256 issuance, uint256 startPeriod, uint256 endPeriod) = hub.calculateIssuance(humanAddress); ``` ### Calculate issuance with v1 status check update ```solidity (uint256 issuance, uint256 startPeriod, uint256 endPeriod) = hub.calculateIssuanceWithCheck(humanAddress); ``` ### Example: Check and mint ```solidity if (hub.isHuman(msg.sender)) { (uint256 available,,) = hub.calculateIssuance(msg.sender); if (available > 0) { hub.personalMint(); } } ``` ### Events emitted: - PersonalMint(address indexed human, uint256 amount, uint256 startPeriod, uint256 endPeriod) ``` -------------------------------- ### Register Group Avatar Source: https://context7.com/aboutcircles/circles-contracts-v2/llms.txt Registers a group avatar that can mint group Circles. Requires a mint policy address, name, symbol, and metadata digest. A custom treasury can also be specified. ```solidity // Register a group with standard treasury hub.registerGroup( mintPolicyAddress, // address of mint policy contract "GroupName", // name - max 32 bytes "GRP", // symbol - max 16 bytes 0x1234567890abcdef1234567890abcdef1234567890abcdef1234567890abcdef // metadata digest ); // Register a group with custom treasury hub.registerCustomGroup( mintPolicyAddress, // mint policy contract customTreasuryAddress,// custom treasury contract "CustomGroup", // name "CGRP", // symbol bytes32(0) // metadata digest ); // Events emitted: // RegisterGroup(address indexed group, address indexed mint, address indexed treasury, string name, string symbol) ``` -------------------------------- ### Convert Inflationary to Demurraged Value Source: https://context7.com/aboutcircles/circles-contracts-v2/llms.txt Converts an inflationary amount to its equivalent demurraged value based on the current day. Requires the Hub contract and the current day's calculation. ```Solidity // Convert inflationary amount to demurraged value uint256 demurragedValue = hub.convertInflationaryToDemurrageValue( inflationaryAmount, day(block.timestamp) ); ```