Skip to content

Instantly share code, notes, and snippets.

View IMEF-FEMI's full-sized avatar
💻
🦀

Femi Bolaji IMEF-FEMI

💻
🦀
View GitHub Profile
@IMEF-FEMI
IMEF-FEMI / numa.md
Last active October 13, 2025 13:31
Numa Doc

Numa Protocol

The Hybrid Lending Protocol for DeFi on Solana


Problem

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);

Falsehoods that Ethereum programmers believe

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.

About Gas

Calling estimateGas will return the gas required by my transaction

Calling 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"
MY_ADDRESS=CvQWop3FSnFX9je6a******BCZ9nnp53mmQ7eX41u #replace with address of earlier generated keypair (id.json)
# Make ourselves the mint authority
# Replace the mint authority 2wmVCSfPxGPjrnMMn7rchp4uaeoTqN39mXFC2zhPdri9 (M. Allair multisig) with our solana address
# or 32 bytes at index 4
#
# Ugly "One" liner because i don't know how to do this in any other way
python3 -c "import base64;import base58;import json;usdc = json.load(open('./clones/usdc.json'));data = bytearray(base64.b64decode(usdc['account']['data'][0]));data[4:4+32] = base58.b58decode('${MY_ADDRESS}');print(base64.b64encode(data));usdc['account']['data'][0] = base64.b64encode(data).decode('utf8');json.dump(usdc, open('./clones/usdc_clone.json', 'w'))"
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"
@IMEF-FEMI
IMEF-FEMI / dev.yml
Created February 24, 2022 01:05 — forked from fpatelm/dev.yml
Github actions to deploy to Firebase hosting
# 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: