Options
All
  • Public
  • Public/Protected
  • All
Menu

Module "comp"

Index

Functions

claimFortress

  • claimFortress(options?: CallOptions): Promise<TrxResponse>
  • Create a transaction to claim accrued FORTRESS tokens for the user.

    example
    const fortress = new Fortress(window.ethereum);
    
    (async function() {
    
      console.log('Claiming Fortress...');
      const trx = await fortress.claimFortress();
      console.log('Ethers.js transaction object', trx);
    
    })().catch(console.error);

    Parameters

    • Default value options: CallOptions = {}

    Returns Promise<TrxResponse>

    Returns an Ethers.js transaction object of the vote transaction.

createDelegateSignature

  • createDelegateSignature(delegatee: string, expiry?: number): Promise<Signature>
  • Create a delegate signature for Fortress Governance using EIP-712. The signature can be created without burning gas. Anyone can post it to the blockchain using the delegateBySig method, which does have gas costs.

    example
    const fortress = new Fortress(window.ethereum);
    
    (async () => {
    
      const delegateSignature = await fortress.createDelegateSignature('0xa0df350d2637096571F7A701CBc1C5fdE30dF76A');
      console.log('delegateSignature', delegateSignature);
    
    })().catch(console.error);

    Parameters

    • delegatee: string

      The address to delegate the user's voting rights to.

    • Default value expiry: number = 10000000000

    Returns Promise<Signature>

    Returns an object that contains the v, r, and s components of an Ethereum signature as hexadecimal strings.

delegate

  • delegate(_address: string, options?: CallOptions): Promise<TrxResponse>
  • Create a transaction to delegate Fortress Governance voting rights to an address.

    example
    const fortress = new Fortress(window.ethereum);
    
    (async function() {
      const delegateTx = await fortress.delegate('0xa0df350d2637096571F7A701CBc1C5fdE30dF76A');
      console.log('Ethers.js transaction object', delegateTx);
    })().catch(console.error);

    Parameters

    • _address: string

      The address in which to delegate voting rights to.

    • Default value options: CallOptions = {}

    Returns Promise<TrxResponse>

    Returns an Ethers.js transaction object of the vote transaction.

delegateBySig

  • delegateBySig(_address: string, nonce: number, expiry: number, signature?: Signature, options?: CallOptions): Promise<TrxResponse>
  • Delegate voting rights in Fortress Governance using an EIP-712 signature.

    example
    const fortress = new Fortress(window.ethereum);
    
    (async function() {
      const delegateTx = await fortress.delegateBySig(
        '0xa0df350d2637096571F7A701CBc1C5fdE30dF76A',
        42,
        9999999999,
        {
          v: '0x1b',
          r: '0x130dbca2fafa07424c033b4479687cc1deeb65f08809e3ab397988cc4c6f2e78',
          s: '0x1debeb8250262f23906b1177161f0c7c9aa3641e8bff5b6f5c88a6bb78d5d8cd'
        }
      );
      console.log('Ethers.js transaction object', delegateTx);
    })().catch(console.error);

    Parameters

    • _address: string

      The address to delegate the user's voting rights to.

    • nonce: number

      The contract state required to match the signature. This can be retrieved from the FORTRESS contract's public nonces mapping.

    • expiry: number

      The time at which to expire the signature. A block timestamp as seconds since the unix epoch.

    • Default value signature: Signature = { v: '', r: '', s: '' }

      An object that contains the v, r, and, s values of an EIP-712 signature.

    • Default value options: CallOptions = {}

    Returns Promise<TrxResponse>

    Returns an Ethers.js transaction object of the vote transaction.

faiController

  • faiController(options?: CallOptions): Promise<string>
  • Get the faiController.

    example
    const fortress = new Fortress(window.ethereum);
    
    (async () => {
    
      const faiControllerAddress = await fortress.faiController();
      console.log('faiControllerAddress', faiControllerAddress);
    
    })().catch(console.error);

    Parameters

    • Default value options: CallOptions = {}

    Returns Promise<string>

    Returns a string of the faiController address.

