Changed order of write parameters in LibBytes. Now ordered by most generalized to most specific
This commit is contained in:
committed by
Amir Bandeali
parent
78d81f193f
commit
219d6c294d
@@ -63,7 +63,7 @@ contract ERC20TransferProxy is
|
||||
// Encode fields into a byte array
|
||||
assetMetadata = new bytes(21);
|
||||
assetMetadata[0] = byte(assetProxyId);
|
||||
writeAddress(tokenAddress, assetMetadata, 1);
|
||||
writeAddress(assetMetadata, 1, tokenAddress);
|
||||
return assetMetadata;
|
||||
}
|
||||
|
||||
|
@@ -72,7 +72,7 @@ contract ERC20TransferProxy_v1 is
|
||||
// Encode fields into a byte array
|
||||
assetMetadata = new bytes(21);
|
||||
assetMetadata[0] = byte(assetProxyId);
|
||||
writeAddress(tokenAddress, assetMetadata, 1);
|
||||
writeAddress(assetMetadata, 1, tokenAddress);
|
||||
return assetMetadata;
|
||||
}
|
||||
|
||||
|
@@ -73,8 +73,8 @@ contract ERC721TransferProxy is
|
||||
// Encode fields into a byte array
|
||||
assetMetadata = new bytes(53);
|
||||
assetMetadata[0] = byte(assetProxyId);
|
||||
writeAddress(tokenAddress, assetMetadata, 1);
|
||||
writeUint256(tokenId, assetMetadata, 21);
|
||||
writeAddress(assetMetadata, 1, tokenAddress);
|
||||
writeUint256(assetMetadata, 21, tokenId);
|
||||
return assetMetadata;
|
||||
}
|
||||
|
||||
|
@@ -48,13 +48,13 @@ contract LibBytes {
|
||||
}
|
||||
|
||||
/// @dev Writes an address into a specific position in a byte array.
|
||||
/// @param input Address to put into byte array.
|
||||
/// @param b Byte array to insert address into.
|
||||
/// @param index Index in byte array of address.
|
||||
/// @param input Address to put into byte array.
|
||||
function writeAddress(
|
||||
address input,
|
||||
bytes b,
|
||||
uint256 index)
|
||||
uint256 index,
|
||||
address input)
|
||||
public pure
|
||||
{
|
||||
require(b.length >= index + 20); // 20 is length of address
|
||||
@@ -104,13 +104,13 @@ contract LibBytes {
|
||||
}
|
||||
|
||||
/// @dev Writes a uint256 into a specific position in a byte array.
|
||||
/// @param input uint256 to put into byte array.
|
||||
/// @param b Byte array to insert <input> into.
|
||||
/// @param index Index in byte array of <input>.
|
||||
/// @param input uint256 to put into byte array.
|
||||
function writeUint256(
|
||||
uint256 input,
|
||||
bytes b,
|
||||
uint256 index)
|
||||
uint256 index,
|
||||
uint256 input)
|
||||
public pure
|
||||
{
|
||||
require(b.length >= index + 32);
|
||||
|
Reference in New Issue
Block a user