# Thunder Finance Schema (phase 2) ```typescript= // jetton master bond v1 export const MasterOpocde = { TopUp: 0xd372158c, Mint: 0x642b7d07, InternalTransfer: 0x178d4519, Burn: 0x595f07bc, BurnNotification: 0x7bdd97de, Excess: 0xd53276db, JettonNotification: 0x7362d09c, DepositAsset: 0x95db9d39, ClaimAdminFee: 0x913e42af, ToTheMoon: 0x18ea8228, Upgrade: 0x2508d66a, }; export type Mint = { $$type: 'BuyToken'; queryId: bigint; tonAmount: bigint; minTokenOut: bigint; destination: Address; responseAddress: Address; custom_payload: Maybe<Cell>; forwardTonAmount: bigint; forwardPayload: Cell; }; export function storeMint(src: Mint) { return (b: Builder) => { b.storeUint(MasterOpocde.Mint, 32); b.storeUint(src.queryId, 64); b.storeCoins(src.tonAmount); b.storeCoins(src.minTokenOut); b.storeAddress(src.destination); b.storeAddress(src.responseAddress); b.storeMaybeRef(src.custom_payload); b.storeCoins(src.forwardTonAmount); b.storeRef(src.forwardPayload); }; } export type ToTheMoon = { $$type: 'ToTheMoon'; queryId: bigint; tonBody: Cell; jettonBody: Cell; vault1: Address; }; export function storeToTheMoon(src: ToTheMoon) { return (b: Builder) => { b.storeUint(MasterOpocde.ToTheMoon, 32); b.storeUint(src.queryId, 64); b.storeRef(src.tonBody); b.storeRef(src.jettonBody); b.storeAddress(src.vault1); }; } export type Upgrade = { $$type: 'Upgrade'; queryId: bigint; newCode: Cell; newData: Maybe<Cell>; }; export function storeUpgrade(src: Upgrade) { return (b: Builder) => { b.storeUint(MasterOpocde.Upgrade, 32); b.storeUint(src.queryId, 64); b.storeRef(src.newCode); b.storeMaybeRef(src.newData); }; } // airdrop contract export const DropOpcodes = { TopUp: 0xd372158c, JettonTransfer: 0xf8a7ea5, Claim: 0xa769de27, ClaimInternal: 0xca03fb47, ClaimInternalReply: 0xd4a4cd9c, Withdraw: 0xb5de5f9e, Upgrade: 0xb766741a, }; export const DropExitCodes = { InvalidOpcode: 0xffff, WrongWorkchain: 333, PermissionDenied: 500, NotStarted: 501, Finished: 502, InvalidProof: 503, InvalidParams: 504, AlreadyClaimed: 505, NotInitialized: 506, IsInitialized: 507, PendingClaim: 508, NotFinished: 509, NotEnoughGas: 510, }; export const DropError = (exitCode: number) => { switch (exitCode) { case 0xffff: return 'Invalid Opcode'; case 333: return 'Wrong Workchain'; case 500: return 'Permission Denied'; case 501: return 'Not Started'; case 502: return 'Finished'; case 503: return 'Invalid Proof'; case 504: return 'Invalid Params'; case 505: return 'Already Claimed'; case 506: return 'Not Initialized'; case 507: return 'Is Initialized'; case 508: return 'Pending Claim'; case 509: return 'Not Finished'; default: return `Unknown Exit Code: ${exitCode}`; } }; export type TopUp = { $$type: 'TopUp'; queryId: bigint; }; export function storeTopUp(src: TopUp) { return (b: Builder) => { b.storeUint(DropOpcodes.TopUp, 32); b.storeUint(src.queryId, 64); }; } export type Claim = { $$type: 'Claim'; queryId: bigint; index: bigint; account: Address; amount: bigint; merkleProof: Dictionary<bigint, bigint>; // array index -> hash }; export function storeClaim(src: Claim) { return (b: Builder) => { b.storeUint(DropOpcodes.Claim, 32); b.storeUint(src.queryId, 64); b.storeUint(src.index, 256); b.storeAddress(src.account); b.storeCoins(src.amount); b.storeUint(src.merkleProof.size, 32); b.storeDict(src.merkleProof); }; } export type Withdraw = { $$type: 'Withdraw'; queryId: bigint; }; export function storeWithdraw(src: Withdraw) { return (b: Builder) => { b.storeUint(DropOpcodes.Withdraw, 32); b.storeUint(src.queryId, 64); }; } export type Upgrade = { $$type: 'Upgrade'; queryId: bigint; newCode: Cell; newData: Maybe<Cell>; }; export function storeUpgrade(src: Upgrade) { return (b: Builder) => { b.storeUint(DropOpcodes.Upgrade, 32); b.storeUint(src.queryId, 64); b.storeRef(src.newCode); b.storeMaybeRef(src.newData); }; } export type JettonTransferDrop = { $$type: 'JettonTransfer'; queryId: bigint; jettonAmount: bigint; to: Address; responseAddress: Address | null; customPayload: Maybe<Cell>; forwardTonAmount: bigint; forwardPayload: Maybe<Cell>; }; export function storeJettonTransferDrop(src: JettonTransferDrop) { return (b: Builder) => { b.storeUint(DropOpcodes.JettonTransfer, 32); b.storeUint(src.queryId, 64); b.storeCoins(src.jettonAmount); b.storeAddress(src.to); b.storeAddress(src.responseAddress); b.storeMaybeRef(src.customPayload); b.storeCoins(src.forwardTonAmount); b.storeMaybeRef(src.forwardPayload); }; } ``` # Thunder Finance schema (phase 1) BOC Size: 9122 bytes ## Deploy TLB: `deploy#946a98b6 queryId:uint64 = Deploy` Signature: `Deploy{queryId:uint64}` ## DeployOk TLB: `deploy_ok#aff90f57 queryId:uint64 = DeployOk` Signature: `DeployOk{queryId:uint64}` ## FactoryDeploy TLB: `factory_deploy#6d0ff13b queryId:uint64 cashback:address = FactoryDeploy` Signature: `FactoryDeploy{queryId:uint64,cashback:address}` ## JettonTransfer TLB: `jetton_transfer#0f8a7ea5 query_id:uint64 amount:coins destination:address response_destination:address custom_payload:Maybe ^cell forward_ton_amount:coins forward_payload:remainder<slice> = JettonTransfer` Signature: `JettonTransfer{query_id:uint64,amount:coins,destination:address,response_destination:address,custom_payload:Maybe ^cell,forward_ton_amount:coins,forward_payload:remainder<slice>}` ## JettonTransferNotification TLB: `jetton_transfer_notification#7362d09c query_id:uint64 amount:coins sender:address forward_payload:remainder<slice> = JettonTransferNotification` Signature: `JettonTransferNotification{query_id:uint64,amount:coins,sender:address,forward_payload:remainder<slice>}` ## BuildJettonMasterChef TLB: `build_jetton_master_chef#89265822 owner:address seed:uint256 mcRewardJettonWallet:address metaData:^slice totalReward:coins deadline:uint64 startTime:uint64 queryId:uint64 = BuildJettonMasterChef` Signature: `BuildJettonMasterChef{owner:address,seed:uint256,mcRewardJettonWallet:address,metaData:^slice,totalReward:coins,deadline:uint64,startTime:uint64,queryId:uint64}` ## Initialize TLB: `initialize#c1c45a7c rewardJettonContent:^cell = Initialize` Signature: `Initialize{rewardJettonContent:^cell}` ## SetUpJettonMC TLB: `set_up_jetton_mc#f6cf7e6c owner:address mcRewardJettonWallet:address thunderMintWallet:address metaData:^slice totalReward:coins deadline:uint64 startTime:uint64 queryId:uint64 = SetUpJettonMC` Signature: `SetUpJettonMC{owner:address,mcRewardJettonWallet:address,thunderMintWallet:address,metaData:^slice,totalReward:coins,deadline:uint64,startTime:uint64,queryId:uint64}` ## AddPool TLB: `add_pool#4b7d1ae4 lpTokenAddress:address allocPoint:uint256 queryId:uint64 = AddPool` Signature: `AddPool{lpTokenAddress:address,allocPoint:uint256,queryId:uint64}` ## UpdatePool TLB: `update_pool#5e653b7f lpTokenAddress:address = UpdatePool` Signature: `UpdatePool{lpTokenAddress:address}` ## Withdraw TLB: `withdraw#097bb407 queryId:uint64 lpTokenAddress:address amount:coins beneficiary:address = Withdraw` Signature: `Withdraw{queryId:uint64,lpTokenAddress:address,amount:coins,beneficiary:address}` ## WithdrawInternalReply TLB: `withdraw_internal_reply#dc4c8b1a queryId:uint64 lpTokenAddress:address amount:coins sender:address beneficiary:address = WithdrawInternalReply` Signature: `WithdrawInternalReply{queryId:uint64,lpTokenAddress:address,amount:coins,sender:address,beneficiary:address}` ## Harvest TLB: `harvest#8839dc49 queryId:uint64 lpTokenAddress:address beneficiary:address = Harvest` Signature: `Harvest{queryId:uint64,lpTokenAddress:address,beneficiary:address}` ## HarvestInternalReply TLB: `harvest_internal_reply#952bcd19 queryId:uint64 lpTokenAddress:address beneficiary:address reward:coins sender:address = HarvestInternalReply` Signature: `HarvestInternalReply{queryId:uint64,lpTokenAddress:address,beneficiary:address,reward:coins,sender:address}` ## UserDeposit TLB: `user_deposit#6ba1d82e queryId:uint64 lpTokenAddress:address amount:coins rewardDebt:int257 = UserDeposit` Signature: `UserDeposit{queryId:uint64,lpTokenAddress:address,amount:coins,rewardDebt:int257}` ## WithdrawInternal TLB: `withdraw_internal#81732891 queryId:uint64 lpTokenAddress:address amount:coins rewardDebt:int257 beneficiary:address sender:address = WithdrawInternal` Signature: `WithdrawInternal{queryId:uint64,lpTokenAddress:address,amount:coins,rewardDebt:int257,beneficiary:address,sender:address}` ## HarvestInternal TLB: `harvest_internal#925d0240 queryId:uint64 lpTokenAddress:address beneficiary:address accRewardPerShare:coins = HarvestInternal` Signature: `HarvestInternal{queryId:uint64,lpTokenAddress:address,beneficiary:address,accRewardPerShare:coins}` ## WithdrawAndHarvest TLB: `withdraw_and_harvest#4212017c queryId:uint64 lpTokenAddress:address withdrawAmount:coins beneficiary:address = WithdrawAndHarvest` Signature: `WithdrawAndHarvest{queryId:uint64,lpTokenAddress:address,withdrawAmount:coins,beneficiary:address}` ## WithdrawAndHarvestInternal TLB: `withdraw_and_harvest_internal#16a5d563 queryId:uint64 lpTokenAddress:address withdrawAmount:coins accRewardPerShare:coins beneficiary:address sender:address = WithdrawAndHarvestInternal` Signature: `WithdrawAndHarvestInternal{queryId:uint64,lpTokenAddress:address,withdrawAmount:coins,accRewardPerShare:coins,beneficiary:address,sender:address}` ## WithdrawAndHarvestReply TLB: `withdraw_and_harvest_reply#a1114e19 queryId:uint64 lpTokenAddress:address beneficiary:address rewardAmount:coins withdrawAmount:coins sender:address = WithdrawAndHarvestReply` Signature: `WithdrawAndHarvestReply{queryId:uint64,lpTokenAddress:address,beneficiary:address,rewardAmount:coins,withdrawAmount:coins,sender:address}` ## SetUpTonMC TLB: `set_up_ton_mc#8bf38613 owner:address thunderMintWallet:address metaData:^slice totalReward:coins deadline:uint64 startTime:uint64 queryId:uint64 = SetUpTonMC` Signature: `SetUpTonMC{owner:address,thunderMintWallet:address,metaData:^slice,totalReward:coins,deadline:uint64,startTime:uint64,queryId:uint64}` ## BuildTonMasterChef TLB: `build_ton_master_chef#d449b642 owner:address seed:uint256 metaData:^slice totalReward:coins deadline:uint64 startTime:uint64 queryId:uint64 = BuildTonMasterChef` Signature: `BuildTonMasterChef{owner:address,seed:uint256,metaData:^slice,totalReward:coins,deadline:uint64,startTime:uint64,queryId:uint64}` ## DeployMasterChef TLB: `deploy_master_chef#d1a0507d owner:address seed:uint256 = DeployMasterChef` Signature: `DeployMasterChef{owner:address,seed:uint256}` ## Set TLB: `set#d8d5ea7f lpTokenAddress:address allocPoint:uint256 = Set` Signature: `Set{lpTokenAddress:address,allocPoint:uint256}` ## PoolInfo TLB: `_ allocPoint:uint256 lastRewardBlock:uint256 accRewardPerShare:coins lpSupply:coins lpTokenAddress:address = PoolInfo` Signature: `PoolInfo{allocPoint:uint256,lastRewardBlock:uint256,accRewardPerShare:coins,lpSupply:coins,lpTokenAddress:address}` ## UserInfo TLB: `_ amount:coins rewardDebt:int257 = UserInfo` Signature: `UserInfo{amount:coins,rewardDebt:int257}` ## MasterChefData TLB: `_ owner:address mcRewardJettonWallet:address rewardPerSecond:coins startTime:uint64 deadline:uint64 isInitialized:bool totalAllocPoint:int257 feeForDevs:coins pools:dict<address, ^PoolInfo{allocPoint:uint256,lastRewardBlock:uint256,accRewardPerShare:coins,lpSupply:coins,lpTokenAddress:address}> metaData:^cell totalReward:coins = MasterChefData` Signature: `MasterChefData{owner:address,mcRewardJettonWallet:address,rewardPerSecond:coins,startTime:uint64,deadline:uint64,isInitialized:bool,totalAllocPoint:int257,feeForDevs:coins,pools:dict<address, ^PoolInfo{allocPoint:uint256,lastRewardBlock:uint256,accRewardPerShare:coins,lpSupply:coins,lpTokenAddress:address}>,metaData:^cell,totalReward:coins}` ## RedeemData TLB: `_ redundantReward:coins totalLpSupply:coins lastWithdrawTime:int257 = RedeemData` Signature: `RedeemData{redundantReward:coins,totalLpSupply:coins,lastWithdrawTime:int257}` # Get Methods Total Get Methods: 6 ## getJettonMasterChefData ## getMiniChefAddress Argument: userAddress ## getPoolInfo Argument: lpTokenAddress ## getMetaData ## getAccRewardPerShare Argument: lpTokenAddress ## getRedeemData # Error Codes 2: Stack undeflow 3: Stack overflow 4: Integer overflow 5: Integer out of expected range 6: Invalid opcode 7: Type check error 8: Cell overflow 9: Cell underflow 10: Dictionary error 13: Out of gas error 32: Method ID not found 34: Action is invalid or not supported 37: Not enough TON 38: Not enough extra-currencies 128: Null reference exception 129: Invalid serialization prefix 130: Invalid incoming message 131: Constraints error 132: Access denied 133: Contract stopped 134: Invalid argument 135: Code of a contract was not found 136: Invalid address 137: Masterchain support is not enabled for this contract 3359: pool already exist 6499: reward wallet already set 9504: only masterChef can withdraw 17425: only masterChef can deposit 18346: only owner can add pool 19364: insufficient balance 22034: contract already initialized 24895: contract not initialized 28952: value not enough 31120: only masterChef can harvest 33311: unexpected sender 36210: only owner can set alloc point 36629: Alloc point must > 0 45761: Not enough TON to redeem 48992: reward distribution not started 52316: user not exists 58086: pool not exists