Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
deploy.assetLedgerData.schemaId.substr(2),
capabilities,
deploy.assetLedgerData.owner.substr(2),
].join('')),
);
const transferData = keccak256(
hexToBytes([
'0x',
deploy.tokenTransferData.ledgerId.substr(2),
deploy.tokenTransferData.receiverId.substr(2),
getValue(deploy.tokenTransferData.value).substr(2),
].join('')),
);
return keccak256(
hexToBytes([
'0x',
gateway.id.substr(2),
deploy.makerId.substr(2),
deploy.takerId.substr(2),
xcertData.substr(2),
transferData.substr(2),
leftPad(toInteger(deploy.seed), 64, '0', false),
leftPad(toSeconds(deploy.expiration), 64, '0', false),
].join('')),
);
}
export function createOrderHash(gateway: Gateway, order: ActionsOrder) {
let actionsHash = '0x0000000000000000000000000000000000000000000000000000000000000000';
for (const action of order.actions) {
actionsHash = keccak256(
hexToBytes([
'0x',
actionsHash.substr(2),
`0000000${getActionProxy(gateway, action)}`,
action.ledgerId.substr(2),
getActionParams(action, order.signers).substr(2),
].join('')),
);
}
return keccak256(
hexToBytes([
'0x',
gateway.config.actionsOrderId.substr(2),
parseAddresses(order.signers),
actionsHash.substr(2),
leftPad(toInteger(order.seed), 64, '0', false),
leftPad(toSeconds(order.expiration), 64, '0', false),
].join('')),
);
}
export function createOrderHash(gateway: Gateway, order: ActionsOrder) {
let actionsHash = '0x0000000000000000000000000000000000000000000000000000000000000000';
for (const action of order.actions) {
actionsHash = keccak256(
hexToBytes([
'0x',
actionsHash.substr(2),
`0000000${getActionProxy(gateway, action)}`,
action.ledgerId.substr(2),
getActionParams(action, order.signers).substr(2),
].join('')),
);
}
return keccak256(
hexToBytes([
'0x',
gateway.config.actionsOrderId.substr(2),
parseAddresses(order.signers),
actionsHash.substr(2),
order.assetLedgerData.schemaId,
capabilities,
order.assetLedgerData.ownerId.substr(2),
].join('')),
);
const transferData = keccak256(
hexToBytes([
'0x',
order.tokenTransferData.ledgerId.substr(2),
order.tokenTransferData.receiverId.substr(2),
getValue(order.tokenTransferData.value).substr(2),
].join('')),
);
return keccak256(
hexToBytes([
'0x',
gateway.config.assetLedgerDeployOrderId.substr(2),
order.makerId.substr(2),
order.takerId.substr(2),
xcertData.substr(2),
transferData.substr(2),
leftPad(toInteger(order.seed), 64, '0', false),
leftPad(toSeconds(order.expiration), 64, '0', false),
].join('')),
);
}
export function createOrderHash(gateway: Gateway, order: AssetLedgerDeployOrder) {
const capabilities = order.assetLedgerData.capabilities
.map((c) => rightPad(getInterfaceCode(c), 64, '0', false))
.join('');
const xcertData = keccak256(
hexToBytes([
'0x',
stringToHex(order.assetLedgerData.name),
stringToHex(order.assetLedgerData.symbol),
stringToHex(order.assetLedgerData.uriPrefix),
stringToHex(order.assetLedgerData.uriPostfix),
order.assetLedgerData.schemaId,
capabilities,
order.assetLedgerData.ownerId.substr(2),
].join('')),
);
const transferData = keccak256(
hexToBytes([
'0x',
order.tokenTransferData.ledgerId.substr(2),
export function createOrderHash(gateway: Gateway, order: ValueLedgerDeployOrder) {
const tokenData = keccak256(
hexToBytes([
'0x',
stringToHex(order.valueLedgerData.name),
stringToHex(order.valueLedgerData.symbol),
getValue(order.valueLedgerData.supply).substr(2),
leftPad(bigNumberify(order.valueLedgerData.decimals).toHexString(), 2, '0', false),
order.valueLedgerData.ownerId.substr(2),
].join('')),
);
const transferData = keccak256(
hexToBytes([
'0x',
order.tokenTransferData.ledgerId.substr(2),
order.tokenTransferData.receiverId.substr(2),
getValue(order.tokenTransferData.value).substr(2),
capabilities = capabilities + rightPad(getInterfaceCode(c), 64, '0', false);
});
const xcertData = keccak256(
hexToBytes([
'0x',
stringToHex(deploy.assetLedgerData.name),
stringToHex(deploy.assetLedgerData.symbol),
stringToHex(deploy.assetLedgerData.uriBase),
deploy.assetLedgerData.schemaId.substr(2),
capabilities,
deploy.assetLedgerData.owner.substr(2),
].join('')),
);
const transferData = keccak256(
hexToBytes([
'0x',
deploy.tokenTransferData.ledgerId.substr(2),
deploy.tokenTransferData.receiverId.substr(2),
getValue(deploy.tokenTransferData.value).substr(2),
].join('')),
);
return keccak256(
hexToBytes([
'0x',
gateway.id.substr(2),
deploy.makerId.substr(2),
deploy.takerId.substr(2),
xcertData.substr(2),
transferData.substr(2),
export function createOrderHash(gateway: Gateway, order: ValueLedgerDeployOrder) {
const tokenData = keccak256(
hexToBytes([
'0x',
stringToHex(order.valueLedgerData.name),
stringToHex(order.valueLedgerData.symbol),
getValue(order.valueLedgerData.supply).substr(2),
leftPad(bigNumberify(order.valueLedgerData.decimals).toHexString(), 2, '0', false),
order.valueLedgerData.ownerId.substr(2),
].join('')),
);
const transferData = keccak256(
hexToBytes([
'0x',
order.tokenTransferData.ledgerId.substr(2),
order.tokenTransferData.receiverId.substr(2),
getValue(order.tokenTransferData.value).substr(2),
].join('')),
);
return keccak256(
hexToBytes([
'0x',
gateway.config.valueLedgerDeployOrderId.substr(2),
order.makerId.substr(2),
order.takerId.substr(2),
tokenData.substr(2),
transferData.substr(2),
.join('');
const xcertData = keccak256(
hexToBytes([
'0x',
stringToHex(order.assetLedgerData.name),
stringToHex(order.assetLedgerData.symbol),
stringToHex(order.assetLedgerData.uriPrefix),
stringToHex(order.assetLedgerData.uriPostfix),
order.assetLedgerData.schemaId,
capabilities,
order.assetLedgerData.ownerId.substr(2),
].join('')),
);
const transferData = keccak256(
hexToBytes([
'0x',
order.tokenTransferData.ledgerId.substr(2),
order.tokenTransferData.receiverId.substr(2),
getValue(order.tokenTransferData.value).substr(2),
].join('')),
);
return keccak256(
hexToBytes([
'0x',
gateway.config.assetLedgerDeployOrderId.substr(2),
order.makerId.substr(2),
order.takerId.substr(2),
xcertData.substr(2),
transferData.substr(2),
export function createDeployHash(gateway: DeployGateway, deploy: Deploy) {
let capabilities = '';
deploy.assetLedgerData.capabilities.forEach((c) => {
capabilities = capabilities + rightPad(getInterfaceCode(c), 64, '0', false);
});
const xcertData = keccak256(
hexToBytes([
'0x',
stringToHex(deploy.assetLedgerData.name),
stringToHex(deploy.assetLedgerData.symbol),
stringToHex(deploy.assetLedgerData.uriBase),
deploy.assetLedgerData.schemaId.substr(2),
capabilities,
deploy.assetLedgerData.owner.substr(2),
].join('')),
);
const transferData = keccak256(
hexToBytes([
'0x',
deploy.tokenTransferData.ledgerId.substr(2),
deploy.tokenTransferData.receiverId.substr(2),