diff options
author | Remco Bloemen <remco@wicked.ventures> | 2018-06-26 03:55:26 +0800 |
---|---|---|
committer | Amir Bandeali <abandeali1@gmail.com> | 2018-06-27 03:23:19 +0800 |
commit | 97a70d14a333ff1fc8e9f35cb7acd34075c1098e (patch) | |
tree | 884a1a9f588e0b16711a67c8f675c8826938a442 | |
parent | 394fbebfa83cd42a80bdd0b3ebe267899070f056 (diff) | |
download | dexon-0x-contracts-97a70d14a333ff1fc8e9f35cb7acd34075c1098e.tar.gz dexon-0x-contracts-97a70d14a333ff1fc8e9f35cb7acd34075c1098e.tar.zst dexon-0x-contracts-97a70d14a333ff1fc8e9f35cb7acd34075c1098e.zip |
ERC20 Custom storage layout
-rw-r--r-- | packages/contracts/src/contracts/current/protocol/AssetProxy/ERC20Proxy.sol | 4 | ||||
-rw-r--r-- | packages/contracts/src/contracts/current/protocol/AssetProxy/MixinAuthorizable.sol | 4 |
2 files changed, 5 insertions, 3 deletions
diff --git a/packages/contracts/src/contracts/current/protocol/AssetProxy/ERC20Proxy.sol b/packages/contracts/src/contracts/current/protocol/AssetProxy/ERC20Proxy.sol index cb9c8c86c..7dcd2087b 100644 --- a/packages/contracts/src/contracts/current/protocol/AssetProxy/ERC20Proxy.sol +++ b/packages/contracts/src/contracts/current/protocol/AssetProxy/ERC20Proxy.sol @@ -55,8 +55,6 @@ contract ERC20Proxy is ) external { - bool auth = authorized[msg.sender]; - // `transferFrom`. // The function is marked `external`, so no abi decodeding is done for // us. Instead, we expect the `calldata` memory to contain the @@ -104,7 +102,7 @@ contract ERC20Proxy is // | | 68 | | 3. amount | assembly { - if iszero(auth) { + if iszero(sload(caller)) { // Revert with `Error("SENDER_NOT_AUTHORIZED")` mstore(0, 0x08c379a000000000000000000000000000000000000000000000000000000000) mstore(32, 0x0000002000000000000000000000000000000000000000000000000000000000) diff --git a/packages/contracts/src/contracts/current/protocol/AssetProxy/MixinAuthorizable.sol b/packages/contracts/src/contracts/current/protocol/AssetProxy/MixinAuthorizable.sol index 3b9584a44..9aa8697ba 100644 --- a/packages/contracts/src/contracts/current/protocol/AssetProxy/MixinAuthorizable.sol +++ b/packages/contracts/src/contracts/current/protocol/AssetProxy/MixinAuthorizable.sol @@ -49,6 +49,10 @@ contract MixinAuthorizable is !authorized[target], "TARGET_ALREADY_AUTHORIZED" ); + + assembly { + sstore(target, 1) + } authorized[target] = true; authorities.push(target); |