UNPKG

@neo-one/smart-contract-compiler

Version:

NEO•ONE TypeScript smart contract compiler.

28 lines (26 loc) 1.1 kB
import { tsUtils } from '@neo-one/ts-utils'; import { GlobalProperty } from '../../../constants'; import { BuiltinMemberCall } from '../../BuiltinMemberCall'; export class AddressIsSender extends BuiltinMemberCall { emitCall(sb, _func, node, optionsIn) { if (tsUtils.argumented.getArguments(node).length < 1) { return; } const options = sb.pushValueOptions(optionsIn); sb.visit(tsUtils.argumented.getArguments(node)[0], options); sb.emitHelper(tsUtils.argumented.getArguments(node)[0], options, sb.helpers.unwrapBuffer); sb.emitOp(node, 'DUP'); sb.emitSysCall(node, 'Neo.Runtime.CheckWitness'); sb.emitOp(node, 'SWAP'); sb.emitHelper(node, options, sb.helpers.getGlobalProperty({ property: GlobalProperty.CallingScriptHash })); sb.emitOp(node, 'EQUAL'); sb.emitOp(node, 'BOOLOR'); if (optionsIn.pushValue) { sb.emitHelper(node, options, sb.helpers.wrapBoolean); } else { sb.emitOp(node, 'DROP'); } } } //# sourceMappingURL=isSender.js.map