The Hybrid Lending Protocol for DeFi on Solana
DeFi lending is stuck between two (not so favorable) options:
async function handleDeleveraging(parsedLog: ParsedLog = undefined, bytes32MarketAddress: string) { | |
if (parsedLog && parsedLog.eventName != "AdlStateUpdated") { | |
throw "Event not a ADL event"; | |
} | |
const { signers } = getKeepers(); | |
const { dataStore, reader, pyth, adlHandler, exchangeRouter } = getContracts(signers.adlKeeper,); | |
const client = new GraphQLClient(EnvKeys.subgraphUrl); | |
const connection = new EvmPriceServiceConnection(EnvKeys.hermes); |
I recently stumbled upon Falsehoods programmers believe about time zones, which got a good laugh out of me. It reminded me of other great lists of falsehoods, such as about names or time, and made me look for an equivalent for Ethereum. Having found none, here is my humble contribution to this set.
estimateGas
will return the gas required by my transactionCalling estimateGas
will return the gas that your transaction would require if it were mined now. The current state of the chain may be very different to the state in which your tx will get mined. So when your tx i
it("mints some usdc", async () => { | |
const USDC_MINT = new anchor.web3.PublicKey("EPjFWdd5AufqSSqeM2qN1xzybapC8G4wEGGkZwyTDt1v"); | |
const payer = (provider.wallet as anchor.Wallet).payer; | |
assert.ok(payer.publicKey.toBase58() == provider.wallet.publicKey.toBase58()) | |
//create associated token account | |
let usdcTokenAccount = await getOrCreateAssociatedTokenAccount( | |
provider.connection, //connection | |
payer, //payer | |
USDC_MINT, //mint |
it("mints some usdc", async () => { | |
const USDC_MINT = new anchor.web3.PublicKey("EPjFWdd5AufqSSqeM2qN1xzybapC8G4wEGGkZwyTDt1v"); | |
const payer = (provider.wallet as anchor.Wallet).payer; | |
assert.ok(payer.publicKey.toBase58() == provider.wallet.publicKey.toBase58()) | |
//create associated token account | |
let usdcTokenAccount = await getOrCreateAssociatedTokenAccount( | |
provider.connection, //connection | |
payer, //payer |
[features] | |
seeds = false | |
skip-lint = false | |
[programs.localnet] | |
chainlink_solana_demo = "Fg6PaFpoGXkYsidMpWTK6W2BeZ7FEfcYkg476zPFsLnS" | |
[registry] | |
url = "https://anchor.projectserum.com" |
import * as anchor from '@project-serum/anchor'; | |
import * as fs from 'fs'; | |
import { Program, BN } from '@project-serum/anchor'; | |
import { ChainlinkSolanaDemo } from '../target/types/chainlink_solana_demo'; | |
const assert = require("assert"); | |
const CHAINLINK_PROGRAM_ID = "HEvSKofvBgfaexv23kMabbYqxasxU3mQ4ibBMEmJWHny"; | |
// SOL/USD feed account | |
const CHAINLINK_FEED = "CcPVS9bqyXbD9cLnTbhhHazLsrua8QMFUHTutPtjyDzq"; | |
const DIVISOR = 100000000; |
[features] | |
seeds = false | |
skip-lint = false | |
[programs.localnet] | |
chainlink_solana_demo = "Fg6PaFpoGXkYsidMpWTK6W2BeZ7FEfcYkg476zPFsLnS" | |
[registry] | |
url = "https://anchor.projectserum.com" |
# This is a basic workflow to help you get started with Actions | |
name: CI | |
# Controls when the action will run. Triggers the workflow on push or pull request | |
# events but only for the master branch | |
on: | |
push: | |
branches: [ dev ] | |
pull_request: |