diff options
author | chriseth <chris@ethereum.org> | 2017-11-14 19:58:04 +0800 |
---|---|---|
committer | chriseth <chris@ethereum.org> | 2018-01-19 23:27:44 +0800 |
commit | 6807010dc7864500d89a833e4f6e7f338e58b948 (patch) | |
tree | 90fa3b3d59ae85a752dc611b6a32e24fe91e9efb /libsolidity/codegen/ContractCompiler.h | |
parent | 33723c457a99213a545006162112b55351da5fe4 (diff) | |
download | dexon-solidity-6807010dc7864500d89a833e4f6e7f338e58b948.tar dexon-solidity-6807010dc7864500d89a833e4f6e7f338e58b948.tar.gz dexon-solidity-6807010dc7864500d89a833e4f6e7f338e58b948.tar.bz2 dexon-solidity-6807010dc7864500d89a833e4f6e7f338e58b948.tar.lz dexon-solidity-6807010dc7864500d89a833e4f6e7f338e58b948.tar.xz dexon-solidity-6807010dc7864500d89a833e4f6e7f338e58b948.tar.zst dexon-solidity-6807010dc7864500d89a833e4f6e7f338e58b948.zip |
Prevent libraries from being called.
Diffstat (limited to 'libsolidity/codegen/ContractCompiler.h')
-rw-r--r-- | libsolidity/codegen/ContractCompiler.h | 9 |
1 files changed, 9 insertions, 0 deletions
diff --git a/libsolidity/codegen/ContractCompiler.h b/libsolidity/codegen/ContractCompiler.h index 7c5ee59f..1fd80d05 100644 --- a/libsolidity/codegen/ContractCompiler.h +++ b/libsolidity/codegen/ContractCompiler.h @@ -75,10 +75,19 @@ private: /// with a new and initialized context. Adds the constructor code. /// @returns the identifier of the runtime sub assembly size_t packIntoContractCreator(ContractDefinition const& _contract); + /// Appends code that deploys the given contract as a library. + /// Will also add code that modifies the contract in memory by injecting the current address + /// for the call protector. + size_t deployLibrary(ContractDefinition const& _contract); /// Appends state variable initialisation and constructor code. void appendInitAndConstructorCode(ContractDefinition const& _contract); void appendBaseConstructor(FunctionDefinition const& _constructor); void appendConstructor(FunctionDefinition const& _constructor); + /// Appends code that returns a boolean flag on the stack that tells whether + /// the contract has been called via delegatecall (false) or regular call (true). + /// This is done by inserting a specific push constant as the first instruction + /// whose data will be modified in memory at deploy time. + void appendDelegatecallCheck(); void appendFunctionSelector(ContractDefinition const& _contract); void appendCallValueCheck(); /// Creates code that unpacks the arguments for the given function represented by a vector of TypePointers. |