aboutsummaryrefslogtreecommitdiffstats
path: root/packages/contracts
diff options
context:
space:
mode:
authorGreg Hysen <greg.hysen@gmail.com>2018-04-12 01:51:55 +0800
committerAmir Bandeali <abandeali1@gmail.com>2018-04-21 04:56:17 +0800
commit1707f1940d27c5de4fac65dfd5d7ef86f8a0efcf (patch)
tree492f263199a4234c90c92fb9b338f47d62ce4037 /packages/contracts
parent5dd708aae8b2e51fdb3a0a4b551aa1cee4c8dca3 (diff)
downloaddexon-sol-tools-1707f1940d27c5de4fac65dfd5d7ef86f8a0efcf.tar
dexon-sol-tools-1707f1940d27c5de4fac65dfd5d7ef86f8a0efcf.tar.gz
dexon-sol-tools-1707f1940d27c5de4fac65dfd5d7ef86f8a0efcf.tar.bz2
dexon-sol-tools-1707f1940d27c5de4fac65dfd5d7ef86f8a0efcf.tar.lz
dexon-sol-tools-1707f1940d27c5de4fac65dfd5d7ef86f8a0efcf.tar.xz
dexon-sol-tools-1707f1940d27c5de4fac65dfd5d7ef86f8a0efcf.tar.zst
dexon-sol-tools-1707f1940d27c5de4fac65dfd5d7ef86f8a0efcf.zip
Replaced read/write Uint256 with generic bytes32, plus casting
Diffstat (limited to 'packages/contracts')
-rw-r--r--packages/contracts/src/contracts/current/protocol/AssetProxyDispatcher/AssetProxyDispatcher.sol2
-rw-r--r--packages/contracts/src/contracts/current/protocol/AssetProxyDispatcher/IAssetProxyDispatcher.sol2
-rw-r--r--packages/contracts/src/contracts/current/protocol/AssetProxyDispatcher/proxies/ERC721Proxy.sol4
-rw-r--r--packages/contracts/src/contracts/current/utils/LibBytes/LibBytes.sol24
4 files changed, 16 insertions, 16 deletions
diff --git a/packages/contracts/src/contracts/current/protocol/AssetProxyDispatcher/AssetProxyDispatcher.sol b/packages/contracts/src/contracts/current/protocol/AssetProxyDispatcher/AssetProxyDispatcher.sol
index b8a1fb4fe..bf5001575 100644
--- a/packages/contracts/src/contracts/current/protocol/AssetProxyDispatcher/AssetProxyDispatcher.sol
+++ b/packages/contracts/src/contracts/current/protocol/AssetProxyDispatcher/AssetProxyDispatcher.sol
@@ -54,7 +54,7 @@ contract AssetProxyDispatcher is
assetProxy.transferFrom(assetMetadata, from, to, amount);
}
- /// @dev Registers a new asset proxy.
+ /// @dev Adds a new asset proxy.
/// @param assetProxyId Id of the asset proxy.
/// @param newAssetProxyAddress Address of the asset proxy contract to register.
/// @param currentAssetProxyAddress Address of existing asset proxy to overwrite.
diff --git a/packages/contracts/src/contracts/current/protocol/AssetProxyDispatcher/IAssetProxyDispatcher.sol b/packages/contracts/src/contracts/current/protocol/AssetProxyDispatcher/IAssetProxyDispatcher.sol
index fcd1d2d65..534be6114 100644
--- a/packages/contracts/src/contracts/current/protocol/AssetProxyDispatcher/IAssetProxyDispatcher.sol
+++ b/packages/contracts/src/contracts/current/protocol/AssetProxyDispatcher/IAssetProxyDispatcher.sol
@@ -30,7 +30,7 @@ contract IAssetProxyDispatcher is
address oldAssetClassAddress
);
- /// @dev Sets a new asset proxy.
+ /// @dev Adds a new asset proxy.
/// @param assetProxyId Id of the asset proxy.
/// @param newAssetProxyAddress Address of the asset proxy contract to register.
/// @param currentAssetProxyAddress Address of existing asset proxy to overwrite.
diff --git a/packages/contracts/src/contracts/current/protocol/AssetProxyDispatcher/proxies/ERC721Proxy.sol b/packages/contracts/src/contracts/current/protocol/AssetProxyDispatcher/proxies/ERC721Proxy.sol
index d4c548e62..bbad8b392 100644
--- a/packages/contracts/src/contracts/current/protocol/AssetProxyDispatcher/proxies/ERC721Proxy.sol
+++ b/packages/contracts/src/contracts/current/protocol/AssetProxyDispatcher/proxies/ERC721Proxy.sol
@@ -76,7 +76,7 @@ contract ERC721Proxy is
assetMetadata = new bytes(53);
assetMetadata[0] = byte(assetProxyId);
writeAddress(assetMetadata, 1, tokenAddress);
- writeUint256(assetMetadata, 21, tokenId);
+ writeBytes32(assetMetadata, 21, bytes32(tokenId));
return assetMetadata;
}
@@ -90,7 +90,7 @@ contract ERC721Proxy is
{
require(assetMetadata.length == 53);
tokenAddress = readAddress(assetMetadata, 1);
- tokenId = readUint256(assetMetadata, 21);
+ tokenId = uint256(readBytes32(assetMetadata, 21));
return (tokenAddress, tokenId);
}
}
diff --git a/packages/contracts/src/contracts/current/utils/LibBytes/LibBytes.sol b/packages/contracts/src/contracts/current/utils/LibBytes/LibBytes.sol
index 59017d159..a1eca7f45 100644
--- a/packages/contracts/src/contracts/current/utils/LibBytes/LibBytes.sol
+++ b/packages/contracts/src/contracts/current/utils/LibBytes/LibBytes.sol
@@ -81,36 +81,36 @@ contract LibBytes {
}
}
- /// @dev Reads a uint256 value from a position in a byte array.
- /// @param b Byte array containing a uint256 value.
- /// @param index Index in byte array of uint256 value.
- /// @return uint256 value from byte array.
- function readUint256(
+ /// @dev Reads a bytes32 value from a position in a byte array.
+ /// @param b Byte array containing a bytes32 value.
+ /// @param index Index in byte array of bytes32 value.
+ /// @return bytes32 value from byte array.
+ function readBytes32(
bytes b,
uint256 index)
public pure
- returns (uint256 result)
+ returns (bytes32 result)
{
require(b.length >= index + 32);
// Arrays are prefixed by a 256 bit length parameter
index += 32;
- // Read the uint256 from array memory
+ // Read the bytes32 from array memory
assembly {
result := mload(add(b, index))
}
return result;
}
- /// @dev Writes a uint256 into a specific position in a byte array.
+ /// @dev Writes a bytes32 into a specific position in a 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(
+ /// @param input bytes32 to put into byte array.
+ function writeBytes32(
bytes b,
uint256 index,
- uint256 input)
+ bytes32 input)
public pure
{
require(b.length >= index + 32);
@@ -118,7 +118,7 @@ contract LibBytes {
// Arrays are prefixed by a 256 bit length parameter
index += 32;
- // Read the uint256 from array memory
+ // Read the bytes32 from array memory
assembly {
mstore(add(b, index), input)
}