d4t

package module
v0.0.0-...-5e4023f Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Jul 11, 2022 License: Apache-2.0 Imports: 16 Imported by: 0

README

DeFi for NFT (DeFi4NFT)

Documentation Status

DeFi4NFT

d4t logo

DeFi4NFT's Algorand world Full Tutorial

DeFi4NFT is a borrow/lend platform for NFTs on Algorand. At the core a state machine stores the loan health of a pure non-custodial borrow/lend protocol.

Pure non-custodial means assets remain in the owner’s wallet, for borrowers this means collateral assets remain frozen in address. And for liquidity providers this means creating a delegated logicSig promising to provide a loan when a borrower matches, aka promise. And for liquidators this means a three way transaction, where the end receiver is a third party buyer willing to buy the borrower’s collateral NFT and the liquidator pays the debt of the borrower while a third party buyer sends payment of the collateral NFT to liquidator. This system is set up so permissioned tokens can be open to receive liquidity from non-whitelisted addresses.

Resources

Documentation

Live Demo | Simple Live demo site

Medium article

Algorand game world in Neos | neosrec:///U-1egen/R-41a7cb88-b5d1-4cce-a8cd-c2885bafda30

Contact

Discord @1egen#0803

Discord @3spear#9556

Documentation

Index

Constants

View Source
const (
	KMD_ADDRESS         = "http://localhost:4002"
	KMD_TOKEN           = "aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa"
	KMD_WALLET_NAME     = "unencrypted-default-wallet"
	KMD_WALLET_PASSWORD = ""
)

Variables

This section is empty.

Functions

func Borrow

func Borrow(algodClient *algod.Client, acct crypto.Account, lender types.Address, usdc, jusd, mng, lqt uint64, xids, camt, lamt []uint64, lsigFile string) (err error)

Make 44t application call to borrow against provided collateral

func ChildUpdate

func ChildUpdate(algodClient *algod.Client, acct crypto.Account, appID uint64, app, clear string) (err error)

Update child smart contract

func Claim

func Claim(algodClient *algod.Client, acct crypto.Account, mng, amt, usdc, jusd uint64) (err error)

Make 44t application call to claim USDCa for JUSD

func CompileSmartContractTeal

func CompileSmartContractTeal(algodClient *algod.Client, file string) (compiledProgram []byte, err error)

func CompileToLsig

func CompileToLsig(algodClient *algod.Client, args [][]byte, osTealFile, codecFile string, sk ed25519.PrivateKey) (lsa crypto.LogicSigAccount)

func ConfigASA

func ConfigASA(algodClient *algod.Client, acct crypto.Account, mngID, d4tID, lqtID, assetID uint64) (err error)

func ConfigureApps

func ConfigureApps(algodClient *algod.Client, acct crypto.Account, lqt, d4t, usdc, jusd uint64) (err error)

func CreateASA

func CreateASA(algodClient *algod.Client, acct crypto.Account, amt uint64, dec uint32, name, url string) (assetID uint64, err error)

func CreateApps

func CreateApps(algodClient *algod.Client, acct crypto.Account, usdc uint64) (ids [4]uint64, err error)

create sub-apps

func Deploy

func Deploy(algodClient *algod.Client, acct crypto.Account, usdc uint64) (newApp uint64, err error)

Deploy smart contract

func DispenseAsset

func DispenseAsset(algodClient *algod.Client, reserve, recipient string, assetamount, assetID uint64, codecFile string) (err error)

function that dispenses set amount of asset, from a signed Delegated LogicSig

func Earn

func Earn(algodClient *algod.Client, acct crypto.Account, xids []uint64, aamt, lvr uint64, lsa []byte) (err error)

Make 44t application call to earn USDCa at 3%

func FetchLsigFromFile

func FetchLsigFromFile(filename string) (lsa crypto.LogicSigAccount, err error)

fetch LogicSig from file

func Fund

func Fund(algodClient *algod.Client, acct crypto.Account, amt uint64) (err error)

Fund app

func GetAccounts

func GetAccounts() ([]crypto.Account, error)

func InitAlgodClient

func InitAlgodClient() (*algod.Client, error)

func Optin

func Optin(algodClient *algod.Client, acct crypto.Account, app uint64, setContract string) (err error)

func OptinASA

func OptinASA(algodClient *algod.Client, acct crypto.Account, assetID uint64) (err error)

func Repay

func Repay(algodClient *algod.Client, acct crypto.Account, mng, lqt, usdc uint64, xids, ramt []uint64) (err error)

Make 44t application call to repay loan and unfreeze asset

func SendDusd

func SendDusd(algodClient *algod.Client, acct crypto.Account, rec types.Address, jusd uint64) (err error)

func Start

func Start(algodClient *algod.Client, acct crypto.Account) (assetID uint64, err error)

Start sandbox and create USDCa and other NFTs for testing purpose

func Update

func Update(algodClient *algod.Client, acct crypto.Account) (err error)

Update smart contract

Types

type Conf

type Conf struct {
	Network     string `json:"network,omitempty"`
	RootDir     string `json:"dir,omitempty"`
	AbiDir      string `json:"abi_dir,omitempty"`
	TealDir     string `json:"teal_dir,omitempty"`
	CodecDir    string `json:"codec_dir,omitempty"`
	DryrunDir   string `json:"dryrun_dir,omitempty"`
	ResponseDir string `json:"response_dir,omitempty"`
	Address     string `json:"address"`
	Token       string `json:"token"`
	Header      string `json:"header"`
}

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL