The popular open-source contract for web designers and developers by Stuff & Nonsense
- Originally published: 23/12/2008
- Revised date: 15/12/2013
- Original post
Raine Revere @raineorshine 23:39 I'm getting an out of gas error when I try to deploy a contract. It is not due to the control flow itself but seems to be due to the raw size of the contract. Is it possible for the bytecode to get too big at a certain point to deploy? Any recommendations? Does splitting a contract into libraries get around this issue? Thanks.
Nick Johnson @Arachnid 00:10 Yes, it is, and yes, it does.
| cat > ~/.gitconfig <<EOF | |
| [github] | |
| user = zelig | |
| token = | |
| [user] | |
| name = zelig | |
| email = [email protected] | |
| [core] | |
| pager = less -FRX | |
| [color] |
| // | |
| // The new assembly support in Solidity makes writing helpers easy. | |
| // Many have complained how complex it is to use `ecrecover`, especially in conjunction | |
| // with the `eth_sign` RPC call. Here is a helper, which makes that a matter of a single call. | |
| // | |
| // Sample input parameters: | |
| // (with v=0) | |
| // "0x47173285a8d7341e5e972fc677286384f802f8ef42a5ec5f03bbfa254cb01fad", | |
| // "0xaca7da997ad177f040240cdccf6905b71ab16b74434388c3a72f34fd25d6439346b2bac274ff29b48b3ea6e2d04c1336eaceafda3c53ab483fc3ff12fac3ebf200", | |
| // "0x0e5cb767cce09a7f3ca594df118aa519be5e2b5a" |
| pragma solidity ^0.4.24; | |
| import 'https://github.com/OpenZeppelin/zeppelin-solidity/contracts/token/ERC20/ERC20Mintable.sol'; | |
| import 'https://github.com/OpenZeppelin/zeppelin-solidity/contracts/ownership/Ownable.sol'; | |
| import "./Ballot.sol"; | |
| contract AwardToken is ERC20Mintable, Ownable { | |
| uint quantity; | |
| uint ballotPeriod = 7 hours; | |
| Ballot public currBallot; | |
| address[] public prevWinners; |
| pragma solidity ^0.4.24; | |
| import 'https://github.com/OpenZeppelin/zeppelin-solidity/contracts/math/SafeMath.sol'; | |
| /* | |
| Using a proxy contract here allows revert-causing functions that contain | |
| require() to return false rather than halt execution | |
| https://truffleframework.com/tutorials/testing-for-throws-in-solidity-tests | |
| */ | |
| contract SafeMathProxy { | |
| using SafeMath for uint; |
| pragma solidity ^0.4.7; | |
| import "remix_tests.sol"; | |
| contract SimpleStorage { | |
| uint public storedData; | |
| function SimpleStorage() public { | |
| storedData = 100; | |
| } | |
| function set(uint x) public { |
| pragma solidity ^0.5.0; | |
| contract Mortal { | |
| /* Define variable owner of the type address */ | |
| address payable owner; | |
| /* This function is executed at initialization and sets the owner of the contract */ | |
| function mortal() public { owner = msg.sender; } | |
| /* Function to recover the funds on the contract */ | |
| function kill() public { if (msg.sender == owner) selfdestruct(owner); } |
| pragma solidity ^0.5.0; | |
| contract Mortal { | |
| /* Define variable owner of the type address */ | |
| address payable owner; | |
| /* This function is executed at initialization and sets the owner of the contract */ | |
| function mortal() public { owner = msg.sender; } | |
| /* Function to recover the funds on the contract */ |