HyToken.sol contract represents deposits in the HypurrFi protocol. When users deposit assets into HypurrFi lending pools, they receive corresponding HyTokens. These tokens accrue interest through a rebase mechanism, meaning the token balance automatically increases over time.
HyTokens follow the ERC20 standard with additional functionality specific to the HypurrFi protocol. Each HyToken is pegged 1:1 to the value of the underlying asset that is deposited in the HypurrFi protocol.
Write Methods
mint
Copy
Ask AI
function mint(
address user,
uint256 amount,
uint256 index
) external returns (bool)
| Name | Type | Description |
|---|---|---|
| user | address | The address receiving the minted tokens |
| amount | uint256 | The amount of tokens to mint |
| index | uint256 | The liquidity index of the reserve |
| Type | Description |
|---|---|
| bool | True if the mint was successful |
burn
Copy
Ask AI
function burn(
address user,
address receiverOfUnderlying,
uint256 amount,
uint256 index
) external returns (bool)
| Name | Type | Description |
|---|---|---|
| user | address | The address from which to burn tokens |
| receiverOfUnderlying | address | The address that will receive the underlying |
| amount | uint256 | The amount to burn |
| index | uint256 | The liquidity index of the reserve |
| Type | Description |
|---|---|
| bool | True if the burn was successful |
transferOnLiquidation
Copy
Ask AI
function transferOnLiquidation(
address from,
address to,
uint256 value
) external
| Name | Type | Description |
|---|---|---|
| from | address | The address sending the tokens |
| to | address | The address receiving the tokens |
| value | uint256 | The amount of tokens to transfer |
View Methods
UNDERLYING_ASSET_ADDRESS
Copy
Ask AI
function UNDERLYING_ASSET_ADDRESS() external view returns (address)
| Type | Description |
|---|---|
| address | The address of the underlying asset |
POOL
Copy
Ask AI
function POOL() external view returns (address)
| Type | Description |
|---|---|
| address | The address of the lending pool |
scaledBalanceOf
Copy
Ask AI
function scaledBalanceOf(address user) external view returns (uint256)
| Name | Type | Description |
|---|---|---|
| user | address | The address of the user |
| Type | Description |
|---|---|
| uint256 | The scaled balance of the user |
Events
Mint
Copy
Ask AI
event Mint(
address indexed from,
uint256 value,
uint256 index
)
Burn
Copy
Ask AI
event Burn(
address indexed from,
address indexed target,
uint256 value,
uint256 index
)
Usage Example
Copy
Ask AI
// Deposit 100 DAI into HypurrFi
// User receives 100 hyDAI tokens
lendingPool.deposit(DAI_ADDRESS, 100, userAddress, 0);
// hyDAI balance increases automatically as interest accrues
// After some time, balance might be 102 hyDAI
// Withdraw all hyDAI
// User receives underlying DAI plus earned interest
lendingPool.withdraw(DAI_ADDRESS, type(uint256).max, userAddress);
ABI
HyToken ABI
HyToken ABI
Copy
Ask AI
[
{
"type": "constructor",
"inputs": [
{
"name": "pool",
"type": "address",
"internalType": "contract IPool"
}
],
"stateMutability": "nonpayable"
},
{
"type": "function",
"name": "ATOKEN_REVISION",
"inputs": [],
"outputs": [
{
"name": "",
"type": "uint256",
"internalType": "uint256"
}
],
"stateMutability": "view"
},
{
"type": "function",
"name": "DOMAIN_SEPARATOR",
"inputs": [],
"outputs": [
{
"name": "",
"type": "bytes32",
"internalType": "bytes32"
}
],
"stateMutability": "view"
},
{
"type": "function",
"name": "EIP712_REVISION",
"inputs": [],
"outputs": [
{
"name": "",
"type": "bytes",
"internalType": "bytes"
}
],
"stateMutability": "view"
},
{
"type": "function",
"name": "PERMIT_TYPEHASH",
"inputs": [],
"outputs": [
{
"name": "",
"type": "bytes32",
"internalType": "bytes32"
}
],
"stateMutability": "view"
},
{
"type": "function",
"name": "POOL",
"inputs": [],
"outputs": [
{
"name": "",
"type": "address",
"internalType": "contract IPool"
}
],
"stateMutability": "view"
},
{
"type": "function",
"name": "RESERVE_TREASURY_ADDRESS",
"inputs": [],
"outputs": [
{
"name": "",
"type": "address",
"internalType": "address"
}
],
"stateMutability": "view"
},
{
"type": "function",
"name": "UNDERLYING_ASSET_ADDRESS",
"inputs": [],
"outputs": [
{
"name": "",
"type": "address",
"internalType": "address"
}
],
"stateMutability": "view"
},
{
"type": "function",
"name": "allowance",
"inputs": [
{
"name": "owner",
"type": "address",
"internalType": "address"
},
{
"name": "spender",
"type": "address",
"internalType": "address"
}
],
"outputs": [
{
"name": "",
"type": "uint256",
"internalType": "uint256"
}
],
"stateMutability": "view"
},
{
"type": "function",
"name": "approve",
"inputs": [
{
"name": "spender",
"type": "address",
"internalType": "address"
},
{
"name": "amount",
"type": "uint256",
"internalType": "uint256"
}
],
"outputs": [
{
"name": "",
"type": "bool",
"internalType": "bool"
}
],
"stateMutability": "nonpayable"
},
{
"type": "function",
"name": "balanceOf",
"inputs": [
{
"name": "user",
"type": "address",
"internalType": "address"
}
],
"outputs": [
{
"name": "",
"type": "uint256",
"internalType": "uint256"
}
],
"stateMutability": "view"
},
{
"type": "function",
"name": "burn",
"inputs": [
{
"name": "from",
"type": "address",
"internalType": "address"
},
{
"name": "receiverOfUnderlying",
"type": "address",
"internalType": "address"
},
{
"name": "amount",
"type": "uint256",
"internalType": "uint256"
},
{
"name": "index",
"type": "uint256",
"internalType": "uint256"
}
],
"outputs": [],
"stateMutability": "nonpayable"
},
{
"type": "function",
"name": "decimals",
"inputs": [],
"outputs": [
{
"name": "",
"type": "uint8",
"internalType": "uint8"
}
],
"stateMutability": "view"
},
{
"type": "function",
"name": "decreaseAllowance",
"inputs": [
{
"name": "spender",
"type": "address",
"internalType": "address"
},
{
"name": "subtractedValue",
"type": "uint256",
"internalType": "uint256"
}
],
"outputs": [
{
"name": "",
"type": "bool",
"internalType": "bool"
}
],
"stateMutability": "nonpayable"
},
{
"type": "function",
"name": "getIncentivesController",
"inputs": [],
"outputs": [
{
"name": "",
"type": "address",
"internalType": "contract IAaveIncentivesController"
}
],
"stateMutability": "view"
},
{
"type": "function",
"name": "getPreviousIndex",
"inputs": [
{
"name": "user",
"type": "address",
"internalType": "address"
}
],
"outputs": [
{
"name": "",
"type": "uint256",
"internalType": "uint256"
}
],
"stateMutability": "view"
},
{
"type": "function",
"name": "getScaledUserBalanceAndSupply",
"inputs": [
{
"name": "user",
"type": "address",
"internalType": "address"
}
],
"outputs": [
{
"name": "",
"type": "uint256",
"internalType": "uint256"
},
{
"name": "",
"type": "uint256",
"internalType": "uint256"
}
],
"stateMutability": "view"
},
{
"type": "function",
"name": "handleRepayment",
"inputs": [
{
"name": "user",
"type": "address",
"internalType": "address"
},
{
"name": "onBehalfOf",
"type": "address",
"internalType": "address"
},
{
"name": "amount",
"type": "uint256",
"internalType": "uint256"
}
],
"outputs": [],
"stateMutability": "nonpayable"
},
{
"type": "function",
"name": "increaseAllowance",
"inputs": [
{
"name": "spender",
"type": "address",
"internalType": "address"
},
{
"name": "addedValue",
"type": "uint256",
"internalType": "uint256"
}
],
"outputs": [
{
"name": "",
"type": "bool",
"internalType": "bool"
}
],
"stateMutability": "nonpayable"
},
{
"type": "function",
"name": "initialize",
"inputs": [
{
"name": "initializingPool",
"type": "address",
"internalType": "contract IPool"
},
{
"name": "treasury",
"type": "address",
"internalType": "address"
},
{
"name": "underlyingAsset",
"type": "address",
"internalType": "address"
},
{
"name": "incentivesController",
"type": "address",
"internalType": "contract IAaveIncentivesController"
},
{
"name": "aTokenDecimals",
"type": "uint8",
"internalType": "uint8"
},
{
"name": "aTokenName",
"type": "string",
"internalType": "string"
},
{
"name": "aTokenSymbol",
"type": "string",
"internalType": "string"
},
{
"name": "params",
"type": "bytes",
"internalType": "bytes"
}
],
"outputs": [],
"stateMutability": "nonpayable"
},
{
"type": "function",
"name": "mint",
"inputs": [
{
"name": "caller",
"type": "address",
"internalType": "address"
},
{
"name": "onBehalfOf",
"type": "address",
"internalType": "address"
},
{
"name": "amount",
"type": "uint256",
"internalType": "uint256"
},
{
"name": "index",
"type": "uint256",
"internalType": "uint256"
}
],
"outputs": [
{
"name": "",
"type": "bool",
"internalType": "bool"
}
],
"stateMutability": "nonpayable"
},
{
"type": "function",
"name": "mintToTreasury",
"inputs": [
{
"name": "amount",
"type": "uint256",
"internalType": "uint256"
},
{
"name": "index",
"type": "uint256",
"internalType": "uint256"
}
],
"outputs": [],
"stateMutability": "nonpayable"
},
{
"type": "function",
"name": "name",
"inputs": [],
"outputs": [
{
"name": "",
"type": "string",
"internalType": "string"
}
],
"stateMutability": "view"
},
{
"type": "function",
"name": "nonces",
"inputs": [
{
"name": "owner",
"type": "address",
"internalType": "address"
}
],
"outputs": [
{
"name": "",
"type": "uint256",
"internalType": "uint256"
}
],
"stateMutability": "view"
},
{
"type": "function",
"name": "permit",
"inputs": [
{
"name": "owner",
"type": "address",
"internalType": "address"
},
{
"name": "spender",
"type": "address",
"internalType": "address"
},
{
"name": "value",
"type": "uint256",
"internalType": "uint256"
},
{
"name": "deadline",
"type": "uint256",
"internalType": "uint256"
},
{
"name": "v",
"type": "uint8",
"internalType": "uint8"
},
{
"name": "r",
"type": "bytes32",
"internalType": "bytes32"
},
{
"name": "s",
"type": "bytes32",
"internalType": "bytes32"
}
],
"outputs": [],
"stateMutability": "nonpayable"
},
{
"type": "function",
"name": "rescueTokens",
"inputs": [
{
"name": "token",
"type": "address",
"internalType": "address"
},
{
"name": "to",
"type": "address",
"internalType": "address"
},
{
"name": "amount",
"type": "uint256",
"internalType": "uint256"
}
],
"outputs": [],
"stateMutability": "nonpayable"
},
{
"type": "function",
"name": "scaledBalanceOf",
"inputs": [
{
"name": "user",
"type": "address",
"internalType": "address"
}
],
"outputs": [
{
"name": "",
"type": "uint256",
"internalType": "uint256"
}
],
"stateMutability": "view"
},
{
"type": "function",
"name": "scaledTotalSupply",
"inputs": [],
"outputs": [
{
"name": "",
"type": "uint256",
"internalType": "uint256"
}
],
"stateMutability": "view"
},
{
"type": "function",
"name": "setIncentivesController",
"inputs": [
{
"name": "controller",
"type": "address",
"internalType": "contract IAaveIncentivesController"
}
],
"outputs": [],
"stateMutability": "nonpayable"
},
{
"type": "function",
"name": "symbol",
"inputs": [],
"outputs": [
{
"name": "",
"type": "string",
"internalType": "string"
}
],
"stateMutability": "view"
},
{
"type": "function",
"name": "totalSupply",
"inputs": [],
"outputs": [
{
"name": "",
"type": "uint256",
"internalType": "uint256"
}
],
"stateMutability": "view"
},
{
"type": "function",
"name": "transfer",
"inputs": [
{
"name": "recipient",
"type": "address",
"internalType": "address"
},
{
"name": "amount",
"type": "uint256",
"internalType": "uint256"
}
],
"outputs": [
{
"name": "",
"type": "bool",
"internalType": "bool"
}
],
"stateMutability": "nonpayable"
},
{
"type": "function",
"name": "transferFrom",
"inputs": [
{
"name": "sender",
"type": "address",
"internalType": "address"
},
{
"name": "recipient",
"type": "address",
"internalType": "address"
},
{
"name": "amount",
"type": "uint256",
"internalType": "uint256"
}
],
"outputs": [
{
"name": "",
"type": "bool",
"internalType": "bool"
}
],
"stateMutability": "nonpayable"
},
{
"type": "function",
"name": "transferOnLiquidation",
"inputs": [
{
"name": "from",
"type": "address",
"internalType": "address"
},
{
"name": "to",
"type": "address",
"internalType": "address"
},
{
"name": "value",
"type": "uint256",
"internalType": "uint256"
}
],
"outputs": [],
"stateMutability": "nonpayable"
},
{
"type": "function",
"name": "transferUnderlyingTo",
"inputs": [
{
"name": "target",
"type": "address",
"internalType": "address"
},
{
"name": "amount",
"type": "uint256",
"internalType": "uint256"
}
],
"outputs": [],
"stateMutability": "nonpayable"
},
{
"type": "event",
"name": "Approval",
"inputs": [
{
"name": "owner",
"type": "address",
"indexed": true,
"internalType": "address"
},
{
"name": "spender",
"type": "address",
"indexed": true,
"internalType": "address"
},
{
"name": "value",
"type": "uint256",
"indexed": false,
"internalType": "uint256"
}
],
"anonymous": false
},
{
"type": "event",
"name": "BalanceTransfer",
"inputs": [
{
"name": "from",
"type": "address",
"indexed": true,
"internalType": "address"
},
{
"name": "to",
"type": "address",
"indexed": true,
"internalType": "address"
},
{
"name": "value",
"type": "uint256",
"indexed": false,
"internalType": "uint256"
},
{
"name": "index",
"type": "uint256",
"indexed": false,
"internalType": "uint256"
}
],
"anonymous": false
},
{
"type": "event",
"name": "Burn",
"inputs": [
{
"name": "from",
"type": "address",
"indexed": true,
"internalType": "address"
},
{
"name": "target",
"type": "address",
"indexed": true,
"internalType": "address"
},
{
"name": "value",
"type": "uint256",
"indexed": false,
"internalType": "uint256"
},
{
"name": "balanceIncrease",
"type": "uint256",
"indexed": false,
"internalType": "uint256"
},
{
"name": "index",
"type": "uint256",
"indexed": false,
"internalType": "uint256"
}
],
"anonymous": false
},
{
"type": "event",
"name": "Initialized",
"inputs": [
{
"name": "underlyingAsset",
"type": "address",
"indexed": true,
"internalType": "address"
},
{
"name": "pool",
"type": "address",
"indexed": true,
"internalType": "address"
},
{
"name": "treasury",
"type": "address",
"indexed": false,
"internalType": "address"
},
{
"name": "incentivesController",
"type": "address",
"indexed": false,
"internalType": "address"
},
{
"name": "aTokenDecimals",
"type": "uint8",
"indexed": false,
"internalType": "uint8"
},
{
"name": "aTokenName",
"type": "string",
"indexed": false,
"internalType": "string"
},
{
"name": "aTokenSymbol",
"type": "string",
"indexed": false,
"internalType": "string"
},
{
"name": "params",
"type": "bytes",
"indexed": false,
"internalType": "bytes"
}
],
"anonymous": false
},
{
"type": "event",
"name": "Mint",
"inputs": [
{
"name": "caller",
"type": "address",
"indexed": true,
"internalType": "address"
},
{
"name": "onBehalfOf",
"type": "address",
"indexed": true,
"internalType": "address"
},
{
"name": "value",
"type": "uint256",
"indexed": false,
"internalType": "uint256"
},
{
"name": "balanceIncrease",
"type": "uint256",
"indexed": false,
"internalType": "uint256"
},
{
"name": "index",
"type": "uint256",
"indexed": false,
"internalType": "uint256"
}
],
"anonymous": false
},
{
"type": "event",
"name": "Transfer",
"inputs": [
{
"name": "from",
"type": "address",
"indexed": true,
"internalType": "address"
},
{
"name": "to",
"type": "address",
"indexed": true,
"internalType": "address"
},
{
"name": "value",
"type": "uint256",
"indexed": false,
"internalType": "uint256"
}
],
"anonymous": false
}
]