My Name Tag:
Not Available, login to update
Txn Hash | Method |
Block
|
From
|
To
|
Value | [Txn Fee] | ||
---|---|---|---|---|---|---|---|---|
0x2d6c24e790f3b7987f724e0ba2774314981261f26b2183ed864fa842e826fa18 | 0x60806040 | 29794068 | 359 days 18 hrs ago | 0xb98d4d4e205aff4d4755e9df19bd0b8bd4e0f148 | IN | Create: ProviderHundred | 0 FTM | 0.42709932098 |
[ Download CSV Export ]
Latest 25 internal transaction
[ Download CSV Export ]
Contract Name:
ProviderHundred
Compiler Version
v0.8.2+commit.661d1103
Optimization Enabled:
Yes with 1000 runs
Other Settings:
default evmVersion
Contract Source Code (Solidity Standard Json-Input format)
// SPDX-License-Identifier: MIT pragma solidity ^0.8.0; import "@openzeppelin/contracts/token/ERC20/IERC20.sol"; import "../../interfaces/IProvider.sol"; import "../../interfaces/IUnwrapper.sol"; import "../../interfaces/IVault.sol"; import "../../interfaces/IWETH.sol"; import "../../interfaces/IFujiMappings.sol"; import "../../interfaces/compound/IGenCToken.sol"; import "../../interfaces/compound/ICEth.sol"; import "../../interfaces/compound/ICErc20.sol"; import "../../interfaces/compound/IComptroller.sol"; import "../../interfaces/compound/IProxyReceiver.sol"; import "../libraries/LibUniversalERC20FTM.sol"; contract HelperFunct { function _isFTM(address token) internal pure returns (bool) { return (token == address(0) || token == address(0xFFfFfFffFFfffFFfFFfFFFFFffFFFffffFfFFFfF)); } function _getMappingAddr() internal pure returns (address) { return 0xE89f9aFe2cd8B0498FC575238b0ef65Cf24e3De2; // Hundred fantom mapper } function _getComptrollerAddress() internal pure returns (address) { return 0x0F390559F258eB8591C8e31Cf0905E97cf36ACE2; // Hundred fantom } function _getUnwrapper() internal pure returns (address) { return 0xee94A39D185329d8c46dEA726E01F91641E57346; } function _getProxyReceiver() internal pure returns (address) { return 0x0A666645b6429eB1A5e04a4831092F7b907C2606; } // Fantom Hundred functions /** * @dev Approves vault's assets as collateral for Hundred Protocol. * @param _cTokenAddress: asset type to be approved as collateral. */ function _enterCollatMarket(address _cTokenAddress) internal { // Create a reference to the corresponding network Comptroller IComptroller comptroller = IComptroller(_getComptrollerAddress()); address[] memory cTokenMarkets = new address[](1); cTokenMarkets[0] = _cTokenAddress; comptroller.enterMarkets(cTokenMarkets); } /** * @dev Removes vault's assets as collateral for Hundred Protocol. * @param _cTokenAddress: asset type to be removed as collateral. */ function _exitCollatMarket(address _cTokenAddress) internal { // Create a reference to the corresponding network Comptroller IComptroller comptroller = IComptroller(_getComptrollerAddress()); comptroller.exitMarket(_cTokenAddress); } } contract ProviderHundred is IProvider, HelperFunct { using LibUniversalERC20FTM for IERC20; // Provider Core Functions /** * @dev Deposit '_asset'. * @param _asset: token address to deposit. (For FTM: 0xFFfFfFffFFfffFFfFFfFFFFFffFFFffffFfFFFfF) * @param _amount: token amount to deposit. */ function deposit(address _asset, uint256 _amount) external payable override { // Get cToken address from mapping address cTokenAddr = IFujiMappings(_getMappingAddr()).addressMapping(_asset); // Enter and/or ensure collateral market is enacted _enterCollatMarket(cTokenAddr); if (_isFTM(_asset)) { // Create a reference to the cToken contract ICEth cToken = ICEth(cTokenAddr); // Compound protocol Mints cTokens, ETH method cToken.mint{ value: _amount }(); } else { // Create reference to the ERC20 contract IERC20 erc20token = IERC20(_asset); // Create a reference to the cToken contract ICErc20 cToken = ICErc20(cTokenAddr); // Checks, Vault balance of ERC20 to make deposit require(erc20token.balanceOf(address(this)) >= _amount, "Not enough Balance"); // Approve to move ERC20tokens erc20token.univApprove(address(cTokenAddr), _amount); // Compound Protocol mints cTokens, trhow error if not require(cToken.mint(_amount) == 0, "Deposit-failed"); } } /** * @dev Withdraw '_asset'. * @param _asset: token address to withdraw. (For FTM: 0xFFfFfFffFFfffFFfFFfFFFFFffFFFffffFfFFFfF) * @param _amount: token amount to withdraw. */ function withdraw(address _asset, uint256 _amount) external payable override { // Get cToken address from mapping address cTokenAddr = IFujiMappings(_getMappingAddr()).addressMapping(_asset); // Create a reference to the corresponding cToken contract IGenCToken cToken = IGenCToken(cTokenAddr); if (_isFTM(_asset)) { // use a proxy receiver because Hundred uses "to.transfer(amount)" // which runs out of gas whit proxy contracts uint256 exRate = cToken.exchangeRateStored(); uint256 scaledAmount = _amount * 1e18 / exRate; address receiverAddr = _getProxyReceiver(); cToken.transfer(receiverAddr, scaledAmount); IProxyReceiver(receiverAddr).withdraw(_amount, cToken); } else { require(cToken.redeemUnderlying(_amount) == 0, "Withdraw-failed"); } } /** * @dev Borrow '_asset'. * @param _asset token address to borrow.(For FTM: 0xFFfFfFffFFfffFFfFFfFFFFFffFFFffffFfFFFfF) * @param _amount: token amount to borrow. */ function borrow(address _asset, uint256 _amount) external payable override { // Get cToken address from mapping address cTokenAddr = IFujiMappings(_getMappingAddr()).addressMapping(_asset); // Create a reference to the corresponding cToken contract IGenCToken cToken = IGenCToken(cTokenAddr); // Compound Protocol Borrow Process, throw errow if not. require(cToken.borrow(_amount) == 0, "borrow-failed"); } /** * @dev Payback borrowed '_asset'. * @param _asset token address to payback.(For FTM: 0xFFfFfFffFFfffFFfFFfFFFFFffFFFffffFfFFFfF) * @param _amount: token amount to payback. */ function payback(address _asset, uint256 _amount) external payable override { // Get cToken address from mapping address cTokenAddr = IFujiMappings(_getMappingAddr()).addressMapping(_asset); if (_isFTM(_asset)) { // Create a reference to the corresponding cToken contract ICEth cToken = ICEth(cTokenAddr); cToken.repayBorrow{ value: msg.value }(); } else { // Create reference to the ERC20 contract IERC20 erc20token = IERC20(_asset); // Create a reference to the corresponding cToken contract ICErc20 cToken = ICErc20(cTokenAddr); // Check there is enough balance to pay require(erc20token.balanceOf(address(this)) >= _amount, "Not-enough-token"); erc20token.univApprove(address(cTokenAddr), _amount); cToken.repayBorrow(_amount); } } /** * @dev Returns the current borrowing rate (APR) of '_asset', in ray(1e27). * @param _asset: token address to query the current borrowing rate. */ function getBorrowRateFor(address _asset) external view override returns (uint256) { address cTokenAddr = IFujiMappings(_getMappingAddr()).addressMapping(_asset); // Block Rate transformed for common mantissa for Fuji in ray (1e27) // Note: Cream uses base 1e18 uint256 bRateperBlock = IGenCToken(cTokenAddr).borrowRatePerBlock() * 10**9; // The approximate number of blocks per year that is assumed by the Cream interest rate model // ~60 blocks per min in fantom return bRateperBlock * 60 * 60 * 24 * 365; } /** * @dev Returns the borrow balance of '_asset' of caller. * NOTE: Returned value is at the last update state of provider. * @param _asset: token address to query the balance. */ function getBorrowBalance(address _asset) external view override returns (uint256) { address cTokenAddr = IFujiMappings(_getMappingAddr()).addressMapping(_asset); return IGenCToken(cTokenAddr).borrowBalanceStored(msg.sender); } /** * @dev Return borrow balance of '_asset' of caller. * This function updates the state of provider contract to return latest borrow balance. * It costs ~84K gas and is not a view function. * @param _asset token address to query the balance. * @param _who address of the account. */ function getBorrowBalanceOf(address _asset, address _who) external override returns (uint256) { address cTokenAddr = IFujiMappings(_getMappingAddr()).addressMapping(_asset); return IGenCToken(cTokenAddr).borrowBalanceCurrent(_who); } /** * @dev Returns the deposit balance of '_asset' of caller. * @param _asset: token address to query the balance. */ function getDepositBalance(address _asset) external view override returns (uint256) { address cTokenAddr = IFujiMappings(_getMappingAddr()).addressMapping(_asset); uint256 cTokenBal = IGenCToken(cTokenAddr).balanceOf(msg.sender); uint256 exRate = IGenCToken(cTokenAddr).exchangeRateStored(); return (exRate * cTokenBal) / 1e18; } }
// SPDX-License-Identifier: MIT pragma solidity ^0.8.0; /** * @dev Interface of the ERC20 standard as defined in the EIP. */ interface IERC20 { /** * @dev Returns the amount of tokens in existence. */ function totalSupply() external view returns (uint256); /** * @dev Returns the amount of tokens owned by `account`. */ function balanceOf(address account) external view returns (uint256); /** * @dev Moves `amount` tokens from the caller's account to `recipient`. * * Returns a boolean value indicating whether the operation succeeded. * * Emits a {Transfer} event. */ function transfer(address recipient, uint256 amount) external returns (bool); /** * @dev Returns the remaining number of tokens that `spender` will be * allowed to spend on behalf of `owner` through {transferFrom}. This is * zero by default. * * This value changes when {approve} or {transferFrom} are called. */ function allowance(address owner, address spender) external view returns (uint256); /** * @dev Sets `amount` as the allowance of `spender` over the caller's tokens. * * Returns a boolean value indicating whether the operation succeeded. * * IMPORTANT: Beware that changing an allowance with this method brings the risk * that someone may use both the old and the new allowance by unfortunate * transaction ordering. One possible solution to mitigate this race * condition is to first reduce the spender's allowance to 0 and set the * desired value afterwards: * https://github.com/ethereum/EIPs/issues/20#issuecomment-263524729 * * Emits an {Approval} event. */ function approve(address spender, uint256 amount) external returns (bool); /** * @dev Moves `amount` tokens from `sender` to `recipient` using the * allowance mechanism. `amount` is then deducted from the caller's * allowance. * * Returns a boolean value indicating whether the operation succeeded. * * Emits a {Transfer} event. */ function transferFrom( address sender, address recipient, uint256 amount ) external returns (bool); /** * @dev Emitted when `value` tokens are moved from one account (`from`) to * another (`to`). * * Note that `value` may be zero. */ event Transfer(address indexed from, address indexed to, uint256 value); /** * @dev Emitted when the allowance of a `spender` for an `owner` is set by * a call to {approve}. `value` is the new allowance. */ event Approval(address indexed owner, address indexed spender, uint256 value); }
// SPDX-License-Identifier: MIT pragma solidity ^0.8.0; interface IProvider { //Basic Core Functions function deposit(address _collateralAsset, uint256 _collateralAmount) external payable; function borrow(address _borrowAsset, uint256 _borrowAmount) external payable; function withdraw(address _collateralAsset, uint256 _collateralAmount) external payable; function payback(address _borrowAsset, uint256 _borrowAmount) external payable; // returns the borrow annualized rate for an asset in ray (1e27) //Example 8.5% annual interest = 0.085 x 10^27 = 85000000000000000000000000 or 85*(10**24) function getBorrowRateFor(address _asset) external view returns (uint256); function getBorrowBalance(address _asset) external view returns (uint256); function getDepositBalance(address _asset) external view returns (uint256); function getBorrowBalanceOf(address _asset, address _who) external returns (uint256); }
// SPDX-License-Identifier: MIT pragma solidity ^0.8.0; interface IUnwrapper { function withdraw(uint256 amount) external; }
// SPDX-License-Identifier: MIT pragma solidity ^0.8.0; interface IVault { // Vault Events /** * @dev Log a deposit transaction done by a user */ event Deposit(address indexed userAddrs, address indexed asset, uint256 amount); /** * @dev Log a withdraw transaction done by a user */ event Withdraw(address indexed userAddrs, address indexed asset, uint256 amount); /** * @dev Log a borrow transaction done by a user */ event Borrow(address indexed userAddrs, address indexed asset, uint256 amount); /** * @dev Log a payback transaction done by a user */ event Payback(address indexed userAddrs, address indexed asset, uint256 amount); /** * @dev Log a switch from provider to new provider in vault */ event Switch( address fromProviderAddrs, address toProviderAddr, uint256 debtamount, uint256 collattamount ); /** * @dev Log a change in active provider */ event SetActiveProvider(address newActiveProviderAddress); /** * @dev Log a change in the array of provider addresses */ event ProvidersChanged(address[] newProviderArray); /** * @dev Log a change in F1155 address */ event F1155Changed(address newF1155Address); /** * @dev Log a change in fuji admin address */ event FujiAdminChanged(address newFujiAdmin); /** * @dev Log a change in the factor values */ event FactorChanged(FactorType factorType, uint64 newFactorA, uint64 newFactorB); /** * @dev Log a change in the oracle address */ event OracleChanged(address newOracle); enum FactorType { Safety, Collateralization, ProtocolFee, BonusLiquidation } struct Factor { uint64 a; uint64 b; } // Core Vault Functions function deposit(uint256 _collateralAmount) external payable; function withdraw(int256 _withdrawAmount) external; function withdrawLiq(int256 _withdrawAmount) external; function borrow(uint256 _borrowAmount) external; function payback(int256 _repayAmount) external payable; function paybackLiq(address[] memory _users, uint256 _repayAmount) external payable; function executeSwitch( address _newProvider, uint256 _flashLoanDebt, uint256 _fee ) external payable; //Getter Functions function activeProvider() external view returns (address); function borrowBalance(address _provider) external view returns (uint256); function depositBalance(address _provider) external view returns (uint256); function userDebtBalance(address _user) external view returns (uint256); function userProtocolFee(address _user) external view returns (uint256); function userDepositBalance(address _user) external view returns (uint256); function getNeededCollateralFor(uint256 _amount, bool _withFactors) external view returns (uint256); function getLiquidationBonusFor(uint256 _amount) external view returns (uint256); function getProviders() external view returns (address[] memory); function fujiERC1155() external view returns (address); //Setter Functions function setActiveProvider(address _provider) external; function updateF1155Balances() external; function protocolFee() external view returns (uint64, uint64); }
// SPDX-License-Identifier: MIT pragma solidity ^0.8.0; interface IWETH { function approve(address, uint256) external; function deposit() external payable; function withdraw(uint256) external; }
// SPDX-License-Identifier: MIT pragma solidity ^0.8.0; interface IFujiMappings { // FujiMapping Events /** * @dev Log a change in address mapping */ event MappingChanged(address keyAddress, address mappedAddress); /** * @dev Log a change in URI */ event UriChanged(string newUri); function addressMapping(address) external view returns (address); }
// SPDX-License-Identifier: MIT pragma solidity ^0.8.0; import "@openzeppelin/contracts/token/ERC20/IERC20.sol"; interface IGenCToken is IERC20 { function redeem(uint256) external returns (uint256); function redeemUnderlying(uint256) external returns (uint256); function borrow(uint256 borrowAmount) external returns (uint256); function exchangeRateCurrent() external returns (uint256); function exchangeRateStored() external view returns (uint256); function borrowRatePerBlock() external view returns (uint256); function supplyRatePerBlock() external view returns (uint256); function balanceOfUnderlying(address owner) external returns (uint256); function borrowBalanceCurrent(address account) external returns (uint256); function borrowBalanceStored(address account) external view returns (uint256); }
// SPDX-License-Identifier: MIT pragma solidity ^0.8.0; import "@openzeppelin/contracts/token/ERC20/IERC20.sol"; import "./IGenCToken.sol"; interface ICEth is IGenCToken { function mint() external payable; function repayBorrow() external payable; function repayBorrowBehalf(address borrower) external payable; }
// SPDX-License-Identifier: MIT pragma solidity ^0.8.0; import "@openzeppelin/contracts/token/ERC20/IERC20.sol"; import "./IGenCToken.sol"; interface ICErc20 is IGenCToken { function mint(uint256) external returns (uint256); function repayBorrow(uint256 repayAmount) external returns (uint256); function repayBorrowBehalf(address borrower, uint256 repayAmount) external returns (uint256); }
// SPDX-License-Identifier: MIT pragma solidity ^0.8.0; interface IComptroller { function markets(address) external returns (bool, uint256); function enterMarkets(address[] calldata) external returns (uint256[] memory); function exitMarket(address cyTokenAddress) external returns (uint256); function claimComp(address holder) external; }
// SPDX-License-Identifier: MIT pragma solidity ^0.8.0; import "./IGenCToken.sol"; interface IProxyReceiver { function withdraw(uint256, IGenCToken) external payable; }
// SPDX-License-Identifier: MIT pragma solidity ^0.8.0; import { IERC20 } from "@openzeppelin/contracts/token/ERC20/IERC20.sol"; import { SafeERC20 } from "@openzeppelin/contracts/token/ERC20/utils/SafeERC20.sol"; library LibUniversalERC20FTM { using SafeERC20 for IERC20; IERC20 private constant _FTM_ADDRESS = IERC20(0xFFfFfFffFFfffFFfFFfFFFFFffFFFffffFfFFFfF); IERC20 private constant _ZERO_ADDRESS = IERC20(0x0000000000000000000000000000000000000000); function isFTM(IERC20 token) internal pure returns (bool) { return (token == _ZERO_ADDRESS || token == _FTM_ADDRESS); } function univBalanceOf(IERC20 token, address account) internal view returns (uint256) { if (isFTM(token)) { return account.balance; } else { return token.balanceOf(account); } } function univTransfer( IERC20 token, address payable to, uint256 amount ) internal { if (amount > 0) { if (isFTM(token)) { (bool sent, ) = to.call{ value: amount }(""); require(sent, "Failed to send Ether"); } else { token.safeTransfer(to, amount); } } } function univApprove( IERC20 token, address to, uint256 amount ) internal { require(!isFTM(token), "Approve called on ETH"); if (amount == 0) { token.safeApprove(to, 0); } else { uint256 allowance = token.allowance(address(this), to); if (allowance < amount) { if (allowance > 0) { token.safeApprove(to, 0); } token.safeApprove(to, amount); } } } }
// SPDX-License-Identifier: MIT pragma solidity ^0.8.0; import "../IERC20.sol"; import "../../../utils/Address.sol"; /** * @title SafeERC20 * @dev Wrappers around ERC20 operations that throw on failure (when the token * contract returns false). Tokens that return no value (and instead revert or * throw on failure) are also supported, non-reverting calls are assumed to be * successful. * To use this library you can add a `using SafeERC20 for IERC20;` statement to your contract, * which allows you to call the safe operations as `token.safeTransfer(...)`, etc. */ library SafeERC20 { using Address for address; function safeTransfer( IERC20 token, address to, uint256 value ) internal { _callOptionalReturn(token, abi.encodeWithSelector(token.transfer.selector, to, value)); } function safeTransferFrom( IERC20 token, address from, address to, uint256 value ) internal { _callOptionalReturn(token, abi.encodeWithSelector(token.transferFrom.selector, from, to, value)); } /** * @dev Deprecated. This function has issues similar to the ones found in * {IERC20-approve}, and its usage is discouraged. * * Whenever possible, use {safeIncreaseAllowance} and * {safeDecreaseAllowance} instead. */ function safeApprove( IERC20 token, address spender, uint256 value ) internal { // safeApprove should only be called when setting an initial allowance, // or when resetting it to zero. To increase and decrease it, use // 'safeIncreaseAllowance' and 'safeDecreaseAllowance' require( (value == 0) || (token.allowance(address(this), spender) == 0), "SafeERC20: approve from non-zero to non-zero allowance" ); _callOptionalReturn(token, abi.encodeWithSelector(token.approve.selector, spender, value)); } function safeIncreaseAllowance( IERC20 token, address spender, uint256 value ) internal { uint256 newAllowance = token.allowance(address(this), spender) + value; _callOptionalReturn(token, abi.encodeWithSelector(token.approve.selector, spender, newAllowance)); } function safeDecreaseAllowance( IERC20 token, address spender, uint256 value ) internal { unchecked { uint256 oldAllowance = token.allowance(address(this), spender); require(oldAllowance >= value, "SafeERC20: decreased allowance below zero"); uint256 newAllowance = oldAllowance - value; _callOptionalReturn(token, abi.encodeWithSelector(token.approve.selector, spender, newAllowance)); } } /** * @dev Imitates a Solidity high-level call (i.e. a regular function call to a contract), relaxing the requirement * on the return value: the return value is optional (but if data is returned, it must not be false). * @param token The token targeted by the call. * @param data The call data (encoded using abi.encode or one of its variants). */ function _callOptionalReturn(IERC20 token, bytes memory data) private { // We need to perform a low level call here, to bypass Solidity's return data size checking mechanism, since // we're implementing it ourselves. We use {Address.functionCall} to perform this call, which verifies that // the target address contains contract code and also asserts for success in the low-level call. bytes memory returndata = address(token).functionCall(data, "SafeERC20: low-level call failed"); if (returndata.length > 0) { // Return data is optional require(abi.decode(returndata, (bool)), "SafeERC20: ERC20 operation did not succeed"); } } }
// SPDX-License-Identifier: MIT pragma solidity ^0.8.0; /** * @dev Collection of functions related to the address type */ library Address { /** * @dev Returns true if `account` is a contract. * * [IMPORTANT] * ==== * It is unsafe to assume that an address for which this function returns * false is an externally-owned account (EOA) and not a contract. * * Among others, `isContract` will return false for the following * types of addresses: * * - an externally-owned account * - a contract in construction * - an address where a contract will be created * - an address where a contract lived, but was destroyed * ==== */ function isContract(address account) internal view returns (bool) { // This method relies on extcodesize, which returns 0 for contracts in // construction, since the code is only stored at the end of the // constructor execution. uint256 size; assembly { size := extcodesize(account) } return size > 0; } /** * @dev Replacement for Solidity's `transfer`: sends `amount` wei to * `recipient`, forwarding all available gas and reverting on errors. * * https://eips.ethereum.org/EIPS/eip-1884[EIP1884] increases the gas cost * of certain opcodes, possibly making contracts go over the 2300 gas limit * imposed by `transfer`, making them unable to receive funds via * `transfer`. {sendValue} removes this limitation. * * https://diligence.consensys.net/posts/2019/09/stop-using-soliditys-transfer-now/[Learn more]. * * IMPORTANT: because control is transferred to `recipient`, care must be * taken to not create reentrancy vulnerabilities. Consider using * {ReentrancyGuard} or the * https://solidity.readthedocs.io/en/v0.5.11/security-considerations.html#use-the-checks-effects-interactions-pattern[checks-effects-interactions pattern]. */ function sendValue(address payable recipient, uint256 amount) internal { require(address(this).balance >= amount, "Address: insufficient balance"); (bool success, ) = recipient.call{value: amount}(""); require(success, "Address: unable to send value, recipient may have reverted"); } /** * @dev Performs a Solidity function call using a low level `call`. A * plain `call` is an unsafe replacement for a function call: use this * function instead. * * If `target` reverts with a revert reason, it is bubbled up by this * function (like regular Solidity function calls). * * Returns the raw returned data. To convert to the expected return value, * use https://solidity.readthedocs.io/en/latest/units-and-global-variables.html?highlight=abi.decode#abi-encoding-and-decoding-functions[`abi.decode`]. * * Requirements: * * - `target` must be a contract. * - calling `target` with `data` must not revert. * * _Available since v3.1._ */ function functionCall(address target, bytes memory data) internal returns (bytes memory) { return functionCall(target, data, "Address: low-level call failed"); } /** * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`], but with * `errorMessage` as a fallback revert reason when `target` reverts. * * _Available since v3.1._ */ function functionCall( address target, bytes memory data, string memory errorMessage ) internal returns (bytes memory) { return functionCallWithValue(target, data, 0, errorMessage); } /** * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`], * but also transferring `value` wei to `target`. * * Requirements: * * - the calling contract must have an ETH balance of at least `value`. * - the called Solidity function must be `payable`. * * _Available since v3.1._ */ function functionCallWithValue( address target, bytes memory data, uint256 value ) internal returns (bytes memory) { return functionCallWithValue(target, data, value, "Address: low-level call with value failed"); } /** * @dev Same as {xref-Address-functionCallWithValue-address-bytes-uint256-}[`functionCallWithValue`], but * with `errorMessage` as a fallback revert reason when `target` reverts. * * _Available since v3.1._ */ function functionCallWithValue( address target, bytes memory data, uint256 value, string memory errorMessage ) internal returns (bytes memory) { require(address(this).balance >= value, "Address: insufficient balance for call"); require(isContract(target), "Address: call to non-contract"); (bool success, bytes memory returndata) = target.call{value: value}(data); return verifyCallResult(success, returndata, errorMessage); } /** * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`], * but performing a static call. * * _Available since v3.3._ */ function functionStaticCall(address target, bytes memory data) internal view returns (bytes memory) { return functionStaticCall(target, data, "Address: low-level static call failed"); } /** * @dev Same as {xref-Address-functionCall-address-bytes-string-}[`functionCall`], * but performing a static call. * * _Available since v3.3._ */ function functionStaticCall( address target, bytes memory data, string memory errorMessage ) internal view returns (bytes memory) { require(isContract(target), "Address: static call to non-contract"); (bool success, bytes memory returndata) = target.staticcall(data); return verifyCallResult(success, returndata, errorMessage); } /** * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`], * but performing a delegate call. * * _Available since v3.4._ */ function functionDelegateCall(address target, bytes memory data) internal returns (bytes memory) { return functionDelegateCall(target, data, "Address: low-level delegate call failed"); } /** * @dev Same as {xref-Address-functionCall-address-bytes-string-}[`functionCall`], * but performing a delegate call. * * _Available since v3.4._ */ function functionDelegateCall( address target, bytes memory data, string memory errorMessage ) internal returns (bytes memory) { require(isContract(target), "Address: delegate call to non-contract"); (bool success, bytes memory returndata) = target.delegatecall(data); return verifyCallResult(success, returndata, errorMessage); } /** * @dev Tool to verifies that a low level call was successful, and revert if it wasn't, either by bubbling the * revert reason using the provided one. * * _Available since v4.3._ */ function verifyCallResult( bool success, bytes memory returndata, string memory errorMessage ) internal pure returns (bytes memory) { if (success) { return returndata; } else { // Look for revert reason and bubble it up if present if (returndata.length > 0) { // The easiest way to bubble the revert reason is using memory via assembly assembly { let returndata_size := mload(returndata) revert(add(32, returndata), returndata_size) } } else { revert(errorMessage); } } } }
{ "optimizer": { "enabled": true, "runs": 1000 }, "outputSelection": { "*": { "*": [ "evm.bytecode", "evm.deployedBytecode", "devdoc", "userdoc", "metadata", "abi" ] } }, "libraries": {} }
Contract Security Audit
- No Contract Security Audit Submitted- Submit Audit Here
[{"inputs":[{"internalType":"address","name":"_asset","type":"address"},{"internalType":"uint256","name":"_amount","type":"uint256"}],"name":"borrow","outputs":[],"stateMutability":"payable","type":"function"},{"inputs":[{"internalType":"address","name":"_asset","type":"address"},{"internalType":"uint256","name":"_amount","type":"uint256"}],"name":"deposit","outputs":[],"stateMutability":"payable","type":"function"},{"inputs":[{"internalType":"address","name":"_asset","type":"address"}],"name":"getBorrowBalance","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"_asset","type":"address"},{"internalType":"address","name":"_who","type":"address"}],"name":"getBorrowBalanceOf","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"_asset","type":"address"}],"name":"getBorrowRateFor","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"_asset","type":"address"}],"name":"getDepositBalance","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"_asset","type":"address"},{"internalType":"uint256","name":"_amount","type":"uint256"}],"name":"payback","outputs":[],"stateMutability":"payable","type":"function"},{"inputs":[{"internalType":"address","name":"_asset","type":"address"},{"internalType":"uint256","name":"_amount","type":"uint256"}],"name":"withdraw","outputs":[],"stateMutability":"payable","type":"function"}]
Contract Creation Code
608060405234801561001057600080fd5b5061196b806100206000396000f3fe60806040526004361061007b5760003560e01c80637d6af0791161004e5780637d6af079146100ed578063ed05ae781461010d578063f17cca4a1461012d578063f3fef3a31461014d5761007b565b806335ed8ab81461008057806347e7ef24146100955780634b8a3529146100a857806351724377146100bb575b600080fd5b61009361008e3660046116d2565b610160565b005b6100936100a33660046116d2565b6103e1565b6100936100b63660046116d2565b610692565b3480156100c757600080fd5b506100db6100d636600461169a565b61080f565b60405190815260200160405180910390f35b3480156100f957600080fd5b506100db610108366004611662565b610942565b34801561011957600080fd5b506100db610128366004611662565b610a6f565b34801561013957600080fd5b506100db610148366004611662565b610c1c565b61009361015b3660046116d2565b610d61565b600073e89f9afe2cd8b0498fc575238b0ef65cf24e3de260405163024a66cd60e11b81526001600160a01b0385811660048301529190911690630494cd9a9060240160206040518083038186803b1580156101ba57600080fd5b505afa1580156101ce573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906101f2919061167e565b90506101fd836110b2565b15610261576000819050806001600160a01b0316634e4d9fea346040518263ffffffff1660e01b81526004016000604051808303818588803b15801561024257600080fd5b505af1158015610256573d6000803e3d6000fd5b5050505050506103dc565b6040516370a0823160e01b81523060048201528390829084906001600160a01b038416906370a082319060240160206040518083038186803b1580156102a657600080fd5b505afa1580156102ba573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906102de91906117dc565b10156103315760405162461bcd60e51b815260206004820152601060248201527f4e6f742d656e6f7567682d746f6b656e0000000000000000000000000000000060448201526064015b60405180910390fd5b6103456001600160a01b03831684866110d8565b6040517f0e752702000000000000000000000000000000000000000000000000000000008152600481018590526001600160a01b03821690630e75270290602401602060405180830381600087803b1580156103a057600080fd5b505af11580156103b4573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906103d891906117dc565b5050505b505050565b600073e89f9afe2cd8b0498fc575238b0ef65cf24e3de260405163024a66cd60e11b81526001600160a01b0385811660048301529190911690630494cd9a9060240160206040518083038186803b15801561043b57600080fd5b505afa15801561044f573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610473919061167e565b905061047e81611209565b610487836110b2565b156104cc576000819050806001600160a01b0316631249c58b846040518263ffffffff1660e01b81526004016000604051808303818588803b15801561024257600080fd5b6040516370a0823160e01b81523060048201528390829084906001600160a01b038416906370a082319060240160206040518083038186803b15801561051157600080fd5b505afa158015610525573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061054991906117dc565b10156105975760405162461bcd60e51b815260206004820152601260248201527f4e6f7420656e6f7567682042616c616e636500000000000000000000000000006044820152606401610328565b6105ab6001600160a01b03831684866110d8565b6040517fa0712d68000000000000000000000000000000000000000000000000000000008152600481018590526001600160a01b0382169063a0712d6890602401602060405180830381600087803b15801561060657600080fd5b505af115801561061a573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061063e91906117dc565b1561068b5760405162461bcd60e51b815260206004820152600e60248201527f4465706f7369742d6661696c65640000000000000000000000000000000000006044820152606401610328565b5050505050565b600073e89f9afe2cd8b0498fc575238b0ef65cf24e3de260405163024a66cd60e11b81526001600160a01b0385811660048301529190911690630494cd9a9060240160206040518083038186803b1580156106ec57600080fd5b505afa158015610700573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610724919061167e565b6040517fc5ebeaec0000000000000000000000000000000000000000000000000000000081526004810184905290915081906001600160a01b0382169063c5ebeaec90602401602060405180830381600087803b15801561078457600080fd5b505af1158015610798573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906107bc91906117dc565b156108095760405162461bcd60e51b815260206004820152600d60248201527f626f72726f772d6661696c6564000000000000000000000000000000000000006044820152606401610328565b50505050565b60008073e89f9afe2cd8b0498fc575238b0ef65cf24e3de260405163024a66cd60e11b81526001600160a01b0386811660048301529190911690630494cd9a9060240160206040518083038186803b15801561086a57600080fd5b505afa15801561087e573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906108a2919061167e565b6040517f17bfdfbc0000000000000000000000000000000000000000000000000000000081526001600160a01b038581166004830152919250908216906317bfdfbc90602401602060405180830381600087803b15801561090257600080fd5b505af1158015610916573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061093a91906117dc565b949350505050565b60008073e89f9afe2cd8b0498fc575238b0ef65cf24e3de260405163024a66cd60e11b81526001600160a01b0385811660048301529190911690630494cd9a9060240160206040518083038186803b15801561099d57600080fd5b505afa1580156109b1573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906109d5919061167e565b6040517f95dd91930000000000000000000000000000000000000000000000000000000081523360048201529091506001600160a01b038216906395dd91939060240160206040518083038186803b158015610a3057600080fd5b505afa158015610a44573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610a6891906117dc565b9392505050565b60008073e89f9afe2cd8b0498fc575238b0ef65cf24e3de260405163024a66cd60e11b81526001600160a01b0385811660048301529190911690630494cd9a9060240160206040518083038186803b158015610aca57600080fd5b505afa158015610ade573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610b02919061167e565b6040516370a0823160e01b81523360048201529091506000906001600160a01b038316906370a082319060240160206040518083038186803b158015610b4757600080fd5b505afa158015610b5b573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610b7f91906117dc565b90506000826001600160a01b031663182df0f56040518163ffffffff1660e01b815260040160206040518083038186803b158015610bbc57600080fd5b505afa158015610bd0573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610bf491906117dc565b9050670de0b6b3a7640000610c0983836118b0565b610c139190611890565b95945050505050565b60008073e89f9afe2cd8b0498fc575238b0ef65cf24e3de260405163024a66cd60e11b81526001600160a01b0385811660048301529190911690630494cd9a9060240160206040518083038186803b158015610c7757600080fd5b505afa158015610c8b573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610caf919061167e565b90506000816001600160a01b031663f8f9da286040518163ffffffff1660e01b815260040160206040518083038186803b158015610cec57600080fd5b505afa158015610d00573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610d2491906117dc565b610d3290633b9aca006118b0565b9050610d3f81603c6118b0565b610d4a90603c6118b0565b610d559060186118b0565b61093a9061016d6118b0565b600073e89f9afe2cd8b0498fc575238b0ef65cf24e3de260405163024a66cd60e11b81526001600160a01b0385811660048301529190911690630494cd9a9060240160206040518083038186803b158015610dbb57600080fd5b505afa158015610dcf573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610df3919061167e565b905080610dff846110b2565b15610fd2576000816001600160a01b031663182df0f56040518163ffffffff1660e01b815260040160206040518083038186803b158015610e3f57600080fd5b505afa158015610e53573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610e7791906117dc565b9050600081610e8e86670de0b6b3a76400006118b0565b610e989190611890565b90506000730a666645b6429eb1a5e04a4831092f7b907c26066040517fa9059cbb0000000000000000000000000000000000000000000000000000000081526001600160a01b038083166004830152602482018590529192509085169063a9059cbb90604401602060405180830381600087803b158015610f1857600080fd5b505af1158015610f2c573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610f5091906117bc565b506040517ef714ce000000000000000000000000000000000000000000000000000000008152600481018790526001600160a01b03858116602483015282169062f714ce90604401600060405180830381600087803b158015610fb257600080fd5b505af1158015610fc6573d6000803e3d6000fd5b50505050505050610809565b6040517f852a12e3000000000000000000000000000000000000000000000000000000008152600481018490526001600160a01b0382169063852a12e390602401602060405180830381600087803b15801561102d57600080fd5b505af1158015611041573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061106591906117dc565b156108095760405162461bcd60e51b815260206004820152600f60248201527f57697468647261772d6661696c656400000000000000000000000000000000006044820152606401610328565b60006001600160a01b03821615806110d257506001600160a01b03828116145b92915050565b6110e1836110b2565b1561112e5760405162461bcd60e51b815260206004820152601560248201527f417070726f76652063616c6c6564206f6e2045544800000000000000000000006044820152606401610328565b8061114d576111486001600160a01b03841683600061130e565b6103dc565b604051636eb1769f60e11b81523060048201526001600160a01b0383811660248301526000919085169063dd62ed3e9060440160206040518083038186803b15801561119857600080fd5b505afa1580156111ac573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906111d091906117dc565b9050818110156108095780156111f5576111f56001600160a01b03851684600061130e565b6108096001600160a01b038516848461130e565b604080516001808252818301909252730f390559f258eb8591c8e31cf0905e97cf36ace2916000919060208083019080368337019050509050828160008151811061126457634e487b7160e01b600052603260045260246000fd5b6001600160a01b0392831660209182029290920101526040517fc29982380000000000000000000000000000000000000000000000000000000081529083169063c2998238906112b8908490600401611810565b600060405180830381600087803b1580156112d257600080fd5b505af11580156112e6573d6000803e3d6000fd5b505050506040513d6000823e601f3d908101601f1916820160405261080991908101906116fd565b8015806113975750604051636eb1769f60e11b81523060048201526001600160a01b03838116602483015284169063dd62ed3e9060440160206040518083038186803b15801561135d57600080fd5b505afa158015611371573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061139591906117dc565b155b6114095760405162461bcd60e51b815260206004820152603660248201527f5361666545524332303a20617070726f76652066726f6d206e6f6e2d7a65726f60448201527f20746f206e6f6e2d7a65726f20616c6c6f77616e6365000000000000000000006064820152608401610328565b604080516001600160a01b03848116602483015260448083018590528351808403909101815260649092018352602080830180517bffffffffffffffffffffffffffffffffffffffffffffffffffffffff167f095ea7b30000000000000000000000000000000000000000000000000000000017905283518085019094528084527f5361666545524332303a206c6f772d6c6576656c2063616c6c206661696c6564908401526103dc928692916000916114c7918516908490611557565b8051909150156103dc57808060200190518101906114e591906117bc565b6103dc5760405162461bcd60e51b815260206004820152602a60248201527f5361666545524332303a204552433230206f7065726174696f6e20646964206e60448201527f6f742073756363656564000000000000000000000000000000000000000000006064820152608401610328565b606061093a848460008585843b6115b05760405162461bcd60e51b815260206004820152601d60248201527f416464726573733a2063616c6c20746f206e6f6e2d636f6e74726163740000006044820152606401610328565b600080866001600160a01b031685876040516115cc91906117f4565b60006040518083038185875af1925050503d8060008114611609576040519150601f19603f3d011682016040523d82523d6000602084013e61160e565b606091505b509150915061161e828286611629565b979650505050505050565b60608315611638575081610a68565b8251156116485782518084602001fd5b8160405162461bcd60e51b8152600401610328919061185d565b600060208284031215611673578081fd5b8135610a688161191d565b60006020828403121561168f578081fd5b8151610a688161191d565b600080604083850312156116ac578081fd5b82356116b78161191d565b915060208301356116c78161191d565b809150509250929050565b600080604083850312156116e4578182fd5b82356116ef8161191d565b946020939093013593505050565b6000602080838503121561170f578182fd5b825167ffffffffffffffff80821115611726578384fd5b818501915085601f830112611739578384fd5b81518181111561174b5761174b611907565b838102604051601f19603f8301168101818110858211171561176f5761176f611907565b604052828152858101935084860182860187018a101561178d578788fd5b8795505b838610156117af578051855260019590950194938601938601611791565b5098975050505050505050565b6000602082840312156117cd578081fd5b81518015158114610a68578182fd5b6000602082840312156117ed578081fd5b5051919050565b600082516118068184602087016118db565b9190910192915050565b6020808252825182820181905260009190848201906040850190845b818110156118515783516001600160a01b03168352928401929184019160010161182c565b50909695505050505050565b600060208252825180602084015261187c8160408501602087016118db565b601f01601f19169190910160400192915050565b6000826118ab57634e487b7160e01b81526012600452602481fd5b500490565b60008160001904831182151516156118d657634e487b7160e01b81526011600452602481fd5b500290565b60005b838110156118f65781810151838201526020016118de565b838111156108095750506000910152565b634e487b7160e01b600052604160045260246000fd5b6001600160a01b038116811461193257600080fd5b5056fea264697066735822122008d2dca6cc58fe3b54850ecc67597c5c870176feff8b882015272dd1d227fb7264736f6c63430008020033
Age | Block | Fee Address | BC Fee Address | Voting Power | Jailed | Incoming |
---|
Validator ID :
0 FTM
Amount Staked
0
Amount Delegated
0
Staking Total
0
Staking Start Epoch
0
Staking Start Time
0
Proof of Importance
0
Origination Score
0
Validation Score
0
Active
0
Online
0
Downtime
0 s
Address | Amount | claimed Rewards | Created On Epoch | Created On |
---|
Make sure to use the "Vote Down" button for any spammy posts, and the "Vote Up" for interesting conversations.