Skip to content

Commit 11e30a1

Browse files
committed
feat (WIP): bridge
1 parent dee7ba7 commit 11e30a1

File tree

6 files changed

+425
-7
lines changed

6 files changed

+425
-7
lines changed

src/localServer/define.d.ts

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -262,6 +262,7 @@ declare type WorkerCommand =
262262
| "getProfileAvailableCntpReward"
263263
| "redeemAirdrop"
264264
| "redeemSilentPassPassport"
265+
| "bridge"
265266

266267
type SINodesSortby = 'CUSTOMER_REVIEW'|'TOTAL_ONLINE_TIME'|
267268
'STORAGE_PRICE_LOW'|'STORAGE_PRICE_HIGH'|'OUTBOUND_PRICE_HIGH'|'OUTBOUND_PRICE_LOW'
@@ -335,6 +336,8 @@ interface conet_tokens {
335336
eth?: CryptoAsset
336337
usdt?:CryptoAsset
337338

339+
conet_eth?: CryptoAsset
340+
338341
// BSC
339342
bnb?: CryptoAsset
340343
wbnb?: CryptoAsset

src/localServer/userMining.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -96,9 +96,9 @@ const getAllNodes = () => new Promise(async resolve => {
9696
}, err => {
9797
if (err) {
9898
const length = parseInt(err.message) - 100
99-
logger(`Error at ${length} Guardian_Nodes = ${Guardian_Nodes[length].domain}`)
99+
logger(`Error at ${length} Guardian_Nodes = ${Guardian_Nodes?.[length]?.domain}`)
100100
Guardian_Nodes.splice(length)
101-
logger(`Guardian_Nodes length = ${Guardian_Nodes.length} the last node is ${Guardian_Nodes[Guardian_Nodes.length - 1].ip_addr}`)
101+
logger(`Guardian_Nodes length = ${Guardian_Nodes.length} the last node is ${Guardian_Nodes?.[Guardian_Nodes.length - 1]?.ip_addr}`)
102102

103103
}
104104
logger(`mapLimit finished err = ${err?.message}`)

src/localServer/workers/encrypt.ts

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -848,6 +848,10 @@ const processCmd = async (cmd: worker_command) => {
848848
return redeemSilentPassPassport(cmd);
849849
}
850850

851+
case "bridge": {
852+
return bridge(cmd);
853+
}
854+
851855
default: {
852856
cmd.err = "INVALID_COMMAND";
853857
responseChannel.postMessage(JSON.stringify(cmd));

src/localServer/workers/utilities/smartContractABI.ts

Lines changed: 292 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8254,4 +8254,296 @@ const passportAbi_cancun = [
82548254
stateMutability: "view",
82558255
type: "function",
82568256
},
8257+
];
8258+
8259+
const conetMainnetBridgeAbi = [
8260+
{
8261+
inputs: [],
8262+
stateMutability: "payable",
8263+
type: "constructor",
8264+
},
8265+
{
8266+
anonymous: false,
8267+
inputs: [
8268+
{
8269+
indexed: false,
8270+
internalType: "address",
8271+
name: "Sender",
8272+
type: "address",
8273+
},
8274+
{
8275+
indexed: false,
8276+
internalType: "uint256",
8277+
name: "Value",
8278+
type: "uint256",
8279+
},
8280+
],
8281+
name: "Received",
8282+
type: "event",
8283+
},
8284+
{
8285+
inputs: [
8286+
{
8287+
internalType: "bytes32",
8288+
name: "_tx",
8289+
type: "bytes32",
8290+
},
8291+
],
8292+
name: "_bridgeExit",
8293+
outputs: [],
8294+
stateMutability: "nonpayable",
8295+
type: "function",
8296+
},
8297+
{
8298+
inputs: [
8299+
{
8300+
internalType: "bytes32",
8301+
name: "_tx",
8302+
type: "bytes32",
8303+
},
8304+
],
8305+
name: "_bridgeExitTx",
8306+
outputs: [
8307+
{
8308+
internalType: "bool",
8309+
name: "isUsed",
8310+
type: "bool",
8311+
},
8312+
],
8313+
stateMutability: "view",
8314+
type: "function",
8315+
},
8316+
{
8317+
inputs: [
8318+
{
8319+
internalType: "address",
8320+
name: "",
8321+
type: "address",
8322+
},
8323+
],
8324+
name: "adminList",
8325+
outputs: [
8326+
{
8327+
internalType: "bool",
8328+
name: "",
8329+
type: "bool",
8330+
},
8331+
],
8332+
stateMutability: "view",
8333+
type: "function",
8334+
},
8335+
{
8336+
inputs: [
8337+
{
8338+
internalType: "bytes32",
8339+
name: "_tx",
8340+
type: "bytes32",
8341+
},
8342+
],
8343+
name: "bridgeExit",
8344+
outputs: [],
8345+
stateMutability: "nonpayable",
8346+
type: "function",
8347+
},
8348+
{
8349+
inputs: [],
8350+
name: "bridgedEntryTotal",
8351+
outputs: [
8352+
{
8353+
internalType: "uint256",
8354+
name: "",
8355+
type: "uint256",
8356+
},
8357+
],
8358+
stateMutability: "view",
8359+
type: "function",
8360+
},
8361+
{
8362+
inputs: [],
8363+
name: "bridgedExitTotal",
8364+
outputs: [
8365+
{
8366+
internalType: "uint256",
8367+
name: "",
8368+
type: "uint256",
8369+
},
8370+
],
8371+
stateMutability: "view",
8372+
type: "function",
8373+
},
8374+
{
8375+
inputs: [
8376+
{
8377+
internalType: "address",
8378+
name: "addr",
8379+
type: "address",
8380+
},
8381+
{
8382+
internalType: "bool",
8383+
name: "status",
8384+
type: "bool",
8385+
},
8386+
],
8387+
name: "changeAddressInAdminlist",
8388+
outputs: [],
8389+
stateMutability: "nonpayable",
8390+
type: "function",
8391+
},
8392+
{
8393+
inputs: [
8394+
{
8395+
internalType: "bytes32",
8396+
name: "_tx",
8397+
type: "bytes32",
8398+
},
8399+
],
8400+
name: "isExistTx",
8401+
outputs: [
8402+
{
8403+
internalType: "bool",
8404+
name: "",
8405+
type: "bool",
8406+
},
8407+
],
8408+
stateMutability: "view",
8409+
type: "function",
8410+
},
8411+
{
8412+
inputs: [
8413+
{
8414+
internalType: "bytes32",
8415+
name: "_tx",
8416+
type: "bytes32",
8417+
},
8418+
{
8419+
internalType: "address",
8420+
name: "to",
8421+
type: "address",
8422+
},
8423+
{
8424+
internalType: "uint256",
8425+
name: "value",
8426+
type: "uint256",
8427+
},
8428+
],
8429+
name: "makeExitTx",
8430+
outputs: [],
8431+
stateMutability: "nonpayable",
8432+
type: "function",
8433+
},
8434+
{
8435+
inputs: [
8436+
{
8437+
internalType: "bytes32",
8438+
name: "",
8439+
type: "bytes32",
8440+
},
8441+
],
8442+
name: "mintTx",
8443+
outputs: [
8444+
{
8445+
internalType: "bytes32",
8446+
name: "tx",
8447+
type: "bytes32",
8448+
},
8449+
{
8450+
internalType: "uint256",
8451+
name: "value",
8452+
type: "uint256",
8453+
},
8454+
{
8455+
internalType: "address",
8456+
name: "to",
8457+
type: "address",
8458+
},
8459+
{
8460+
internalType: "bool",
8461+
name: "isUsed",
8462+
type: "bool",
8463+
},
8464+
],
8465+
stateMutability: "view",
8466+
type: "function",
8467+
},
8468+
{
8469+
stateMutability: "payable",
8470+
type: "receive",
8471+
},
8472+
];
8473+
8474+
const ethTreasuryAbi = [
8475+
{ inputs: [], stateMutability: "payable", type: "constructor" },
8476+
{
8477+
anonymous: false,
8478+
inputs: [
8479+
{
8480+
indexed: false,
8481+
internalType: "address",
8482+
name: "Sender",
8483+
type: "address",
8484+
},
8485+
{
8486+
indexed: false,
8487+
internalType: "uint256",
8488+
name: "Value",
8489+
type: "uint256",
8490+
},
8491+
],
8492+
name: "Received",
8493+
type: "event",
8494+
},
8495+
{
8496+
anonymous: false,
8497+
inputs: [
8498+
{
8499+
indexed: false,
8500+
internalType: "address payable",
8501+
name: "to",
8502+
type: "address",
8503+
},
8504+
{
8505+
indexed: false,
8506+
internalType: "uint256",
8507+
name: "amount",
8508+
type: "uint256",
8509+
},
8510+
],
8511+
name: "Transfer",
8512+
type: "event",
8513+
},
8514+
{
8515+
inputs: [{ internalType: "address", name: "", type: "address" }],
8516+
name: "adminList",
8517+
outputs: [{ internalType: "bool", name: "", type: "bool" }],
8518+
stateMutability: "view",
8519+
type: "function",
8520+
},
8521+
{
8522+
inputs: [],
8523+
name: "balance",
8524+
outputs: [{ internalType: "uint256", name: "", type: "uint256" }],
8525+
stateMutability: "view",
8526+
type: "function",
8527+
},
8528+
{
8529+
inputs: [
8530+
{ internalType: "address", name: "addr", type: "address" },
8531+
{ internalType: "bool", name: "status", type: "bool" },
8532+
],
8533+
name: "changeAddressInAdminlist",
8534+
outputs: [],
8535+
stateMutability: "nonpayable",
8536+
type: "function",
8537+
},
8538+
{
8539+
inputs: [
8540+
{ internalType: "address payable", name: "_to", type: "address" },
8541+
{ internalType: "uint256", name: "amount", type: "uint256" },
8542+
],
8543+
name: "sendETH",
8544+
outputs: [],
8545+
stateMutability: "payable",
8546+
type: "function",
8547+
},
8548+
{ stateMutability: "payable", type: "receive" },
82578549
];

src/localServer/workers/utilities/utilV2.ts

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -65,10 +65,14 @@ const tron_USDT = '0xA614F803B6FD780986A42C78EC9C7F77E6DED13C'
6565
const blast_usdb_contract = '0x4300000000000000000000000000000000000003'
6666
const bnb_wbnb_contract = '0xbb4CdB9CBd36B01bD1cBaEBF2De08d9173bc095c'
6767
const bnb_usdt_contract = '0x55d398326f99059fF775485246999027B3197955'
68-
6968
const eth_usdt_contract = '0xdac17f958d2ee523a2206206994597c13d831ec7'
7069

7170
const assetOracle_contract_addr = '0x0Ac28e301FeE0f60439675594141BEB53853f7b9'
71+
const receivedPoolContractAddress =
72+
"0x287CFe91c3779Ea9F495f7cf2cd88b438550c8D8";
73+
const conetMainnetBridgeContractAddress =
74+
"0xD9f2d81FF6ca7a172143FC9DE2aF23FcffD53dbf";
75+
const ethTreasuryContractAddress = "0x8E946aaD91155A8A37d24Dc10DE851f4Ef41C2Ef";
7276

7377
// claimable
7478
const claimable_BNB_USDT = '0x49d1E11A25E99015cAaE3e032a7ED23D4399F3f9'

0 commit comments

Comments
 (0)