faiMintRate

  • faiMintRate(options?: CallOptions): Promise<string>
  • Get the faiMintRate.

    example
    const fortress = new Fortress(window.ethereum);
    
    (async () => {
    
      const faiMintRate = await fortress.faiMintRate();
      console.log('faiMintRate', faiMintRate);
    
    })().catch(console.error);

    Parameters

    • Default value options: CallOptions = {}

    Returns Promise<string>

    Returns a string of the numeric faiMintRate.

getFAIMintRate

  • getFAIMintRate(options?: CallOptions): Promise<string>
  • Get the FAI mint rate.

    example
    const fortress = new Fortress(window.ethereum);
    
    (async () => {
    
      const rate = await fortress.getFAIMintRate();
      console.log('FAI mint rate', rate);
    
    })().catch(console.error);

    Parameters

    • Default value options: CallOptions = {}

    Returns Promise<string>

    Returns a string of the numeric FAI mint rate.

getFortressAccrued

  • getFortressAccrued(_address: string, _provider?: Provider | string): Promise<string>
  • Get the amount of FORTRESS tokens accrued but not yet claimed by an address.

    example
    (async function () {
      const acc = await Fortress.fortress.getFortressAccrued('0x4Ddc2D193948926D02f9B1fE9e1daa0718270ED5');
      console.log('Accrued', acc);
    })().catch(console.error);

    Parameters

    • _address: string

      The address in which to find the FORTRESS accrued.

    • Default value _provider: Provider | string = "mainnet"

    Returns Promise<string>

    Returns a string of the numeric accruement of FORTRESS. The value is scaled up by 18 decimal places.

getFortressBalance

  • getFortressBalance(_address: string, _provider?: Provider | string): Promise<string>
  • Get the balance of FORTRESS tokens held by an address.

    example
    (async function () {
      const bal = await Fortress.fortress.getFortressBalance('0x2775b1c75658Be0F640272CCb8c72ac986009e38');
      console.log('Balance', bal);
    })().catch(console.error);

    Parameters

    • _address: string

      The address in which to find the FORTRESS balance.

    • Default value _provider: Provider | string = "mainnet"

    Returns Promise<string>

    Returns a string of the numeric balance of FORTRESS. The value is scaled up by 18 decimal places.

getMintableFAI

  • getMintableFAI(_address: string, options?: CallOptions): Promise<string>
  • Get the mintable FAI amount of address.

    example
    const fortress = new Fortress(window.ethereum);
    
    (async () => {
    
      const amount = await fortress.getMintableFAI('0x4Ddc2D193948926D02f9B1fE9e1daa0718270ED5');
      console.log('MintableFAI amount', amount);
    
    })().catch(console.error);

    Parameters

    • _address: string

      The address in which to get mintable FAI amount.

    • Default value options: CallOptions = {}

    Returns Promise<string>

    Returns a string of the numeric amount of mintable FAI. The value is scaled up by 18 decimal places.

mintFAI

  • mintFAI(mintFAIAmount: string | number | BigNumber, options?: CallOptions): Promise<TrxResponse>
  • Mint FAI in the Fortress Protocol.

    example
    const fortress = new Fortress(window.ethereum);
    
    // const trxOptions = { gasLimit: 250000, mantissa: false };
    
    (async function() {
    
      console.log('Minting FAI in the Fortress Protocol...');
      const trx = await fortress.mintFAI(1);
      console.log('Ethers.js transaction object', trx);
    
    })().catch(console.error);

    Parameters

    • mintFAIAmount: string | number | BigNumber

      A string, number, or BigNumber object of the amount of an asset to mintFAI. Use the mantissa boolean in the options parameter to indicate if this value is scaled up (so there are no decimals) or in its natural scale.

    • Default value options: CallOptions = {}

    Returns Promise<TrxResponse>

    Returns an Ethers.js transaction object of the mintFAI transaction.

