Skip to content

Commit df60eda

Browse files
committed
feat: get available conetian airdrop and do airdrop (WIP)
1 parent 464d176 commit df60eda

File tree

5 files changed

+369
-1
lines changed

5 files changed

+369
-1
lines changed

src/localServer/define.d.ts

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -259,6 +259,7 @@ declare type WorkerCommand =
259259
| "addMonitoredWallet"
260260
| "removeMonitoredWallet"
261261
| "getProfileAvailableCntpReward"
262+
| "claimConetianAirdrop"
262263

263264
type SINodesSortby = 'CUSTOMER_REVIEW'|'TOTAL_ONLINE_TIME'|
264265
'STORAGE_PRICE_LOW'|'STORAGE_PRICE_HIGH'|'OUTBOUND_PRICE_HIGH'|'OUTBOUND_PRICE_LOW'
@@ -366,6 +367,12 @@ interface historicBalance {
366367
balance: string
367368
}
368369

370+
interface airdrop {
371+
availableCntp?: number
372+
availableConetian?: number
373+
availableGuardian?: number
374+
}
375+
369376
interface profile extends keyPair {
370377
isPrimary?: boolean;
371378
pgpKey?: pgpKeyPair;
@@ -383,6 +390,7 @@ interface profile extends keyPair {
383390
nodeIP_address?: string;
384391
nodeRegion?: string;
385392
historicBalance?: historicBalance[]
393+
airdrop?: airdrop
386394
}
387395

388396
interface publicProfile {

src/localServer/workers/encrypt.ts

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -843,6 +843,10 @@ const processCmd = async (cmd: worker_command) => {
843843
return removeMonitoredWallet(cmd);
844844
}
845845

846+
case "claimConetianAirdrop": {
847+
return claimConetianAirdrop(cmd);
848+
}
849+
846850
default: {
847851
cmd.err = "INVALID_COMMAND";
848852
responseChannel.postMessage(JSON.stringify(cmd));

src/localServer/workers/utilities/smartContractABI.ts

Lines changed: 284 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6680,4 +6680,288 @@ const christmas2024Abi = [
66806680
stateMutability: "view",
66816681
type: "function",
66826682
},
6683+
];
6684+
6685+
const conetianAirdropAbi = [
6686+
{ inputs: [], stateMutability: "nonpayable", type: "constructor" },
6687+
{
6688+
inputs: [
6689+
{ internalType: "address", name: "spender", type: "address" },
6690+
{ internalType: "uint256", name: "allowance", type: "uint256" },
6691+
{ internalType: "uint256", name: "needed", type: "uint256" },
6692+
],
6693+
name: "ERC20InsufficientAllowance",
6694+
type: "error",
6695+
},
6696+
{
6697+
inputs: [
6698+
{ internalType: "address", name: "sender", type: "address" },
6699+
{ internalType: "uint256", name: "balance", type: "uint256" },
6700+
{ internalType: "uint256", name: "needed", type: "uint256" },
6701+
],
6702+
name: "ERC20InsufficientBalance",
6703+
type: "error",
6704+
},
6705+
{
6706+
inputs: [{ internalType: "address", name: "approver", type: "address" }],
6707+
name: "ERC20InvalidApprover",
6708+
type: "error",
6709+
},
6710+
{
6711+
inputs: [{ internalType: "address", name: "receiver", type: "address" }],
6712+
name: "ERC20InvalidReceiver",
6713+
type: "error",
6714+
},
6715+
{
6716+
inputs: [{ internalType: "address", name: "sender", type: "address" }],
6717+
name: "ERC20InvalidSender",
6718+
type: "error",
6719+
},
6720+
{
6721+
inputs: [{ internalType: "address", name: "spender", type: "address" }],
6722+
name: "ERC20InvalidSpender",
6723+
type: "error",
6724+
},
6725+
{
6726+
anonymous: false,
6727+
inputs: [
6728+
{
6729+
indexed: true,
6730+
internalType: "address",
6731+
name: "owner",
6732+
type: "address",
6733+
},
6734+
{
6735+
indexed: true,
6736+
internalType: "address",
6737+
name: "spender",
6738+
type: "address",
6739+
},
6740+
{
6741+
indexed: false,
6742+
internalType: "uint256",
6743+
name: "value",
6744+
type: "uint256",
6745+
},
6746+
],
6747+
name: "Approval",
6748+
type: "event",
6749+
},
6750+
{
6751+
anonymous: false,
6752+
inputs: [
6753+
{ indexed: true, internalType: "address", name: "from", type: "address" },
6754+
{ indexed: true, internalType: "address", name: "to", type: "address" },
6755+
{
6756+
indexed: false,
6757+
internalType: "uint256",
6758+
name: "value",
6759+
type: "uint256",
6760+
},
6761+
],
6762+
name: "Transfer",
6763+
type: "event",
6764+
},
6765+
{
6766+
inputs: [],
6767+
name: "CONETianCoNETAirDrop",
6768+
outputs: [{ internalType: "uint256", name: "", type: "uint256" }],
6769+
stateMutability: "view",
6770+
type: "function",
6771+
},
6772+
{
6773+
inputs: [{ internalType: "address", name: "", type: "address" }],
6774+
name: "CONETianDidMint",
6775+
outputs: [{ internalType: "bool", name: "", type: "bool" }],
6776+
stateMutability: "view",
6777+
type: "function",
6778+
},
6779+
{
6780+
inputs: [],
6781+
name: "CONETianEnd",
6782+
outputs: [{ internalType: "bool", name: "", type: "bool" }],
6783+
stateMutability: "view",
6784+
type: "function",
6785+
},
6786+
{
6787+
inputs: [],
6788+
name: "CONETianMint",
6789+
outputs: [],
6790+
stateMutability: "nonpayable",
6791+
type: "function",
6792+
},
6793+
{
6794+
inputs: [],
6795+
name: "CONETianPlan",
6796+
outputs: [
6797+
{ internalType: "contract CONETianPlanV2", name: "", type: "address" },
6798+
],
6799+
stateMutability: "view",
6800+
type: "function",
6801+
},
6802+
{
6803+
inputs: [],
6804+
name: "CONETianPoolMinted",
6805+
outputs: [{ internalType: "uint256", name: "", type: "uint256" }],
6806+
stateMutability: "view",
6807+
type: "function",
6808+
},
6809+
{
6810+
inputs: [],
6811+
name: "CONETianReferrerCoNETAirDrop",
6812+
outputs: [{ internalType: "uint256", name: "", type: "uint256" }],
6813+
stateMutability: "view",
6814+
type: "function",
6815+
},
6816+
{
6817+
inputs: [{ internalType: "address", name: "", type: "address" }],
6818+
name: "adminList",
6819+
outputs: [{ internalType: "bool", name: "", type: "bool" }],
6820+
stateMutability: "view",
6821+
type: "function",
6822+
},
6823+
{
6824+
inputs: [
6825+
{ internalType: "address", name: "owner", type: "address" },
6826+
{ internalType: "address", name: "spender", type: "address" },
6827+
],
6828+
name: "allowance",
6829+
outputs: [{ internalType: "uint256", name: "", type: "uint256" }],
6830+
stateMutability: "view",
6831+
type: "function",
6832+
},
6833+
{
6834+
inputs: [
6835+
{ internalType: "address", name: "spender", type: "address" },
6836+
{ internalType: "uint256", name: "value", type: "uint256" },
6837+
],
6838+
name: "approve",
6839+
outputs: [{ internalType: "bool", name: "", type: "bool" }],
6840+
stateMutability: "nonpayable",
6841+
type: "function",
6842+
},
6843+
{
6844+
inputs: [],
6845+
name: "availableCONETianAirDrop",
6846+
outputs: [
6847+
{ internalType: "uint256", name: "availableCoNET", type: "uint256" },
6848+
],
6849+
stateMutability: "view",
6850+
type: "function",
6851+
},
6852+
{
6853+
inputs: [{ internalType: "address", name: "account", type: "address" }],
6854+
name: "balanceOf",
6855+
outputs: [{ internalType: "uint256", name: "", type: "uint256" }],
6856+
stateMutability: "view",
6857+
type: "function",
6858+
},
6859+
{
6860+
inputs: [
6861+
{ internalType: "address", name: "to", type: "address" },
6862+
{ internalType: "uint256", name: "value", type: "uint256" },
6863+
],
6864+
name: "bridgeBurn",
6865+
outputs: [],
6866+
stateMutability: "nonpayable",
6867+
type: "function",
6868+
},
6869+
{
6870+
inputs: [
6871+
{ internalType: "address", name: "to", type: "address" },
6872+
{ internalType: "uint256", name: "value", type: "uint256" },
6873+
{ internalType: "string", name: "_tx", type: "string" },
6874+
],
6875+
name: "bridgeMint",
6876+
outputs: [],
6877+
stateMutability: "nonpayable",
6878+
type: "function",
6879+
},
6880+
{
6881+
inputs: [],
6882+
name: "bridgedTotal",
6883+
outputs: [{ internalType: "uint256", name: "", type: "uint256" }],
6884+
stateMutability: "view",
6885+
type: "function",
6886+
},
6887+
{
6888+
inputs: [],
6889+
name: "canTransferRule",
6890+
outputs: [{ internalType: "bool", name: "", type: "bool" }],
6891+
stateMutability: "view",
6892+
type: "function",
6893+
},
6894+
{
6895+
inputs: [
6896+
{ internalType: "address", name: "addr", type: "address" },
6897+
{ internalType: "bool", name: "status", type: "bool" },
6898+
],
6899+
name: "changeAddressInAdminlist",
6900+
outputs: [],
6901+
stateMutability: "nonpayable",
6902+
type: "function",
6903+
},
6904+
{
6905+
inputs: [{ internalType: "bytes32", name: "", type: "bytes32" }],
6906+
name: "credentialTx",
6907+
outputs: [{ internalType: "bool", name: "", type: "bool" }],
6908+
stateMutability: "view",
6909+
type: "function",
6910+
},
6911+
{
6912+
inputs: [],
6913+
name: "decimals",
6914+
outputs: [{ internalType: "uint8", name: "", type: "uint8" }],
6915+
stateMutability: "view",
6916+
type: "function",
6917+
},
6918+
{
6919+
inputs: [],
6920+
name: "name",
6921+
outputs: [{ internalType: "string", name: "", type: "string" }],
6922+
stateMutability: "view",
6923+
type: "function",
6924+
},
6925+
{
6926+
inputs: [{ internalType: "bool", name: "status", type: "bool" }],
6927+
name: "setCanTransferRule",
6928+
outputs: [],
6929+
stateMutability: "nonpayable",
6930+
type: "function",
6931+
},
6932+
{
6933+
inputs: [],
6934+
name: "symbol",
6935+
outputs: [{ internalType: "string", name: "", type: "string" }],
6936+
stateMutability: "view",
6937+
type: "function",
6938+
},
6939+
{
6940+
inputs: [],
6941+
name: "totalSupply",
6942+
outputs: [{ internalType: "uint256", name: "", type: "uint256" }],
6943+
stateMutability: "view",
6944+
type: "function",
6945+
},
6946+
{
6947+
inputs: [
6948+
{ internalType: "address", name: "to", type: "address" },
6949+
{ internalType: "uint256", name: "value", type: "uint256" },
6950+
],
6951+
name: "transfer",
6952+
outputs: [{ internalType: "bool", name: "", type: "bool" }],
6953+
stateMutability: "nonpayable",
6954+
type: "function",
6955+
},
6956+
{
6957+
inputs: [
6958+
{ internalType: "address", name: "from", type: "address" },
6959+
{ internalType: "address", name: "to", type: "address" },
6960+
{ internalType: "uint256", name: "value", type: "uint256" },
6961+
],
6962+
name: "transferFrom",
6963+
outputs: [{ internalType: "bool", name: "", type: "bool" }],
6964+
stateMutability: "nonpayable",
6965+
type: "function",
6966+
},
66836967
];

src/localServer/workers/utilities/utilV2.ts

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -33,6 +33,8 @@ const conet_dWBNB = '0xd8b094E91c552c623bc054085871F6c1CA3E5cAd'
3333
const CONET_Guardian_Nodes1 = '0x5e4aE81285b86f35e3370B3EF72df1363DD05286'
3434
const fx168OrderContractAddress = '0x9aE6D3Bd3029C8B2A73817b9aFa1C029237E3e30'
3535
const christmas2024ContractAddress = "0xb188e707f4544835aEe28E4206C65edfF23221C0";
36+
const conetianAirdropContractAddress =
37+
"0x675291851C5007759b35B89af9aDa3561Afbba18";
3638

3739
const CONETIAN_PRICE = 100
3840
const GUARDIAN_PRICE = 1250

0 commit comments

Comments
 (0)