UNPKG

@neo-one/smart-contract-compiler

Version:

NEO•ONE TypeScript smart contract compiler.

27 lines (25 loc) 890 B
import { Helper } from '../Helper'; export class GetStorageBaseHelper extends Helper { emit(sb, node, optionsIn) { const options = sb.pushValueOptions(optionsIn); sb.emitSysCall(node, 'Neo.Storage.GetReadOnlyContext'); sb.emitSysCall(node, 'Neo.Storage.Find'); sb.emitOp(node, 'DUP'); sb.emitHelper(node, options, sb.helpers.if({ condition: () => { sb.emitSysCall(node, 'Neo.Enumerator.Next'); }, whenTrue: () => { sb.emitSysCall(node, 'Neo.Enumerator.Value'); }, whenFalse: () => { sb.emitOp(node, 'DROP'); sb.emitPushBuffer(node, Buffer.alloc(0, 0)); }, })); if (!optionsIn.pushValue) { sb.emitOp(node, 'DROP'); } } } //# sourceMappingURL=GetStorageBaseHelper.js.map