بلوک های ساختمانی برای اینترنت نسل بعدی
NEO تعداد کاملی از ویژگی های خارج از جعبه را فراهم می کند ، اما شما را در جعبه نگه نمی دارد.
قابلیت های بومی تمام زیرساخت های مورد نیاز شما برای ایجاد برنامه های غیرمتمرکز کامل را فراهم می کند ، در حالی که قابلیت همکاری پیشرفته به شما امکان می دهد قدرت اکوسیستم جهانی blockchain را مهار کنید. بیشتر بدانید
ue6ab یک بلوک نهایی
مکانیسم اجماع DBFT نهایی و سریع و کارآمد را در یک بلوک واحد تضمین می کند.
ue6ab اوراکل
یک اوراکل داخلی که امکان دسترسی امن به هرگونه داده خارج از زنجیره را فراهم می کند.
ue6ab neofs
یک راه حل ذخیره سازی داده توزیع شده برای مقیاس پذیری و حریم خصوصی.
ue6ab قراردادهای هوشمند
قراردادهای هوشمند خود را در C#، Go ، Python ، Java یا TypeScript بنویسید.
service Neo Name Service
یک سرویس نام دامنه . NEO غیر متمرکز برای برنامه های وب اینترنت نسل بعدی.
ue6ab قابلیت همکاری
Poly. network قابلیت همکاری زنجیره ای متقابل را با اتریوم ، زنجیره دوتایی و موارد دیگر فعال کرد.
ue6ab نئوید
مجموعه ای از استانداردهای راه حل غیرمتمرکز هویت خود ضخیم.
blockchain شما می دانید
قراردادهای هوشمند را به زبانی بنویسید که قبلاً دوستش دارید
پیتون



شرح

جاوا

پیتون

پیتون
ue603
from boa3.builtin.contract import Nep17TransferEvent, abort @metadata def manifest_metadata() -> NeoMetadata: meta = NeoMetadata() meta.author = "coz" retu meta OWNER = UInt160(b'x00x00x00x00x00x00x00x00x00x00x00x00x00x00x00x00x00x00x00x00') TOKEN_TOTAL_SUPPLY = 100_000_000 * 100_000_000 # 10m total supply * 10^8 (decimals) # Events on_transfer = Nep17TransferEvent @public def transfer(from_address: UInt160, to_address: UInt160, amount: int, data: Any) -> bool: assert len(from_address) == 20 and len(to_address) == 20 assert amount >= 0 # اگر تراز حساب از نشانه های کافی برای خرج کردن استفاده کند ، عملکرد باید نادرست برگردد. from_balance = دریافت (from_address) . to_int () اگر از_بلانس< amount: retu False # The function should check whether the from address equals the caller contract hash. if from_address != calling_script_hash: if not check_witness(from_address): retu False # skip balance changes if transferring to yourself or transferring 0 cryptocurrency if from_address != to_address and amount != 0: if from_balance == amount: delete(from_address) else: put(from_address, from_balance - amount) to_balance = get(to_address).to_int() put(to_address, to_balance + amount) on_transfer(from_address, to_address, amount) # if the to_address is a smart contract, it must call the contract's onPayment method post_transfer(from_address, to_address, amount, data) retu True
منابع پایتون

