⚡ CreditShaft

Credit Card Pre-Auth as DeFi Collateral

Chromion Hackathon • Powered by Chainlink

🔥 The Problem

💀 Instant Liquidations

One price spike = lose everything

🔒 Over-collateralized

Lock 150%+ just for basic leverage

😱 No Alternative Collateral

Only crypto accepted as collateral

🚫 High Barriers

Need massive crypto holdings

DeFi needs traditional finance collateral integration

💡 CreditShaft Solution

💳

Credit Pre-Auth

Use credit card pre-authorization as collateral backup

2x-5x Leverage

Efficient capital with hybrid collateral system

🌉

TradFi Bridge

First protocol bridging credit systems to DeFi

Turn your credit card into DeFi collateral

🔗 Powered by Chainlink

🔓 Position Opening Flow

👤

1. User Creates Pre-Auth

Chainlink Functions → Stripe API → 150% credit hold created

🏦

2. Flash Loan Request

CreditShaftCore provides USDC flash loan

4. Supply to Aave

AaveStrategy supplies combined LINK as collateral

🏛️

3. Swap USDC → LINK

Uniswap converts borrowed USDC to LINK

🔄
💰

5. Borrow USDC

AaveStrategy borrows USDC against LINK collateral

6. Repay Flash Loan

Position opened with 2x-5x LINK exposure!

🔒 Position Closing Flow

🏦

1. Flash Loan for Debt

CreditShaftCore provides USDC to cover Aave debt

🏛️

2. Repay Aave Debt

AaveStrategy repays all borrowed USDC

4. Withdraw Collateral

AaveStrategy withdraws ALL LINK from Aave

📤

3. Release Pre-Auth

Chainlink Functions → Stripe API → Credit hold released

📤
🔄

5. Swap & Repay

Sell enough LINK → Repay flash loan

💎

6. Return Profit/Loss

Remaining LINK returned to user

🤖 Automation Flow: Time Expiry

1. Time Monitor

Chainlink Automation checks: block.timestamp >= preAuthExpiryTime

🚨

2. Expiry Detected

checkUpkeep() identifies expired pre-auth (7+ days)

💳

4. Stripe API Call

DON executes payment capture via Stripe API

🔧

3. Functions Triggered

performUpkeep() calls Chainlink Functions with Stripe source

5. Payment Captured

Pre-auth amount charged to user's credit card

🔄

6. Position Continues

User can still trade and close position normally

🤖 Automation Flow: Unsafe LTV

📊

1. LTV Monitor

Chainlink Automation checks: position LTV > 65% threshold

🚨

2. Risk Detected

checkUpkeep() identifies unsafe collateral ratio

🏦

4. Flash Loan Initiated

Same flow as manual close - gets USDC to cover debt

3. Auto Close Triggered

performUpkeep() calls closeUnsafePositionPublic()

🔄

5. Position Unwound

Aave debt repaid → LINK withdrawn → Flash loan repaid

💎

6. Assets Returned

Remaining LINK returned to user (protection, not liquidation)

👨‍💻 The Code

🔧 Chainlink Functions

Lines 578-589 → Stripe pre-auth requests

Lines 520-548 → Payment processing responses

🤖 Chainlink Automation

Lines 649-688 → checkUpkeep() monitors positions

Lines 695-733 → performUpkeep() executes actions

Lines 606-620 → closeUnsafePositionPublic() protection

📊 Chainlink Price Feeds

Lines 502-506 → Real-time LINK/USD price

Lines 756-770 → LTV risk calculations

Live demo: creditshaft-demo.vercel.app

Full Chainlink integration on Sepolia testnet

1 / 9