import { FileCreateTransaction, ContractCreateTransaction, ContractCallQuery, Hbar, ContractFunctionParameters, ContractDeleteTransaction, FileAppendTransaction, FileDeleteTransaction, MirrorNodeContractEstimateQuery, } from "../../src/exports.js"; import { wait } from "../../src/util.js"; import { REQUIRE_ARRAY_ERROR } from "../../src/util.js"; import IntegrationTestEnv from "./client/NodeIntegrationTestEnv.js"; import BigNumber from "bignumber.js"; import Long from "long"; const EXTREMUM = { MAX: "max", MIN: "min", }; const METHOD_TYPE = { INT: "int", UINT: "uint", }; const INPUT_TYPE = { NUMBER: "number", BIG_NUMBER: "BigNumber", LONG: "Long", }; /** * @param {number} bitSize * @param {string} inputType * @returns {{ min: number, max: number}} */ const calculateRange = (bitSize, inputType) => { // As of ECMA-262 5th Edition, "all the positive and // negative integers whose magnitude is no greater // than 2^53 are representable in the Number type", // which is "representing the doubleprecision 64-bit // format IEEE 754 values as specified in the IEEE Standard // for Binary Floating-Point Arithmetic". // The maximum safe integer in JavaScript is 2^53-1. const MAX_EXPONENT = 53; let exponent = bitSize - 1; if (inputType === INPUT_TYPE.NUMBER && bitSize > MAX_EXPONENT) { exponent = MAX_EXPONENT; } const extremum = 2 ** exponent; return { min: extremum, max: extremum - 1, }; }; /** * @param {number} bitSize * @param {string} inputType * @returns {number[]} */ const createArray = (bitSize, inputType) => { const { min, max } = calculateRange(bitSize, inputType); switch (inputType) { case INPUT_TYPE.NUMBER: return [-min, max]; case INPUT_TYPE.BIG_NUMBER: return [ new BigNumber(-2).pow(bitSize - 1), new BigNumber(2).pow(bitSize - 1).minus(1), ]; case INPUT_TYPE.LONG: return [new Long(min).neg(), new Long(max)]; default: return [-min, max]; } }; /** * @param {string} extremum * @param {number} bitSize * @param {string} inputType * @param {string} methodType * @returns {string} */ const getDescription = (extremum, bitSize, inputType, methodType) => { switch (extremum) { case EXTREMUM.MIN: return `should return the right min ${methodType}${bitSize} value [${inputType}]`; case EXTREMUM.MAX: return `should return the right max ${methodType}${bitSize} value [${inputType}]`; default: return "An error occured."; } }; /** * @param {number} bitSize * @param {string} inputType * @param {string} methodType * @returns {string} */ const getDescriptionForArrayMethod = (bitSize, inputType, methodType) => `should return the right array of ${methodType}${bitSize} values [${inputType}]`; let smartContractBytecode = "0x608060405234801561001057600080fd5b5061574c80620000216000396000f3fe608060405234801561001057600080fd5b50600436106107bc5760003560e01c8063897831d2116103f5578063c6c18a1c11610215578063e05e91e011610130578063ea5405b3116100c3578063f6e877f411610092578063f6e877f414611719578063f8293f6e1461173f578063f9e6743114611761578063faab75351461177c578063ffb805011461179757600080fd5b8063ea5405b3146116a7578063ef4a8c1b146116c2578063f4e490f5146116dd578063f53552ef146116fe57600080fd5b8063e4081890116100ff578063e408189014611633578063e436d3901461164e578063e4fadc1014611669578063e713cda81461168457600080fd5b8063e05e91e0146115a6578063e066de50146115cc578063e0f53e24146115f2578063e29dc38a1461161857600080fd5b8063d2e43ea2116101a8578063dade0c0b11610177578063dade0c0b14611513578063dbb04ed914611535578063de9fb4841461155e578063df8cfdbe1461158b57600080fd5b8063d2e43ea21461149c578063d32201bb146114b7578063d79d4d40146114d2578063d98dda69146114f857600080fd5b8063cbf2beee116101e4578063cbf2beee14611425578063cdb9e4e814611440578063ce1ccc7a14611466578063d037df461461148157600080fd5b8063c6c18a1c14611395578063c7d8b87e146113bf578063ca692370146113e5578063cbd2e6a51461140057600080fd5b8063aa450f1f11610310578063b989c7ee116102a3578063bd90536a11610272578063bd90536a146112fc578063c05cfd8e14611324578063c3d385b91461133f578063c4596b121461135a578063c503772d1461137557600080fd5b8063b989c7ee14611274578063ba945bdb14611295578063bb6b5243146112bb578063bbcb71ed146112e157600080fd5b8063b79ecc0c116102df578063b79ecc0c146111f7578063b82c0fce14611212578063b834bfe91461122d578063b8da8d161461124e57600080fd5b8063aa450f1f1461117a578063b0dfddc414611195578063b2db404a146111b0578063b4e3e7b1146111d157600080fd5b80639b1794ae11610388578063a1bda12211610357578063a1bda122146110f7578063a284da3114611118578063a401d60d14611133578063a75761f11461115957600080fd5b80639b1794ae1461107a5780639c5663c7146110a05780639d639bcc146110bb578063a08b9f67146110d657600080fd5b806394cd7c80116103c457806394cd7c8014611002578063956ce3d714611023578063967075e31461103e57806398508ba31461105957600080fd5b8063897831d214610f9057806389cd48ed14610fab5780638b61e01314610fc6578063923f5edf14610fe157600080fd5b80633f396e67116105e057806368ef4466116104fb578063779290b31161048e5780637fc360201161045d5780637fc3602014610ef85780638469c40614610f1357806387d062dc14610f2e578063881c8fb714610f4957806388b7e6f514610f6f57600080fd5b8063779290b314610e75578063796a27ea14610e905780637d0dc26214610eb65780637ec32d8414610ed757600080fd5b8063703bd050116104ca578063703bd05014610df857806370a5cb8114610e1357806372a06b4d14610e3957806375546bf214610e5a57600080fd5b806368ef446614610d8057806369993eff14610da15780636a54715c14610dbc5780636a842c3514610ddd57600080fd5b8063545e2113116105735780635e68a6a8116105425780635e68a6a814610d085780635f6a65e314610d23578063628bc3ef14610d3e57806364e008c114610d5f57600080fd5b8063545e211314610ca557806355bed93714610cd257806359adb2df14610a105780635b14551a14610ced57600080fd5b806344e7b037116105af57806344e7b03714610c2e57806347febd6614610c545780634d4ec9c814610c6f5780635154a08414610c8a57600080fd5b80633f396e6714610baf578063407b899b14610bd757806341b3ed9914610bf85780634384e5ee14610c1357600080fd5b8063189cea8e116106db57806333520ec31161066e5780633822abcb1161063d5780633822abcb14610b1c5780633b33ccd314610b375780633b45e6e014610b525780633e1a277114610b735780633ee0a4b514610b9457600080fd5b806333520ec314610ac557806335d794e7146108fa57806336e6630214610ae657806337ff875914610b0157600080fd5b80632ef16e8e116106aa5780632ef16e8e14610a475780632f47a40d14610a685780632f6c1bb414610a89578063324ff91e14610aaa57600080fd5b8063189cea8e146109d45780631e6dccfb146109f557806322937ea914610a105780632528956214610a2c57600080fd5b806310d5455311610753578063129ed5da11610722578063129ed5da1461095757806312cd95a11461097d57806313c5d0991461099e578063155464fa146109b957600080fd5b806310d54553146108d957806311259dcf146108fa578063118b84151461091557806311ec6c901461093657600080fd5b8063060e393a1161078f578063060e393a1461085157806306ac6fe11461086c57806308123e09146108925780630a958dc8146108b857600080fd5b8063017fa10b146107c1578063021d88ab146107ef5780630374543014610815578063048bf1fb14610836575b600080fd5b6107d26107cf36600461184b565b90565b6040516001600160801b0390911681526020015b60405180910390f35b6107fd6107cf366004611884565b6040516001600160601b0390911681526020016107e6565b6108236107cf3660046118b1565b604051600c9190910b81526020016107e6565b6108446107cf366004611947565b6040516107e691906119e3565b61085f6107cf366004611a41565b6040516107e69190611acd565b61087a6107cf366004611b25565b6040516001600160781b0390911681526020016107e6565b6108a06107cf366004611b57565b60405166ffffffffffffff90911681526020016107e6565b6108c66107cf366004611b84565b60405160049190910b81526020016107e6565b6108e76107cf366004611bb1565b60405160119190910b81526020016107e6565b6109086107cf366004611bcc565b6040516107e69190611c51565b6109236107cf366004611c9b565b604051601e9190910b81526020016107e6565b6109446107cf366004611cc8565b60405160139190910b81526020016107e6565b6109656107cf366004611cfa565b6040516001600160981b0390911681526020016107e6565b61098b6107cf366004611d27565b60405160129190910b81526020016107e6565b6109ac6107cf366004611d42565b6040516107e69190611dce565b6109c76107cf366004611e26565b6040516107e69190611eb2565b6109e26107cf366004611f05565b60405160169190910b81526020016107e6565b610a036107cf366004611f32565b6040516107e69190611fbe565b610a1e6107cf366004611ff9565b6040519081526020016107e6565b610a3a6107cf36600461202c565b6040516107e691906120b8565b610a556107cf36600461210e565b604051601d9190910b81526020016107e6565b610a766107cf36600461213b565b604051600a9190910b81526020016107e6565b610a976107cf366004612168565b60405160199190910b81526020016107e6565b610ab86107cf36600461219a565b6040516107e69190612226565b610ad36107cf366004612279565b604051601a9190910b81526020016107e6565b610af46107cf366004612294565b6040516107e69190612320565b610b0f6107cf366004612372565b6040516107e691906123fe565b610b2a6107cf366004612451565b6040516107e691906124dd565b610b456107cf36600461252a565b6040516107e691906125b6565b610b606107cf366004612603565b60405160109190910b81526020016107e6565b610b816107cf366004612630565b604051601c9190910b81526020016107e6565b610ba26107cf36600461265d565b6040516107e691906126e9565b610bbd6107cf36600461273d565b60405168ffffffffffffffffff90911681526020016107e6565b610be56107cf36600461276a565b60405160079190910b81526020016107e6565b610c066107cf36600461279c565b6040516107e69190612828565b610c216107cf366004612869565b6040516107e691906128f5565b610c3c6107cf366004612947565b6040516001600160a01b0390911681526020016107e6565b610c626107cf366004612962565b6040516107e691906129ee565b610c7d6107cf366004612a29565b6040516107e69190612ab5565b610c986107cf366004612b0d565b6040516107e69190612b99565b610cb8610cb3366004612bec565b6117bb565b60408051600093840b81529190920b6020820152016107e6565b610ce06107cf366004612c07565b6040516107e69190612c93565b610cfb6107cf366004612ceb565b6040516107e69190612d77565b610d166107cf366004612db8565b6040516107e69190612e44565b610d316107cf366004612e9a565b6040516107e69190612f26565b610d4c6107cf366004612f7d565b60405160099190910b81526020016107e6565b610d6d6107cf366004612faa565b60405160179190910b81526020016107e6565b610d8e6107cf366004612fc5565b60405160149190910b81526020016107e6565b610daf6107cf366004612fe0565b6040516107e6919061306c565b610dca6107cf3660046130a7565b60405160069190910b81526020016107e6565b610deb6107cf3660046130d4565b6040516107e69190613160565b610e066107cf3660046131ae565b6040516107e6919061323a565b610e216107cf36600461328c565b6040516001600160681b0390911681526020016107e6565b610e476107cf366004612bec565b60405160009190910b81526020016107e6565b610e686107cf3660046132b9565b6040516107e69190613345565b610e836107cf366004613397565b6040516107e69190613423565b610e9e6107cf366004613464565b6040516001600160d81b0390911681526020016107e6565b610ec46107cf366004613491565b604051601b9190910b81526020016107e6565b610ee56107cf3660046134be565b60405160029190910b81526020016107e6565b610f066107cf3660046134d9565b6040516107e69190613565565b610f216107cf3660046135a8565b6040516107e69190613634565b610f3c6107cf366004613675565b6040516107e69190613701565b610f576107cf366004613753565b6040516001600160b01b0390911681526020016107e6565b610f7d6107cf366004613780565b604051600f9190910b81526020016107e6565b610f9e6107cf3660046137b2565b6040516107e6919061383e565b610fb96107cf366004613896565b6040516107e69190613922565b610fd46107cf366004613963565b6040516107e691906139ef565b610fef6107cf366004613a3c565b60405160159190910b81526020016107e6565b6110106107cf366004613a57565b60405160189190910b81526020016107e6565b6110316107cf366004613a72565b6040516107e69190613afe565b61104c6107cf366004613b39565b6040516107e69190613bc5565b6110676107cf366004613c0d565b604051600d9190910b81526020016107e6565b6110886107cf366004613c28565b6040516001600160b81b0390911681526020016107e6565b6110ae6107cf366004613c55565b6040516107e69190613ce1565b6110c96107cf366004613d2f565b6040516107e69190613dbb565b6110e46107cf366004613df8565b604051600b9190910b81526020016107e6565b6111056107cf366004613e13565b60405160019190910b81526020016107e6565b6111266107cf366004613e2e565b6040516107e69190613eba565b6111416107cf366004613ef5565b6040516001600160f01b0390911681526020016107e6565b6111676107cf366004613f10565b60405161ffff90911681526020016107e6565b6111886107cf366004613f3f565b6040516107e69190613fcb565b6111a36107cf366004614009565b6040516107e69190614095565b6111be6107cf3660046140d0565b60405160059190910b81526020016107e6565b6111df6107cf3660046140eb565b6040516001600160701b0390911681526020016107e6565b6112056107cf36600461411d565b6040516107e691906141a9565b6112206107cf366004614200565b6040516107e6919061428c565b61123b6107cf3660046142cc565b604051600e9190910b81526020016107e6565b61125c6107cf3660046142fe565b6040516001600160a81b0390911681526020016107e6565b6112826107cf36600461432b565b60405160039190910b81526020016107e6565b6112a36107cf366004614346565b6040516001600160881b0390911681526020016107e6565b6112c96107cf366004614361565b6040516001600160c81b0390911681526020016107e6565b6112ef6107cf36600461437c565b6040516107e69190614408565b61130f61130a366004611ff9565b6117d3565b604080519283526020830191909152016107e6565b6113326107cf366004614449565b6040516107e691906144d5565b61134d6107cf366004614510565b6040516107e6919061459c565b6113686107cf3660046145d7565b6040516107e69190614663565b6113836107cf3660046146b5565b60405160ff90911681526020016107e6565b6113a36107cf3660046146d0565b6040516affffffffffffffffffffff90911681526020016107e6565b6113cd6107cf3660046146eb565b6040516001600160f81b0390911681526020016107e6565b6113f36107cf366004614706565b6040516107e69190614792565b61140e6107cf3660046147cd565b60405165ffffffffffff90911681526020016107e6565b6114336107cf3660046147e8565b6040516107e69190614874565b61144e6107cf3660046148b5565b6040516001600160e01b0390911681526020016107e6565b6114746107cf3660046148d0565b6040516107e6919061495c565b61148f6107cf3660046149ae565b6040516107e69190614a3a565b6114aa6107cf366004614a7b565b6040516107e69190614b07565b6114c56107cf366004614b54565b6040516107e69190614be0565b6114e06107cf366004614c32565b6040516001600160d01b0390911681526020016107e6565b6115066107cf366004614c4d565b6040516107e69190614cd9565b611526611521366004614d14565b6117e2565b6040516107e693929190614d2f565b6115436107cf366004614d9b565b60405169ffffffffffffffffffff90911681526020016107e6565b61157161156c366004611b84565b611820565b60408051600493840b81529190920b6020820152016107e6565b6115996107cf366004614db6565b6040516107e69190614e42565b6115b46107cf366004614e83565b6040516001600160401b0390911681526020016107e6565b6115da6107cf366004614e9e565b6040516001600160e81b0390911681526020016107e6565b6116006107cf366004614eb9565b6040516001600160c01b0390911681526020016107e6565b6116266107cf366004614ed4565b6040516107e69190614f60565b6116416107cf366004614f9b565b6040516107e69190615027565b61165c6107cf366004615068565b6040516107e691906150f4565b6116776107cf36600461512f565b6040516107e691906151bb565b6116926107cf366004614d14565b60405163ffffffff90911681526020016107e6565b6116b56107cf36600461520b565b6040516107e69190615297565b6116d06107cf3660046152d6565b6040516107e69190615362565b6116eb6107cf3660046153a3565b60405160089190910b81526020016107e6565b61170c6107cf3660046153be565b6040516107e6919061544a565b6117276107cf366004615485565b6040516001600160901b0390911681526020016107e6565b61174d6107cf3660046154a0565b60405162ffffff90911681526020016107e6565b61176f6107cf3660046154bb565b6040516107e69190615547565b61178a6107cf366004615582565b6040516107e6919061560e565b6117a56107cf366004615649565b60405164ffffffffff90911681526020016107e6565b600080826117ca81601461567a565b91509150915091565b600080826117ca8160016156a1565b6000806060836117f36001826156c9565b6040805180820190915260028152614f4b60f01b602082015291945063ffffffff16925090509193909250565b600080826117ca8160016156ed565b80356001600160801b038116811461184657600080fd5b919050565b60006020828403121561185d57600080fd5b6118668261182f565b9392505050565b80356001600160601b038116811461184657600080fd5b60006020828403121561189657600080fd5b6118668261186d565b8035600c81900b811461184657600080fd5b6000602082840312156118c357600080fd5b6118668261189f565b634e487b7160e01b600052604160045260246000fd5b604051601f8201601f191681016001600160401b038111828210171561190a5761190a6118cc565b604052919050565b60006001600160401b0382111561192b5761192b6118cc565b5060051b60200190565b8035601481900b811461184657600080fd5b6000602080838503121561195a57600080fd5b82356001600160401b0381111561197057600080fd5b8301601f8101851361198157600080fd5b803561199461198f82611912565b6118e2565b81815260059190911b820183019083810190878311156119b357600080fd5b928401925b828410156119d8576119c984611935565b825292840192908401906119b8565b979650505050505050565b6020808252825182820181905260009190848201906040850190845b81811015611a1e57835160140b835292840192918401916001016119ff565b50909695505050505050565b80356001600160e81b038116811461184657600080fd5b60006020808385031215611a5457600080fd5b82356001600160401b03811115611a6a57600080fd5b8301601f81018513611a7b57600080fd5b8035611a8961198f82611912565b81815260059190911b82018301908381019087831115611aa857600080fd5b928401925b828410156119d857611abe84611a2a565b82529284019290840190611aad565b6020808252825182820181905260009190848201906040850190845b81811015611a1e5783516001600160e81b031683529284019291840191600101611ae9565b80356001600160781b038116811461184657600080fd5b600060208284031215611b3757600080fd5b61186682611b0e565b803566ffffffffffffff8116811461184657600080fd5b600060208284031215611b6957600080fd5b61186682611b40565b8035600481900b811461184657600080fd5b600060208284031215611b9657600080fd5b61186682611b72565b8035601181900b811461184657600080fd5b600060208284031215611bc357600080fd5b61186682611b9f565b60006020808385031215611bdf57600080fd5b82356001600160401b03811115611bf557600080fd5b8301601f81018513611c0657600080fd5b8035611c1461198f82611912565b81815260059190911b82018301908381019087831115611c3357600080fd5b928401925b828410156119d857833582529284019290840190611c38565b6020808252825182820181905260009190848201906040850190845b81811015611a1e57835183529284019291840191600101611c6d565b8035601e81900b811461184657600080fd5b600060208284031215611cad57600080fd5b61186682611c89565b8035601381900b811461184657600080fd5b600060208284031215611cda57600080fd5b61186682611cb6565b80356001600160981b038116811461184657600080fd5b600060208284031215611d0c57600080fd5b61186682611ce3565b8035601281900b811461184657600080fd5b600060208284031215611d3957600080fd5b61186682611d15565b60006020808385031215611d5557600080fd5b82356001600160401b03811115611d6b57600080fd5b8301601f81018513611d7c57600080fd5b8035611d8a61198f82611912565b81815260059190911b82018301908381019087831115611da957600080fd5b928401925b828410156119d857611dbf84611b40565b82529284019290840190611dae565b6020808252825182820181905260009190848201906040850190845b81811015611a1e57835166ffffffffffffff1683529284019291840191600101611dea565b80356001600160c01b038116811461184657600080fd5b60006020808385031215611e3957600080fd5b82356001600160401b03811115611e4f57600080fd5b8301601f81018513611e6057600080fd5b8035611e6e61198f82611912565b81815260059190911b82018301908381019087831115611e8d57600080fd5b928401925b828410156119d857611ea384611e0f565b82529284019290840190611e92565b6020808252825182820181905260009190848201906040850190845b81811015611a1e5783516001600160c01b031683529284019291840191600101611ece565b8035601681900b811461184657600080fd5b600060208284031215611f1757600080fd5b61186682611ef3565b8035600581900b811461184657600080fd5b60006020808385031215611f4557600080fd5b82356001600160401b03811115611f5b57600080fd5b8301601f81018513611f6c57600080fd5b8035611f7a61198f82611912565b81815260059190911b82018301908381019087831115611f9957600080fd5b928401925b828410156119d857611faf84611f20565b82529284019290840190611f9e565b6020808252825182820181905260009190848201906040850190845b81811015611a1e57835160050b83529284019291840191600101611fda565b60006020828403121561200b57600080fd5b5035919050565b803569ffffffffffffffffffff8116811461184657600080fd5b6000602080838503121561203f57600080fd5b82356001600160401b0381111561205557600080fd5b8301601f8101851361206657600080fd5b803561207461198f82611912565b81815260059190911b8201830190838101908783111561209357600080fd5b928401925b828410156119d8576120a984612012565b82529284019290840190612098565b6020808252825182820181905260009190848201906040850190845b81811015611a1e57835169ffffffffffffffffffff16835292840192918401916001016120d4565b8035601d81900b811461184657600080fd5b60006020828403121561212057600080fd5b611866826120fc565b8035600a81900b811461184657600080fd5b60006020828403121561214d57600080fd5b61186682612129565b8035601981900b811461184657600080fd5b60006020828403121561217a57600080fd5b61186682612156565b80356001600160b81b038116811461184657600080fd5b600060208083850312156121ad57600080fd5b82356001600160401b038111156121c357600080fd5b8301601f810185136121d457600080fd5b80356121e261198f82611912565b81815260059190911b8201830190838101908783111561220157600080fd5b928401925b828410156119d85761221784612183565b82529284019290840190612206565b6020808252825182820181905260009190848201906040850190845b81811015611a1e5783516001600160b81b031683529284019291840191600101612242565b8035601a81900b811461184657600080fd5b60006020828403121561228b57600080fd5b61186682612267565b600060208083850312156122a757600080fd5b82356001600160401b038111156122bd57600080fd5b8301601f810185136122ce57600080fd5b80356122dc61198f82611912565b81815260059190911b820183019083810190878311156122fb57600080fd5b928401925b828410156119d85761231184611cb6565b82529284019290840190612300565b6020808252825182820181905260009190848201906040850190845b81811015611a1e57835160130b8352928401929184019160010161233c565b80356001600160f01b038116811461184657600080fd5b6000602080838503121561238557600080fd5b82356001600160401b0381111561239b57600080fd5b8301601f810185136123ac57600080fd5b80356123ba61198f82611912565b81815260059190911b820183019083810190878311156123d957600080fd5b928401925b828410156119d8576123ef8461235b565b825292840192908401906123de565b6020808252825182820181905260009190848201906040850190845b81811015611a1e5783516001600160f01b03168352928401929184019160010161241a565b8035600681900b811461184657600080fd5b6000602080838503121561246457600080fd5b82356001600160401b0381111561247a57600080fd5b8301601f8101851361248b57600080fd5b803561249961198f82611912565b81815260059190911b820183019083810190878311156124b857600080fd5b928401925b828410156119d8576124ce8461243f565b825292840192908401906124bd565b6020808252825182820181905260009190848201906040850190845b81811015611a1e57835160060b835292840192918401916001016124f9565b8035600181900b811461184657600080fd5b6000602080838503121561253d57600080fd5b82356001600160401b0381111561255357600080fd5b8301601f8101851361256457600080fd5b803561257261198f82611912565b81815260059190911b8201830190838101908783111561259157600080fd5b928401925b828410156119d8576125a784612518565b82529284019290840190612596565b6020808252825182820181905260009190848201906040850190845b81811015611a1e578351600190810b84529385019392850192016125d2565b8035601081900b811461184657600080fd5b60006020828403121561261557600080fd5b611866826125f1565b8035601c81900b811461184657600080fd5b60006020828403121561264257600080fd5b6118668261261e565b8035600b81900b811461184657600080fd5b6000602080838503121561267057600080fd5b82356001600160401b0381111561268657600080fd5b8301601f8101851361269757600080fd5b80356126a561198f82611912565b81815260059190911b820183019083810190878311156126c457600080fd5b928401925b828410156119d8576126da8461264b565b825292840192908401906126c9565b6020808252825182820181905260009190848201906040850190845b81811015611a1e578351600b0b83529284019291840191600101612705565b803568ffffffffffffffffff8116811461184657600080fd5b60006020828403121561274f57600080fd5b61186682612724565b8035600781900b811461184657600080fd5b60006020828403121561277c57600080fd5b61186682612758565b80356001600160d81b038116811461184657600080fd5b600060208083850312156127af57600080fd5b82356001600160401b038111156127c557600080fd5b8301601f810185136127d657600080fd5b80356127e461198f82611912565b81815260059190911b8201830190838101908783111561280357600080fd5b928401925b828410156119d85761281984612785565b82529284019290840190612808565b6020808252825182820181905260009190848201906040850190845b81811015611a1e5783516001600160d81b031683529284019291840191600101612844565b6000602080838503121561287c57600080fd5b82356001600160401b0381111561289257600080fd5b8301601f810185136128a357600080fd5b80356128b161198f82611912565b81815260059190911b820183019083810190878311156128d057600080fd5b928401925b828410156119d8576128e684611b9f565b825292840192908401906128d5565b6020808252825182820181905260009190848201906040850190845b81811015611a1e57835160110b83529284019291840191600101612911565b80356001600160a01b038116811461184657600080fd5b60006020828403121561295957600080fd5b61186682612930565b6000602080838503121561297557600080fd5b82356001600160401b0381111561298b57600080fd5b8301601f8101851361299c57600080fd5b80356129aa61198f82611912565b81815260059190911b820183019083810190878311156129c957600080fd5b928401925b828410156119d8576129df8461189f565b825292840192908401906129ce565b6020808252825182820181905260009190848201906040850190845b81811015611a1e578351600c0b83529284019291840191600101612a0a565b60006020808385031215612a3c57600080fd5b82356001600160401b03811115612a5257600080fd5b8301601f81018513612a6357600080fd5b8035612a7161198f82611912565b81815260059190911b82018301908381019087831115612a9057600080fd5b928401925b828410156119d857612aa68461186d565b82529284019290840190612a95565b6020808252825182820181905260009190848201906040850190845b81811015611a1e5783516001600160601b031683529284019291840191600101612ad1565b80356001600160e01b038116811461184657600080fd5b60006020808385031215612b2057600080fd5b82356001600160401b03811115612b3657600080fd5b8301601f81018513612b4757600080fd5b8035612b5561198f82611912565b81815260059190911b82018301908381019087831115612b7457600080fd5b928401925b828410156119d857612b8a84612af6565b82529284019290840190612b79565b6020808252825182820181905260009190848201906040850190845b81811015611a1e5783516001600160e01b031683529284019291840191600101612bb5565b8035600081900b811461184657600080fd5b600060208284031215612bfe57600080fd5b61186682612bda565b60006020808385031215612c1a57600080fd5b82356001600160401b03811115612c3057600080fd5b8301601f81018513612c4157600080fd5b8035612c4f61198f82611912565b81815260059190911b82018301908381019087831115612c6e57600080fd5b928401925b828410156119d857612c8484611b0e565b82529284019290840190612c73565b6020808252825182820181905260009190848201906040850190845b81811015611a1e5783516001600160781b031683529284019291840191600101612caf565b80356001600160c81b038116811461184657600080fd5b60006020808385031215612cfe57600080fd5b82356001600160401b03811115612d1457600080fd5b8301601f81018513612d2557600080fd5b8035612d3361198f82611912565b81815260059190911b82018301908381019087831115612d5257600080fd5b928401925b828410156119d857612d6884612cd4565b82529284019290840190612d57565b6020808252825182820181905260009190848201906040850190845b81811015611a1e5783516001600160c81b031683529284019291840191600101612d93565b60006020808385031215612dcb57600080fd5b82356001600160401b03811115612de157600080fd5b8301601f81018513612df257600080fd5b8035612e0061198f82611912565b81815260059190911b82018301908381019087831115612e1f57600080fd5b928401925b828410156119d857612e35846125f1565b82529284019290840190612e24565b6020808252825182820181905260009190848201906040850190845b81811015611a1e57835160100b83529284019291840191600101612e60565b80356affffffffffffffffffffff8116811461184657600080fd5b60006020808385031215612ead57600080fd5b82356001600160401b03811115612ec357600080fd5b8301601f81018513612ed457600080fd5b8035612ee261198f82611912565b81815260059190911b82018301908381019087831115612f0157600080fd5b928401925b828410156119d857612f1784612e7f565b82529284019290840190612f06565b6020808252825182820181905260009190848201906040850190845b81811015611a1e5783516affffffffffffffffffffff1683529284019291840191600101612f42565b8035600981900b811461184657600080fd5b600060208284031215612f8f57600080fd5b61186682612f6b565b8035601781900b811461184657600080fd5b600060208284031215612fbc57600080fd5b61186682612f98565b600060208284031215612fd757600080fd5b61186682611935565b60006020808385031215612ff357600080fd5b82356001600160401b0381111561300957600080fd5b8301601f8101851361301a57600080fd5b803561302861198f82611912565b81815260059190911b8201830190838101908783111561304757600080fd5b928401925b828410156119d85761305d84612f98565b8252928401929084019061304c565b6020808252825182820181905260009190848201906040850190845b81811015611a1e57835160170b83529284019291840191600101613088565b6000602082840312156130b957600080fd5b6118668261243f565b803561ffff8116811461184657600080fd5b600060208083850312156130e757600080fd5b82356001600160401b038111156130fd57600080fd5b8301601f8101851361310e57600080fd5b803561311c61198f82611912565b81815260059190911b8201830190838101908783111561313b57600080fd5b928401925b828410156119d857613151846130c2565b82529284019290840190613140565b6020808252825182820181905260009190848201906040850190845b81811015611a1e57835161ffff168352928401929184019160010161317c565b8035600d81900b811461184657600080fd5b600060208083850312156131c157600080fd5b82356001600160401b038111156131d757600080fd5b8301601f810185136131e857600080fd5b80356131f661198f82611912565b81815260059190911b8201830190838101908783111561321557600080fd5b928401925b828410156119d85761322b8461319c565b8252928401929084019061321a565b6020808252825182820181905260009190848201906040850190845b81811015611a1e578351600d0b83529284019291840191600101613256565b80356001600160681b038116811461184657600080fd5b60006020828403121561329e57600080fd5b61186682613275565b8035601881900b811461184657600080fd5b600060208083850312156132cc57600080fd5b82356001600160401b038111156132e257600080fd5b8301601f810185136132f357600080fd5b803561330161198f82611912565b81815260059190911b8201830190838101908783111561332057600080fd5b928401925b828410156119d857613336846132a7565b82529284019290840190613325565b6020808252825182820181905260009190848201906040850190845b81811015611a1e57835160180b83529284019291840191600101613361565b80356001600160701b038116811461184657600080fd5b600060208083850312156133aa57600080fd5b82356001600160401b038111156133c057600080fd5b8301601f810185136133d157600080fd5b80356133df61198f82611912565b81815260059190911b820183019083810190878311156133fe57600080fd5b928401925b828410156119d85761341484613380565b82529284019290840190613403565b6020808252825182820181905260009190848201906040850190845b81811015611a1e5783516001600160701b03168352928401929184019160010161343f565b60006020828403121561347657600080fd5b61186682612785565b8035601b81900b811461184657600080fd5b6000602082840312156134a357600080fd5b6118668261347f565b8035600281900b811461184657600080fd5b6000602082840312156134d057600080fd5b611866826134ac565b600060208083850312156134ec57600080fd5b82356001600160401b0381111561350257600080fd5b8301601f8101851361351357600080fd5b803561352161198f82611912565b81815260059190911b8201830190838101908783111561354057600080fd5b928401925b828410156119d85761355684612724565b82529284019290840190613545565b6020808252825182820181905260009190848201906040850190845b81811015611a1e57835168ffffffffffffffffff1683529284019291840191600101613581565b600060208083850312156135bb57600080fd5b82356001600160401b038111156135d157600080fd5b8301601f810185136135e257600080fd5b80356135f061198f82611912565b81815260059190911b8201830190838101908783111561360f57600080fd5b928401925b828410156119d85761362584613275565b82529284019290840190613614565b6020808252825182820181905260009190848201906040850190845b81811015611a1e5783516001600160681b031683529284019291840191600101613650565b6000602080838503121561368857600080fd5b82356001600160401b0381111561369e57600080fd5b8301601f810185136136af57600080fd5b80356136bd61198f82611912565b81815260059190911b820183019083810190878311156136dc57600080fd5b928401925b828410156119d8576136f2846120fc565b825292840192908401906136e1565b6020808252825182820181905260009190848201906040850190845b81811015611a1e578351601d0b8352928401929184019160010161371d565b80356001600160b01b038116811461184657600080fd5b60006020828403121561376557600080fd5b6118668261373c565b8035600f81900b811461184657600080fd5b60006020828403121561379257600080fd5b6118668261376e565b80356001600160881b038116811461184657600080fd5b600060208083850312156137c557600080fd5b82356001600160401b038111156137db57600080fd5b8301601f810185136137ec57600080fd5b80356137fa61198f82611912565b81815260059190911b8201830190838101908783111561381957600080fd5b928401925b828410156119d85761382f8461379b565b8252928401929084019061381e565b6020808252825182820181905260009190848201906040850190845b81811015611a1e5783516001600160881b03168352928401929184019160010161385a565b80356001600160f81b038116811461184657600080fd5b600060208083850312156138a957600080fd5b82356001600160401b038111156138bf57600080fd5b8301601f810185136138d057600080fd5b80356138de61198f82611912565b81815260059190911b820183019083810190878311156138fd57600080fd5b928401925b828410156119d8576139138461387f565b82529284019290840190613902565b6020808252825182820181905260009190848201906040850190845b81811015611a1e5783516001600160f81b03168352928401929184019160010161393e565b6000602080838503121561397657600080fd5b82356001600160401b0381111561398c57600080fd5b8301601f8101851361399d57600080fd5b80356139ab61198f82611912565b81815260059190911b820183019083810190878311156139ca57600080fd5b928401925b828410156119d8576139e084611d15565b825292840192908401906139cf565b6020808252825182820181905260009190848201906040850190845b81811015611a1e57835160120b83529284019291840191600101613a0b565b8035601581900b811461184657600080fd5b600060208284031215613a4e57600080fd5b61186682613a2a565b600060208284031215613a6957600080fd5b611866826132a7565b60006020808385031215613a8557600080fd5b82356001600160401b03811115613a9b57600080fd5b8301601f81018513613aac57600080fd5b8035613aba61198f82611912565b81815260059190911b82018301908381019087831115613ad957600080fd5b928401925b828410156119d857613aef8461261e565b82529284019290840190613ade565b6020808252825182820181905260009190848201906040850190845b81811015611a1e578351601c0b83529284019291840191600101613b1a565b60006020808385031215613b4c57600080fd5b82356001600160401b03811115613b6257600080fd5b8301601f81018513613b7357600080fd5b8035613b8161198f82611912565b81815260059190911b82018301908381019087831115613ba057600080fd5b928401925b828410156119d857613bb684612bda565b82529284019290840190613ba5565b602080825282518282018190526000919084820190604085019084805b82811015613c00578451820b84529385019392850192600101613be2565b5091979650505050505050565b600060208284031215613c1f57600080fd5b6118668261319c565b600060208284031215613c3a57600080fd5b61186682612183565b8035600e81900b811461184657600080fd5b60006020808385031215613c6857600080fd5b82356001600160401b03811115613c7e57600080fd5b8301601f81018513613c8f57600080fd5b8035613c9d61198f82611912565b81815260059190911b82018301908381019087831115613cbc57600080fd5b928401925b828410156119d857613cd284613c43565b82529284019290840190613cc1565b6020808252825182820181905260009190848201906040850190845b81811015611a1e578351600e0b83529284019291840191600101613cfd565b803562ffffff8116811461184657600080fd5b60006020808385031215613d4257600080fd5b82356001600160401b03811115613d5857600080fd5b8301601f81018513613d6957600080fd5b8035613d7761198f82611912565b81815260059190911b82018301908381019087831115613d9657600080fd5b928401925b828410156119d857613dac84613d1c565b82529284019290840190613d9b565b6020808252825182820181905260009190848201906040850190845b81811015611a1e57835162ffffff1683529284019291840191600101613dd7565b600060208284031215613e0a57600080fd5b6118668261264b565b600060208284031215613e2557600080fd5b61186682612518565b60006020808385031215613e4157600080fd5b82356001600160401b03811115613e5757600080fd5b8301601f81018513613e6857600080fd5b8035613e7661198f82611912565b81815260059190911b82018301908381019087831115613e9557600080fd5b928401925b828410156119d857613eab84611c89565b82529284019290840190613e9a565b6020808252825182820181905260009190848201906040850190845b81811015611a1e578351601e0b83529284019291840191600101613ed6565b600060208284031215613f0757600080fd5b6118668261235b565b600060208284031215613f2257600080fd5b611866826130c2565b803563ffffffff8116811461184657600080fd5b60006020808385031215613f5257600080fd5b82356001600160401b03811115613f6857600080fd5b8301601f81018513613f7957600080fd5b8035613f8761198f82611912565b81815260059190911b82018301908381019087831115613fa657600080fd5b928401925b828410156119d857613fbc84613f2b565b82529284019290840190613fab565b6020808252825182820181905260009190848201906040850190845b81811015611a1e57835163ffffffff1683529284019291840191600101613fe7565b6000602080838503121561401c57600080fd5b82356001600160401b0381111561403257600080fd5b8301601f8101851361404357600080fd5b803561405161198f82611912565b81815260059190911b8201830190838101908783111561407057600080fd5b928401925b828410156119d85761408684611b72565b82529284019290840190614075565b6020808252825182820181905260009190848201906040850190845b81811015611a1e57835160040b835292840192918401916001016140b1565b6000602082840312156140e257600080fd5b61186682611f20565b6000602082840312156140fd57600080fd5b61186682613380565b80356001600160401b038116811461184657600080fd5b6000602080838503121561413057600080fd5b82356001600160401b0381111561414657600080fd5b8301601f8101851361415757600080fd5b803561416561198f82611912565b81815260059190911b8201830190838101908783111561418457600080fd5b928401925b828410156119d85761419a84614106565b82529284019290840190614189565b6020808252825182820181905260009190848201906040850190845b81811015611a1e5783516001600160401b0316835292840192918401916001016141c5565b803565ffffffffffff8116811461184657600080fd5b6000602080838503121561421357600080fd5b82356001600160401b0381111561422957600080fd5b8301601f8101851361423a57600080fd5b803561424861198f82611912565b81815260059190911b8201830190838101908783111561426757600080fd5b928401925b828410156119d85761427d846141ea565b8252928401929084019061426c565b6020808252825182820181905260009190848201906040850190845b81811015611a1e57835165ffffffffffff16835292840192918401916001016142a8565b6000602082840312156142de57600080fd5b61186682613c43565b80356001600160a81b038116811461184657600080fd5b60006020828403121561431057600080fd5b611866826142e7565b8035600381900b811461184657600080fd5b60006020828403121561433d57600080fd5b61186682614319565b60006020828403121561435857600080fd5b6118668261379b565b60006020828403121561437357600080fd5b61186682612cd4565b6000602080838503121561438f57600080fd5b82356001600160401b038111156143a557600080fd5b8301601f810185136143b657600080fd5b80356143c461198f82611912565b81815260059190911b820183019083810190878311156143e357600080fd5b928401925b828410156119d8576143f98461182f565b825292840192908401906143e8565b6020808252825182820181905260009190848201906040850190845b81811015611a1e5783516001600160801b031683529284019291840191600101614424565b6000602080838503121561445c57600080fd5b82356001600160401b0381111561447257600080fd5b8301601f8101851361448357600080fd5b803561449161198f82611912565b81815260059190911b820183019083810190878311156144b057600080fd5b928401925b828410156119d8576144c68461376e565b825292840192908401906144b5565b6020808252825182820181905260009190848201906040850190845b81811015611a1e578351600f0b835292840192918401916001016144f1565b6000602080838503121561452357600080fd5b82356001600160401b0381111561453957600080fd5b8301601f8101851361454a57600080fd5b803561455861198f82611912565b81815260059190911b8201830190838101908783111561457757600080fd5b928401925b828410156119d85761458d84612f6b565b8252928401929084019061457c565b6020808252825182820181905260009190848201906040850190845b81811015611a1e57835160090b835292840192918401916001016145b8565b600060208083850312156145ea57600080fd5b82356001600160401b0381111561460057600080fd5b8301601f8101851361461157600080fd5b803561461f61198f82611912565b81815260059190911b8201830190838101908783111561463e57600080fd5b928401925b828410156119d85761465484611ce3565b82529284019290840190614643565b6020808252825182820181905260009190848201906040850190845b81811015611a1e5783516001600160981b03168352928401929184019160010161467f565b803560ff8116811461184657600080fd5b6000602082840312156146c757600080fd5b611866826146a4565b6000602082840312156146e257600080fd5b61186682612e7f565b6000602082840312156146fd57600080fd5b6118668261387f565b6000602080838503121561471957600080fd5b82356001600160401b0381111561472f57600080fd5b8301601f8101851361474057600080fd5b803561474e61198f82611912565b81815260059190911b8201830190838101908783111561476d57600080fd5b928401925b828410156119d85761478384611ef3565b82529284019290840190614772565b6020808252825182820181905260009190848201906040850190845b81811015611a1e57835160160b835292840192918401916001016147ae565b6000602082840312156147df57600080fd5b611866826141ea565b600060208083850312156147fb57600080fd5b82356001600160401b0381111561481157600080fd5b8301601f8101851361482257600080fd5b803561483061198f82611912565b81815260059190911b8201830190838101908783111561484f57600080fd5b928401925b828410156119d8576148658461373c565b82529284019290840190614854565b6020808252825182820181905260009190848201906040850190845b81811015611a1e5783516001600160b01b031683529284019291840191600101614890565b6000602082840312156148c757600080fd5b61186682612af6565b600060208083850312156148e357600080fd5b82356001600160401b038111156148f957600080fd5b8301601f8101851361490a57600080fd5b803561491861198f82611912565b81815260059190911b8201830190838101908783111561493757600080fd5b928401925b828410156119d85761494d84614319565b8252928401929084019061493c565b6020808252825182820181905260009190848201906040850190845b81811015611a1e57835160030b83529284019291840191600101614978565b80356001600160901b038116811461184657600080fd5b600060208083850312156149c157600080fd5b82356001600160401b038111156149d757600080fd5b8301601f810185136149e857600080fd5b80356149f661198f82611912565b81815260059190911b82018301908381019087831115614a1557600080fd5b928401925b828410156119d857614a2b84614997565b82529284019290840190614a1a565b6020808252825182820181905260009190848201906040850190845b81811015611a1e5783516001600160901b031683529284019291840191600101614a56565b60006020808385031215614a8e57600080fd5b82356001600160401b03811115614aa457600080fd5b8301601f81018513614ab557600080fd5b8035614ac361198f82611912565b81815260059190911b82018301908381019087831115614ae257600080fd5b928401925b828410156119d857614af884612129565b82529284019290840190614ae7565b6020808252825182820181905260009190848201906040850190845b81811015611a1e578351600a0b83529284019291840191600101614b23565b8035600881900b811461184657600080fd5b60006020808385031215614b6757600080fd5b82356001600160401b03811115614b7d57600080fd5b8301601f81018513614b8e57600080fd5b8035614b9c61198f82611912565b81815260059190911b82018301908381019087831115614bbb57600080fd5b928401925b828410156119d857614bd184614b42565b82529284019290840190614bc0565b6020808252825182820181905260009190848201906040850190845b81811015611a1e57835160080b83529284019291840191600101614bfc565b80356001600160d01b038116811461184657600080fd5b600060208284031215614c4457600080fd5b61186682614c1b565b60006020808385031215614c6057600080fd5b82356001600160401b03811115614c7657600080fd5b8301601f81018513614c8757600080fd5b8035614c9561198f82611912565b81815260059190911b82018301908381019087831115614cb457600080fd5b928401925b828410156119d857614cca84612267565b82529284019290840190614cb9565b6020808252825182820181905260009190848201906040850190845b81811015611a1e578351601a0b83529284019291840191600101614cf5565b600060208284031215614d2657600080fd5b61186682613f2b565b63ffffffff84168152600060206001600160401b0385168184015260606040840152835180606085015260005b81811015614d7857858101830151858201608001528201614d5c565b506000608082860101526080601f19601f83011685010192505050949350505050565b600060208284031215614dad57600080fd5b61186682612012565b60006020808385031215614dc957600080fd5b82356001600160401b03811115614ddf57600080fd5b8301601f81018513614df057600080fd5b8035614dfe61198f82611912565b81815260059190911b82018301908381019087831115614e1d57600080fd5b928401925b828410156119d857614e3384612930565b82529284019290840190614e22565b6020808252825182820181905260009190848201906040850190845b81811015611a1e5783516001600160a01b031683529284019291840191600101614e5e565b600060208284031215614e9557600080fd5b61186682614106565b600060208284031215614eb057600080fd5b61186682611a2a565b600060208284031215614ecb57600080fd5b61186682611e0f565b60006020808385031215614ee757600080fd5b82356001600160401b03811115614efd57600080fd5b8301601f81018513614f0e57600080fd5b8035614f1c61198f82611912565b81815260059190911b82018301908381019087831115614f3b57600080fd5b928401925b828410156119d857614f5184612758565b82529284019290840190614f40565b6020808252825182820181905260009190848201906040850190845b81811015611a1e57835160070b83529284019291840191600101614f7c565b60006020808385031215614fae57600080fd5b82356001600160401b03811115614fc457600080fd5b8301601f81018513614fd557600080fd5b8035614fe361198f82611912565b81815260059190911b8201830190838101908783111561500257600080fd5b928401925b828410156119d857615018846142e7565b82529284019290840190615007565b6020808252825182820181905260009190848201906040850190845b81811015611a1e5783516001600160a81b031683529284019291840191600101615043565b6000602080838503121561507b57600080fd5b82356001600160401b0381111561509157600080fd5b8301601f810185136150a257600080fd5b80356150b061198f82611912565b81815260059190911b820183019083810190878311156150cf57600080fd5b928401925b828410156119d8576150e584613a2a565b825292840192908401906150d4565b6020808252825182820181905260009190848201906040850190845b81811015611a1e57835160150b83529284019291840191600101615110565b6000602080838503121561514257600080fd5b82356001600160401b0381111561515857600080fd5b8301601f8101851361516957600080fd5b803561517761198f82611912565b81815260059190911b8201830190838101908783111561519657600080fd5b928401925b828410156119d8576151ac846134ac565b8252928401929084019061519b565b6020808252825182820181905260009190848201906040850190845b81811015611a1e57835160020b835292840192918401916001016151d7565b803564ffffffffff8116811461184657600080fd5b6000602080838503121561521e57600080fd5b82356001600160401b0381111561523457600080fd5b8301601f8101851361524557600080fd5b803561525361198f82611912565b81815260059190911b8201830190838101908783111561527257600080fd5b928401925b828410156119d857615288846151f6565b82529284019290840190615277565b6020808252825182820181905260009190848201906040850190845b81811015611a1e57835164ffffffffff16835292840192918401916001016152b3565b600060208083850312156152e957600080fd5b82356001600160401b038111156152ff57600080fd5b8301601f8101851361531057600080fd5b803561531e61198f82611912565b81815260059190911b8201830190838101908783111561533d57600080fd5b928401925b828410156119d85761535384614c1b565b82529284019290840190615342565b6020808252825182820181905260009190848201906040850190845b81811015611a1e5783516001600160d01b03168352928401929184019160010161537e565b6000602082840312156153b557600080fd5b61186682614b42565b600060208083850312156153d157600080fd5b82356001600160401b038111156153e757600080fd5b8301601f810185136153f857600080fd5b803561540661198f82611912565b81815260059190911b8201830190838101908783111561542557600080fd5b928401925b828410156119d85761543b84612156565b8252928401929084019061542a565b6020808252825182820181905260009190848201906040850190845b81811015611a1e57835160190b83529284019291840191600101615466565b60006020828403121561549757600080fd5b61186682614997565b6000602082840312156154b257600080fd5b61186682613d1c565b600060208083850312156154ce57600080fd5b82356001600160401b038111156154e457600080fd5b8301601f810185136154f557600080fd5b803561550361198f82611912565b81815260059190911b8201830190838101908783111561552257600080fd5b928401925b828410156119d857615538846146a4565b82529284019290840190615527565b6020808252825182820181905260009190848201906040850190845b81811015611a1e57835160ff1683529284019291840191600101615563565b6000602080838503121561559557600080fd5b82356001600160401b038111156155ab57600080fd5b8301601f810185136155bc57600080fd5b80356155ca61198f82611912565b81815260059190911b820183019083810190878311156155e957600080fd5b928401925b828410156119d8576155ff8461347f565b825292840192908401906155ee565b6020808252825182820181905260009190848201906040850190845b81811015611a1e578351601b0b8352928401929184019160010161562a565b60006020828403121561565b57600080fd5b611866826151f6565b634e487b7160e01b600052601160045260246000fd5b600081810b9083900b01607f8113607f198212171561569b5761569b615664565b92915050565b80820182811260008312801582168215821617156156c1576156c1615664565b505092915050565b63ffffffff8281168282160390808211156156e6576156e6615664565b5092915050565b600481810b9083900b01647fffffffff8113647fffffffff198212171561569b5761569b61566456fea264697066735822122059b2a999293b864561fd2a712500441a478d011203453b72f2b4088d8c8a521464736f6c63430008120033"; const bitSizes = [ 8, 16, 24, 32, 40, 48, 56, 64, 72, 80, 88, 96, 104, 112, 120, 128, 136, 144, 152, 160, 168, 176, 184, 192, 200, 208, 216, 224, 232, 240, 248, 256, ]; describe("ContractFunctionParameters", function () { let env; let newContractId; beforeAll(async function () { env = await IntegrationTestEnv.new(); // Create a file on Hedera and store the bytecode const fileCreateTx = new FileCreateTransaction() .setKeys([env.operatorKey]) .freezeWith(env.client); const fileCreateSign = await fileCreateTx.sign(env.operatorKey); const fileCreateSubmit = await fileCreateSign.execute(env.client); const fileCreateRx = await fileCreateSubmit.getReceipt(env.client); const bytecodeFileId = fileCreateRx.fileId; console.log(`- The bytecode file ID is: ${bytecodeFileId} \n`); //Append contents to the file const fileAppendTx = new FileAppendTransaction() .setFileId(bytecodeFileId) .setContents(smartContractBytecode) .setMaxChunks(20) .freezeWith(env.client); const fileAppendSign = await fileAppendTx.sign(env.operatorKey); const fileAppendSubmit = await fileAppendSign.execute(env.client); const fileAppendRx = await fileAppendSubmit.getReceipt(env.client); console.log( "Status of file append is", fileAppendRx.status.toString(10), ); // Instantiate the contract instance const contractTx = new ContractCreateTransaction() //Set the file ID of the Hedera file storing the bytecode .setBytecodeFileId(bytecodeFileId) //Set the gas to instantiate the contract .setGas(5_500_000) //Provide the constructor parameters for the contract .setConstructorParameters(); //Submit the transaction to the Hedera test network const contractResponse = await contractTx.execute(env.client); //Get the receipt of the file create transaction const contractReceipt = await contractResponse.getReceipt(env.client); await wait(2500); //Get the smart contract ID newContractId = contractReceipt.contractId; //Log the smart contract ID console.log("The smart contract ID is " + newContractId); }); bitSizes.forEach((bitSize) => { describe(`Tests for addInt${bitSize} method`, function () { it( getDescription( EXTREMUM.MIN, bitSize, INPUT_TYPE.NUMBER, METHOD_TYPE.INT, ), async function () { const contractParams = new ContractFunctionParameters()[ `addInt${bitSize}` ](-calculateRange(bitSize, INPUT_TYPE.NUMBER).min); const gasEstimte = await new MirrorNodeContractEstimateQuery() .setContractId(newContractId) .setFunction(`returnInt${bitSize}`, contractParams) .execute(env.client); const contractQuery = new ContractCallQuery() //Set the gas for the query .setGas(gasEstimte) //Set the contract ID to return the request for .setContractId(newContractId) //Set the contract function to call .setFunction(`returnInt${bitSize}`, contractParams) //Set the query payment for the node returning the request //This value must cover the cost of the request otherwise will fail .setQueryPayment(new Hbar(10)); //Submit to a Hedera network const txResponse = await contractQuery.execute(env.client); expect( txResponse[`getInt${bitSize}`](0).toString(10), ).to.be.equal( (-calculateRange(bitSize, INPUT_TYPE.NUMBER) .min).toString(10), ); }, ); it( getDescription( EXTREMUM.MAX, bitSize, INPUT_TYPE.NUMBER, METHOD_TYPE.INT, ), async function () { const functionParams = new ContractFunctionParameters()[ `addInt${bitSize}` ](calculateRange(bitSize, INPUT_TYPE.NUMBER).max); const gasEstimte = await new MirrorNodeContractEstimateQuery() .setContractId(newContractId) .setFunction(`returnInt${bitSize}`, functionParams) .execute(env.client); const contractQuery = new ContractCallQuery() //Set the gas for the query .setGas(gasEstimte) //Set the contract ID to return the request for .setContractId(newContractId) //Set the contract function to call .setFunction(`returnInt${bitSize}`, functionParams) //Set the query payment for the node returning the request //This value must cover the cost of the request otherwise will fail .setQueryPayment(new Hbar(10)); //Submit to a Hedera network const txResponse = await contractQuery.execute(env.client); expect( txResponse[`getInt${bitSize}`](0).toString(10), ).to.be.equal( calculateRange(bitSize, INPUT_TYPE.NUMBER).max.toString( 10, ), ); }, ); it( getDescription( EXTREMUM.MIN, bitSize, INPUT_TYPE.BIG_NUMBER, METHOD_TYPE.INT, ), async function () { const contractParams = new ContractFunctionParameters()[ `addInt${bitSize}` ](new BigNumber(-2).pow(bitSize - 1)); const gasEstimte = await new MirrorNodeContractEstimateQuery() .setContractId(newContractId) .setFunction(`returnInt${bitSize}`, contractParams) .execute(env.client); const contractQuery = new ContractCallQuery() //Set the gas for the query .setGas(gasEstimte) //Set the contract ID to return the request for .setContractId(newContractId) //Set the contract function to call .setFunction(`returnInt${bitSize}`, contractParams) //Set the query payment for the node returning the request //This value must cover the cost of the request otherwise will fail .setQueryPayment(new Hbar(10)); //Submit to a Hedera network const txResponse = await contractQuery.execute(env.client); expect( txResponse[`getInt${bitSize}`](0).toString(10), ).to.be.equal( new BigNumber(-2).pow(bitSize - 1).toString(10), ); }, ); it( getDescription( EXTREMUM.MAX, bitSize, INPUT_TYPE.BIG_NUMBER, METHOD_TYPE.INT, ), async function () { const contractParams = new ContractFunctionParameters()[ `addInt${bitSize}` ](new BigNumber(2).pow(bitSize - 1).minus(1)); const gasEstimte = await new MirrorNodeContractEstimateQuery() .setContractId(newContractId) .setFunction(`returnInt${bitSize}`, contractParams) .execute(env.client); const contractQuery = new ContractCallQuery() //Set the gas for the query .setGas(gasEstimte) //Set the contract ID to return the request for .setContractId(newContractId) //Set the contract function to call .setFunction(`returnInt${bitSize}`, contractParams) //Set the query payment for the node returning the request //This value must cover the cost of the request otherwise will fail .setQueryPayment(new Hbar(10)); //Submit to a Hedera network const txResponse = await contractQuery.execute(env.client); expect( txResponse[`getInt${bitSize}`](0).toString(10), ).to.be.equal( new BigNumber(2) .pow(bitSize - 1) .minus(1) .toString(10), ); }, ); it( getDescription( EXTREMUM.MIN, bitSize, INPUT_TYPE.LONG, METHOD_TYPE.INT, ), async function () { const contractParams = new ContractFunctionParameters()[ `addInt${bitSize}` ](new Long(calculateRange(bitSize).min).neg()); const gasEstimte = await new MirrorNodeContractEstimateQuery() .setContractId(newContractId) .setFunction(`returnInt${bitSize}`, contractParams) .execute(env.client); const contractQuery = new ContractCallQuery() //Set the gas for the query .setGas(gasEstimte) //Set the contract ID to return the request for .setContractId(newContractId) //Set the contract function to call .setFunction(`returnInt${bitSize}`, contractParams) //Set the query payment for the node returning the request //This value must cover the cost of the request otherwise will fail .setQueryPayment(new Hbar(10)); //Submit to a Hedera network const txResponse = await contractQuery.execute(env.client); expect( txResponse[`getInt${bitSize}`](0).toString(10), ).to.be.equal( new Long(calculateRange(bitSize).min) .neg() .toString(10), ); }, ); it( getDescription( EXTREMUM.MAX, bitSize, INPUT_TYPE.LONG, METHOD_TYPE.INT, ), async function () { const contractParams = new ContractFunctionParameters()[ `addInt${bitSize}` ](new Long(calculateRange(bitSize).max)); const gasEstimte = await new MirrorNodeContractEstimateQuery() .setContractId(newContractId) .setFunction(`returnInt${bitSize}`, contractParams) .execute(env.client); const contractQuery = new ContractCallQuery() //Set the gas for the query .setGas(gasEstimte) //Set the contract ID to return the request for .setContractId(newContractId) //Set the contract function to call .setFunction(`returnInt${bitSize}`, contractParams) //Set the query payment for the node returning the request //This value must cover the cost of the request otherwise will fail .setQueryPayment(new Hbar(10)); //Submit to a Hedera network const txResponse = await contractQuery.execute(env.client); expect( txResponse[`getInt${bitSize}`](0).toString(10), ).to.be.equal( new Long(calculateRange(bitSize).max).toString(10), ); }, ); }); describe(`Tests for addInt${bitSize}Array method`, function () { it( getDescriptionForArrayMethod( bitSize, INPUT_TYPE.NUMBER, METHOD_TYPE.INT, ), async function () { const arr = createArray(bitSize, INPUT_TYPE.NUMBER); const contractParams = new ContractFunctionParameters()[ `addInt${bitSize}Array` ](arr); const gasEstimte = await new MirrorNodeContractEstimateQuery() .setContractId(newContractId) .setFunction( `returnInt${bitSize}Array`, contractParams, ) .execute(env.client); const contractQuery = new ContractCallQuery() //Set the gas for the query .setGas(gasEstimte) //Set the contract ID to return the request for .setContractId(newContractId) //Set the contract function to call .setFunction(`returnInt${bitSize}Array`, contractParams) //Set the query payment for the node returning the request //This value must cover the cost of the request otherwise will fail .setQueryPayment(new Hbar(10)); //Submit to a Hedera network const txResponse = await contractQuery.execute(env.client); const result = txResponse.getResult([`int${bitSize}[]`])[0]; expect(result).to.be.an("array"); arr.map((item, i) => { expect(item.toString(10)).to.be.equal( result[i].toString(10), ); }); }, ); it( getDescriptionForArrayMethod( bitSize, INPUT_TYPE.BIG_NUMBER, METHOD_TYPE.INT, ), async function () { const arr = createArray(bitSize, INPUT_TYPE.BIG_NUMBER); const contractParams = new ContractFunctionParameters()[ `addInt${bitSize}Array` ](arr); const gasEstimte = await new MirrorNodeContractEstimateQuery() .setContractId(newContractId) .setFunction( `returnInt${bitSize}Array`, contractParams, ) .execute(env.client); const contractQuery = new ContractCallQuery() //Set the gas for the query .setGas(gasEstimte) //Set the contract ID to return the request for .setContractId(newContractId) //Set the contract function to call .setFunction( `returnInt${bitSize}Array`, new ContractFunctionParameters()[ `addInt${bitSize}Array` ](arr), ) //Set the query payment for the node returning the request //This value must cover the cost of the request otherwise will fail .setQueryPayment(new Hbar(10)); //Submit to a Hedera network const txResponse = await contractQuery.execute(env.client); const result = txResponse.getResult([`int${bitSize}[]`])[0]; expect(result).to.be.an("array"); arr.map((item, i) => { expect(item.toString(10)).to.be.equal( result[i].toString(10), ); }); }, ); it( getDescriptionForArrayMethod( bitSize, INPUT_TYPE.LONG, METHOD_TYPE.INT, ), async function () { const arr = createArray(bitSize, INPUT_TYPE.LONG); const contractParams = new ContractFunctionParameters()[ `addInt${bitSize}Array` ](arr); const gasEstimte = await new MirrorNodeContractEstimateQuery() .setContractId(newContractId) .setFunction( `returnInt${bitSize}Array`, contractParams, ) .execute(env.client); const contractQuery = new ContractCallQuery() //Set the gas for the query .setGas(gasEstimte) //Set the contract ID to return the request for .setContractId(newContractId) //Set the contract function to call .setFunction(`returnInt${bitSize}Array`, contractParams) //Set the query payment for the node returning the request //This value must cover the cost of the request otherwise will fail .setQueryPayment(new Hbar(10)); //Submit to a Hedera network const txResponse = await contractQuery.execute(env.client); const result = txResponse.getResult([`int${bitSize}[]`])[0]; expect(result).to.be.an("array"); arr.map((item, i) => { expect(item.toString(10)).to.be.equal( result[i].toString(10), ); }); }, ); it(`addInt${bitSize}Array method should return an empty array`, async function () { const contractParams = new ContractFunctionParameters()[ `addInt${bitSize}Array` ]([]); const gasEstimte = await new MirrorNodeContractEstimateQuery() .setContractId(newContractId) .setFunction(`returnInt${bitSize}Array`, contractParams) .execute(env.client); const contractQuery = new ContractCallQuery() //Set the gas for the query .setGas(gasEstimte) //Set the contract ID to return the request for .setContractId(newContractId) //Set the contract function to call .setFunction(`returnInt${bitSize}Array`, contractParams) //Set the query payment for the node returning the request //This value must cover the cost of the request otherwise will fail .setQueryPayment(new Hbar(10)); //Submit to a Hedera network const txResponse = await contractQuery.execute(env.client); const result = txResponse.getResult([`uint${bitSize}[]`])[0]; expect(result).to.be.an("array").to.have.length(0); }); it(`addInt${bitSize}Array method should throw an error`, async function () { const contractParams = new ContractFunctionParameters()[ `addInt${bitSize}` ](calculateRange(bitSize, INPUT_TYPE.NUMBER).max); const gasEstimte = await new MirrorNodeContractEstimateQuery() .setContractId(newContractId) .setFunction(`returnInt${bitSize}`, contractParams) .execute(env.client); try { new ContractCallQuery() //Set the gas for the query .setGas(gasEstimte) //Set the contract ID to return the request for .setContractId(newContractId) //Set the contract function to call .setFunction(`returnInt${bitSize}Array`, contractParams) //Set the query payment for the node returning the request //This value must cover the cost of the request otherwise will fail .setQueryPayment(new Hbar(10)); } catch (error) { expect(error).to.be.instanceOf(Error); expect(error.message).to.be.equal(REQUIRE_ARRAY_ERROR); } }); }); describe(`Tests for addUint${bitSize} method`, function () { it( getDescription( EXTREMUM.MAX, bitSize, INPUT_TYPE.NUMBER, METHOD_TYPE.UINT, ), async function () { const contractParams = new ContractFunctionParameters()[ `addUint${bitSize}` ](calculateRange(bitSize, INPUT_TYPE.NUMBER).max); const contractQuery = new ContractCallQuery() //Set the gas for the query .setGas(1_500_000) //Set the contract ID to return the request for .setContractId(newContractId) //Set the contract function to call .setFunction(`returnUint${bitSize}`, contractParams) //Set the query payment for the node returning the request //This value must cover the cost of the request otherwise will fail .setQueryPayment(new Hbar(10)); //Submit to a Hedera network const txResponse = await contractQuery.execute(env.client); expect( txResponse[`getUint${bitSize}`](0).toString(10), ).to.be.equal( calculateRange(bitSize, INPUT_TYPE.NUMBER).max.toString( 10, ), ); }, ); it( getDescription( EXTREMUM.MAX, bitSize, INPUT_TYPE.BIG_NUMBER, METHOD_TYPE.UINT, ), async function () { const contractParams = new ContractFunctionParameters()[ `addUint${bitSize}` ](new BigNumber(2).pow(bitSize - 1).minus(1)); const contractQuery = new ContractCallQuery() //Set the gas for the query .setGas(1_500_000) //Set the contract ID to return the request for .setContractId(newContractId) //Set the contract function to call .setFunction(`returnUint${bitSize}`, contractParams) //Set the query payment for the node returning the request //This value must cover the cost of the request otherwise will fail .setQueryPayment(new Hbar(10)); //Submit to a Hedera network const txResponse = await contractQuery.execute(env.client); expect( txResponse[`getUint${bitSize}`](0).toString(10), ).to.be.equal( new BigNumber(2) .pow(bitSize - 1) .minus(1) .toString(10), ); }, ); it( getDescription( EXTREMUM.MAX, bitSize, INPUT_TYPE.LONG, METHOD_TYPE.UINT, ), async function () { const contractParams = new ContractFunctionParameters()[ `addUint${bitSize}` ](new Long(calculateRange(bitSize).max)); const contractQuery = new ContractCallQuery() //Set the gas for the query .setGas(1_500_000) //Set the contract ID to return the request for .setContractId(newContractId) //Set the contract function to call .setFunction(`returnUint${bitSize}`, contractParams) //Set the query payment for the node returning the request //This value must cover the cost of the request otherwise will fail .setQueryPayment(new Hbar(10)); //Submit to a Hedera network const txResponse = await contractQuery.execute(env.client); expect( txResponse[`getUint${bitSize}`](0).toString(10), ).to.be.equal( new Long(calculateRange(bitSize).max).toString(10), ); }, ); }); describe(`Tests for addUint${bitSize}Array method`, function () { it( getDescriptionForArrayMethod( bitSize, INPUT_TYPE.NUMBER, METHOD_TYPE.UINT, ), async function () { const range = calculateRange(bitSize, INPUT_TYPE.NUMBER); const arr = [0, range.min + range.max]; const contractParams = new ContractFunctionParameters()[ `addUint${bitSize}Array` ](arr); const contractQuery = new ContractCallQuery() //Set the gas for the query .setGas(1_500_000) //Set the contract ID to return the request for .setContractId(newContractId) //Set the contract function to call .setFunction( `returnUint${bitSize}Array`, contractParams, ) //Set the query payment for the node returning the request //This value must cover the cost of the request otherwise will fail .setQueryPayment(new Hbar(10)); //Submit to a Hedera network const txResponse = await contractQuery.execute(env.client); const result = txResponse.getResult([ `uint${bitSize}[]`, ])[0]; expect(result).to.be.an("array"); arr.map((item, i) => { expect(item.toString(10)).to.be.equal( result[i].toString(10), ); }); }, ); it( getDescriptionForArrayMethod( bitSize, INPUT_TYPE.BIG_NUMBER, METHOD_TYPE.UINT, ), async function () { const arr = [0, new BigNumber(2).pow(bitSize - 1).minus(1)]; const contractParams = new ContractFunctionParameters()[ `addUint${bitSize}Array` ](arr); const contractQuery = new ContractCallQuery() //Set the gas for the query .setGas(1_500_000) //Set the contract ID to return the request for .setContractId(newContractId) //Set the contract function to call .setFunction( `returnUint${bitSize}Array`, contractParams, ) //Set the query payment for the node returning the request //This value must cover the cost of the request otherwise will fail .setQueryPayment(new Hbar(10)); //Submit to a Hedera network const txResponse = await contractQuery.execute(env.client); const result = txResponse.getResult([ `uint${bitSize}[]`, ])[0]; expect(result).to.be.an("array"); arr.map((item, i) => { expect(item.toString(10)).to.be.equal( result[i].toString(10), ); }); }, ); it( getDescriptionForArrayMethod( bitSize, INPUT_TYPE.LONG, METHOD_TYPE.UINT, ), async function () { const range = calculateRange(bitSize, INPUT_TYPE.NUMBER); const arr = [0, new Long(range.min + range.max)]; const contractParams = new ContractFunctionParameters()[ `addUint${bitSize}Array` ](arr); const contractQuery = new ContractCallQuery() //Set the gas for the query .setGas(1_500_000) //Set the contract ID to return the request for .setContractId(newContractId) //Set the contract function to call .setFunction( `returnUint${bitSize}Array`, contractParams, ) //Set the query payment for the node returning the request //This value must cover the cost of the request otherwise will fail .setQueryPayment(new Hbar(10)); //Submit to a Hedera network const txResponse = await contractQuery.execute(env.client); const result = txResponse.getResult([ `uint${bitSize}[]`, ])[0]; expect(result).to.be.an("array"); arr.map((item, i) => { expect(item.toString(10)).to.be.equal( result[i].toString(10), ); }); }, ); it(`addUint${bitSize}Array method should return an empty array`, async function () { const contractParams = new ContractFunctionParameters()[ `addUint${bitSize}Array` ]([]); const contractQuery = new ContractCallQuery() //Set the gas for the query .setGas(1_500_000) //Set the contract ID to return the request for .setContractId(newContractId) //Set the contract function to call .setFunction(`returnUint${bitSize}Array`, contractParams) //Set the query payment for the node returning the request //This value must cover the cost of the request otherwise will fail .setQueryPayment(new Hbar(10)); //Submit to a Hedera network const txResponse = await contractQuery.execute(env.client); const result = txResponse.getResult([`uint${bitSize}[]`])[0]; expect(result).to.be.an("array").to.have.length(0); }); it(`addUint${bitSize}Array method should throw an error`, async function () { try { const contractParams = new ContractFunctionParameters()[ `addUint${bitSize}Array` ](); new ContractCallQuery() //Set the gas for the query .setGas(1_500_000) //Set the contract ID to return the request for .setContractId(newContractId) //Set the contract function to call .setFunction( `returnUint${bitSize}Array`, contractParams, ) //Set the query payment for the node returning the request //This value must cover the cost of the request otherwise will fail .setQueryPayment(new Hbar(10)); } catch (error) { expect(error).to.be.instanceOf(Error); expect(error.message).to.be.equal(REQUIRE_ARRAY_ERROR); } }); }); }); it("should return the right min multiple int8 value", async function () { const contractParams = new ContractFunctionParameters().addInt8(-128); const contractQuery = new ContractCallQuery() //Set the gas for the query .setGas(1_500_000) //Set the contract ID to return the request for .setContractId(newContractId) //Set the contract function to call .setFunction( "returnInt8Multiple", // return two params: input & input (+) 20 // -128 + 20 = - 108 contractParams, ) //Set the query payment for the node returning the request //This value must cover the cost of the request otherwise will fail .setQueryPayment(new Hbar(10)); //Submit to a Hedera network const txResponse = await contractQuery.execute(env.client); expect(txResponse.getInt8(0)).to.be.equal(-128); expect(txResponse.getInt8(1)).to.be.equal(-108); }); it("should work the right way with 0 uint32 value", async function () { const contractParams = new ContractFunctionParameters().addUint32(0); const contractQuery = new ContractCallQuery() //Set the gas for the query .setGas(1_500_000) //Set the contract ID to return the request for .setContractId(newContractId) //Set the contract function to call .setFunction("returnUint32", contractParams) //Set the query payment for the node returning the request //This value must cover the cost of the request otherwise will fail .setQueryPayment(new Hbar(10)); //Submit to a Hedera network const txResponse = await contractQuery.execute(env.client); expect(txResponse.getUint32(0)).to.be.equal(0); }); it("should return the right multiple values", async function () { const contractParams = new ContractFunctionParameters().addUint32( 4294967295, ); const contractQuery = new ContractCallQuery() //Set the gas for the query .setGas(1_500_000) //Set the contract ID to return the request for .setContractId(newContractId) //Set the contract function to call .setFunction("returnMultipleTypeParams", contractParams) //Set the query payment for the node returning the request //This value must cover the cost of the request otherwise will fail .setQueryPayment(new Hbar(10)); //Submit to a Hedera network const txResponse = await contractQuery.execute(env.client); const result = txResponse.getResult(["uint32", "uint64", "string"]); expect(result[0]).to.be.equal(4294967295); // first param returned by the contrast is in UINT32 expect(result[1].toNumber()).to.be.equal(4294967294); // second param returned by the contract is in UINT64 expect(result[2]).to.be.equal("OK"); // third param returned by the contract is in STRING }); it("should return the right multiple int40 values", async function () { const contractParams = new ContractFunctionParameters().addInt40( 549755813885, ); const contractQuery = new ContractCallQuery() //Set the gas for the query .setGas(1_500_000) //Set the contract ID to return the request for .setContractId(newContractId) //Set the contract function to call .setFunction("returnMultipleInt40", contractParams) //Set the query payment for the node returning the request //This value must cover the cost of the request otherwise will fail .setQueryPayment(new Hbar(10)); //Submit to a Hedera network const txResponse = await contractQuery.execute(env.client); expect(txResponse.getInt40(0).toNumber()).to.be.equal(549755813885); expect(txResponse.getInt40(1).toNumber()).to.be.equal(549755813886); }); it("should return the right zero uint256 value", async function () { const contractParams = new ContractFunctionParameters().addUint256(0); const contractQuery = new ContractCallQuery() //Set the gas for the query .setGas(1_500_000) //Set the contract ID to return the request for .setContractId(newContractId) //Set the contract function to call .setFunction("returnUint256", contractParams) //Set the query payment for the node returning the request //This value must cover the cost of the request otherwise will fail .setQueryPayment(new Hbar(10)); //Submit to a Hedera network const txResponse = await contractQuery.execute(env.client); expect(txResponse.getUint256(0).toNumber()).to.be.equal(0); }); it("should return the right 20 decimal uint256 value", async function () { const contractParams = new ContractFunctionParameters().addUint256( 5000000000000000000000, ); const contractQuery = new ContractCallQuery() //Set the gas for the query .setGas(1_500_000) //Set the contract ID to return the request for .setContractId(newContractId) //Set the contract function to call .setFunction("returnUint256", contractParams) //Set the query payment for the node returning the request //This value must cover the cost of the request otherwise will fail .setQueryPayment(new Hbar(10)); //Submit to a Hedera network const txResponse = await contractQuery.execute(env.client); expect(txResponse.getUint256(0).toNumber()).to.be.equal( 5000000000000000000000, ); }); it("should return the again right uint256 value", async function () { const contractParams = new ContractFunctionParameters().addUint256(50); const contractQuery = new ContractCallQuery() //Set the gas for the query .setGas(1_500_000) //Set the contract ID to return the request for .setContractId(newContractId) //Set the contract function to call .setFunction("returnUint256", contractParams) //Set the query payment for the node returning the request //This value must cover the cost of the request otherwise will fail .setQueryPayment(new Hbar(10)); //Submit to a Hedera network const txResponse = await contractQuery.execute(env.client); expect(txResponse.getUint256(0).toNumber()).to.be.equal(50); }); it("contract create of A nonce, which deploys contract B in CONSTRUCTOR", async function () { const SMART_CONTRACT_BYTECODE = "6080604052348015600f57600080fd5b50604051601a90603b565b604051809103906000f0801580156035573d6000803e3d6000fd5b50506047565b605c8061009483390190565b603f806100556000396000f3fe6080604052600080fdfea2646970667358221220a20122cbad3457fedcc0600363d6e895f17048f5caa4afdab9e655123737567d64736f6c634300081200336080604052348015600f57600080fd5b50603f80601d6000396000f3fe6080604052600080fdfea264697066735822122053dfd8835e3dc6fedfb8b4806460b9b7163f8a7248bac510c6d6808d9da9d6d364736f6c63430008120033"; const fileCreate = await new FileCreateTransaction() .setKeys([env.operatorKey]) .setContents(SMART_CONTRACT_BYTECODE) .execute(env.client); const fileId = (await fileCreate.getReceipt(env.client)).fileId; const contractCreate = await new ContractCreateTransaction() .setAdminKey(env.operatorKey) .setGas(300_000) .setBytecodeFileId(fileId) .setContractMemo("[e2e::ContractADeploysContractBInConstructor]") .execute(env.client); const contractCreateRecord = await contractCreate.getRecord(env.client); const nonces = contractCreateRecord.contractFunctionResult.contractNonces; console.log(`contractNonces: ${JSON.stringify(nonces)}`); const contractId = contractCreateRecord.receipt.contractId; const contractAnonce = nonces.find( (nonceInfo) => nonceInfo.contractId.toString() === contractId.toString(), ); const contractBnonce = nonces.find( (nonceInfo) => nonceInfo.contractId.toString() !== contractId.toString(), ); expect(contractAnonce.nonce.toNumber()).to.be.equal(2); expect(contractBnonce.nonce.toNumber()).to.be.equal(1); const contractDeleteTx = await new ContractDeleteTransaction() .setTransferAccountId(env.operatorId) .setContractId(contractId) .execute(env.client); const contractDeleteResult = await contractDeleteTx.getReceipt( env.client, ); console.log( `contractDelete status: ${contractDeleteResult.status.toString()}`, ); const fileDeleteTx = await new FileDeleteTransaction() .setFileId(fileId) .execute(env.client); const fileDeleteResult = await fileDeleteTx.getReceipt(env.client); console.log(`fileDelete status: ${fileDeleteResult.status.toString()}`); }); afterAll(async function () { await env.close(); }); });