module crypto

Blockchain Actions (crypto)

Contents

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

[Return to contents]

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

[Return to contents]

asset_burn

fn asset_burn(args AssetBurnArgs) ?

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

[Return to contents]

asset_create

fn asset_create(args AssetCreateArgs) ?

[Return to contents]

asset_delete

fn asset_delete(args AssetDeleteArgs) ?

deletes the asset, checks the multisignature approach

[Return to contents]

asset_mint

fn asset_mint(args AssetMintArgs) ?

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

[Return to contents]

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
}

[Return to contents]

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

[Return to contents]

defi_pool_info

fn defi_pool_info(args DefiPoolIdentity) ?DefiPoolInfo

get all info from defi pool

[Return to contents]

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

[Return to contents]

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

[Return to contents]

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
}

[Return to contents]

orderbook_info

fn orderbook_info(account string, args OrderBookInfoArgs) ?string

returns all relevant info from an orderbook

[Return to contents]

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
}

[Return to contents]

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

[[Return to contents]](#Contents)

## trade_delete
```v
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

[Return to contents]

trade_delete_all

fn trade_delete_all(account string) ?TradeInfoPair

delete all you open trades

[Return to contents]

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

[Return to contents]

AccountArgs

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

[Return to contents]

AccountAsset

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

[Return to contents]

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
}

[Return to contents]

AssetBurnArgs

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

[Return to contents]

AssetCreateArgs

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

[Return to contents]

AssetDeleteArgs

struct AssetDeleteArgs {
pub:
	account string
	name    string
}

[Return to contents]

AssetMintArgs

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

[Return to contents]

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
}

[Return to contents]

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)

[Return to contents]

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

[Return to contents]

DefiPoolInfo

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

[Return to contents]

DefiPoolInfoPairInfo

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

[Return to contents]

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

[Return to contents]

MultiSig

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

[Return to contents]

OrderBookInfo

struct OrderBookInfo {
pub mut:
	pairs []OrderBookInfoPair
}

[Return to contents]

OrderBookInfoArgs

struct OrderBookInfoArgs {
pub mut:
	only_my_orders bool = true
}

[Return to contents]

OrderBookInfoPair

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

[Return to contents]

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
}

[Return to contents]

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
}

[Return to contents]

TradeInfoPair

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

[Return to contents]

Powered by vdoc.