Skip to content

crypto #

Blockchain Actions (crypto)

fn account_delete #

fn account_delete(name string) ?

delete account on the handler in case it was already initialized, does not give error if not active yet if multisignature more than one will have to do

fn account_init #

fn account_init(args AccountArgs) ?

init the account on the action handler will give error if it already exists and mneomonic or type different will also give error if an error to create it e.g. wrong mnemonic the account will be selected, which means all actions done after are done on this account

fn asset_burn #

fn asset_burn(args AssetBurnArgs) ?

destroy some of the tokens of the asset multisignature is used when asset was multisignature

fn asset_create #

fn asset_create(args AssetCreateArgs) ?

fn asset_delete #

fn asset_delete(args AssetDeleteArgs) ?

deletes the asset, checks the multisignature approach

fn asset_mint #

fn asset_mint(args AssetMintArgs) ?

mint amount of tokens of the asset multisignature is used when asset was multisignature

fn buy #

fn buy(args BuyActionArg) ?string

set of actions to buy an asset everything is re-calculated to USD pricing of USD comes from the blockchain (only stellar/algorand) the action server will execute in the background and return a uid4 identifier, which can be used to check sometimes the blockchain supports a deadline, sometimes the action handler will have to do it

pub struct BuyActionArg {
    asset_buy string 		// the asset you want to buy
    max_price_usd	f64		//maximum price your want to  biy for
    expirationtime_min	u16 //max time in minutes, the trade stays open
    memo       string 		// per type blockchain we need to check that memo
                            field is not too long, is not everywhere used
}

fn defi_pool_deposit #

fn defi_pool_deposit(account string, args DefiPoolDepositArgs) ?

set of arguments to create, or add to a DEFIPool

pool can exist or it can be a new one if there is already money, you will just add to it

fn defi_pool_info #

fn defi_pool_info(args DefiPoolIdentity) ?DefiPoolInfo

get all info from defi pool

fn defi_pool_withdraw #

fn defi_pool_withdraw(account string, args DefiPoolWithDrawArgs) ?

withdraw money from the pool need to specify which currency and amount per currency

fn defi_pool_withdraw_all #

fn defi_pool_withdraw_all(account string, args DefiPoolIdentity) ?

withdraw money from the pool, do the maximum the purpose is to get all your money out from the pool the handler need to implement the logic to take all out

fn info #

fn info(name string) ?AccountInfo

return info about your account, the name is the name of the account as used in .account_init() the info returned

pub struct AccountInfo {
    pubkey_bin     []u8 // binary form of key
    pubkey_ed25519 ed25519.PublicKey // can be empty, if not same type, but often it is
    assets         []Asset
}
pub struct AccountAsset {
    amount   f64
    currency string // always lowercase
}

fn orderbook_info #

fn orderbook_info(account string, args OrderBookInfoArgs) ?string

returns all relevant info from an orderbook

fn sell #

fn sell(args SellActionArg) ?string

set of actions to sell an asset everything is re-calculated to USD, the money you get back is in USDC pricing of USD comes from the blockchain (only stellar/algorand) the action server will execute in the background and return a uid4 identifier, which can be used to check sometimes the blockchain supports a deadline, sometimes the action handler will have to do it

pub struct SellActionArg {
    asset_sell string 			// the asset you want to sell
    min_price_usd      f64    	// min price your want to sell for always in USDC
    expirationtime_min	u16 	// max time in minutes, the trade stays open
    memo       string 			// per type blockchain we need to check that memo
                                field is not too long, is not everywhere used
}

fn send #

fn send(args SendArgs) ?

send money to a user on the chosen blockchain network the account used is the one who is selected

