evm
Version:
An ethereum virtual machine (EVM) bytecode decompiler
64 lines (59 loc) • 1.81 kB
text/typescript
import EVM from '../classes/evm.class';
import Opcode from '../interfaces/opcode.interface';
import stringify from '../utils/stringify';
export class DELEGATECALL {
readonly name: string;
readonly type?: string;
readonly wrapped: boolean;
readonly gas: any;
readonly address: any;
readonly memoryStart: any;
readonly memoryLength: any;
readonly outputStart: any;
readonly outputLength: any;
constructor(
gas: any,
address: any,
memoryStart: any,
memoryLength: any,
outputStart: any,
outputLength: any
) {
this.name = 'DELEGATECALL';
this.wrapped = true;
this.gas = gas;
this.address = address;
this.memoryStart = memoryStart;
this.memoryLength = memoryLength;
this.outputStart = outputStart;
this.outputLength = outputLength;
}
toString() {
return (
'delegatecall(' +
stringify(this.gas) +
',' +
stringify(this.address) +
',' +
stringify(this.memoryStart) +
',' +
stringify(this.memoryLength) +
',' +
stringify(this.outputStart) +
',' +
stringify(this.outputLength) +
')'
);
}
}
export default (opcode: Opcode, state: EVM): void => {
const gas = state.stack.pop();
const address = state.stack.pop();
const memoryStart = state.stack.pop();
const memoryLength = state.stack.pop();
const outputStart = state.stack.pop();
const outputLength = state.stack.pop();
state.stack.push(
new DELEGATECALL(gas, address, memoryStart, memoryLength, outputStart, outputLength)
);
};