Documentation ¶
Index ¶
- Constants
- Variables
- func CheckIsWrappedNativeToken(contractAddress string, network int) bool
- func GetEVMAddress(privateKey string) (string, error)
- func GetNativeNetworkCurrencyType(network string) int
- func GetNetworkID(network string) int
- func GetNetworkIDFromCurrencyType(currencyType int) (int, error)
- func GetNetworkName(network int) string
- func IsNativeCurrency(currencyType int) bool
- type BridgeNetworkData
- type Config
- type DexSwapTrackData
- type EVMProofRecordData
- type ExternalNetworksFeeData
- type ExternalTxStatus
- type ExternalTxSwapResult
- type InterSwapTxData
- type OpenseaAssetData
- type OpenseaCollectionData
- type OpenseaDefaultCollectionData
- type PAppAPIKeyData
- type PAppsEndpointData
- type PappSupportedTokenData
- type PappSwapInfo
- type PappTxData
- type PappVaultData
- type RefundFeeData
- type ShieldTxData
- type TokenInfo
- type TradeDataRespond
- type TradeWithdrawInfo
- type UnshieldTxData
Constants ¶
View Source
const ( MODE_TXSUBMITWATCHER = "submitwatcher" MODE_TXSUBMITWORKER = "submitworker" MODE_API = "api" MODE_FEEESTIMATOR = "feeestimator" MODE_UNSHIELDWATCHER = "unshieldwatcher" MODE_INTERSWAP = "interswap" )
View Source
const ( EVMGasLimit = 1500000 EVMGasLimitETH = 800000 EVMGasLimitPancake = 600000 EVMGasLimitOpensea = 600000 MinEVMTxs = uint64(10) PRV_TOKENID = "0000000000000000000000000000000000000000000000000000000000000004" )
View Source
const ( StatusSubmitting = "submitting" // broadcast inc chain StatusSubmitFailed = "submit_failed" // StatusPending = "pending" StatusExecuting = "executing" StatusRejected = "rejected" StatusAccepted = "accepted" StatusWaiting = "waiting" // for ui StatusSuccess = "success" StatusFailed = "failed" )
View Source
const ( NETWORK_INC = "inc" NETWORK_PDEX = "pdex" // for Interswap NETWORK_ETH = "eth" NETWORK_BSC = "bsc" NETWORK_PLG = "plg" NETWORK_FTM = "ftm" NETWORK_AVAX = "avax" NETWORK_AURORA = "aurora" NETWORK_NEAR = "near" )
View Source
const ( NativeCurrencyTypePRV = 0 NativeCurrencyTypeETH = 1 NativeCurrencyTypeBSC = 7 NativeCurrencyTypePLG = 19 NativeCurrencyTypeFTM = 21 NativeCurrencyTypeAVAX = 28 NativeCurrencyTypeAURORA = 30 NativeCurrencyTypeNEAR = 26 UnifiedCurrencyType = 25 )
View Source
const ( NETWORK_INC_ID = iota NETWORK_ETH_ID NETWORK_BSC_ID NETWORK_PLG_ID NETWORK_FTM_ID NETWORK_AURORA_ID NETWORK_AVAX_ID )
View Source
const ( Unknown = iota ETH //1 BTC //2 ERC20 //3 BNB //4 BNB_BEP2 //5 USD //6 BNB_BSC //7 BNB_BEP20 //8 TOMO //9 ZIL //10 XMR //11 NEO //12 DASH //13 LTC //14 DOGE //15 ZEC //16 DOT //17 PDEX //18 0000000000000000000000000000000000000000000000000000000000000006 // Polygon: MATIC //19 PLG_ERC20 //20 FTM //21 FTM_ERC20 //22 SOL //23 SOL_SPL //24 // pUnifined token: UNIFINE_TOKEN //25 NEAR //26 NEAR_TOKEN //27 AVAX //28 AVAX_ERC20 //29 AURORA_ETH //30 AURORA_ERC20 //31 )
View Source
const ( TestnetPortalV4BTCID = "4584d5e9b2fc0337dfb17f4b5bb025e5b82c38cfa4f54e8a3d4fcdd03954ff82" MainnetPortalV4BTCID = "b832e5d3b1f01a4f0623f7fe91d6673461e1f5d37d91fe78c5c2e6183ff39696" )
View Source
const ( ExternalTxTypeUnknown = iota ExternalTxTypeSwap ExternalTxTypeUnshield ExternalTxTypeOpensea = 96 )
View Source
const (
PercentFeeDiff = float64(5)
)
Variables ¶
View Source
var DefaultConfig = Config{
Port: 9898,
CoinserviceURL: "http://51.161.117.193:8096",
NetworkID: "testnet",
FullnodeURL: "https://testnet.incognito.org/fullnode",
ShieldService: "https://staging-api-service.incognito.org",
}
View Source
var MainnetBridgeNetworkData = []BridgeNetworkData{ { Network: "eth", ChainID: "1", ConfirmationBlocks: 35, Endpoints: []string{"https://eth-fullnode.incognito.org"}, }, { Network: "plg", ChainID: "137", ConfirmationBlocks: 128, Endpoints: []string{"https://polygon-mainnet.infura.io/v3/9bc873177cf74a03a35739e45755a9ac", "https://rpc-mainnet.maticvigil.com", "https://rpc-mainnet.matic.quiknode.pro"}, }, { Network: "bsc", ChainID: "56", ConfirmationBlocks: 14, Endpoints: []string{"https://bsc-dataseed1.binance.org", "https://bsc-dataseed1.ninicoin.io"}, }, }
Default param mainnet
View Source
var MainnetIncognitoVault = []PappVaultData{
{
Network: "bsc",
Type: 1,
ContractAddress: "0x43D037A562099A4C2c95b1E2120cc43054450629",
},
{
Network: "eth",
Type: 1,
ContractAddress: "0x43D037A562099A4C2c95b1E2120cc43054450629",
},
{
Network: "plg",
Type: 1,
ContractAddress: "0x43D037A562099A4C2c95b1E2120cc43054450629",
},
}
View Source
var MainnetPappsEndpointData = []PAppsEndpointData{ { Network: "plg", ExchangeApps: map[string]string{"uniswap": "uniswapep:3000", "curve": ""}, AppContracts: map[string]string{"uniswap": "0xCC8c88e9Dae72fa07aC077933a2E73d146FECdf0", "curve": "0x55b08b7c1ecdc1931660b18fe2d46ce7b20613e2"}, }, { Network: "bsc", ExchangeApps: map[string]string{"pancake": "pancakeswapep:3000"}, AppContracts: map[string]string{"pancake": "0x95Cd8898917c7216Da0517aAB6A115d7A7b6CA90"}, }, { Network: "eth", ExchangeApps: map[string]string{"uniswap": "uniswapep_eth:3000"}, AppContracts: map[string]string{"uniswap": "0xe38e54B2d6B1FCdfaAe8B674bF36ca62429fdBDe"}, }, }
View Source
var ( NativeTokenSymbol = map[int]string{ NETWORK_PLG_ID: "MATIC", NETWORK_BSC_ID: "BNB", NETWORK_ETH_ID: "ETH", NETWORK_FTM_ID: "FTM", NETWORK_AVAX_ID: "AVAX", NETWORK_AURORA_ID: "AURORA", } )
View Source
var ( NetworkCurrencyMap = map[int]int{ Unknown: NETWORK_INC_ID, UNIFINE_TOKEN: NETWORK_INC_ID, ETH: NETWORK_ETH_ID, ERC20: NETWORK_ETH_ID, BNB_BSC: NETWORK_BSC_ID, BNB_BEP20: NETWORK_BSC_ID, MATIC: NETWORK_PLG_ID, PLG_ERC20: NETWORK_PLG_ID, FTM: NETWORK_FTM_ID, FTM_ERC20: NETWORK_FTM_ID, AVAX: NETWORK_AVAX_ID, AVAX_ERC20: NETWORK_AVAX_ID, AURORA_ETH: NETWORK_AURORA_ID, AURORA_ERC20: NETWORK_AURORA_ID, } )
View Source
var OnlyPDexTokenCurrency = []int{ BTC, BNB, BNB_BEP2, TOMO, ZIL, XMR, NEO, DASH, LTC, DOGE, ZEC, DOT, NEAR, NEAR_TOKEN, }
View Source
var TestnetBridgeNetworkData = []BridgeNetworkData{ { Network: "eth", ChainID: "42", ConfirmationBlocks: 35, Endpoints: []string{"https://goerli.infura.io/v3"}, }, { Network: "plg", ChainID: "80001", ConfirmationBlocks: 128, Endpoints: []string{"https://matic-mumbai.chainstacklabs.com"}, }, { Network: "bsc", ChainID: "97", ConfirmationBlocks: 14, Endpoints: []string{ "https://data-seed-prebsc-1-s1.binance.org:8545", "https://data-seed-prebsc-2-s2.binance.org:8545", "https://data-seed-prebsc-1-s1.binance.org:8545", }, }, { Network: "ftm", ChainID: "4002", ConfirmationBlocks: 5, Endpoints: []string{"https://rpc.testnet.fantom.network"}, }, }
Default param testnet
View Source
var TestnetIncognitoVault = []PappVaultData{
{
Network: "bsc",
Type: 1,
ContractAddress: "0x3534C0a523b3A862c06C8CAF61de230f9b408f51",
},
{
Network: "eth",
Type: 1,
ContractAddress: "0xc157CC3077ddfa425bae12d2F3002668971A4e3d",
},
{
Network: "plg",
Type: 1,
ContractAddress: "0x76318093c374e39B260120EBFCe6aBF7f75c8D28",
},
{
Network: "ftm",
Type: 1,
ContractAddress: "0x76318093c374e39B260120EBFCe6aBF7f75c8D28",
},
}
View Source
var TestnetPappsEndpointData = []PAppsEndpointData{ { Network: "plg", ExchangeApps: map[string]string{"uniswap": "uniswapep:3000"}, AppContracts: map[string]string{"uniswap": "0xAe85BB3D2ED209736E4d236DcE24624EA1A04249"}, }, { Network: "bsc", ExchangeApps: map[string]string{"pancake": "pancakeswapep:3000"}, AppContracts: map[string]string{"pancake": "0x0e2923c21E2C5A2BDD18aa460B3FdDDDaDb0aE18"}, }, { Network: "ftm", ExchangeApps: map[string]string{"spooky": "spookyswapep:3000"}, AppContracts: map[string]string{"spooky": "0x14D0cf3bC307aA15DA40Aa4c8cc2A2a81eF96B3a"}, }, }
View Source
var ( WrappedNativeMap = map[int][]string{ NETWORK_PLG_ID: {strings.ToLower("0x9c3C9283D3e44854697Cd22D3Faa240Cfb032889"), strings.ToLower("0x0d500B1d8E8eF31E21C99d1Db9A6444d3ADf1270")}, NETWORK_BSC_ID: {strings.ToLower("0xbb4cdb9cbd36b01bd1cbaebf2de08d9173bc095c"), strings.ToLower("0xae13d989dac2f0debff460ac112a837c89baa7cd")}, NETWORK_ETH_ID: {strings.ToLower("0xC02aaA39b223FE8D0A0e5C4F27eAD9083C756Cc2"), strings.ToLower("0xb4fbf271143f4fbf7b91a5ded31805e42b2208d6")}, NETWORK_FTM_ID: {strings.ToLower("0xf1277d1Ed8AD466beddF92ef448A132661956621"), strings.ToLower("0x21be370D5312f44cB42ce377BC9b8a0cEF1A4C83")}, NETWORK_AVAX_ID: {strings.ToLower("0xB31f66AA3C1e785363F0875A1B74E27b85FD66c7"), strings.ToLower("0xd00ae08403b9bbb9124bb305c09058e32c39a48c")}, NETWORK_AURORA_ID: {strings.ToLower("0xC9BdeEd33CD01541e1eeD10f90519d2C06Fe3feB"), strings.ToLower("0x1b6A3d5B5DCdF7a37CFE35CeBC0C4bD28eA7e946")}, } )
Functions ¶
func GetEVMAddress ¶
func GetNetworkID ¶
func GetNetworkName ¶
func IsNativeCurrency ¶
Types ¶
type BridgeNetworkData ¶
type Config ¶
type Config struct { Port int Mode string Mongo string Mongodb string CoinserviceURL string FullnodeURL string FullnodeAuthKey string ShieldService string BTCShieldPortal string FaucetService string NetworkID string CaptchaSecret string SlackMonitor string // papps submit proof IncKey string EVMKey string CentralIncPaymentAddress string GGCProject string GGCAuth string OpenSeaAPI string OpenSeaAPIKey string // Interswap ISIncPrivKeys map[string]string }
type DexSwapTrackData ¶
type DexSwapTrackData struct { mgm.DefaultModel `bson:",inline"` IncTx string `json:"inctx" bson:"inctx"` Status string `json:"status" bson:"status"` TokenSell string `json:"token_sell" bson:"token_sell"` TokenBuy string `json:"token_buy" bson:"token_buy"` AmountIn string `json:"amount_in" bson:"amount_in"` MinAmountOut string `json:"amount_out" bson:"amount_out"` UserAgent string `json:"useragent" bson:"useragent"` }
type EVMProofRecordData ¶
type EVMProofRecordData struct { mgm.DefaultModel `bson:",inline"` BlockNumber uint64 `json:"blocknumber" bson:"blocknumber"` BlockHash string `json:"blockhash" bson:"blockhash"` TxIndex uint `json:"txidx" bson:"txidx"` Proof string `json:"proof" bson:"proof"` ContractID string `json:"contractid" bson:"contractid"` PaymentAddr string `json:"paymentaddr" bson:"paymentaddr"` IsRedeposit bool `json:"isredeposit" bson:"isredeposit"` IsTxPass bool `json:"istxpass" bson:"istxpass"` OTAStr string `json:"otaStr" bson:"otaStr"` Amount uint64 `json:"amount" bson:"amount"` Network string `json:"network" bson:"network"` }
type ExternalNetworksFeeData ¶
type ExternalTxStatus ¶
type ExternalTxStatus struct { mgm.DefaultModel `bson:",inline"` Txhash string `json:"txhash" bson:"txhash"` IncRequestTx string `json:"increquesttx" bson:"increquesttx"` Network string `json:"network" bson:"network"` Status string `json:"status" bson:"status"` Type int `json:"type" bson:"type"` Error string `json:"error" bson:"error"` OtherInfo string `json:"otherinfo" bson:"otherinfo"` Nonce uint64 `json:"nonce" bson:"nonce"` WillRedeposit bool `json:"will_redeposit" bson:"will_redeposit"` RedepositSubmitted bool `json:"redeposit_submitted" bson:"redeposit_submitted"` }
type ExternalTxSwapResult ¶
type InterSwapTxData ¶
type InterSwapTxData struct { mgm.DefaultModel `bson:",inline"` // txID of the first tx, index for one interswap request TxID string `json:"txid" bson:"txid"` TxRaw string `json:"txraw" bson:"txraw"` FromAmount uint64 `json:"fromamount" bson:"fromamount"` FromToken string `json:"fromtoken" bson:"fromtoken"` ToToken string `json:"totoken" bson:"totoken"` MidToken string `json:"midtoken" bson:"midtoken"` PathType int `json:"pathtype" bson:"pathtype"` FinalMinExpectedAmt uint64 `json:"final_minacceptedamount" bson:"final_minacceptedamount"` Slippage string `json:"slippage" bson:"slippage"` OTARefundFee string `json:"ota_refundfee" bson:"ota_refundfee"` OTARefund string `json:"ota_refund" bson:"ota_refund"` OTAFromToken string `json:"ota_fromtoken" bson:"ota_fromtoken"` OTAToToken string `json:"ota_totoken" bson:"ota_totoken"` WithdrawAddress string `json:"withdrawaddress" bson:"withdrawaddress"` AddOnTxID string `json:"addon_txid" bson:"addon_txid"` PAppName string `json:"papp_name" bson:"papp_name"` PAppNetwork string `json:"papp_network" bson:"papp_network"` PAppContract string `json:"papp_contract" bson:"papp_contract"` // for Interswap service refund TxIDRefund string `json:"txidrefund" bson:"txidrefund"` // for chain response (sucess / refund) TxIDResponse string `json:"txidresponse" bson:"txidresponse"` AmountResponse uint64 `json:"amountresponse" bson:"amountresponse"` TokenResponse string `json:"tokenresponse" bson:"tokenresponse"` ShardID byte `json:"shardid" bson:"shardid"` TxIDOutchain string `json:"txidoutchain" bson:"txidoutchain"` Status int `json:"status" bson:"status"` StatusStr string `json:"statusstr" bson:"statusstr"` UserAgent string `json:"useragent" bson:"useragent"` Error string `json:"error" bson:"error"` NumRecheck uint `json:"num_recheck" bson:"num_recheck"` NumRetry bool `json:"num_retry" bson:"num_retry"` // for retry refund tx CoinInfo []string `json:"coin_info" bson:"coin_info"` CoinIndex []uint64 `json:"coin_index" bson:"coin_index"` }
DATA MODELS FOR INTERSWAP
type OpenseaAssetData ¶
type OpenseaCollectionData ¶
type OpenseaCollectionData struct { mgm.DefaultModel `bson:",inline"` Address string `bson:"address"` Name string `bson:"name"` Detail popensea.CollectionDetail `bson:"detail"` }
type PAppAPIKeyData ¶
type PAppsEndpointData ¶
type PappSupportedTokenData ¶
type PappSwapInfo ¶
type PappTxData ¶
type PappTxData struct { mgm.DefaultModel `bson:",inline"` IncTx string `json:"inctx" bson:"inctx"` Networks []string `json:"networks" bson:"networks"` Type int `json:"type" bson:"type"` IncTxData string `json:"inctxdata" bson:"inctxdata"` FeeToken string `json:"feetoken" bson:"feetoken"` FeeAmount uint64 `json:"feeamount" bson:"feeamount"` PFeeAmount uint64 `json:"pfeeamount" bson:"pfeeamount"` BurntAmount uint64 `json:"burntamount" bson:"burntamount"` BurntToken string `json:"burnttoken" bson:"burnttoken"` // decode call data => bytes => encode to string PappSwapInfo string `json:"pappswapinfo" bson:"pappswapinfo"` // Status string `json:"status" bson:"status"` IsUnifiedToken bool `json:"isunifiedtoken" bson:"isunifiedtoken"` RefundSubmitted bool `json:"refundsubmitted" bson:"refundsubmitted"` RefundPrivacyFee bool `json:"refundpfee" bson:"refundpfee"` FeeRefundOTA string `json:"fee_refundota" bson:"fee_refundota"` FeeRefundAddress string `json:"fee_refundaddress" bson:"fee_refundaddress"` ShardID int `json:"shardid" bson:"shardid"` OutchainStatus string `json:"outchain_status" bson:"outchain_status"` UserAgent string `json:"useragent" bson:"useragent"` Error string `json:"error" bson:"error"` }
type PappVaultData ¶
type RefundFeeData ¶
type RefundFeeData struct { mgm.DefaultModel `bson:",inline"` IncRequestTx string `json:"increquesttx" bson:"increquesttx"` RefundAmount uint64 `json:"refundamount" bson:"refundamount"` RefundToken string `json:"refundtoken" bson:"refundtoken"` RefundOTA string `json:"refundota" bson:"refundota"` RefundAddress string `json:"refundaddress" bson:"refundaddress"` RefundTx string `json:"refundtx" bson:"refundtx"` RefundStatus string `json:"status" bson:"status"` RefundPrivacyFee bool `json:"ispfee" bson:"ispfee"` Error string `json:"error" bson:"error"` }
type ShieldTxData ¶
type ShieldTxData struct { mgm.DefaultModel `bson:",inline"` Status string `json:"status" bson:"status"` ExternalTx string `json:"externaltx" bson:"externaltx"` NetworkID int `json:"networkid" bson:"networkid"` TokenID string `json:"tokenid" bson:"tokenid"` UTokenID string `json:"utokenid" bson:"utokenid"` PaymentAddress string `json:"paymentaddress" bson:"paymentaddress"` IncTx string `json:"inctx" bson:"inctx"` Error string `json:"error" bson:"error"` }
type TokenInfo ¶
type TokenInfo struct { TokenID string Name string Symbol string Image string IsPrivacy bool IsBridge bool ExternalID string PDecimals int Decimals int64 ContractID string Status int Type int CurrencyType int Default bool Verified bool UserID int ListChildToken []TokenInfo ListUnifiedToken []TokenInfo PSymbol string OriginalSymbol string LiquidityReward float64 ExternalPriceUSD float64 `json:"ExternalPriceUSD"` // use to convert token PriceUsd float64 `json:"PriceUsd"` PercentChange1h string `json:"PercentChange1h"` PercentChangePrv1h string `json:"PercentChangePrv1h"` PercentChange24h string `json:"PercentChange24h"` CurrentPrvPool uint64 `json:"CurrentPrvPool"` PricePrv float64 `json:"PricePrv"` Volume24 uint64 `json:"volume24"` ParentID int `json:"ParentID"` Network string DefaultPoolPair string DefaultPairToken string //additional p-unified token NetworkID int MovedUnifiedToken bool ParentUnifiedID int IsSwapable bool ContractIDSwap string }
type TradeDataRespond ¶
type TradeDataRespond struct { RequestTx string RespondTxs []string RespondTokens []string RespondAmounts []uint64 WithdrawTxs map[string]TradeWithdrawInfo SellTokenID string BuyTokenID string Status string StatusCode int PairID string PoolID string MinAccept uint64 Amount uint64 Matched uint64 Requestime int64 NFTID string Receiver string Fee uint64 FeeToken string IsCompleted bool SellTokenBalance uint64 BuyTokenBalance uint64 SellTokenWithdrawed uint64 BuyTokenWithdrawed uint64 TradingPath []string }
type TradeWithdrawInfo ¶
type UnshieldTxData ¶
type UnshieldTxData struct { mgm.DefaultModel `bson:",inline"` Status string `json:"status" bson:"status"` OutchainStatus string `json:"outchain_status" bson:"outchain_status"` NetworkID int `json:"networkid" bson:"networkid"` TokenID string `json:"tokenid" bson:"tokenid"` UTokenID string `json:"utokenid" bson:"utokenid"` ExternalAddress string `json:"externaladdress" bson:"externaladdress"` Amount uint64 `json:"amount" bson:"amount"` Networks []string `json:"networks" bson:"networks"` IncTx string `json:"inctx" bson:"inctx"` IsUnifiedToken bool `json:"isunifiedtoken" bson:"isunifiedtoken"` IncTxData string `json:"inctxdata" bson:"inctxdata"` FeeToken string `json:"feetoken" bson:"feetoken"` FeeAmount uint64 `json:"feeamount" bson:"feeamount"` PFeeAmount uint64 `json:"pfeeamount" bson:"pfeeamount"` RefundSubmitted bool `json:"refundsubmitted" bson:"refundsubmitted"` RefundPrivacyFee bool `json:"refundpfee" bson:"refundpfee"` FeeRefundOTA string `json:"fee_refundota" bson:"fee_refundota"` FeeRefundAddress string `json:"fee_refundaddress" bson:"fee_refundaddress"` UserAgent string `json:"useragent" bson:"useragent"` Error string `json:"error" bson:"error"` }
Source Files ¶
Click to show internal directories.
Click to hide internal directories.