SendArgs {
        account string
        to string
        amount f64
        memo string
        currency string
}
``` multisig is supported, if account is multisig, the the needed needs to be done

fn trade_delete #

fn trade_delete(account string, uid string) ?TradeInfoPair

dlete an open trade, the uid is unique uid is uid4, and as given by sales/buy order creation

fn trade_delete_all #

fn trade_delete_all(account string) ?TradeInfoPair

delete all you open trades

fn trade_info #

fn trade_info(account string, uid string) ?TradeInfoPair

returns all relevant info from an orderbook uid is uid4, and as given by sales/buy order creation

struct AccountArgs #

struct AccountArgs {
pub:
	name           string
	mnemonic       string
	blockchaintype BlockchainType
	expiration     int = 300 // will expire default 5 min
	multisig       MultiSig // optional
}

struct AccountAsset #

struct AccountAsset {
	amount   f64
	currency string // always lowercase
}

struct AccountInfo #

struct AccountInfo {
	pubkey_bin     []u8 // binary form of key
	pubkey_ed25519 ed25519.PublicKey // can be empty, if not same type, but often it is
	assets         []Asset
}

struct AssetBurnArgs #

struct AssetBurnArgs {
pub:
	account    string
	name       string
	burnamount f64
}

struct AssetCreateArgs #

struct AssetCreateArgs {
pub:
	account string
	name    string
// TODO specify
	multisig MultiSig // optional
}

struct AssetDeleteArgs #

struct AssetDeleteArgs {
pub:
	account string
	name    string
}

struct AssetMintArgs #

struct AssetMintArgs {
pub:
	account    string
	name       string
	mintamount f64
}

struct BuyActionArg #

struct BuyActionArg {
	account            string
	asset_buy          string // the asset you want to buy
	max_price_usd      f64    // maximum price your want to buy for
	expirationtime_min u16    // max time in minutes, the trade stays open
	memo               string // per type blockchain we need to check that memo field
// is not too long, is not everywhere used
}

struct DefiPoolDepositArgs #

struct DefiPoolDepositArgs {
	poolasset1 string // a pool has 2 assets, this is the first one
	amount1    f64
	currency1  string
	poolasset2 string // a pool has 2 assets, this is the first one
	amount2    f64
	currency2  string
	memo       string // per type blockchain we need to check that memo field is not too long, is not everywhere used
}

set of arguments to create, or add to a DEFIPool this is for an AMM DEFI pool (Automatic Market Making DEFI Pool)

struct DefiPoolIdentity #

struct DefiPoolIdentity {
	poolasset1 string // a pool has 2 assets, this is the first one
	poolasset2 string
}

identify a pool, is unique, the order of asset 1 or 2 does not matter

struct DefiPoolInfo #

struct DefiPoolInfo {
	pairs []DefiPoolInfoPairInfo // is always 2, need to check this is correct
// TODO what else is important here?
}

struct DefiPoolInfoPairInfo #

struct DefiPoolInfoPairInfo {
	currency string
	amount   f64
// TODO what else is important here?
}

struct DefiPoolWithDrawArgs #

struct DefiPoolWithDrawArgs {
	poolasset1 string // a pool has 2 assets, this is the first one
	amount1    f64
	currency1  string
	poolasset2 string // a pool has 2 assets, this is the first one
	amount2    f64
	currency2  string
	memo       string // per type blockchain we need to check that memo field is not too long, is not everywhere used
}

withdraw money from the pool need to specify which currency and amount per currency

struct MultiSig #

struct MultiSig {
pub:
	pubkeys       []string // the pubkeys of who needs to sign
	min_signature i16      // how many need minimally to sign
}

struct OrderBookInfo #

struct OrderBookInfo {
pub mut:
	pairs []OrderBookInfoPair
}

struct OrderBookInfoArgs #

struct OrderBookInfoArgs {
pub mut:
	only_my_orders bool = true
}

struct OrderBookInfoPair #

struct OrderBookInfoPair {
pub mut:
	currency1 string
// TODO specify	
}

struct SellActionArg #

struct SellActionArg {
	account            string
	asset_sell         string // the asset you want to sell
	min_price_usd      f64    // min price your want to sell for always in USDC
	expirationtime_min u16    // max time in minutes, the trade stays open
	memo               string // per type blockchain we need to check that memo field is not too long, is not everywhere used
}

struct SendArgs #

struct SendArgs {
	account  string // the account we are sending info from
	to       string
	amount   f64
	currency string
	memo     string // per type blockchain we need to check that memo field is not too long
}

struct TradeInfoPair #

struct TradeInfoPair {
pub mut:
// TODO specify	
	state TradeState
}