mintFAIGuardianPaused

  • mintFAIGuardianPaused(options?: CallOptions): Promise<string>
  • Get the mintFAIGuardianPaused.

    example
    const fortress = new Fortress(window.ethereum);
    
    (async () => {
    
      const _mintFAIGuardianPaused = await fortress.mintFAIGuardianPaused();
      console.log('mintFAIGuardianPaused', _mintFAIGuardianPaused);
    
    })().catch(console.error);

    Parameters

    • Default value options: CallOptions = {}

    Returns Promise<string>

    Returns a string of the boolean mintFAIGuardianPaused.

mintedFAIOf

  • mintedFAIOf(_address: string, options?: CallOptions): Promise<string>
  • Get the minted FAI amount of the address.

    example
    const fortress = new Fortress(window.ethereum);
    
    (async () => {
    
      const amount = await fortress.mintedFAIOf('0x4Ddc2D193948926D02f9B1fE9e1daa0718270ED5');
      console.log('Minted FAI amount', amount);
    
    })().catch(console.error);

    Parameters

    • _address: string

      The address in which to get the minted FAI amount.

    • Default value options: CallOptions = {}

    Returns Promise<string>

    Returns a string of the numeric amount of minted FAI. The value is scaled up by 18 decimal places.

mintedFAIs

  • mintedFAIs(_address: string, options?: CallOptions): Promise<string>
  • Get the minted FAI amount of the address.

    example
    const fortress = new Fortress(window.ethereum);
    
    (async () => {
    
      const amount = await fortress.mintedFAIs('0x4Ddc2D193948926D02f9B1fE9e1daa0718270ED5');
      console.log('Minted FAI amount', amount);
    
    })().catch(console.error);

    Parameters

    • _address: string

      The address in which to get the minted FAI amount.

    • Default value options: CallOptions = {}

    Returns Promise<string>

    Returns a string of the numeric amount of minted FAI. The value is scaled up by 18 decimal places.

repayFAI

  • repayFAI(repayFAIAmount: string | number | BigNumber, options?: CallOptions): Promise<TrxResponse>
  • Repay FAI in the Fortress Protocol.

    example
    const fortress = new Fortress(window.ethereum);
    
    // const trxOptions = { gasLimit: 250000, mantissa: false };
    
    (async function() {
    
      console.log('Repaying FAI in the Fortress Protocol...');
      const trx = await fortress.repayFAI(1);
      console.log('Ethers.js transaction object', trx);
    
    })().catch(console.error);

    Parameters

    • repayFAIAmount: string | number | BigNumber

      A string, number, or BigNumber object of the amount of an asset to repay. Use the mantissa boolean in the options parameter to indicate if this value is scaled up (so there are no decimals) or in its natural scale.

    • Default value options: CallOptions = {}

    Returns Promise<TrxResponse>

    Returns an Ethers.js transaction object of the repayFAI transaction.

repayFAIGuardianPaused

  • repayFAIGuardianPaused(options?: CallOptions): Promise<string>
  • Get the repayFAIGuardianPaused.

    example
    const fortress = new Fortress(window.ethereum);
    
    (async () => {
    
      const _repayFAIGuardianPaused = await fortress.repayFAIGuardianPaused();
      console.log('repayFAIGuardianPaused', _repayFAIGuardianPaused);
    
    })().catch(console.error);

    Parameters

    • Default value options: CallOptions = {}

    Returns Promise<string>

    Returns a string of the boolean repayFAIGuardianPaused.

toChecksumAddress

  • toChecksumAddress(_address: any): string
  • Applies the EIP-55 checksum to an Ethereum address.

    Parameters

    • _address: any

      The Ethereum address to apply the checksum.

    Returns string

    Returns a string of the Ethereum address.