ue603
با استفاده از نئو ؛با استفاده از neo. smartcontract ؛با استفاده از neo. smartcontract. framework ؛با استفاده از neo. smartcontract. framework. attributes ؛با استفاده از neo. smartcontract. framework. native ؛با استفاده از neo. smartcontract. framework. service ؛استفاده از سیستم ؛با استفاده از System. Numerics ؛دسک تا فضای نام< [ManifestExtra("Author", "Neo")] [ManifestExtra("Email", "dev@neo.org")] [ManifestExtra("Description", "This is a contract example")] [ContractSourceCode("https://github.com/neo-project/neo-devpack-dotnet/tree/master/src/Neo.SmartContract.Template")] public class Contract1 : SmartContract < //TODO: Replace it with your own address. [InitialValue("NiNmXL8FjEUEs1nfX9uHFBNaenxDHJtmuB", ContractParameterType.Hash160)] static readonly UInt160 Owner = default; private static bool IsOwner() =>Runtime.CheckWitness(Owner); // When this contract address is included in the transaction signature, // this method will be triggered as a VerificationTrigger to verify that the signature is correct. // For example, this method needs to be called when withdrawing token from the contract. public static bool Verify() =>isOwner () ؛// TODO: آن را با روش های خود جایگزین کنید. رشته استاتیک عمومی mymethod ()< retu Storage.Get(Storage.CurrentContext, "Hello"); >void static عمومی _deploy (داده های شی ، بروزرسانی بول)< if (update) retu; // It will be executed during deploy Storage.Put(Storage.CurrentContext, "Hello", "World"); >به روزرسانی خالی استاتیک عمومی (Neffile Bytestring ، مانیفست رشته)< if (!IsOwner()) throw new Exception("No authorization."); ContractManagement.Update(nefFile, manifest, null); >تخریب استاتیک عمومی ()< if (!IsOwner()) throw new Exception("No authorization."); ContractManagement.Destroy(); >> >
منابع Csharp

ue603
بسته بندی NEP17Contract var (Token NEP17. Token CTX Storage. Context) // Initace Initace Token and Storage Context Init () را آغاز می کند.< token = nep17.Token< . Name: "Nep17 example", Owner: util.FromAddress("NdHjSPVnw99RDMCoJdCnAcjkE23gvqUeg2"), TotalSupply: 10000000000000000 >ctx = storage.GetContext() >// انتقال توکن از یک کاربر به یک کاربر دیگر (T Token) انتقال (CTX Storage. Context ، از ، به interop. hash160 ، مقدار int ، رابط داده<>) بول< amountFrom := t.CanTransfer(ctx, from, to, amount) if amountFrom == -1 < retu false >اگر مقدار از == 0< storage.Delete(ctx, from) >if amountFrom >0< diff := amountFrom - amount storage.Put(ctx, from, diff) >مقدار TO: = getIntFromDb (ctx ، to) totalamountto: = مقدار to + مقدار ذخیره سازی)! = صفر< contract.Call(to, "onNEP17Payment", contract.All, from, amount, data) >retu true >
منابع برو
شرح

شرح
ue603
وارد كردن< SmartContract>از '@neo-one/smart-contract' ؛کلاس صادرات NEP17Contract SmartContract را گسترش می دهد< public readonly properties = < name: 'NEO•ONE NEP17 Example', groups: [], trusts: '*', permissions: [], >; public readonly name = 'NEO•ONE NEP17 Example'; public readonly decimals = 8; private readonly notifyTransfer = createEventNotifier>("انتقال" ، "از" ، "به" ، "مقدار" ،) ؛انتقال عمومی (از: آدرس ، به: آدرس ، مقدار: ثابت ، داده ها؟: هر): بولی< if (amount < 0) const fromBalance = this.balanceOf(from); if (fromBalance < amount) < retu false; >const Contract = Contract. for (به) ؛if (قرارداد! == تعریف نشده &&! آدرس. iscaller (به))< const smartContract = SmartContract.for(to); if (!smartContract.approveReceiveTransfer(from, amount, this.address)) < retu false; >>const tobalance = this. balanceof (to) ؛this. Balances. Set (از ، از تعادل - مقدار) ؛this. Balances. Set (به ، مقدار TOBALANCE +) ؛این. notifytransfer (از ، به ، مقدار) ؛if (قرارداد! == تعریف نشده)< const smartContract = SmartContract.for(to); smartContract.onNEP17Payable(from, amount, data); > retu true; > >
منابع نسخه
جاوا

