### Run Centrifuge POD with Custom Configuration Source: https://updated-docs.documentation-569.pages.dev/developer/legacy/pod Shell command to start the Centrifuge POD application, specifying the path to a custom `config.yaml` file. Users must replace the placeholder with their actual configuration directory. ```bash $ centrifuge run -c //config.yaml ``` -------------------------------- ### JW3 Token Payload Example for On-chain Proxy Authentication Source: https://updated-docs.documentation-569.pages.dev/developer/legacy/pod Illustrates a JW3 token payload for on-chain proxy authentication, where 'Bob' acts as a 'PodAuth' proxy for 'Alice'. This example shows how the 'address', 'on_behalf_of', and 'proxy_type' fields are populated based on on-chain proxy relationships. ```json { "address": "ss58_address_of_bob", "on_behalf_of": "ss58_address_of_alice", "proxy_type": "PodAuth", "expires_at": "1663070957", "issued_at": "1662984557", "not_before": "1662984557" } ``` -------------------------------- ### Go Substrate RPC Client: Bootstrap Account with Keystore and Proxy Pallets Source: https://updated-docs.documentation-569.pages.dev/developer/legacy/pod This Go function demonstrates how to bootstrap a new account on a Substrate-based chain using the 'go-substrate-rpc-client'. It performs two key operations: adding public keys (for P2P discovery and document signing) to the 'Keystore' pallet, and adding a 'PodOperation' proxy to the account's identity via the 'Proxy' pallet. Both operations are batched into a single extrinsic, signed, and then submitted and monitored for finalization. ```Go func bootstrapAccount( api *gsrpc.SubstrateAPI, rv *types.RuntimeVersion, genesisHash types.Hash, meta *types.Metadata, accountInfo types.AccountInfo, krp signature.KeyringPair, ) error { addProxyCall, err := types.NewCall( meta, "Proxy.add_proxy", delegateAccountID, 10, // PodOperation types.NewU32(0), // Delay ) if err != nil { return fmt.Errorf("couldn't create addProxy call: %w", err) } discoveryKeyHash := types.NewHash(discoveryKeyBytes) documentSigningKeyHash := types.NewHash(documentSigningKeyBytes) type AddKey struct { Key types.Hash Purpose uint8 KeyType uint8 } addKeysCall, err := types.NewCall( meta, "Keystore.add_keys", []*AddKey{ { Key: discoveryKeyHash, Purpose: 0, // P2P Discovery KeyType: 0, // ECDSA }, { Key: documentSigningKeyHash, Purpose: 1, // P2P Document Signing KeyType: 0, // ECDSA }, }, ) if err != nil { return fmt.Errorf("couldn't create addKeys call: %w", err) } batchCall, err := types.NewCall( meta, "Utility.batch_all", addProxyCall, addKeysCall, ) if err != nil { return fmt.Errorf("couldn't create batch call: %w", err) } ext := types.NewExtrinsic(batchCall) opts := types.SignatureOptions{ BlockHash: genesisHash, // using genesis since we're using immortal era Era: types.ExtrinsicEra{IsMortalEra: false}, GenesisHash: genesisHash, Nonce: types.NewUCompactFromUInt(uint64(accountInfo.Nonce)), SpecVersion: rv.SpecVersion, Tip: types.NewUCompactFromUInt(0), TransactionVersion: rv.TransactionVersion, } err = ext.Sign(krp, opts) if err != nil { return fmt.Errorf("couldn't sign extrinsic: %w", err) } sub, err := api.RPC.Author.SubmitAndWatchExtrinsic(ext) if err != nil { return fmt.Errorf("couldn't submit and watch extrinsic: %w", err) } defer sub.Unsubscribe() select { case st := <-sub.Chan(): switch { case st.IsFinalized, st.IsInBlock, st.IsReady: return nil default: return fmt.Errorf("extrinsic not successful - %v", st) } case err := <-sub.Err(): return fmt.Errorf("extrinsic error: %w", err) } } ``` -------------------------------- ### Verify Centrifuge POD Status via API Ping Source: https://updated-docs.documentation-569.pages.dev/developer/legacy/pod A `curl` command to perform a GET request to the Centrifuge POD's local API endpoint (`/ping`) to verify its operational status. A successful response includes version and network details in JSON format. ```bash $ curl -X GET "http://localhost:8082/ping" -H "accept: application/json" ``` -------------------------------- ### Install Centrifuge SDK and Viem Source: https://updated-docs.documentation-569.pages.dev/developer/centrifuge-sdk/overview Instructions for installing the Centrifuge SDK and its required peer dependency, viem, using either npm or yarn package managers. ```Shell npm install @centrifuge/sdk viem # or yarn add @centrifuge/sdk viem ``` -------------------------------- ### Centrifuge POD REST API: Documents Section Overview Source: https://updated-docs.documentation-569.pages.dev/developer/legacy/pod Provides an overview of the endpoints available within the Documents section of the Centrifuge POD REST API. The primary role of the POD is to serve as a handler for documents containing private off-chain data, which these endpoints facilitate. ```APIDOC API Section: Documents Purpose: Handle documents, especially those containing private off-chain data. Role of POD: Serve as a handler for these documents. ``` -------------------------------- ### Example Pool Onboarding Proposal (POP) Title Source: https://updated-docs.documentation-569.pages.dev/user/launching-a-pool This snippet provides a concrete example of a Pool Onboarding Proposal (POP) title, demonstrating how the placeholder '[pool name]' is replaced with a specific pool name, 'Jay's Properties', adhering to the required format for submission. ```Text RFC: (POP) Jay's Properties ``` -------------------------------- ### Subwasm Runtime Info Output Example Source: https://updated-docs.documentation-569.pages.dev/developer/legacy/centrifuge-chain/contributing An example output from the `subwasm info` command, detailing various properties of the Centrifuge runtime WASM. This output is crucial for verifying the integrity and version of the deployed runtime. ```APIDOC ๐Ÿ‹๏ธ Runtime size: 1.819 MB (1,906,886 bytes) ๐Ÿ—œ Compressed: Yes, 78.50% โœจ Reserved meta: OK - [6D, 65, 74, 61] ๐ŸŽ Metadata version: V14 ๐Ÿ”ฅ Core version: centrifuge-1025 (centrifuge-1.tx2.au1) ๐Ÿ—ณ๏ธ system.setCode hash: 0x210cdf71ee5c5fbea3dc5090c596a992b148030474121b481a856433eb5720f3 ๐Ÿ—ณ๏ธ authorizeUpgrade hash: 0x319e30838e1acc9dd071261673060af687704430c45b14cdb5fc97ec561e2a12 ๐Ÿ—ณ๏ธ Blake2-256 hash: 0xb7f74401c52ee8634ad28fe91e8a6b1debb802d4d2058fdda184a6f2746477f6 ๐Ÿ“ฆ IPFS: https://www.ipfs.io/ipfs/QmS3GDmbGKvcmSd7ca1AN9B34BW3DuDEDQ1iSLXgkjktpG ``` -------------------------------- ### Centrifuge POD REST API: NFTs Section Overview Source: https://updated-docs.documentation-569.pages.dev/developer/legacy/pod Provides an overview of the endpoints available within the NFTs section of the Centrifuge POD REST API. This section offers core functionality for minting NFTs for documents and retrieving NFT-specific information such as attributes, metadata, and owner details. It also notes that additional information is stored on-chain and on IPFS. ```APIDOC API Section: NFTs Purpose: Handle document NFTs. Functionality: - Minting NFTs for documents. - Retrieving NFT specific information (attributes, metadata, owner). Data Storage: - On-chain: IPFS hash of document fields set as metadata, document ID and version as attributes. - IPFS: Document fields specified in minting request. Supported IPFS Pinning Service: Pinata. Related Pallet: Uniques pallet (for on-chain queries). ``` -------------------------------- ### Example: Solver Order Calculation Scenario Source: https://updated-docs.documentation-569.pages.dev/developer/legacy/tinlake This example demonstrates a basic scenario for the Tinlake solver, showing initial reserve, supply, and redeem orders, and how a potential solution might look if all orders can be fulfilled without violating constraints. ```Text Example: Reserve: 5 DAI DROP supplyOrder: 10 DAI DROP redeemOrder: 15 DAI Solution: DROP supplyOrder: 10 DAI DROP redeemOrder: 15 DAI ``` -------------------------------- ### Generate Centrifuge POD Configuration File Source: https://updated-docs.documentation-569.pages.dev/developer/legacy/pod This command initializes the Centrifuge POD by creating an identity, required key pairs, and generating the `config.yaml` file. It allows specifying network, directory, ports, Centrifuge Chain endpoint, IPFS pinning service details, and operator/admin secret seeds. The generated `config.yaml` contains sensitive information and should be stored securely. ```bash centrifuge createconfig \\ -n mainnet \\ -t \\ -a 8082 -p 38204 \\ --centchainurl \\ --ipfsPinningServiceName pinata \\ --ipfsPinningServiceURL \\ --ipfsPinningServiceAuth \\ --podOperatorSecretSeed \\ --podAdminSecretSeed ``` -------------------------------- ### Generate Centrifuge Chain Testnet Account Key Source: https://updated-docs.documentation-569.pages.dev/developer/legacy/pod This command uses `subkey` to generate a new SR25519 key pair for a generic testnet. It's used for creating an on-chain identity for testing purposes on Centrifuge test networks. ```bash $ subkey --sr25519 generate ``` -------------------------------- ### Generate Centrifuge Chain Mainnet Account Key Source: https://updated-docs.documentation-569.pages.dev/developer/legacy/pod This command uses `subkey` to generate a new SR25519 key pair specifically for the Centrifuge Mainnet. It's the first step to creating an on-chain identity for interacting with the Centrifuge Chain. ```bash $ subkey --sr25519 --network centrifuge generate ``` -------------------------------- ### Tinlake Lender Module: Supply Order Process and Example Source: https://updated-docs.documentation-569.pages.dev/developer/legacy/tinlake Details the process for a user to create a supply order by locking DAI/stablecoin in Tinlake, explaining how the order changes during an epoch, and how tokens are disbursed. Includes a step-by-step example scenario demonstrating the flow. ```APIDOC Lender Module - Supply Order: - Purpose: Allows users to create a supply order by locking DAI/stablecoin in Tinlake. - Behavior during epoch: Locked DAI amount can be changed. - Behavior after epoch closure: Order cannot be changed. - Execution: If epoch is executed, 'disburse' method must be called to collect DROP tokens. - Partial fulfillment: Unfulfilled portion is automatically resubmitted in the next epoch. - Token Price: Determined when the epoch is closed. ``` ```Pseudocode Example Supply Order Scenario: 1. Alice wants to invest 100 DAI into the seniorTranche (DROP). 2. She calls supplyOrder on the senior operator contract. 3. Her DAI is transferred to the seniorTranche contract. 4. The epoch is closed and the current DROP price of 1.5 DAI is calculated. 5. 60% of all supplyOrders can be fulfilled. 6. Alice calls the disburse method and receives: - (100 DAI * 0.6) / 1.5 = 40 DROP tokens on her address. 7. The remaining 100 - 60 = 40 DAI become a new supplyOrder in the next epoch. 8. Alice calls supplyOrder and changes the order to zero DAI. 9. Alice receives the 40 DAI back. ``` -------------------------------- ### Jobs API Endpoint Overview Source: https://updated-docs.documentation-569.pages.dev/developer/legacy/pod This section provides an overview of the API endpoints available for retrieving detailed information about jobs. A job is defined as a long-running operation triggered by the POD during actions related to documents and/or NFTs. ```APIDOC API Section: Jobs Description: Provides an overview of all endpoints available for retrieving job details. Context: A job is a long-running operation that is triggered by the POD when performing actions related to documents and/or NFTs. ``` -------------------------------- ### IPFS Hash Metadata Format for NFT On-chain Source: https://updated-docs.documentation-569.pages.dev/developer/legacy/pod Describes the format of the IPFS hash that is set as metadata to the NFT on the blockchain. This hash points to the off-chain IPFS content related to the NFT. ```text /ipfs/QmfN7u6hMRHxL83Jboa4bHgme4PJmcS4eQFnkrXye5ctAM ``` -------------------------------- ### Initialize Centrifuge SDK for Mainnet Source: https://updated-docs.documentation-569.pages.dev/developer/centrifuge-sdk/overview Example of initializing the Centrifuge SDK with an explicit 'mainnet' environment configuration. This snippet shows how to override default RPC, indexer, and IPFS URLs for the mainnet deployment. ```JavaScript const centrifuge = new Centrifuge({ environment: "mainnet", rpcUrls: { 1: "https://mainnet.infura.io/v3/YOUR_INFURA_PROJECT_ID", }, indexerUrl: "https://indexer.centrifuge.io", ipfsUrl: "https://ipfs.centrifuge.io", }); ``` -------------------------------- ### Start Parachain with Custom Chain Specification Source: https://updated-docs.documentation-569.pages.dev/developer/legacy/centrifuge-chain/contributing Starts the Centrifuge parachain using a specified chain specification by setting the `PARA_CHAIN_SPEC` environment variable. This allows for testing with different chain configurations. ```bash PARA_CHAIN_SPEC=development ./scripts/init.sh start-parachain ``` -------------------------------- ### Webhooks API Endpoint Overview Source: https://updated-docs.documentation-569.pages.dev/developer/legacy/pod This section details the structure and purpose of webhook notification messages sent by the POD. These messages are triggered by document or job events, providing real-time updates. ```APIDOC API Section: Webhooks Description: Provides an overview of the notification message that is sent by the POD for document or job events. ``` -------------------------------- ### Example On-chain Debt Calculation for Half Year Source: https://updated-docs.documentation-569.pages.dev/user/centrifuge-pools/interest-rate-methodology This example demonstrates calculating the `Debt` after half a year (15,768,000 seconds) using the on-chain formula, showcasing its flexibility for different time periods. ```APIDOC D = 100 ยท 1.00000000190259^15768000 = 103.0455 ``` -------------------------------- ### JW3 Token Header Structure Source: https://updated-docs.documentation-569.pages.dev/developer/legacy/pod Defines the structure of the header for a JW3 token, specifying the algorithm, token type, and address type used for signature verification and token identification. ```json { "algorithm": "sr25519", "token_type": "JW3T", "address_type": "ss58" } ``` -------------------------------- ### Example On-chain Debt Calculation for One Year Source: https://updated-docs.documentation-569.pages.dev/user/centrifuge-pools/interest-rate-methodology This example illustrates the calculation of total `Debt` after one year (31,536,000 seconds) using the previously calculated `rate` and an initial principal of 100. It shows how the on-chain formula yields results consistent with secondly compounding. ```APIDOC D = 100 ยท 1.00000000190259^31536000 = 106.1837 ``` -------------------------------- ### Start Local Relay Chain Source: https://updated-docs.documentation-569.pages.dev/developer/legacy/centrifuge-chain/contributing Deploys a local relay chain with two validator nodes (Alice and Bob) for end-to-end environment testing. This command initiates the relay chain process. ```bash ./scripts/init.sh start-relay-chain ``` -------------------------------- ### Example Calculation of On-chain Rate Variable Source: https://updated-docs.documentation-569.pages.dev/user/centrifuge-pools/interest-rate-methodology This example demonstrates the calculation of the `rate` variable for a 6.00% APR, using the constant for seconds in a year (31,536,000). This rate is then used for per-second compounding on-chain. ```APIDOC rate = 1 + 0.06 / 31536000 = 1.00000000190259 ``` -------------------------------- ### Example: Raising Creditline and its Impact on Asset Ratios Source: https://updated-docs.documentation-569.pages.dev/developer/legacy/tinlake This example illustrates the financial implications of raising the creditline by 10,000 DAI. It demonstrates how the senior and junior asset values, along with the senior ratio, are affected, highlighting potential constraints for TIN investors. ```text Example: Raise creditline 10k DAI seniorRatioRange: 0,10 - 0,9 seniorAsset: 10k juniorAsset: 200k seniorRatio: 0,11 It is possible for nearly all TIN investors to leave the pool. raise creditline: 890k (no overcollateralization) validate constraint perspective: seniorAsset: 900k juniorAsset: 200k seniorRatio: 0,9 It would be not possible for TIN investors to redeem after the raise. ``` -------------------------------- ### Query Centrifuge Pools with Error Handling Source: https://updated-docs.documentation-569.pages.dev/developer/centrifuge-sdk/overview Demonstrates how to fetch pool data from the Centrifuge SDK using an asynchronous `await` call. The example includes a `try-catch` block for robust error handling during the data retrieval process. ```JavaScript try { const pool = await centrifuge.pools(); } catch (error) { console.error(error); } ``` -------------------------------- ### JW3 Token Payload Structure Source: https://updated-docs.documentation-569.pages.dev/developer/legacy/pod Defines the structure of the payload for a JW3 token, including the delegate and delegator addresses, proxy type, and timestamps for token expiration, issuance, and activation. This payload carries the core authorization information. ```json { "address": "delegate_address", "on_behalf_of": "delegator_address", "proxy_type": "proxy_type", "expires_at": "1663070957", "issued_at": "1662984557", "not_before": "1662984557" } ``` -------------------------------- ### Centrifuge POD Accounts API: Account Data JSON Schema Source: https://updated-docs.documentation-569.pages.dev/developer/legacy/pod Defines the JSON structure for account data retrieved from or used with the Centrifuge POD Accounts API. It includes fields such as `identity`, `document_signing_public_key`, `p2p_public_signing_key`, `pod_operator_account_id`, `precommit_enabled`, and `webhook_url`, along with their descriptions. ```json { "data": [ { "identity": "string", "document_signing_public_key": [0], "p2p_public_signing_key": [0], "pod_operator_account_id": [0], "precommit_enabled": true, "webhook_url": "string" } ] } ``` -------------------------------- ### IPFS Document Fields Format for NFT Minting Source: https://updated-docs.documentation-569.pages.dev/developer/legacy/pod Specifies the JSON format for document fields that are stored on IPFS when minting NFTs. This structure includes descriptive metadata like name, description, image, and a 'properties' object for specific asset identifiers and values. ```json { "name": "ipfs_name", "description": "ipfs_description", "image": "ipfs_image", "properties": { "AssetIdentifier": "0x25680a49ff1b6368f7e243130ff957f9523b917c8c83d79aab97c0ef99fd3b15", "AssetValue": "100", "MaturityDate": "2022-10-13T11:07:28.128752151Z", "Originator": "0xd43593c715fdd31c61141abd04a99fd6822c8558854ccde39a5684e7a56da27d", "result": "0x0000000000000000000000000000000100000000000000000000000000000064" } } ``` -------------------------------- ### Lint Cargo.toml Files with Taplo Source: https://updated-docs.documentation-569.pages.dev/developer/legacy/centrifuge-chain/contributing Lints `Cargo.toml` files using the `taplo` tool to ensure proper formatting and structure. This requires `taplo-cli` to be installed via `cargo install taplo-cli`. ```bash taplo fmt ``` -------------------------------- ### API Reference: Centrifuge POD Authentication Header Source: https://updated-docs.documentation-569.pages.dev/developer/legacy/pod This API documentation specifies the HTTP header required for authenticating requests to the Centrifuge POD. The 'Authorization' header must contain a 'Bearer' token, which is a JSON Web3 Token (jw3t_token) used to identify the user and their delegate. ```APIDOC HTTP Header: Name: authorization Value: Bearer Description: The 'authorization' header is used to specify a JSON Web3 Token (jw3t_token) for identifying the identity and its delegate when interacting with the Centrifuge POD. This allows the POD to track different users. ``` -------------------------------- ### Simulate Maker Draw with Overcollateralization and State Changes Source: https://updated-docs.documentation-569.pages.dev/developer/legacy/tinlake This example illustrates the financial state changes within a system (senior/junior assets, reserve) before and after a Maker draw. It shows how a DAI draw leads to minting DROP collateral and impacts asset distribution and ratios, including the TIN price. ```Example Example: State: seniorAsset: 80 DAI | 80 DROP | dropPrice: 1.0 juniorAsset: 20 DAI | 20 TIN | tinPrice: 1.0 Reserve: 100 DAI dropPrice: 1.0 seniorRatio: 0.8 -- Maker draw: draw: 10 DAI from Maker Overcollateralization: 110% Assumption: draw is not violating constraints --- drawAmount: 10 DAI mint: 11 DROP (10 * 1.1/1 = 11 DROP) transfer DROP to MKR deposit: 10 DAI into the reserve increase seniorAsset: 11 DAI State: seniorAsset: 91 DAI | 91 DROP | dropPrice: 1.0 juniorAsset: 19 DAI | 20 TIN | tinPrice: 19/20 = 0.95 Reserve: 110 DAI seniorRatio: 91/110: 0.82 ``` -------------------------------- ### Example Calculation for Disburse Function Source: https://updated-docs.documentation-569.pages.dev/developer/legacy/tinlake This example illustrates how the `disburse` function calculates the total payout for an investor (Alice) by considering fulfillment rates and token prices across multiple epochs. ```Plaintext Alice: supplyOrder: 100 DAI Epochs: epoch n: 40% of all orders can be fulfilled tokenPrice: 1.2 epoch n+1: 30% of all orders can be fulfilled tokenPrice: 1.5 Alice calls the disburse function in epoch n+2: epoch n: 100 DAI * 0.4 /1.2 = 33.33 DROP epoch n: supplyOrder(amountLeft) = 60 DAI epoch n+1: 60 DAI * 0.3/1.5 = 12 DROP Disburse Amount: 33.33 DROP + 12 DROP = 45.33 DROP ``` -------------------------------- ### Solidity Example: ERC-7540 Deposit Request Decoder Source: https://updated-docs.documentation-569.pages.dev/developer/protocol/managers/merkle-proof-manager This Solidity function demonstrates a minimal decoder contract for supporting ERC-7540 deposit requests. Its purpose is to extract the 'controller' and 'owner' addresses from the function call, which are then used by the Merkle Proof Manager for validation. This ensures that only authorized accounts are involved in the transaction, enhancing security and adherence to predefined policies. ```Solidity function requestDeposit( uint256, address controller, address owner ) external view virtual returns (bytes memory addressesFound) { addressesFound = abi.encodePacked(controller, owner); } ``` -------------------------------- ### Get Client Instance Source: https://updated-docs.documentation-569.pages.dev/developer/centrifuge-sdk/reference/classes/Centrifuge Retrieves a client instance, optionally filtered by chain ID. This client object is typically used to interact with the blockchain. ```APIDOC getClient(chainId?: number): undefined | {} chainId?: number Returns: undefined | {} ``` -------------------------------- ### Illustrative Calculation of Senior Asset Evolution in Tinlake Pool Source: https://updated-docs.documentation-569.pages.dev/developer/legacy/tinlake This example demonstrates the calculation of seniorDebt and seniorBalance within a Tinlake pool, showing how seniorDebt accrues interest over time and its impact on the total seniorAsset. It provides a concrete scenario with initial values and subsequent interest accumulation. ```Conceptual Tinlake Pool: ------------------------------------------ | NAV: 80 DAI | juniorAsset: 10 DAI | | Reserve: 20 DAI | seniorAsset: 90 DAI | ------------------------------------------ In this pool, 80% of the pool value is used for loans. Therefore, 80% of the seniorAsset should be used for interest accumulation. seniorDebt: 90 DAI * 0.8 = 72 DAI seniorBalance: 90 DAI - 72 DAI = 18 DAI Let's say the interest rate is 10%. The seniorDebt would increase in one time period. seniorDebt: 72 DAI * 1.10 = 79.2 DAI seniorBalance: = 18.0 DAI seniorAsset: 97.2 DAI ``` -------------------------------- ### Configure Centrifuge POD External IP in YAML Source: https://updated-docs.documentation-569.pages.dev/developer/legacy/pod Example YAML configuration to manually specify the external IP address for a Centrifuge POD node. This setting allows the node to be accessible from outside its private network. ```yaml p2p: externalIP: "100.111.112.113" ``` -------------------------------- ### Initialize Centrifuge SDK for Demo Environment Source: https://updated-docs.documentation-569.pages.dev/developer/centrifuge-sdk/overview Illustrates how to configure the Centrifuge SDK to connect to the 'demo' environment, which automatically points to the Sepolia testnet for development and testing purposes. ```JavaScript const centrifuge = new Centrifuge({ environment: "demo", }); ``` -------------------------------- ### Create Currency Object from Floating Point Number Source: https://updated-docs.documentation-569.pages.dev/developer/centrifuge-sdk/bigint-wrappers Illustrates the use of the static method `Currency.fromFloat()` to initialize a `Currency` object from a standard floating-point number and its corresponding decimals. This example highlights how the internal BigInt representation and other conversions are affected by this initialization method. ```JavaScript const currency = Currency.fromFloat(1000, 6); currency.toBigInt(); // 1_000_000_000n currency.toNumber(); // 1000 currency.toString(); // '1000000000' currency.toDecimal(); // 1000 ``` -------------------------------- ### JW3 Token Payload Example for POD Admin Authentication Source: https://updated-docs.documentation-569.pages.dev/developer/legacy/pod Illustrates a JW3 token payload for POD admin authentication, used for restricted endpoints. In this scenario, both 'address' and 'on_behalf_of' fields are identical, pointing to the POD admin's SS58 address, and the 'proxy_type' is explicitly 'PodAdmin'. ```json { "address": "pod_admin_ss58_address", "on_behalf_of": "pod_admin_ss58_address", "proxy_type": "PodAdmin", "expires_at": "1663070957", "issued_at": "1662984557", "not_before": "1662984557" } ``` -------------------------------- ### Get Subwasm Runtime Information Source: https://updated-docs.documentation-569.pages.dev/developer/legacy/centrifuge-chain/contributing Retrieves detailed information about the built WASM runtime using the `subwasm` tool. This command provides insights into the runtime's properties, including size, compression, metadata version, and various cryptographic hashes. ```bash subwasm info ./target/release/wbuild/centrifuge-runtime/centrifuge_runtime.compact.compressed.wasm ``` -------------------------------- ### Disable Centrifuge SDK Query Caching Source: https://updated-docs.documentation-569.pages.dev/developer/centrifuge-sdk/overview Example demonstrating how to disable caching for the Centrifuge SDK during initialization. This ensures that every query fetches fresh data, which can be useful in scenarios like scripts where immediate data consistency is critical. ```JavaScript const centrifuge = new Centrifuge({ cache: false }); // TODO NOT YET IMPLEMENTED // ... const investment1 = await vault.investment("0x..."); await vault.claim(); const investment2 = await vault.investment("0x..."); // will fetch again ``` -------------------------------- ### Configure Asynchronous Vault Request and Balance Sheet Managers Source: https://updated-docs.documentation-569.pages.dev/developer/protocol/guides/deploy-vaults This code configures the `AsyncRequestManager` contract for asynchronous vaults. It sets the manager as both the Request Manager for handling investment actions via the Hub and as the Balance Sheet Manager for moving assets. This setup is crucial before deploying the asynchronous vault. ```Solidity hub.setRequestManager(poolId, scId, assetId, bytes32(bytes20(address(asyncRequestManager)))); hub.updateBalanceSheetManager(centrifugeId, poolId, bytes32(bytes20(address(asyncRequestManager))), true); ``` -------------------------------- ### Initialize Centrifuge SDK with Default Configuration Source: https://updated-docs.documentation-569.pages.dev/developer/centrifuge-sdk/overview Demonstrates how to initialize the Centrifuge SDK without providing a specific configuration object. The SDK will automatically use its default values for environment and service URLs. ```JavaScript import { Centrifuge } from "@centrifuge/sdk"; const centrifuge = new Centrifuge(); ``` -------------------------------- ### Get balances and last investor transactions for an account Source: https://updated-docs.documentation-569.pages.dev/developer/legacy/querying-v2-data This GraphQL query fetches detailed financial information for a specific account, identified by its ID. It includes outstanding orders, the last two investor transactions (type, currency amount, token amount), currency balances, and tranche balances with various investment amounts, providing a comprehensive view of an investor's activity. ```GraphQL { account(id: "kALNreUp6oBmtfG87fe7MakWR8BnmQ4SmKjjfG27iVd3nuTue") { id outstandingOrders { nodes { investAmount redeemAmount trancheId } } investorTransactions(last: 2) { nodes { type currencyAmount tokenAmount } } currencyBalances { nodes { amount } } trancheBalances { nodes { trancheId sumInvestOrderedAmount sumInvestCollectedAmount sumInvestUncollectedAmount } } } } ``` -------------------------------- ### Get outstanding debt information for loans belonging to a pool Source: https://updated-docs.documentation-569.pages.dev/developer/legacy/querying-v2-data This GraphQL query retrieves the outstanding debt for all loans associated with a specific pool, identified by its ID. It also includes the pool's currency details (ID and decimals), providing context for the debt amounts and allowing for accurate financial calculations. ```GraphQL { pool(id: "2825130900") { id currency { id decimals } loans { nodes { id outstandingDebt } } } } ``` -------------------------------- ### Perquintill Class API Documentation Source: https://updated-docs.documentation-569.pages.dev/developer/centrifuge-sdk/reference/classes/Perquintill Detailed API documentation for the `Perquintill` class from the `@centrifuge/sdk`. It extends `DecimalWrapper` and includes information about its constructor, static and instance properties, and inherited methods for comparison operations. ```APIDOC Class: Perquintill Defined in: src/utils/BigInt.ts:246 Deprecated: Yes Extends: DecimalWrapper Constructors: new Perquintill(value: bigint | Numeric): Perquintill Defined in: src/utils/BigInt.ts:249 Parameters: value: bigint | Numeric Overrides: DecimalWrapper.constructor Properties: decimals: number = 27 (readonly) Defined in: src/utils/BigInt.ts:27 Inherited from: DecimalWrapper.decimals value: bigint (protected) Defined in: src/utils/BigInt.ts:3 Inherited from: DecimalWrapper.value static decimals: number = 18 Defined in: src/utils/BigInt.ts:247 Methods: eq(value: bigint | T): boolean Defined in: src/utils/BigInt.ts:115 Type Parameters: T Parameters: value: bigint | T (where T extends BigIntWrapper) Inherited from: DecimalWrapper.eq gt(value: bigint | T): boolean Defined in: src/utils/BigInt.ts:105 Type Parameters: T Parameters: value: bigint | T (where T extends BigIntWrapper) Inherited from: DecimalWrapper.gt ``` -------------------------------- ### Centrifuge Class API Reference Source: https://updated-docs.documentation-569.pages.dev/developer/centrifuge-sdk/reference/classes/Centrifuge Comprehensive API documentation for the `Centrifuge` class, including its constructor, properties (accessors), and methods. This class is the primary entry point for interacting with the Centrifuge SDK. ```APIDOC Class: Centrifuge Defined in: src/Centrifuge.ts Constructors: new Centrifuge(config: Partial = {}): Centrifuge Parameters: config: Partial - Optional configuration for the Centrifuge instance. Returns: Centrifuge - A new instance of the Centrifuge class. Accessors: chains: number[] Returns: number[] - An array of chain IDs. config: DerivedConfig Returns: DerivedConfig - The derived configuration of the Centrifuge instance. signer: null | Signer Returns: null | Signer - The signer associated with the instance, or null if not set. Methods: account(address: string, chainId?: number): Query Parameters: address: string - The account address. chainId?: number - Optional chain ID for the account query. Returns: Query - A query object for retrieving account details. ``` -------------------------------- ### Centrifuge SDK Pool and Vault API Reference Source: https://updated-docs.documentation-569.pages.dev/developer/centrifuge-sdk/pools Reference documentation for the Centrifuge SDK's Pool, PoolNetwork, and Vault classes, detailing their methods for querying pool status, network activity, vault deployments, and managing investments/redemptions. ```APIDOC class Pool: activeNetworks(): Promise description: Retrieves a list of networks where the pool is active. network(chainId: string): Promise description: Returns a PoolNetwork object for a specific chain ID. parameters: chainId: The identifier of the blockchain network. class PoolNetwork: isActive(): Promise description: Checks if the pool is active on this specific network. vaults(trancheId: string): Promise description: Retrieves a list of deployed vaults for a given tranche on this network. parameters: trancheId: The identifier of the tranche. vault(trancheId: string, currencyAddress: string): Promise description: Retrieves a specific vault for a given tranche and currency address on this network. parameters: trancheId: The identifier of the tranche. currencyAddress: The address of the investment currency. class Vault: investment(investorAddress: string): Promise description: Retrieves the investment details for a specific investor. parameters: investorAddress: The address of the investor. increaseInvestOrder(amount: number): Promise description: Places an order to increase an investment in the vault. parameters: amount: The amount to invest. increaseRedeemOrder(amount: number): Promise description: Places an order to redeem an investment from the vault. parameters: amount: The amount to redeem. claim(): Promise description: Collects fulfilled tokens from the vault. ``` -------------------------------- ### Demonstrate Centrifuge SDK Query Caching Behavior Source: https://updated-docs.documentation-569.pages.dev/developer/centrifuge-sdk/overview This snippet showcases the SDK's query caching mechanism. It demonstrates that subsequent identical queries resolve immediately from cache, while queries with different parameters or after a time delay will fetch fresh data. ```JavaScript const report1 = await pool.reports.balanceSheet(); const report2 = await pool.reports.balanceSheet(); // resolves immediately const report3 = await pool.reports.balanceSheet({ groupBy: "month" }); // also resolves immediately as it doesn't need to fetch new data sleep(5 * 60 * 1000); const report4 = await pool.reports.balanceSheet(); // will wait for fresh data ``` -------------------------------- ### Required Format for Pool Onboarding Proposal (POP) Title Source: https://updated-docs.documentation-569.pages.dev/user/launching-a-pool This snippet illustrates the mandatory format for the title of a Pool Onboarding Proposal (POP) post on the Centrifuge governance forum. It specifies the 'RFC: (POP)' prefix, which must be followed by the actual name of the proposed pool. ```Text RFC: (POP) [pool name] ``` -------------------------------- ### Start Centrifuge Parachain Source: https://updated-docs.documentation-569.pages.dev/developer/legacy/centrifuge-chain/contributing Starts a Centrifuge Chain node as a parachain, running a collator node. This command will typically show logs and block until the parachain process is manually stopped. ```bash ./scripts/init.sh start-parachain ``` -------------------------------- ### Initialize Wasm Build Environment for Centrifuge Chain Source: https://updated-docs.documentation-569.pages.dev/developer/legacy/centrifuge-chain/contributing This command initializes the WebAssembly build environment required for developing the Centrifuge Chain. It sets up the necessary toolchain for Wasm compilation. ```Shell ./scripts/init.sh install-toolchain ``` -------------------------------- ### Impact of Liquidation on TIN Price Source: https://updated-docs.documentation-569.pages.dev/developer/legacy/tinlake This snippet highlights the consequence of a liquidation scenario, specifically how the TIN token's price would be affected, referencing the previous example's final state. ```Example In the example above the TIN price would drop to 0.95 in case of a liquidation. ``` -------------------------------- ### Preview Next Share Class ID for Centrifuge Pool Source: https://updated-docs.documentation-569.pages.dev/developer/protocol/guides/create-a-pool This code snippet shows how to preview the ID for the next share class before its creation, using `shareClassManager.previewNextShareClassId`. This allows for pre-configuration and planning of share classes within a given Centrifuge pool. ```Solidity ShareClassId scId = shareClassManager.previewNextShareClassId(poolId); ``` -------------------------------- ### Calculate Overcollateralization for DROP Collateral Source: https://updated-docs.documentation-569.pages.dev/developer/legacy/tinlake This example demonstrates how to calculate the required collateral in DROP tokens for a given DAI draw amount, based on a specified overcollateralization percentage and the current DROP price. ```Example Example: Overcollateralization of 110% dropPrice: 1.5 draw Amount: 100 DAI collateralValue: 100 DAI 1.10 = 110 DAI collateral in DROP: 110 DAI/1.5 = 73.33 DROP ``` -------------------------------- ### Deploy Synchronous Deposit Vault Source: https://updated-docs.documentation-569.pages.dev/developer/protocol/guides/deploy-vaults Once the `SyncManager` is configured, this command deploys the synchronous deposit vault. It utilizes the `syncDepositVaultFactory` to create and link the vault to the specified pool, share class, and asset. ```Solidity hub.updateVault(poolId, scId, assetId, bytes32(bytes20(address(syncDepositVaultFactory))), VaultUpdateKind.DeployAndLink, 0); ```