Gloop
WebsiteTwitterDiscord
  • gLoop Litepaper v2
    • Introduction
    • The Two Tokens
    • Roadmap
  • PRODUCTS
    • GM Index
      • Providing/Removing Liquidity
      • Fees and Reflection
      • Deposit/Withdrawal Examples
    • GM Lending/Looping (Coming Soon)
    • GLOOP Staking (Coming Soon)
  • GM Points (COMING SOON)
  • FREQUENTLY ASKED QUESTIONS (FAQs)
    • GM Index (GMI)
  • Technical
    • Gloop Protocol Parameters
    • Contracts
      • GMI
        • GM Index
        • GMI USDC Zap
        • Token Banks
        • Token Oracles
        • Fees
    • Audits
  • GLoop Ecosystem
    • Tokenomics
  • Security and Risk
    • Risks
  • Social
    • Socials
Powered by GitBook
On this page
  • constructor
  • deployLendingPool
  • getPoolFromNumber
  1. Technical
  2. Contracts
  3. GM Lending and Looping

GM Lending Pool Factory

Last updated 11 months ago

This Factory contract deploys contracts and creates and stores a pool ID for future lookup. The Factory inherits from Solmate's Auth contract. The functions are:

constructor

The constructor assigns the owner and Authority roles (both hereafter referred to as Admin) to the addresses that the deployer passes in as arguments.

Parameters:

Name
Type
Description

_owner

address

The owner of the Factory

_authority

Authority

The Authority of the Factory

deployLendingPool

function deployLendingPool(string memory name) external returns (LendingPool pool, uint256 index) 

Uses the name provided, a poolNumber counter, as well as the CREATE2 opcode, to deploy a Lending Pool contract with a unique combination of pool ID and name. Upon success, the call emits a PoolDeployed event with the pool ID, the LendingPool contract, and the caller's address.

Parameters:

Name
Type
Description

name

string memory

The deployer-defined name of the Lending Pool

Returns:

Name
Type
Description

pool

LendingPool

The Lending Pool contract instance

index

uint256

The ID of the deployed pool contract

getPoolFromNumber

function getPoolFromNumber(uint256 id) external view returns (LendingPool pool) 

Uses the user-provided pool ID to retrieve the associated pool contract, by converting the CREATE2 hash into a contract instance.

Parameters:

Name
Type
Description

id

uint256

The ID of a Lending Pool contract

Returns:

Name
Type
Description

pool

LendingPool

The Lending Pool contract instance

Lending Pool