جاوا
ue603
بسته io. neow3j. examples. contractdevelopment. contracts ؛واردات io. neow3j. devpack. stringliteralhelper. addressToscriptThash ؛وارد کردن io. neow3j. devpack.* manifestextra (key = "name" ، مقدار = "fungibletoken") manifestextra (key = "نویسنده" ، مقدار = "axlabs") supportedstandards ("nep-17") permission ("nep-17")قرارداد = "FFFDC93764DBADDDDDDDDDDDDDDDDD97C48F252A4A4643FAA3FD") // ContractManagement FungibleToken< static final Hash160 owner = addressToScriptHash("NM7Aky765FG8NhhwtxjXRx7jEL1cnw7PBP"); @DisplayName("Transfer") static Event3ArgsonTransfer; static final int initialSupply = 200_000_000; static final int decimals = 8; static final String assetPrefix = "asset"; static final String totalSupplyKey = "totalSupply"; static final StorageContext sc = Storage.getStorageContext(); static final StorageMap assetMap = sc.createMap(assetPrefix); public static String symbol() < retu "FGT"; >اعشار استاتیک عمومی ()< retu decimals; >استاتیک INT TOTALSUPPLY ()< retu getTotalSupply(); >static int getTotalSupply ()< retu Storage.getInteger(sc, totalSupplyKey); >انتقال بولی استاتیک عمومی (Hash160 از ، Hash160 به ، مقدار int ، داده [] داده ها) استثنا< if (!Hash160.isValid(from) || !Hash160.isValid(to)) < throw new Exception("From or To address is not a valid address."); >if (مقدار< 0) < throw new Exception("The transfer amount was negative."); >if (! runtime. checkwitness (از) && از! = runtime. getCallingScriptThash ())< throw new Exception("Invalid sender signature. The sender of the tokens needs to be " + "the signing account."); >if (getBalance (از)< amount) < retu false; >if (از! = به && مقدار! = 0)< deductFromBalance(from, amount); addToBalance(to, amount); >ontransfer. fire (از ، به ، مقدار) ؛if (contractmanagement. getContract (به)! = null)< Contract.call(to, "onNEP17Payment", CallFlags.All, data); >retu true; >تعادل عمومی استاتیک عمومی (حساب HASH160) استثنا را پرتاب می کند< if (!Hash160.isValid(account)) < throw new Exception("Argument is not a valid address."); >retu getBalance(account); >Endeployment Public Static Void Deploy (داده های شی ، بروزرسانی بولی) استثنا را پرتاب می کند< throwIfSignerIsNotOwner(); if (!update) < if (Storage.get(sc, totalSupplyKey) != null) < throw new Exception("Contract was already deployed."); >// Initialize supply Storage.put(sc, totalSupplyKey, initialSupply); // And allocate all tokens to the contract owner. assetMap.put(owner.toByteArray(), initialSupply); > >به روزرسانی خالی استاتیک عمومی (اسکریپت bytestring ، مانیفست رشته) استثنا را پرتاب می کند< throwIfSignerIsNotOwner(); if (script.length() == 0 && manifest.length() == 0) < throw new Exception("The new contract script and manifest must not be empty."); >ContractManagement.update(script, manifest); >تخریب استاتیک عمومی تخریب () استثنا را پرتاب می کند< throwIfSignerIsNotOwner(); ContractManagement.destroy(); >@onification عمومی استاتیک بولی تأیید می کند () استثنا را پرتاب می کند< throwIfSignerIsNotOwner(); retu true; >/*** آدرس صاحب قرارداد را دریافت می کند.* * retu آدرس صاحب قرارداد.*/ Public Static Hash160 ContractOwner ()< retu owner; >void static private throwifsignerisnotowner () استثنا را پرتاب می کند< if (!Runtime.checkWitness(owner)) < throw new Exception("The calling entity is not the owner of this contract."); >>addtobalance void static خصوصی (کلید HASH160 ، مقدار int)< assetMap.put(key.toByteArray(), getBalance(key) + value); >کسر درجه اعتبار ساقط استاتیک خصوصی (کلید HASH160 ، مقدار INT)< int oldValue = getBalance(key); if (oldValue == value) < assetMap.delete(key.toByteArray()); >دیگر< assetMap.put(key.toByteArray(), oldValue - value); >>استاتیک خصوصی int getBalance (کلید HASH160)< retu assetMap.getInteger(key.toByteArray()); >>
فارکس وکسب درامد...
ما را در سایت فارکس وکسب درامد دنبال می کنید
برچسب :
نویسنده : احمد قانع پور
بازدید : 36
تاريخ : شنبه
31 تير
1402 ساعت: 23:29