Class

CERC20Mock

CERC20Mock(options)

CERC20Mock, use no decimals transformation for numbers because we hold underlaying token asset.

Constructor

# new CERC20Mock(options)

Parameters:
Name Type Description
options CERC20Mock~Options

View Source models/mocks/CERC20Mock.js, line 18

Members

# __assert

Use a cerc20mock contract with the current address

View Source models/mocks/CERC20Mock.js, line 153

Methods

# async balanceOfUnderlying(params) → {Promise.<uint256>}

Get the underlying balance of the owner

Parameters:
Name Type Description
params Object
owner address

The address of the account to query

View Source models/mocks/CERC20Mock.js, line 70

The amount of underlying owned by owner

Promise.<uint256>

# deploy(params, options) → {Promise.<Transaction>}

Deploy CERC20Mock

Parameters:
Name Type Description
params Object

Parameters

underlying Address

The address of the underlying asset

initialExchangeRate uint256

The initial exchange rate, scaled by 1e18

decimals uint256

ERC-20 decimal precision of this token

options IContract~TxOptions

View Source models/mocks/CERC20Mock.js, line 184

Transaction

Promise.<Transaction>

# async exchangeRateCurrent() → {Promise.<uint256>}

Accrue interest then return the up-to-date exchange rate

View Source models/mocks/CERC20Mock.js, line 82

Calculated exchange rate

Promise.<uint256>

# getERC20Contract()

View Source models/mocks/CERC20Mock.js, line 221

ERC20Contract|undefined

# initialBlockNumber() → {Promise.<uint256>}

Block number that interest started to increase from

View Source models/mocks/CERC20Mock.js, line 33

Promise.<uint256>

# initialExchangeRate() → {Promise.<uint256>}

Initial exchange rate used when minting the first CTokens (used when totalSupply = 0)

View Source models/mocks/CERC20Mock.js, line 41

Promise.<uint256>

# isCToken() → {Promise.<bool>}

Indicator that this is a CToken contract (for inspection)

View Source models/mocks/CERC20Mock.js, line 49

Promise.<bool>

# mint(params) → {Promise.<bool>}

Sender supplies assets into the market and receives cTokens in exchange Accrues interest whether or not the operation succeeds, unless reverted

Parameters:
Name Type Description
params Object
mintAmount uint256

The amount of the underlying asset to supply

View Source models/mocks/CERC20Mock.js, line 99

true=success, otherwise a failure

Promise.<bool>

# redeemUnderlying(params) → {Promise.<bool>}

Sender redeems cTokens in exchange for a specified amount of underlying asset

Parameters:
Name Type Description
params Object
redeemAmount uint256

The amount of underlying to redeem

View Source models/mocks/CERC20Mock.js, line 137

true=success, otherwise a failure

Promise.<bool>

# supplyUnderlying(params) → {Promise.<bool>}

Sender supplies underlying to the money market

Parameters:
Name Type Description
params Object
supplyAmount uint256

The amount of underlying to supply

View Source models/mocks/CERC20Mock.js, line 118

true=success, otherwise a failure

Promise.<bool>

# underlying() → {Promise.<address>}

Underlying asset for this CToken

View Source models/mocks/CERC20Mock.js, line 57

Promise.<address>

Type Definitions

Object

# Options

Properties:
Name Type Attributes Default Description
test Boolean
localtest Boolean

ganache local blockchain

web3Connection Web3Connection <optional>
Web3Connection

created from params: 'test', 'localtest' and optional 'web3Connection' string and 'privateKey'

contractAddress string <optional>

View Source models/mocks/CERC20Mock.js, line 5