Fulcrum liquidity check

Monitor the liquidity and check when you can claim back your tokens

Fulcrum is a Defi platform for tokenized margin lending and trading.

Using Fulcrum, you can lend your tokens and earn interests in crypto. Although in principle your tokens can be redeemed any time you want, in practice you need to wait until there is available (non-borrowed) liquidity to claim your loan back. One of the ways you can use HAL is to monitor the liquidity and check when you can claim back your tokens

How does landing work on Fulcrum?

Lending on Fulcrum is powered by iTokens, which are global lending pools. Each asset has a single iToken equivalent (ETH as iETH, DAI has iDAI, etc.), and has an independent interest rate paid to lenders who have deposited funds into the contract. The interest earned is proportional to the amount of iToken held by each lender. iTokens are minted by transferring the underlying asset to the contract, calling mint, and receiving back an equivalent amount of the iToken (ERC20) at the current iToken price. iTokens have an on-chain API to query current "redemption value".

Using Fulcrum you can lend the following tokens, receiving the equivalent iToken:

Token

iToken

Decimals

wETH 0xC02aaA39b223FE8D0A0e5C4F27eAD9083C756Cc2

iETH 0x77f973FCaF871459aa58cd81881Ce453759281bC

18

SAI 0x89d24A6b4CcB1B6fAA2625fE562bDD9a23260359

iSAI 0x14094949152EDDBFcd073717200DA82fEd8dC960

18

DAI 0x6B175474E89094C44Da98b954EedeAC495271d0F

iDAI 0x493C57C4763932315A328269E1ADaD09653B9081

18

USDC 0xA0b86991c6218b36c1d19D4a2e9Eb0cE3606eB48

iUSDC 0xF013406A0B1d544238083DF0B93ad0d2cBE0f65f

6

USDT 0xdAC17F958D2ee523a2206206994597C13D831ec7

iUSDT 0x8326645f3Aa6De6420102Fdb7Da9E3a91855045B

6

SUSD 0x57Ab1E02fEE23774580C119740129eAC7081e9D3

iSUSD 0x49f4592E641820e928F9919Ef4aBd92a719B4b49

18

WBTC 0x2260FAC5E5542a773Aa44fBCfeDf7C193bc2C599

iWBTC 0xBA9262578EFef8b3aFf7F60Cd629d6CC8859C8b5

8

LINK 0x514910771AF9Ca656af840dff83E8264EcF986CA

iLINK 0x1D496da96caf6b518b133736beca85D5C4F9cBc5

18

ZRX 0xE41d2489571d322189246DaFA5ebDe1F4699F498

iZRX 0xA7Eb2bc82df18013ecC2A6C533fc29446442EDEe

18

REP 0x1985365e9f78359a9B6AD760e32412f4a445E862

iREP 0xBd56E9477Fc6997609Cf45F84795eFbDAC642Ff1

18

KNC 0xdd974D5C2e2928deA5F71b9825b8b646686BD200

iKNC 0x1cC9567EA2eB740824a45F8026cCF8e46973234D

18

You can retrieve your original tokens when the balanceOf() shows there is enough liquidity for that token.

Take a look at this example:

const Web3 = require('web3');
​
const infuraEndPoint = 'https://mainnet.infura.io/v3/FOOBAR'; // Your InfuraEndPoint
const web3 = new Web3(new Web3.providers.HttpProvider(infuraEndPoint));
​
const WETH = '0xC02aaA39b223FE8D0A0e5C4F27eAD9083C756Cc2'; // WETH address
const iETH = '0x77f973FCaF871459aa58cd81881Ce453759281bC'; // iETH address
​
const tokenAbi = [{
constant: true,
inputs: [{
name: '_owner',
type: 'address',
}],
name: 'balanceOf',
outputs: [{
name: 'balance',
type: 'uint256',
}],
payable: false,
type: 'function',
}];
​
const getData = async (token, iToken) => {
const tokenInst = await new web3.eth.Contract(tokenAbi, token);
const balance = await tokenInst.methods.balanceOf(iToken).call();
return console.log('😎 Balance: ', balance);
};
​
getData(WETH, iETH);

Use HAL to check available liquidity

Using HAL you can create a trigger to check if there is available liquidity to claim your loan back, no coding needed 🀘.

What do you need?

  1. A HAL account 😈

  2. The token address

  3. the iToken address

Let's go!

1. Go to "Contracts triggers" page and create a new trigger

2. in the contract address field, insert the token address (ie. 0xdd974d5c2e2928dea5f71b9825b8b646686bd200)

Insert the token's address

3. Select the function balanceOf, insert the iToken address (ie. 0x1cc9567ea2eb740824a45f8026ccf8e46973234d), then insert a value

Select the function balanceOf, insert the iToken address then insert a value

4. Select an action (ie. send an email)

Send an email

5. Name your trigger, save. Have a beer 🍺and wait 😴

ERC20 tokens usually have 18 decimal digits. So, if you want to check if the total available liquidity is bigger than 1 KNC, you have to insert 1 000 000 000 000 000 000.

Using the GraphQL layer

You can create a trigger programmatically using HAL's GraphQL layer. Simply use this mutation:

mutation {
createContractsTrigger(input: {
name: "Check liquidity",
type: ContractsTrigger,
statement: {
contract: {
address: "0xC02aaA39b223FE8D0A0e5C4F27eAD9083C756Cc2", // ETH address
abi: [...]
},
inputs: [
{
type: "address",
name: "_owner",
value: "0x77f973FCaF871459aa58cd81881Ce453759281bC" // iETH address
}
],
outputFilters: [
{
parameter: {
name: "balance",
type: "uint256"
},
returnIndex: 0,
condition: {
attribute: "1000000000000000000", // 1 ETH
predicate: "BiggerThan"
}
}
],
"method": {
"name": "balanceOf"
}
},
actions: [
{
type: Email,
attributes: {
body: "Hey!",
subject: "You can reedem your loan!",
to: [
"foo@bar.it"
]
}
}
]
}) {
UUID
}
}

​