Options
All
  • Public
  • Public/Protected
  • All
Menu

Module "comp"

Index

Functions

claimVenus

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

    example
    const venus = new Venus(window.ethereum);
    
    (async function() {
    
      console.log('Claiming Venus...');
      const trx = await venus.claimVenus();
      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 Venus 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 venus = new Venus(window.ethereum);
    
    (async () => {
    
      const delegateSignature = await venus.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 Venus Governance voting rights to an address.

    example
    const venus = new Venus(window.ethereum);
    
    (async function() {
      const delegateTx = await venus.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 Venus Governance using an EIP-712 signature.

    example
    const venus = new Venus(window.ethereum);
    
    (async function() {
      const delegateTx = await venus.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 VENUS 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.

getMintableVAI

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

    example
    const venus = new Venus(window.ethereum);
    
    (async () => {
    
      const amount = await venus.getMintableVAI('0x4Ddc2D193948926D02f9B1fE9e1daa0718270ED5');
      console.log('MintableVAI amount', amount);
    
    })().catch(console.error);

    Parameters

    • _address: string

      The address in which to get mintable VAI amount.

    • Default value options: CallOptions = {}

    Returns Promise<string>

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

getVAIMintRate

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

    example
    const venus = new Venus(window.ethereum);
    
    (async () => {
    
      const rate = await venus.getVAIMintRate();
      console.log('VAI mint rate', rate);
    
    })().catch(console.error);

    Parameters

    • Default value options: CallOptions = {}

    Returns Promise<string>

    Returns a string of the numeric VAI mint rate.

getVenusAccrued

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

    example
    (async function () {
      const acc = await Venus.venus.getVenusAccrued('0x4Ddc2D193948926D02f9B1fE9e1daa0718270ED5');
      console.log('Accrued', acc);
    })().catch(console.error);

    Parameters

    • _address: string

      The address in which to find the VENUS accrued.

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

    Returns Promise<string>

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

getVenusBalance

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

    example
    (async function () {
      const bal = await Venus.venus.getVenusBalance('0x2775b1c75658Be0F640272CCb8c72ac986009e38');
      console.log('Balance', bal);
    })().catch(console.error);

    Parameters

    • _address: string

      The address in which to find the VENUS balance.

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

    Returns Promise<string>

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

mintVAI

  • mintVAI(mintVAIAmount: string | number | BigNumber, options?: CallOptions): Promise<TrxResponse>
  • Mint VAI in the Venus Protocol.

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

    Parameters

    • mintVAIAmount: string | number | BigNumber

      A string, number, or BigNumber object of the amount of an asset to mintVAI. 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 mintVAI transaction.

mintVAIGuardianPaused

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

    example
    const venus = new Venus(window.ethereum);
    
    (async () => {
    
      const _mintVAIGuardianPaused = await venus.mintVAIGuardianPaused();
      console.log('mintVAIGuardianPaused', _mintVAIGuardianPaused);
    
    })().catch(console.error);

    Parameters

    • Default value options: CallOptions = {}

    Returns Promise<string>

    Returns a string of the boolean mintVAIGuardianPaused.

mintedVAIOf

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

    example
    const venus = new Venus(window.ethereum);
    
    (async () => {
    
      const amount = await venus.mintedVAIOf('0x4Ddc2D193948926D02f9B1fE9e1daa0718270ED5');
      console.log('Minted VAI amount', amount);
    
    })().catch(console.error);

    Parameters

    • _address: string

      The address in which to get the minted VAI amount.

    • Default value options: CallOptions = {}

    Returns Promise<string>

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

mintedVAIs

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

    example
    const venus = new Venus(window.ethereum);
    
    (async () => {
    
      const amount = await venus.mintedVAIs('0x4Ddc2D193948926D02f9B1fE9e1daa0718270ED5');
      console.log('Minted VAI amount', amount);
    
    })().catch(console.error);

    Parameters

    • _address: string

      The address in which to get the minted VAI amount.

    • Default value options: CallOptions = {}

    Returns Promise<string>

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

repayVAI

  • repayVAI(repayVAIAmount: string | number | BigNumber, options?: CallOptions): Promise<TrxResponse>
  • Repay VAI in the Venus Protocol.

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

    Parameters

    • repayVAIAmount: 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 repayVAI transaction.

repayVAIGuardianPaused

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

    example
    const venus = new Venus(window.ethereum);
    
    (async () => {
    
      const _repayVAIGuardianPaused = await venus.repayVAIGuardianPaused();
      console.log('repayVAIGuardianPaused', _repayVAIGuardianPaused);
    
    })().catch(console.error);

    Parameters

    • Default value options: CallOptions = {}

    Returns Promise<string>

    Returns a string of the boolean repayVAIGuardianPaused.

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.

vaiController

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

    example
    const venus = new Venus(window.ethereum);
    
    (async () => {
    
      const vaiControllerAddress = await venus.vaiController();
      console.log('vaiControllerAddress', vaiControllerAddress);
    
    })().catch(console.error);

    Parameters

    • Default value options: CallOptions = {}

    Returns Promise<string>

    Returns a string of the vaiController address.

vaiMintRate

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

    example
    const venus = new Venus(window.ethereum);
    
    (async () => {
    
      const vaiMintRate = await venus.vaiMintRate();
      console.log('vaiMintRate', vaiMintRate);
    
    })().catch(console.error);

    Parameters

    • Default value options: CallOptions = {}

    Returns Promise<string>

    Returns a string of the numeric vaiMintRate.