### Install Project Dependencies Source: https://github.com/goldfinch-eng/mono/blob/main/README.md Install all project dependencies and initialize Husky for Git hooks. ```bash # install all dependencies yarn install ``` -------------------------------- ### Install Dependencies Source: https://github.com/goldfinch-eng/mono/blob/main/packages/docs/README.md Run this command from the repo root to install project dependencies. ```bash $ yarn bootstrap ``` -------------------------------- ### Example: Submit Call Request (JavaScript) Source: https://context7.com/goldfinch-eng/mono/llms.txt This JavaScript example shows how to check the available amount to call on a loan, verify the lockup period, and submit a call request for a portion of the amount. ```javascript const callableLoan = new ethers.Contract(CALLABLE_LOAN_ADDRESS, CallableLoanABI, signer); const poolTokenId = 12345; // Check available amount to call const availableAmount = await callableLoan.availableToCall(poolTokenId); console.log("Available to call:", ethers.utils.formatUnits(availableAmount, 6), "USDC"); // Check if we're in lockup period (calls not allowed during lockup) const inLockup = await callableLoan.inLockupPeriod(); if (!inLockup) { // Submit call for half the available amount const callAmount = availableAmount.div(2); const tx = await callableLoan.submitCall(callAmount, poolTokenId); const receipt = await tx.wait(); // Event: CallRequestSubmitted(originalTokenId, callRequestedTokenId, remainingTokenId, callAmount) const event = receipt.events.find(e => e.event === 'CallRequestSubmitted'); console.log("Called token ID:", event.args.callRequestedTokenId.toString()); console.log("Remaining token ID:", event.args.remainingTokenId.toString()); } ``` -------------------------------- ### Get Term Start Time Source: https://github.com/goldfinch-eng/mono/blob/main/packages/docs/docs/reference/contracts/core/schedule/PaymentSchedule.md Retrieves the start time of the term for the payment schedule. ```solidity function termStartTime(struct PaymentSchedule s) internal view returns (uint256) ``` -------------------------------- ### Run Development Server Source: https://github.com/goldfinch-eng/mono/blob/main/packages/client2/README.md Starts the Next.js development server. Open http://localhost:3001 with your browser to see the result. You can start editing the page by modifying pages/index.tsx. The page auto-updates as you edit the file. ```bash yarn dev ``` -------------------------------- ### Tenderly Debugging Setup Source: https://github.com/goldfinch-eng/mono/blob/main/README.md Prerequisite command for installing the Tenderly CLI via Homebrew to enable transaction debugging. ```bash # Ensure tenderly-cli is installed via `brew tap tenderly/tenderly && brew install tenderly` ``` -------------------------------- ### Initialize Payment Schedule Start Time Source: https://github.com/goldfinch-eng/mono/blob/main/packages/docs/docs/reference/contracts/core/schedule/PaymentSchedule.md Sets the start time for a payment schedule. ```solidity function startAt(struct PaymentSchedule s, uint256 timestamp) internal ``` -------------------------------- ### Example: Invest in Junior Tranche and Withdraw (JavaScript) Source: https://context7.com/goldfinch-eng/mono/llms.txt This JavaScript example demonstrates how to approve a Tranched Pool for USDC, deposit into the junior tranche, and later withdraw funds using the PoolToken NFT ID. ```javascript const tranchedPool = new ethers.Contract(POOL_ADDRESS, TranchedPoolABI, signer); const usdc = new ethers.Contract(USDC_ADDRESS, ERC20ABI, signer); const investmentAmount = ethers.utils.parseUnits("50000", 6); // 50,000 USDC // Approve and deposit into junior tranche (tranche ID 2) await usdc.approve(POOL_ADDRESS, investmentAmount); const tx = await tranchedPool.deposit(2, investmentAmount); const receipt = await tx.wait(); // Get the minted PoolToken NFT ID const poolTokenId = receipt.events.find(e => e.event === 'DepositMade').args.tokenId; console.log("Pool Token ID:", poolTokenId.toString()); // Later: Withdraw available funds const withdrawTx = await tranchedPool.withdrawMax(poolTokenId); const withdrawReceipt = await withdrawTx.wait(); const { interestWithdrawn, principalWithdrawn } = withdrawReceipt.events[0].args; ``` -------------------------------- ### Install Forge Standard Library Source: https://github.com/goldfinch-eng/mono/blob/main/packages/goldfinch-prime/lib/forge-std/README.md Use this command to install the Forge Standard Library using the Forge package manager. ```bash forge install foundry-rs/forge-std ``` -------------------------------- ### Get Term Start Time Source: https://github.com/goldfinch-eng/mono/blob/main/packages/docs/docs/reference/contracts/core/callable/CallableLoan.md Returns the timestamp of the first drawdown. ```Solidity function termStartTime() public view returns (uint256) ``` -------------------------------- ### Verify Rust Installation Source: https://github.com/goldfinch-eng/mono/blob/main/packages/subgraph/README.md Check that the Rust compiler is correctly installed and accessible in your environment. ```bash rustc --version ``` -------------------------------- ### Calculate start timestamp of an epoch Source: https://github.com/goldfinch-eng/mono/blob/main/packages/docs/docs/reference/contracts/core/membership/Epochs.md Returns the Unix timestamp for the start of a specific epoch index. ```solidity function startOf(uint256 epoch) internal pure returns (uint256) ``` -------------------------------- ### GET /has Source: https://github.com/goldfinch-eng/mono/blob/main/packages/docs/docs/reference/contracts/core/proxy/ImplementationRepository.md Checks if an implementation has already been added. ```APIDOC ## GET /has ### Description Returns true if an implementation has already been added. ### Method GET ### Endpoint /has ### Parameters #### Query Parameters - **implementation** (address) - Required - Implementation to check existence of ### Response #### Success Response (200) - **[0]** (bool) - True if the implementation has already been added ``` -------------------------------- ### Serve Docs Locally Source: https://github.com/goldfinch-eng/mono/blob/main/packages/docs/README.md Start a local development server from the 'packages/docs' directory. Changes are typically reflected live without a server restart. ```bash $ yarn start ``` -------------------------------- ### Constructor Source: https://github.com/goldfinch-eng/mono/blob/main/packages/docs/docs/reference/contracts/core/membership/MembershipCollector.md Initializes the MembershipCollector with the context and the starting epoch. ```solidity constructor(contract Context _context, uint256 _firstRewardEpoch) public ``` -------------------------------- ### Get Term Start Time from StaleCallableCreditLine Source: https://github.com/goldfinch-eng/mono/blob/main/packages/docs/docs/reference/contracts/core/callable/structs/StaleCallableCreditLine.md Retrieves the term start time for the StaleCallableCreditLine. ```solidity function termStartTime(struct StaleCallableCreditLine cl) internal view returns (uint256) ``` -------------------------------- ### GET /nextImplementationOf Source: https://github.com/goldfinch-eng/mono/blob/main/packages/docs/docs/reference/contracts/core/proxy/ImplementationRepository.md Retrieves the next implementation for a given implementation. ```APIDOC ## GET /nextImplementationOf ### Description Get the next implementation for a given implementation or address(0) if it doesn't exist. Reverts when contract is paused. ### Method GET ### Endpoint /nextImplementationOf ### Parameters #### Query Parameters - **implementation** (address) - Required - The current implementation ``` -------------------------------- ### Run Graph Node Server Source: https://github.com/goldfinch-eng/mono/blob/main/packages/subgraph/README.md Start the Graph Node binary with the necessary configuration for Postgres, Ethereum RPC, and IPFS. ```bash cargo run -p graph-node --release -- --postgres-url postgresql://user:pass@localhost:5432/graph-node --ethereum-rpc localhost:http://localhost:8545 --ipfs 127.0.0.1:5002 ``` -------------------------------- ### Get Start of Period Source: https://github.com/goldfinch-eng/mono/blob/main/packages/docs/docs/reference/contracts/core/schedule/MonthlyPeriodMapper.md Returns the starting timestamp of a given monthly period. This function is part of the MonthlyPeriodMapper contract. ```Solidity function startOf(uint256 period) external pure returns (uint256) ``` -------------------------------- ### Get term start and end times Source: https://github.com/goldfinch-eng/mono/blob/main/packages/docs/docs/reference/contracts/core/CreditLine.md Functions to retrieve the start time of the first drawdown and the term end time. ```solidity function termStartTime() public view returns (uint256) ``` ```solidity function termEndTime() public view returns (uint256) ``` -------------------------------- ### Constructor Source: https://github.com/goldfinch-eng/mono/blob/main/packages/docs/docs/reference/contracts/core/proxy/UcuProxy.md Initializes the proxy with a repository, owner, and lineage ID. ```APIDOC ## constructor ### Description Instantiate a proxy pointing to the current implementation in `_repository` of lineage `_lineageId`. ### Parameters #### Path Parameters - **_repository** (contract IImplementationRepository) - Required - Repository used for sourcing upgrades - **_owner** (address) - Required - Owner of proxy - **_lineageId** (uint256) - Required - ID of the lineage whose current implementation to set as the proxy's implementation. ``` -------------------------------- ### GET termStartTime Source: https://github.com/goldfinch-eng/mono/blob/main/packages/docs/docs/reference/contracts/core/CreditLine.md Retrieves the start time of the first drawdown. ```APIDOC ## GET termStartTime ### Description Returns the time of the first drawdown. ### Response - **returns** (uint256) - The start time timestamp. ``` -------------------------------- ### Start local development environment Source: https://github.com/goldfinch-eng/mono/blob/main/packages/cms/README.md Initializes the local CMS instance after ensuring Docker is running and the environment file is configured. ```bash yarn start:dev ``` -------------------------------- ### Internal: Get Start of Interest Period Source: https://github.com/goldfinch-eng/mono/blob/main/packages/docs/docs/reference/contracts/core/schedule/Schedule.md Internal function that returns the starting timestamp for a specified interest period. Essential for accurate interest accrual calculations. ```solidity function _startOfInterestPeriod(uint256 startTime, uint256 interestPeriod) internal view returns (uint256) ``` -------------------------------- ### Initialize Node.js and Yarn Source: https://github.com/goldfinch-eng/mono/blob/main/README.md Configure the Node.js environment using the version specified in .nvmrc and install the global Yarn package manager. ```bash # setup Node using the version defined in .nvmrc nvm install # install yarn for package & workspace management npm install --global yarn ``` -------------------------------- ### initialize Source: https://github.com/goldfinch-eng/mono/blob/main/packages/docs/docs/reference/contracts/deprecated/CreditDesk.md Initializes the CreditDesk contract. Run only once. ```APIDOC ## initialize ### Description Run only once, on initialization ### Method `function initialize(address owner, contract GoldfinchConfig _config) public` ### Parameters #### Path Parameters None #### Query Parameters None #### Request Body None ### Request Example None ### Response #### Success Response (200) None #### Response Example None ### Parameters - **owner** (address) - Required - The address of who should have the "OWNER_ROLE" of this contract - **_config** (contract GoldfinchConfig) - Required - The address of the GoldfinchConfig contract ``` -------------------------------- ### Internal: Get Start of Principal Period Source: https://github.com/goldfinch-eng/mono/blob/main/packages/docs/docs/reference/contracts/core/schedule/Schedule.md Internal function to determine the starting timestamp of a given principal period. Crucial for precise timing of principal-related events. ```solidity function _startOfPrincipalPeriod(uint256 startTime, uint256 principalPeriod) internal view returns (uint256) ``` -------------------------------- ### Initialize Strategy Source: https://github.com/goldfinch-eng/mono/blob/main/packages/docs/docs/reference/contracts/core/FixedLeverageRatioStrategy.md Initializes the contract with an owner and a GoldfinchConfig instance. ```solidity function initialize(address owner, contract GoldfinchConfig _config) public ``` -------------------------------- ### Internal: Get Absolute Term Start Period Source: https://github.com/goldfinch-eng/mono/blob/main/packages/docs/docs/reference/contracts/core/schedule/Schedule.md Internal function to determine the absolute period in which the term started, considering the stub period. Provides a baseline for period calculations. ```solidity function _termStartAbsolutePeriod(uint256 startTime) internal view returns (uint256) ``` -------------------------------- ### List Runtime Configurator Configurations Source: https://github.com/goldfinch-eng/mono/blob/main/packages/functions/README.md Lists all available runtime configuration resources for a specified project. Replace `` with your project ID. ```bash gcloud beta runtime-config configs list --project ``` -------------------------------- ### Start Local Subgraph with Reset Source: https://github.com/goldfinch-eng/mono/blob/main/packages/subgraph/README.md Shell script commands to reset and start the local subgraph environment on Linux. It handles Docker Compose setup and host IP resolution. ```bash ./reset-local.sh && ./start-local.sh ``` ```bash ./start-local.sh ``` -------------------------------- ### Log values using console2 and console Source: https://github.com/goldfinch-eng/mono/blob/main/packages/goldfinch-prime/lib/forge-std/README.md Shows how to import and use console logging utilities. Use console2.sol for better Forge trace decoding. ```solidity // import it indirectly via Test.sol import "forge-std/Test.sol"; // or directly import it import "forge-std/console2.sol"; ... console2.log(someValue); ``` ```solidity // import it indirectly via Test.sol import "forge-std/Test.sol"; // or directly import it import "forge-std/console.sol"; ... console.log(someValue); ``` -------------------------------- ### Get Term End Time Source: https://github.com/goldfinch-eng/mono/blob/main/packages/docs/docs/reference/contracts/core/schedule/Schedule.md Calculates and returns the timestamp when the loan term will end, based on the provided start time. Essential for understanding the loan's lifecycle. ```solidity function termEndTime(uint256 startTime) external view returns (uint256) ``` -------------------------------- ### Get Period End Time Source: https://github.com/goldfinch-eng/mono/blob/main/packages/docs/docs/reference/contracts/core/schedule/Schedule.md Calculates and returns the end time for a specific period, given the loan's start time. Useful for precise period boundary checks. ```solidity function periodEndTime(uint256 startTime, uint256 period) public view returns (uint256) ``` -------------------------------- ### Initialization Function Source: https://github.com/goldfinch-eng/mono/blob/main/packages/docs/docs/reference/contracts/rewards/CommunityRewards.md Initializes the contract with owner, configuration, and launch time parameters. ```solidity function __initialize__(address owner, contract GoldfinchConfig _config, uint256 _tokenLaunchTimeInSeconds) external ``` -------------------------------- ### Initialize contract Source: https://github.com/goldfinch-eng/mono/blob/main/packages/docs/docs/reference/contracts/core/Go.md Initializes the contract with owner, configuration, and identity contract addresses. ```solidity function initialize(address owner, contract GoldfinchConfig _config, address _uniqueIdentity) public ``` -------------------------------- ### GET /totalCapitalHeldBy Source: https://github.com/goldfinch-eng/mono/blob/main/packages/docs/docs/reference/contracts/core/MembershipOrchestrator.md Gets capital holdings for an address. ```APIDOC ## GET /totalCapitalHeldBy ### Description Get all capital, denominated in USDC, in Membership held by an address. ### Method GET ### Parameters #### Query Parameters - **addr** (address) - Required - The owner address. ### Response #### Success Response (200) - **eligibleAmount** (uint256) - USDC capital eligible for rewards. - **totalAmount** (uint256) - Total USDC capital held. ``` -------------------------------- ### GET /totalGFIHeldBy Source: https://github.com/goldfinch-eng/mono/blob/main/packages/docs/docs/reference/contracts/core/MembershipOrchestrator.md Gets GFI holdings for an address. ```APIDOC ## GET /totalGFIHeldBy ### Description Get all GFI in Membership held by an address, including eligible and total amounts. ### Method GET ### Parameters #### Query Parameters - **addr** (address) - Required - The owner address. ### Response #### Success Response (200) - **eligibleAmount** (uint256) - GFI eligible for rewards. - **totalAmount** (uint256) - Total GFI held. ``` -------------------------------- ### POST /initialize Source: https://github.com/goldfinch-eng/mono/blob/main/packages/docs/docs/reference/contracts/core/proxy/ImplementationRepository.md Initializes the repository state with an owner and an initial implementation. ```APIDOC ## POST /initialize ### Description Initializes the repository's state. Reverts if the owner is the null address or if the implementation is not a contract. ### Method POST ### Endpoint /initialize ### Parameters #### Request Body - **_owner** (address) - Required - Owner of the repository - **implementation** (address) - Required - Initial implementation in the repository ``` -------------------------------- ### POST /createLineage Source: https://github.com/goldfinch-eng/mono/blob/main/packages/docs/docs/reference/contracts/core/proxy/ImplementationRepository.md Creates a new lineage of implementations starting with the provided implementation. ```APIDOC ## POST /createLineage ### Description Creates a new lineage of implementations. Reverts if implementation is not a contract. ### Method POST ### Endpoint /createLineage ### Parameters #### Request Body - **implementation** (address) - Required - Implementation that will be the first in the lineage ### Response #### Success Response (200) - **[0]** (uint256) - Newly created lineage's id ``` -------------------------------- ### Initialize contract Source: https://github.com/goldfinch-eng/mono/blob/main/packages/docs/docs/reference/contracts/core/DynamicLeverageRatioStrategy.md Initializes the contract with the specified owner. ```solidity function initialize(address owner) public ``` -------------------------------- ### POST /initialize Source: https://github.com/goldfinch-eng/mono/blob/main/packages/docs/docs/reference/contracts/core/GoldfinchConfig.md Initializes the GoldfinchConfig contract with the owner's address. ```APIDOC ## POST /initialize ### Description Initializes the GoldfinchConfig contract with the owner's address. ### Method POST ### Endpoint /initialize ### Parameters #### Path Parameters None #### Query Parameters None #### Request Body - **owner** (address) - Required - The address of the contract owner. ### Request Example ```json { "owner": "0x..." } ``` ### Response #### Success Response (200) No specific response body is detailed, typically indicates successful execution. #### Response Example None provided. ``` -------------------------------- ### Internal helper and role initialization Source: https://github.com/goldfinch-eng/mono/blob/main/packages/docs/docs/reference/contracts/core/Go.md Internal getter for legacy go-list and external role initialization. ```solidity function _getLegacyGoList() internal view returns (contract GoldfinchConfig) ``` ```solidity function initZapperRole() external ``` -------------------------------- ### Initialize Implementation Repository Source: https://github.com/goldfinch-eng/mono/blob/main/packages/docs/docs/reference/contracts/core/proxy/ImplementationRepository.md Initializes the repository's state with an owner and an initial implementation. Reverts if the owner is the null address or the implementation is not a contract. ```solidity function initialize(address _owner, address implementation) external ``` -------------------------------- ### Initialization Function Source: https://github.com/goldfinch-eng/mono/blob/main/packages/docs/docs/reference/contracts/rewards/BackerRewards.md Initializes the contract with the owner and Goldfinch configuration. ```solidity function __initialize__(address owner, contract GoldfinchConfig _config) public ``` -------------------------------- ### FIDU Conversion Loss Example Source: https://github.com/goldfinch-eng/mono/blob/main/packages/protocol/internal-audits/v3.0.0/epoch-level-checkpointing/invariant-analysis.md Example demonstrating potential loss of FIDU precision during conversion to USDC. ```text getNumShares(_getUSDCamountFromShares(1000000999999999999)) = getNumShares(1000000) = 1000000000000000000 ``` -------------------------------- ### Quick Start Script Source: https://github.com/goldfinch-eng/mono/blob/main/packages/subgraph/README.md Shell script for a quick subgraph run, requiring a test dump to be restored to the postgres container. This method is for mainnet forking only. ```bash packages/subgraph/quick-start.sh ``` -------------------------------- ### Initialize Subgraph Source: https://github.com/goldfinch-eng/mono/blob/main/packages/subgraph/beta-subgraph/README.md Commands to prepare and deploy the subgraph to the ECS-hosted graph node. ```bash cd packages/subgraph yarn ts-node ./scripts/setup-subgraph-manifest-local.ts yarn graph create --node $LOAD_BALANCER_URL:8020 goldfinch-subgraph yarn graph codegen yarn graph deploy --node $LOAD_BALANCER_URL:8020 --ipfs $LOAD_BALANCER_URL:5002 --version-label v0.0.1 goldfinch-subgraph subgraph-local.yaml ``` -------------------------------- ### Internal Function to Get Number of Shares from USDC Source: https://github.com/goldfinch-eng/mono/blob/main/packages/docs/docs/reference/contracts/core/SeniorPool.md Internal function to get the number of shares for a given USDC amount. This is a helper function. ```solidity function getNumShares(uint256 usdcAmount) public view returns (uint256) ``` -------------------------------- ### Get ERC721 Asset ID of a Position Source: https://github.com/goldfinch-eng/mono/blob/main/packages/docs/docs/reference/contracts/core/membership/CapitalLedger.md Retrieves the ERC721 asset ID for a given position. Use with `assetAddressOf` to get the full NFT details. ```solidity function erc721IdOf(uint256 positionId) public view returns (uint256) ``` -------------------------------- ### List Docker Contexts Source: https://github.com/goldfinch-eng/mono/blob/main/packages/subgraph/beta-subgraph/README.md Displays all available Docker contexts. ```bash docker context ls ``` -------------------------------- ### Run Local Subgraph Instance Source: https://github.com/goldfinch-eng/mono/blob/main/packages/subgraph/README.md Commands to create and deploy a local subgraph instance. This sets up the subgraph locally for development. ```bash yarn create-local ``` ```bash yarn deploy-local ``` -------------------------------- ### POST /setUpgradeDataFor Source: https://github.com/goldfinch-eng/mono/blob/main/packages/docs/docs/reference/contracts/core/proxy/ImplementationRepository.md Sets data that will be delegate called when a proxy upgrades to the given implementation. ```APIDOC ## POST /setUpgradeDataFor ### Description Sets data that will be delegate called when a proxy upgrades to the given implementation. Reverts if caller is not an admin, contract is paused, or implementation is not registered. ### Method POST ### Endpoint /setUpgradeDataFor ### Parameters #### Request Body - **implementation** (address) - Required - The implementation address - **data** (bytes) - Required - Data to be delegate called ``` -------------------------------- ### POST /initializeFromOtherConfig Source: https://github.com/goldfinch-eng/mono/blob/main/packages/docs/docs/reference/contracts/core/GoldfinchConfig.md Initializes the contract from another GoldfinchConfig contract. ```APIDOC ## POST /initializeFromOtherConfig ### Description Initializes the contract from another GoldfinchConfig contract. ### Method POST ### Endpoint /initializeFromOtherConfig ### Parameters #### Path Parameters None #### Query Parameters None #### Request Body - **_initialConfig** (address) - Required - The address of the initial configuration contract. - **numbersLength** (uint256) - Required - The length of the numbers mapping. - **addressesLength** (uint256) - Required - The length of the addresses mapping. ### Request Example ```json { "_initialConfig": "0x...", "numbersLength": 10, "addressesLength": 5 } ``` ### Response #### Success Response (200) No specific response body is detailed, typically indicates successful execution. #### Response Example None provided. ``` -------------------------------- ### GET /getTranche Source: https://github.com/goldfinch-eng/mono/blob/main/packages/docs/docs/reference/contracts/core/TranchedPool.md Retrieves information for a specific tranche. ```APIDOC ## GET /getTranche ### Description Returns TrancheInfo for a tranche with a specific id. ### Method GET ### Endpoint /getTranche ### Parameters #### Query Parameters - **tranche** (uint256) - Required - The tranche ID ``` -------------------------------- ### GET versionRecipient Source: https://github.com/goldfinch-eng/mono/blob/main/packages/docs/docs/reference/contracts/periphery/Borrower.md Retrieves the version of the recipient contract. ```APIDOC ## GET versionRecipient ### Description Returns the version string of the recipient contract. ### Method GET ### Endpoint versionRecipient() ### Response - **string** - The version identifier of the recipient. ``` -------------------------------- ### Initialize Function Source: https://github.com/goldfinch-eng/mono/blob/main/packages/docs/docs/reference/contracts/core/membership/MembershipLedger.md Placeholder function for initialization logic. ```solidity function initialize() public ``` -------------------------------- ### GET /estimateRewardsFor Source: https://github.com/goldfinch-eng/mono/blob/main/packages/docs/docs/reference/contracts/core/membership/MembershipCollector.md Estimate rewards for a specific epoch. ```APIDOC ## GET /estimateRewardsFor ### Description Estimate rewards for a given epoch. For epochs at or before lastFinalizedEpoch this will be the fixed, accurate reward for the epoch. For the current and other non-finalized epochs, this will be the value as if the epoch were finalized in that moment. ### Method GET ### Endpoint /estimateRewardsFor ### Parameters #### Query Parameters - **epoch** (uint256) - Required - epoch to estimate the rewards of ### Response #### Success Response (200) - **[0]** (uint256) - rewards associated with epoch ``` -------------------------------- ### Initialize from Existing Config Source: https://github.com/goldfinch-eng/mono/blob/main/packages/docs/docs/reference/contracts/core/GoldfinchConfig.md Copies configuration state from another GoldfinchConfig instance. ```solidity function initializeFromOtherConfig(address _initialConfig, uint256 numbersLength, uint256 addressesLength) public ``` -------------------------------- ### Create new lineage Source: https://github.com/goldfinch-eng/mono/blob/main/packages/docs/docs/reference/contracts/core/proxy/VersionedImplementationRepository.md Initializes a new lineage with the provided implementation address. ```solidity function _createLineage(address implementation) internal returns (uint256) ``` -------------------------------- ### GET /votingPower Source: https://github.com/goldfinch-eng/mono/blob/main/packages/docs/docs/reference/contracts/core/MembershipOrchestrator.md Checks the voting power of an address. ```APIDOC ## GET /votingPower ### Description Check the voting power of a given address. ### Method GET ### Parameters #### Query Parameters - **addr** (address) - Required - The address to check. ### Response #### Success Response (200) - **[0]** (uint256) - The voting power. ``` -------------------------------- ### GET /claimableRewards Source: https://github.com/goldfinch-eng/mono/blob/main/packages/docs/docs/reference/contracts/core/MembershipOrchestrator.md Checks claimable rewards for an address. ```APIDOC ## GET /claimableRewards ### Description Check how many rewards are claimable at this moment in time for a specific address. ### Method GET ### Parameters #### Query Parameters - **addr** (address) - Required - The address to check. ### Response #### Success Response (200) - **[0]** (uint256) - Amount of rewards claimable. ``` -------------------------------- ### CreditLine Initialization Source: https://github.com/goldfinch-eng/mono/blob/main/packages/docs/docs/reference/contracts/core/CreditLine.md Initializes a new credit line with configuration, borrower, and loan parameters. ```solidity function initialize(address _config, address owner, address _borrower, uint256 _maxLimit, uint256 _interestApr, contract ISchedule _schedule, uint256 _lateFeeApr) public ``` -------------------------------- ### POST /initialize Source: https://github.com/goldfinch-eng/mono/blob/main/packages/docs/docs/reference/contracts/rewards/StakingRewards.md Initializes the StakingRewards contract with an owner and configuration. ```APIDOC ## POST /initialize ### Description Initializes the StakingRewards contract with an owner and configuration. ### Method POST ### Endpoint `/__initialize__(address owner, contract GoldfinchConfig _config)` ### Parameters #### Request Body - **owner** (address) - Required - The address of the contract owner. - **_config** (contract GoldfinchConfig) - Required - The Goldfinch configuration contract address. ``` -------------------------------- ### GET /getNumber Source: https://github.com/goldfinch-eng/mono/blob/main/packages/docs/docs/reference/contracts/core/GoldfinchConfig.md Retrieves a number configuration by its index. ```APIDOC ## GET /getNumber ### Description Retrieves a number configuration by its index. ### Method GET ### Endpoint /getNumber ### Parameters #### Path Parameters None #### Query Parameters - **index** (uint256) - Required - The index of the number to retrieve. ### Request Example ```json { "index": 1 } ``` ### Response #### Success Response (200) - **number** (uint256) - The number value at the specified index. #### Response Example ```json { "number": 1000 } ``` ``` -------------------------------- ### GET /getAddress Source: https://github.com/goldfinch-eng/mono/blob/main/packages/docs/docs/reference/contracts/core/GoldfinchConfig.md Retrieves an address configuration by its index. ```APIDOC ## GET /getAddress ### Description Retrieves an address configuration by its index. ### Method GET ### Endpoint /getAddress ### Parameters #### Path Parameters None #### Query Parameters - **index** (uint256) - Required - The index of the address to retrieve. ### Request Example ```json { "index": 1 } ``` ### Response #### Success Response (200) - **address** (address) - The address value at the specified index. #### Response Example ```json { "address": "0x..." } ``` ``` -------------------------------- ### _applyInitializeNextEpochFrom Source: https://github.com/goldfinch-eng/mono/blob/main/packages/docs/docs/reference/contracts/core/SeniorPool.md Initializes the next epoch using a given previous epoch by carrying forward its outstanding fidu. ```APIDOC ## _applyInitializeNextEpochFrom ### Description Initialize the next epoch using a given epoch by carrying forward its oustanding fidu. ### Method INTERNAL ### Endpoint `_applyInitializeNextEpochFrom(struct ISeniorPoolEpochWithdrawals.Epoch previousEpoch)` ### Parameters #### Path Parameters - **previousEpoch** (struct ISeniorPoolEpochWithdrawals.Epoch) - Required - The previous epoch to initialize from. ### Return Values - **nextEpoch** (struct ISeniorPoolEpochWithdrawals.Epoch) - The newly initialized next epoch. ``` -------------------------------- ### GET /estimateRewardsFor Source: https://github.com/goldfinch-eng/mono/blob/main/packages/protocol-l2/internal-audits/v2.8.0/MembershipOrchestrator.md Proxy method to estimate rewards for a user. ```APIDOC ## GET /estimateRewardsFor ### Description Proxy method to estimate rewards by calling MembershipCollector. ### Method GET ### Endpoint /estimateRewardsFor ``` -------------------------------- ### Build Static Content Source: https://github.com/goldfinch-eng/mono/blob/main/packages/docs/README.md Generate static website content into the 'build' directory from 'packages/docs'. This output can be hosted on any static content service. ```bash $ yarn build ``` -------------------------------- ### Generate Contract Docs Source: https://github.com/goldfinch-eng/mono/blob/main/packages/docs/README.md Execute this command from the 'packages/docs' directory to generate Markdown documentation from Solidity smart contracts. The generated files are version-controlled and require manual committing. ```bash $ yarn build-contract-docs ``` -------------------------------- ### GET /rewardsToken Source: https://github.com/goldfinch-eng/mono/blob/main/packages/docs/docs/reference/contracts/rewards/StakingRewards.md Retrieves the address of the token being disbursed as rewards. ```APIDOC ## GET /rewardsToken ### Description Returns the address of the token being disbursed as rewards. ### Method GET ### Endpoint `/rewardsToken()` ### Response #### Success Response (200) - **[0]** (contract IERC20withDec) - The address of the rewards token. ``` -------------------------------- ### SeniorPool Initialization and Configuration Source: https://github.com/goldfinch-eng/mono/blob/main/packages/docs/docs/reference/contracts/core/SeniorPool.md Functions for initializing the contract and managing epoch settings. ```solidity function initialize(address owner, contract GoldfinchConfig _config) public ``` ```solidity function setEpochDuration(uint256 newEpochDuration) external ``` ```solidity function initializeEpochs() external ``` ```solidity function epochDuration() external view returns (uint256) ``` -------------------------------- ### GET lineageExists Source: https://github.com/goldfinch-eng/mono/blob/main/packages/docs/docs/reference/contracts/core/proxy/ImplementationRepository.md Checks if a specific lineage ID exists. ```APIDOC ## GET lineageExists ### Description Returns true if a given lineageId exists. ### Method GET ### Parameters #### Query Parameters - **lineageId** (uint256) - Required - The ID of the lineage to check. ### Response #### Success Response (200) - **exists** (bool) - Returns true if the lineage exists. ``` -------------------------------- ### GET positionOwnedBy Source: https://github.com/goldfinch-eng/mono/blob/main/packages/docs/docs/reference/contracts/core/membership/MembershipVault.md Retrieves the position details for a specific owner. ```APIDOC ## GET positionOwnedBy ### Description Get the position owned by `owner`. ### Method GET ### Parameters #### Query Parameters - **owner** (address) - Required - The owner address ### Response #### Success Response (200) - **position** (struct Position) - position owned by `owner` ``` -------------------------------- ### List Runtime Configurator Variables Source: https://github.com/goldfinch-eng/mono/blob/main/packages/functions/README.md Lists all variables within a specified runtime configuration for a given project. Ensure you replace `` with your actual project ID. ```bash gcloud beta runtime-config configs variables list --config-name kyc --values --project ``` -------------------------------- ### Build and Run Matchstick Tests Source: https://github.com/goldfinch-eng/mono/blob/main/packages/subgraph/README.md Use these commands to build a Docker image for Matchstick and run subgraph tests, or to execute tests directly using the 'graph test' command. ```bash cd packages/subgraph docker build -t matchstick . && docker run --rm matchstick ``` ```bash cd packages/subgraph graph test ``` -------------------------------- ### GET /hasNext Source: https://github.com/goldfinch-eng/mono/blob/main/packages/docs/docs/reference/contracts/core/proxy/ImplementationRepository.md Checks if an implementation has a next implementation set. ```APIDOC ## GET /hasNext ### Description Returns true if an implementation has a next implementation set. ### Method GET ### Endpoint /hasNext ### Parameters #### Query Parameters - **implementation** (address) - Required - Implementation to check ### Response #### Success Response (200) - **[0]** (bool) - True if the implementation has a successor ``` -------------------------------- ### initialize(address admin) Source: https://github.com/goldfinch-eng/mono/blob/main/packages/protocol-l2/internal-audits/v2.8.0/AccessControl.md Initializes the contract and sets the super admin. ```APIDOC ## initialize(address admin) ### Description Initializes the contract and sets the super admin. Uses the initializer modifier to prevent re-initialization. ### Parameters #### Request Body - **admin** (address) - Required - The address to be set as the super admin. ``` -------------------------------- ### GET /gfi Source: https://github.com/goldfinch-eng/mono/blob/main/packages/docs/docs/reference/contracts/rewards/MerkleDirectDistributor.md Retrieves the address of the GFI token contract. ```APIDOC ## GET /gfi ### Description Returns the address of the GFI contract that is the token distributed as rewards by this contract. ### Method GET ### Endpoint /gfi ### Response #### Success Response (200) - **address** (string) - The address of the GFI token contract. ``` -------------------------------- ### balanceOf Source: https://github.com/goldfinch-eng/mono/blob/main/packages/docs/docs/reference/contracts/core/membership/GFILedger.md Get the number of GFI positions held by an address. ```APIDOC ## GET balanceOf ### Description Get the number of GFI positions held by an address. ### Method GET ### Parameters #### Query Parameters - **addr** (address) - Required - address to query ### Response #### Success Response (200) - **balance** (uint256) - positions held by address ``` -------------------------------- ### Authenticate with Google Cloud Source: https://github.com/goldfinch-eng/mono/blob/main/packages/cms/README.md Authenticates the local environment with the Google Cloud CLI. ```bash gcloud auth login ``` -------------------------------- ### _initializeNextEpochFrom Source: https://github.com/goldfinch-eng/mono/blob/main/packages/docs/docs/reference/contracts/core/SeniorPool.md Internal view function to initialize the next epoch from a previous epoch. ```APIDOC ## _initializeNextEpochFrom ### Description Internal view function to initialize the next epoch from a previous epoch. ### Method VIEW ### Endpoint `_initializeNextEpochFrom(struct ISeniorPoolEpochWithdrawals.Epoch previousEpoch)` ### Parameters #### Path Parameters - **previousEpoch** (struct ISeniorPoolEpochWithdrawals.Epoch) - Required - The previous epoch to initialize from. ### Return Values - **nextEpoch** (struct ISeniorPoolEpochWithdrawals.Epoch) - The initialized next epoch. ``` -------------------------------- ### Get Limit from StaleCallableCreditLine Source: https://github.com/goldfinch-eng/mono/blob/main/packages/docs/docs/reference/contracts/core/callable/structs/StaleCallableCreditLine.md Retrieves the credit limit of the StaleCallableCreditLine. ```solidity function limit(struct StaleCallableCreditLine cl) internal view returns (uint256) ``` -------------------------------- ### startOf Source: https://github.com/goldfinch-eng/mono/blob/main/packages/docs/docs/reference/contracts/core/schedule/MonthlyPeriodMapper.md Retrieves the starting timestamp for a given period index. ```APIDOC ## startOf ### Description Returns the starting timestamp of a given period. ### Method function ### Parameters #### Path Parameters - **period** (uint256) - Required - The period index to query. ### Response - **returns** (uint256) - The starting timestamp of the period. ``` -------------------------------- ### Retrieve protocol ratio and fee settings Source: https://github.com/goldfinch-eng/mono/blob/main/packages/docs/docs/reference/contracts/core/ConfigHelper.md Fetches leverage ratios or specific fee settings in basis points. ```solidity function getLeverageRatio(contract GoldfinchConfig config) internal view returns (uint256) ``` ```solidity function getSeniorPoolWithdrawalCancelationFeeInBps(contract GoldfinchConfig config) internal view returns (uint256) ``` -------------------------------- ### GET /memberScoreOf Source: https://github.com/goldfinch-eng/mono/blob/main/packages/protocol-l2/internal-audits/v2.8.0/MembershipOrchestrator.md Proxy method to retrieve the member score of a user. ```APIDOC ## GET /memberScoreOf ### Description Proxy method to retrieve the current member score from the MembershipDirector. ### Method GET ### Endpoint /memberScoreOf ``` -------------------------------- ### Create Borrower Instance Source: https://github.com/goldfinch-eng/mono/blob/main/packages/docs/docs/reference/contracts/core/GoldfinchFactory.md Allows anyone to create a Borrower contract instance. The owner of the new Borrower contract is specified by the 'owner' parameter. ```solidity function createBorrower(address owner) external returns (address) ``` -------------------------------- ### Initialize GFI Contract Source: https://github.com/goldfinch-eng/mono/blob/main/packages/docs/docs/reference/contracts/core/GFI.md Constructor to set the owner, token name, symbol, and initial cap. ```solidity constructor(address owner, string name, string symbol, uint256 initialCap) public ``` -------------------------------- ### GET /stakedBalanceOf Source: https://github.com/goldfinch-eng/mono/blob/main/packages/docs/docs/reference/contracts/rewards/StakingRewards.md Returns the staked balance of a given position token. ```APIDOC ## GET /stakedBalanceOf ### Description Returns the staked balance of a given position token. The value returned is the bare amount, not the effective amount. The bare amount represents the number of tokens the user has staked for a given position. The effective amount is the bare amount multiplied by the token's underlying asset type multiplier. ### Method GET ### Endpoint `/stakedBalanceOf(uint256 tokenId)` ### Parameters #### Query Parameters - **tokenId** (uint256) - Required - A staking position token ID. ### Response #### Success Response (200) - **[0]** (uint256) - Amount of staked tokens denominated in `stakingToken().decimals()`. ``` -------------------------------- ### Get Tranche Information Source: https://github.com/goldfinch-eng/mono/blob/main/packages/docs/docs/reference/contracts/core/TranchedPool.md Retrieves metadata for a specific tranche ID. ```solidity function _getTrancheInfo(uint256 trancheId) internal view returns (struct ITranchedPool.TrancheInfo) ``` -------------------------------- ### Configure Wallet Connection with Wagmi Source: https://context7.com/goldfinch-eng/mono/llms.txt Sets up the Wagmi client with multiple connectors and demonstrates a React component for wallet management. ```typescript // packages/client2/lib/wallet/wagmi.ts import { configureChains, mainnet, createClient } from "wagmi"; import { MetaMaskConnector } from "wagmi/connectors/metaMask"; import { WalletConnectLegacyConnector } from "wagmi/connectors/walletConnectLegacy"; import { CoinbaseWalletConnector } from "wagmi/connectors/coinbaseWallet"; import { alchemyProvider } from "wagmi/providers/alchemy"; const { chains, provider } = configureChains( [mainnet], [alchemyProvider({ apiKey: process.env.NEXT_PUBLIC_ALCHEMY_API_KEY })] ); export const wagmiClient = createClient({ autoConnect: true, provider, connectors: [ new MetaMaskConnector({ chains }), new WalletConnectLegacyConnector({ chains, options: { qrcode: true } }), new CoinbaseWalletConnector({ chains, options: { appName: "Goldfinch" } }), ], }); // Usage in React component import { useAccount, useConnect, useDisconnect } from "wagmi"; function WalletButton() { const { address, isConnected } = useAccount(); const { connect, connectors } = useConnect(); const { disconnect } = useDisconnect(); if (isConnected) { return (
Connected: {address}
); } return (
{connectors.map((connector) => ( ))}
); } ``` -------------------------------- ### Constructor Source: https://github.com/goldfinch-eng/mono/blob/main/packages/docs/docs/reference/contracts/core/schedule/Schedule.md Initializes the Schedule contract with period mapping and payment frequency parameters. ```APIDOC ## constructor ### Description Initializes the schedule configuration for a loan. ### Parameters #### Request Body - **_periodMapper** (contract IPeriodMapper) - Required - Contract that maps timestamps to periods - **_periodsInTerm** (uint256) - Required - The number of periods in the term of the loan - **_periodsPerPrincipalPeriod** (uint256) - Required - The number of payment periods that need to pass before principal comes due - **_periodsPerInterestPeriod** (uint256) - Required - The number of payment periods that need to pass before interest comes due - **_gracePrincipalPeriods** (uint256) - Required - Principal periods where principal will not be due ``` -------------------------------- ### Get Total Shares Source: https://github.com/goldfinch-eng/mono/blob/main/packages/docs/docs/reference/contracts/deprecated/Pool.md Returns the total number of shares in the pool. ```solidity function totalShares() internal view returns (uint256) ``` -------------------------------- ### GET /getAmountsOwed Source: https://github.com/goldfinch-eng/mono/blob/main/packages/docs/docs/reference/contracts/core/TranchedPool.md Calculates interest and principal owed at a specific timestamp. ```APIDOC ## GET /getAmountsOwed ### Description Compute interest and principal owed on the current balance at a future timestamp. ### Method GET ### Endpoint /getAmountsOwed ### Parameters #### Query Parameters - **timestamp** (uint256) - Required - time to calculate up to ### Response #### Success Response (200) - **interestOwed** (uint256) - amount of obligated interest owed at timestamp - **interestAccrued** (uint256) - amount of accrued interest that can be paid at timestamp - **principalOwed** (uint256) - amount of principal owed at timestamp ``` -------------------------------- ### initialize Function Source: https://github.com/goldfinch-eng/mono/blob/main/packages/docs/docs/reference/contracts/core/callable/structs/CallableCreditLine.md Initializes a new CallableCreditLine with configuration parameters and schedule details. ```solidity function initialize(struct CallableCreditLine cl, contract IGoldfinchConfig _config, uint256 _fundableAt, uint256 _numLockupPeriods, contract ISchedule _schedule, uint256 _interestApr, uint256 _lateAdditionalApr, uint256 _limit) internal ``` -------------------------------- ### Get Pool Assets Source: https://github.com/goldfinch-eng/mono/blob/main/packages/docs/docs/reference/contracts/deprecated/Pool.md Returns the total assets held by the pool. ```solidity function assets() public view returns (uint256) ``` -------------------------------- ### GoldfinchConfig Contract Initialization Source: https://github.com/goldfinch-eng/mono/blob/main/packages/docs/docs/reference/contracts/core/WithdrawalRequestToken.md Initializes the GoldfinchConfig contract. Requires the owner's address and the GoldfinchConfig contract instance. ```solidity function __initialize__(address owner, contract GoldfinchConfig _config) external ``` -------------------------------- ### Improved Map Access in MembershipVault Source: https://github.com/goldfinch-eng/mono/blob/main/packages/protocol/internal-audits/v3.1.2/membership/contracts/MembershipVault.md This example shows the recommended way to access maps for improved clarity. Renaming 'owners' to 'positionIdByOwner' makes the key-value relationship more explicit. ```solidity Position memory position = positions[positionIdByOwner[owner]]; ``` -------------------------------- ### GET /NUM_TRANCHES_PER_SLICE Source: https://github.com/goldfinch-eng/mono/blob/main/packages/docs/docs/reference/contracts/core/TranchedPool.md Returns the number of tranches per slice in the pool. ```APIDOC ## GET /NUM_TRANCHES_PER_SLICE ### Description Returns the constant value representing the number of tranches configured per slice in the pool. This is a pure view function. ### Method GET ### Endpoint /NUM_TRANCHES_PER_SLICE ### Response #### Success Response (200) - **[0]** (uint256) - The number of tranches per slice. ``` -------------------------------- ### GET totalAtEpoch Source: https://github.com/goldfinch-eng/mono/blob/main/packages/docs/docs/reference/contracts/core/membership/MembershipVault.md Retrieves the total value in the vault for a specific epoch. ```APIDOC ## GET totalAtEpoch ### Description Get the total value in the vault as of epoch. ### Method GET ### Parameters #### Query Parameters - **epoch** (uint256) - Required - The epoch to query ### Response #### Success Response (200) - **total** (uint256) - total value in the vault as of epoch ``` -------------------------------- ### Configure Frontend Environment Variables Source: https://github.com/goldfinch-eng/mono/blob/main/README.md Required environment variables for the frontend, including the user's wallet address and Alchemy API key for mainnet forking. ```javascript TEST_USER={your metamask address} // only necessary if running a mainnet-forked frontend ALCHEMY_API_KEY={your alchemy api key} ``` -------------------------------- ### GET /isGrantAccepted Source: https://github.com/goldfinch-eng/mono/blob/main/packages/docs/docs/reference/contracts/rewards/MerkleDistributor.md Checks if a specific grant index has already been accepted. ```APIDOC ## GET /isGrantAccepted ### Description Returns true if the index has been marked accepted. ### Method GET ### Parameters #### Query Parameters - **index** (uint256) - Required - The index of the grant to check. ### Response - **accepted** (bool) - True if accepted, false otherwise. ``` -------------------------------- ### CreditLine Initialization Source: https://github.com/goldfinch-eng/mono/blob/main/packages/docs/docs/reference/contracts/core/CreditLine.md Initializes a new CreditLine instance with the provided configuration and loan terms. ```APIDOC ## Function: initialize ### Description Initialize a brand new credit line ### Method `public` ### Parameters - **_config** (address) - Address of the GoldfinchConfig contract. - **owner** (address) - The owner of the credit line. - **_borrower** (address) - The address of the borrower. - **_maxLimit** (uint256) - The maximum credit limit for this line. - **_interestApr** (uint256) - The annual interest rate. - **_schedule** (contract ISchedule) - The payment schedule contract. - **_lateFeeApr** (uint256) - The annual late fee rate. ``` -------------------------------- ### __BaseUpgradeablePausable__init Source: https://github.com/goldfinch-eng/mono/blob/main/packages/docs/docs/reference/contracts/core/BaseUpgradeablePausable.md Initializes the contract with an owner address. ```APIDOC ## __BaseUpgradeablePausable__init ### Description Initializes the contract with the specified owner address. ### Method public ### Parameters #### Request Body - **owner** (address) - Required - The address to be assigned the OWNER_ROLE. ``` -------------------------------- ### GET /merkleRoot Source: https://github.com/goldfinch-eng/mono/blob/main/packages/docs/docs/reference/contracts/rewards/MerkleDistributor.md Retrieves the Merkle root used for grant verification. ```APIDOC ## GET /merkleRoot ### Description Returns the merkle root of the merkle tree containing grant details available to accept. ### Method GET ### Response - **merkleRoot** (bytes32) - The current merkle root. ``` -------------------------------- ### GET /communityRewards Source: https://github.com/goldfinch-eng/mono/blob/main/packages/docs/docs/reference/contracts/rewards/MerkleDistributor.md Retrieves the address of the CommunityRewards contract associated with this distributor. ```APIDOC ## GET /communityRewards ### Description Returns the address of the CommunityRewards contract whose grants are distributed by this contract. ### Method GET ### Response - **address** (string) - The address of the CommunityRewards contract. ``` -------------------------------- ### Configure Docker for Google Cloud Source: https://github.com/goldfinch-eng/mono/blob/main/packages/cms/README.md Configures Docker to authenticate with the Google Cloud Artifact Registry. ```bash gcloud auth configure-docker us-central1-docker.pkg.dev ``` -------------------------------- ### Build image with multiple tags Source: https://github.com/goldfinch-eng/mono/blob/main/packages/cms/README.md Builds a Docker image and applies multiple tags to target different environments simultaneously. ```bash docker build . \ --tag us-central1-docker.pkg.dev/goldfinch-frontends-prod/goldfinch-docker-images/cms:stable \ --tag us-central1-docker.pkg.dev/goldfinch-frontends-prod/goldfinch-docker-images/cms:latest ``` -------------------------------- ### Get Proxy Owner Source: https://github.com/goldfinch-eng/mono/blob/main/packages/docs/docs/reference/contracts/core/proxy/UcuProxy.md Retrieves the current owner's address. ```solidity function owner() external view returns (address) ``` -------------------------------- ### GET hasVersion Source: https://github.com/goldfinch-eng/mono/blob/main/packages/docs/docs/reference/contracts/core/proxy/VersionedImplementationRepository.md Checks if a specific version tag is registered in the repository. ```APIDOC ## GET hasVersion ### Description Checks if a version exists. ### Method GET ### Endpoint hasVersion ### Parameters #### Query Parameters - **version** (uint8[3]) - Required - [major, minor, patch] version tag ### Response #### Success Response (200) - **exists** (bool) - true if the version is registered ``` -------------------------------- ### Go Contract - Initialization and Upgrades Source: https://github.com/goldfinch-eng/mono/blob/main/packages/docs/docs/reference/contracts/core/Go.md Functions for initializing and performing upgrades on the Go contract. ```APIDOC ## Go Contract - Initialization and Upgrades ### Description Functions related to the initialization and upgrade process of the Go contract. ### Functions - **initialize**(address owner, contract GoldfinchConfig _config, address _uniqueIdentity) `public` - Initializes the contract with the owner, config, and unique identity addresses. - **performUpgrade**() `external` - Executes the contract upgrade process. - **_performUpgrade**() `internal` - Internal function to perform the upgrade. - **initZapperRole**() `external` - Initializes the Zapper role. ``` -------------------------------- ### GET /calculateWritedown Source: https://github.com/goldfinch-eng/mono/blob/main/packages/docs/docs/reference/contracts/core/SeniorPool.md Calculates the writedown amount for a particular pool position. ```APIDOC ## GET /calculateWritedown ### Description Calculates the writedown amount for a particular pool position. ### Method GET ### Endpoint /calculateWritedown ### Parameters #### Query Parameters - **tokenId** (uint256) - Required - The token representing the position ### Response #### Success Response (200) - **amount** (uint256) - The amount in dollars the principal should be written down by ``` -------------------------------- ### Initialize constructor Source: https://github.com/goldfinch-eng/mono/blob/main/packages/docs/docs/reference/contracts/core/schedule/MonthlyScheduleRepo.md Constructor for the MonthlyScheduleRepo contract. ```solidity constructor() public ```