Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
var encodeF = function (abi, args, bytecode) {
if (abi) {
var abiInputs = types(abi.inputs)
args = convert.burrowToAbi(abiInputs, args) // If abi is passed, convert values accordingly
}
// If bytecode provided then this is a creation call, bytecode goes first
if (bytecode) {
var data = bytecode
if (abi) data += convert.bytesTB(coder.rawEncode(abiInputs, args))
return data
} else {
return functionSig(abi) + convert.bytesTB(coder.rawEncode(abiInputs, args))
}
}
export function encodeProxyCall(parametersType, values) {
const methodId = abi.methodID("initialize", parametersType).toString("hex");
const params = abi.rawEncode(parametersType, values).toString("hex");
return "0x" + methodId + params;
}
function encodeCall(name, arguments, values) {
const methodId = abi.methodID(name, arguments).toString('hex');
const params = abi.rawEncode(arguments, values).toString('hex');
return '0x' + methodId + params;
}
encode(...params: any[]) {
return (
'0x' + signature + Abi.rawEncode(iTypes, params).toString('hex')
);
},
decode(raw: string) {
function encodeCall (name, args, values) {
const methodId = abi.methodID(name, args).toString('hex')
const params = abi.rawEncode(args, values).toString('hex')
return '0x' + methodId + params
}
export function abiEncodeData(payload, format = "") {
let abiEncodedData = ethereumjsAbi.rawEncode(payload.signature || [], payload.params);
if (format === "hex") return "0x" + abiEncodedData.toString("hex");
return abiEncodedData;
}
function encodeArgs(unencoded, abi) {
if (unencoded.length === 0) {
return ''
}
const buf = ABI.rawEncode(constructorInputTypes(abi), unencoded)
return buf.toString('hex')
}
function _getAbiEncodedParams (parameterTypes, parameterValues) {
var encoded = abi.rawEncode(parameterTypes, parameterValues)
return encoded.toString('hex')
}
function encodeConstructorArgs(inputs) {
const inputTypes = _.pluck(inputs, 'type')
const args = _.pluck(inputs, 'data')
const encoded = abi.rawEncode(inputTypes, args);
const bytecode = encoded.toString('hex');
return bytecode;
}
function getCtorParams() {
let parameterTypes = ["uint256", "uint256", "address", "address", "address", "address", "address"];
let parameterValues = [startTime + "", endTime + "", wallet, walletFounder, walletOEM, walletBounties, walletReserve];
let ctorParamsEncoded = ABI.rawEncode(parameterTypes, parameterValues);
return ctorParamsEncoded;
}