Originally posted Oct 24 2016. Updated Nov 1 2016.
This is not advise as to whether Arcade City is a good investment or not. This is just a quick look at what Arcade City is offering and how they are doing it.
Arcade City is a community of peer-to-peer ride sharing providers and consumers. The team plans to “reinvent the sharing economy” with its platform and community in an entirely different way than Lyft or Uber.
The crowdsale will start around the beginning of Nov 2016. DO YOUR RESEARCH FIRST! I’ve collected some of discussions around Arcade City in the Links section below.
The contract address with the verified source code and JSON application binary interface (ABI) can be found at 0xAc709FcB44a43c35F0DA4e3163b117A17F3770f5. And the accounts linked to this contract are:
- Multisig – 0x8d9d0bd75319a3780d3cab012759efbae334291b
- Founder 0x08e50ae3e83facacd322a923c177c716b78cd17a
- Owner – 0x5f23acdd1e87112b5fe143509d74ded22b6e59b3
- Rewards – 0xe7c1aa21cbdd664e7e48fec4d0246cf1b6af0502
- Developer – 0x1c18720bc72e9ded9681c65e3223a84741379cb2
Links:
- Arcade City Shows The Public The Startups Initial White Paper
- Arcade City: Blueprint for a New Economy – Whitepaper and Token Plan – Draft
- Nov 1 2016 – Think twice before investing in Arcade City…..
- Oct 29 2016 – Arcade City Mayor gives up his key to the city
- Oct 28 2016 – Arcade City Dev Team. Ask us anything
- Oct 28 2016 – Arcade City off to a rough start – typos, confusion and failed cryptonomics
- Oct 28 2016 – Arcade City Whitepaper and Token sale
- Sep 8 2016 – PSA: Arcade City CEO heading to DevCon 2 – BEWARE
- Aug 24 2016 – Arcade City will be using Consensys’ POPA (Proof of Physical Address) Come September launch
- Aug 18 2016 – Austin police hunt for Arcade City’s rogue ridesharing CEO
- Jul 29 2016 – Why Austin’s ‘Anti-Uber’ start-up is probably doomed
- Apr 4 2016 – [PSA] Arcade City Founder (Christopher David) Has a Questionable Past…
- Apr 2 2016 – Why are so many people worried about whether they can trust Christopher David of Arcade City? The whole point of running a DAO on ethereum is that you dont need trust.
- Apr 2 2016 – [AMA] Arcade City founder Christopher David – Ask me anything
- Apr 1 2016 – Anyone knows Christopher David, founder of Arcade City? Did he defraud people?
- Jan 20 2016 – Arcade City: Decentralized, Blockchain-Based Answer to Uber
- Website – http://arcade.city/
Crowdfunding source code from the verified source at 0xAc709FcB44a43c35F0DA4e3163b117A17F3770f5:
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 |
/** * Overflow aware uint math functions. * * Inspired by https://github.com/MakerDAO/maker-otc/blob/master/contracts/simple_market.sol */ pragma solidity ^0.4.2; contract SafeMath { //internals function safeMul(uint a, uint b) internal returns (uint) { uint c = a * b; assert(a == 0 || c / a == b); return c; } function safeSub(uint a, uint b) internal returns (uint) { assert(b <= a); return a - b; } function safeAdd(uint a, uint b) internal returns (uint) { uint c = a + b; assert(c>=a && c>=b); return c; } function assert(bool assertion) internal { if (!assertion) throw; } } /** * ERC 20 token * * https://github.com/ethereum/EIPs/issues/20 */ contract Token { /// @return total amount of tokens function totalSupply() constant returns (uint256 supply) {} /// @param _owner The address from which the balance will be retrieved /// @return The balance function balanceOf(address _owner) constant returns (uint256 balance) {} /// @notice send `_value` token to `_to` from `msg.sender` /// @param _to The address of the recipient /// @param _value The amount of token to be transferred /// @return Whether the transfer was successful or not function transfer(address _to, uint256 _value) returns (bool success) {} /// @notice send `_value` token to `_to` from `_from` on the condition it is approved by `_from` /// @param _from The address of the sender /// @param _to The address of the recipient /// @param _value The amount of token to be transferred /// @return Whether the transfer was successful or not function transferFrom(address _from, address _to, uint256 _value) returns (bool success) {} /// @notice `msg.sender` approves `_addr` to spend `_value` tokens /// @param _spender The address of the account able to transfer the tokens /// @param _value The amount of wei to be approved for transfer /// @return Whether the approval was successful or not function approve(address _spender, uint256 _value) returns (bool success) {} /// @param _owner The address of the account owning tokens /// @param _spender The address of the account able to transfer the tokens /// @return Amount of remaining tokens allowed to spent function allowance(address _owner, address _spender) constant returns (uint256 remaining) {} event Transfer(address indexed _from, address indexed _to, uint256 _value); event Approval(address indexed _owner, address indexed _spender, uint256 _value); } /** * ERC 20 token * * https://github.com/ethereum/EIPs/issues/20 */ contract StandardToken is Token { /** * Reviewed: * - Interger overflow = OK, checked */ function transfer(address _to, uint256 _value) returns (bool success) { //Default assumes totalSupply can't be over max (2^256 - 1). //If your token leaves out totalSupply and can issue more tokens as time goes on, you need to check if it doesn't wrap. //Replace the if with this one instead. if (balances[msg.sender] >= _value && balances[_to] + _value > balances[_to]) { //if (balances[msg.sender] >= _value && _value > 0) { balances[msg.sender] -= _value; balances[_to] += _value; Transfer(msg.sender, _to, _value); return true; } else { return false; } } function transferFrom(address _from, address _to, uint256 _value) returns (bool success) { //same as above. Replace this line with the following if you want to protect against wrapping uints. if (balances[_from] >= _value && allowed[_from][msg.sender] >= _value && balances[_to] + _value > balances[_to]) { //if (balances[_from] >= _value && allowed[_from][msg.sender] >= _value && _value > 0) { balances[_to] += _value; balances[_from] -= _value; allowed[_from][msg.sender] -= _value; Transfer(_from, _to, _value); return true; } else { return false; } } function balanceOf(address _owner) constant returns (uint256 balance) { return balances[_owner]; } function approve(address _spender, uint256 _value) returns (bool success) { allowed[msg.sender][_spender] = _value; Approval(msg.sender, _spender, _value); return true; } function allowance(address _owner, address _spender) constant returns (uint256 remaining) { return allowed[_owner][_spender]; } mapping(address => uint256) balances; mapping (address => mapping (address => uint256)) allowed; uint256 public totalSupply; } /** * Arcade City crowdsale crowdsale contract. * * Security criteria evaluated against http://ethereum.stackexchange.com/questions/8551/methodological-security-review-of-a-smart-contract * * */ contract ARCToken is StandardToken, SafeMath { string public name = "Arcade Token"; string public symbol = "ARC"; uint public decimals = 18; uint public startBlock; //crowdsale start block (set in constructor) uint public endBlock; //crowdsale end block (set in constructor) // Initial multisig address (set in constructor) // All deposited ETH will be instantly forwarded to this address. // Address is a multisig wallet. address public multisig = 0x0; address public founder = 0x0; address public developer = 0x0; address public rewards = 0x0; bool public rewardAddressesSet = false; address public owner = 0x0; bool public marketactive = false; uint public etherCap = 672000 * 10**18; //max amount raised during crowdsale (8.5M USD worth of ether will be measured with a moving average market price at beginning of the crowdsale) uint public rewardsAllocation = 2; //2% tokens allocated post-crowdsale for swarm rewards uint public developerAllocation = 6 ; //6% of token supply allocated post-crowdsale for the developer fund uint public founderAllocation = 8; //8% of token supply allocated post-crowdsale for the founder allocation bool public allocated = false; //this will change to true when the rewards are allocated uint public presaleTokenSupply = 0; //this will keep track of the token supply created during the crowdsale uint public presaleEtherRaised = 0; //this will keep track of the Ether raised during the crowdsale bool public halted = false; //the founder address can set this to true to halt the crowdsale due to emergency event Buy(address indexed sender, uint eth, uint fbt); function ARCToken(address multisigInput, uint startBlockInput, uint endBlockInput) { owner = msg.sender; multisig = multisigInput; startBlock = startBlockInput; endBlock = endBlockInput; } function setRewardAddresses(address founderInput, address developerInput, address rewardsInput){ if (msg.sender != owner) throw; if (rewardAddressesSet) throw; founder = founderInput; developer = developerInput; rewards = rewardsInput; rewardAddressesSet = true; } function price() constant returns(uint) { return testPrice(block.number); } // price() exposed for unit tests function testPrice(uint blockNumber) constant returns(uint) { if (blockNumber>=startBlock && blockNumber<startBlock+250) return 125; //power hour if (blockNumberendBlock) return 75; //default price return 75 + 4*(endBlock - blockNumber)/(endBlock - startBlock + 1)*34/4; //crowdsale price } /** * Main token buy function. * * Security review * * - Integer math: ok - using SafeMath * * - halt flag added - ok * * Applicable tests: * * - Test halting, buying, and failing * - Test buying on behalf of a recipient * - Test buy * - Test unhalting, buying, and succeeding * - Test buying after the sale ends * */ function buyRecipient(address recipient) { if (block.numberendBlock || safeAdd(presaleEtherRaised,msg.value)>etherCap || halted) throw; uint tokens = safeMul(msg.value, price()); balances[recipient] = safeAdd(balances[recipient], tokens); totalSupply = safeAdd(totalSupply, tokens); presaleEtherRaised = safeAdd(presaleEtherRaised, msg.value); if (!multisig.send(msg.value)) throw; //immediately send Ether to multisig address // if etherCap is reached - activate the market if (presaleEtherRaised == etherCap && !marketactive){ marketactive = true; } Buy(recipient, msg.value, tokens); } /** * Set up founder address token balance. * * allocateBountyAndEcosystemTokens() must be calld first. * * Security review * * - Integer math: ok - only called once with fixed parameters * * Applicable tests: * * - Test bounty and ecosystem allocation * - Test bounty and ecosystem allocation twice * */ function allocateTokens() { // make sure founder/developer/rewards addresses are configured if(founder == 0x0 || developer == 0x0 || rewards == 0x0) throw; // owner/founder/developer/rewards addresses can call this function if (msg.sender != owner && msg.sender != founder && msg.sender != developer && msg.sender != rewards ) throw; // it should only continue if endBlock has passed OR presaleEtherRaised has reached the cap if (block.number <= endBlock && presaleEtherRaised < etherCap) throw; if (allocated) throw; presaleTokenSupply = totalSupply; // total token allocations add up to 16% of total coins, so formula is reward=allocation_in_percent/84 . balances[founder] = safeAdd(balances[founder], presaleTokenSupply * founderAllocation / 84 ); totalSupply = safeAdd(totalSupply, presaleTokenSupply * founderAllocation / 84); balances[developer] = safeAdd(balances[developer], presaleTokenSupply * developerAllocation / 84); totalSupply = safeAdd(totalSupply, presaleTokenSupply * developerAllocation / 84); balances[rewards] = safeAdd(balances[rewards], presaleTokenSupply * rewardsAllocation / 84); totalSupply = safeAdd(totalSupply, presaleTokenSupply * rewardsAllocation / 84); allocated = true; } /** * Emergency Stop crowdsale. * * Applicable tests: * * - Test unhalting, buying, and succeeding */ function halt() { if (msg.sender!=founder && msg.sender != developer) throw; halted = true; } function unhalt() { if (msg.sender!=founder && msg.sender != developer) throw; halted = false; } /** * ERC 20 Standard Token interface transfer function * * Prevent transfers until token sale is over. * * Applicable tests: * * - Test transfer after restricted period * - Test transfer after market activated */ function transfer(address _to, uint256 _value) returns (bool success) { if (block.number <= endBlock && marketactive == false) throw; return super.transfer(_to, _value); } /** * ERC 20 Standard Token interface transfer function * * Prevent transfers until token sale is over. */ function transferFrom(address _from, address _to, uint256 _value) returns (bool success) { if (block.number <= endBlock && marketactive == false) throw; return super.transferFrom(_from, _to, _value); } /** * Direct deposits buys tokens */ function() payable { buyRecipient(msg.sender); } } |
Crowdfunding source code from https://github.com/ArcadeCity/ac-token at Oct 28 2016 14:57:36 UTC.
ARCToken.sol
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 360 361 362 363 364 365 366 367 368 369 370 |
/** * Overflow aware uint math functions. * * Inspired by https://github.com/MakerDAO/maker-otc/blob/master/contracts/simple_market.sol */ pragma solidity ^0.4.2; contract SafeMath { //internals function safeMul(uint a, uint b) internal returns (uint) { uint c = a * b; assert(a == 0 || c / a == b); return c; } function safeSub(uint a, uint b) internal returns (uint) { assert(b <= a); return a - b; } function safeAdd(uint a, uint b) internal returns (uint) { uint c = a + b; assert(c>=a && c>=b); return c; } function assert(bool assertion) internal { if (!assertion) throw; } } /** * ERC 20 token * * https://github.com/ethereum/EIPs/issues/20 */ contract Token { /// @return total amount of tokens function totalSupply() constant returns (uint256 supply) {} /// @param _owner The address from which the balance will be retrieved /// @return The balance function balanceOf(address _owner) constant returns (uint256 balance) {} /// @notice send `_value` token to `_to` from `msg.sender` /// @param _to The address of the recipient /// @param _value The amount of token to be transferred /// @return Whether the transfer was successful or not function transfer(address _to, uint256 _value) returns (bool success) {} /// @notice send `_value` token to `_to` from `_from` on the condition it is approved by `_from` /// @param _from The address of the sender /// @param _to The address of the recipient /// @param _value The amount of token to be transferred /// @return Whether the transfer was successful or not function transferFrom(address _from, address _to, uint256 _value) returns (bool success) {} /// @notice `msg.sender` approves `_addr` to spend `_value` tokens /// @param _spender The address of the account able to transfer the tokens /// @param _value The amount of wei to be approved for transfer /// @return Whether the approval was successful or not function approve(address _spender, uint256 _value) returns (bool success) {} /// @param _owner The address of the account owning tokens /// @param _spender The address of the account able to transfer the tokens /// @return Amount of remaining tokens allowed to spent function allowance(address _owner, address _spender) constant returns (uint256 remaining) {} event Transfer(address indexed _from, address indexed _to, uint256 _value); event Approval(address indexed _owner, address indexed _spender, uint256 _value); } /** * ERC 20 token * * https://github.com/ethereum/EIPs/issues/20 */ contract StandardToken is Token { /** * Reviewed: * - Interger overflow = OK, checked */ function transfer(address _to, uint256 _value) returns (bool success) { //Default assumes totalSupply can't be over max (2^256 - 1). //If your token leaves out totalSupply and can issue more tokens as time goes on, you need to check if it doesn't wrap. //Replace the if with this one instead. if (balances[msg.sender] >= _value && balances[_to] + _value > balances[_to]) { //if (balances[msg.sender] >= _value && _value > 0) { balances[msg.sender] -= _value; balances[_to] += _value; Transfer(msg.sender, _to, _value); return true; } else { return false; } } function transferFrom(address _from, address _to, uint256 _value) returns (bool success) { //same as above. Replace this line with the following if you want to protect against wrapping uints. if (balances[_from] >= _value && allowed[_from][msg.sender] >= _value && balances[_to] + _value > balances[_to]) { //if (balances[_from] >= _value && allowed[_from][msg.sender] >= _value && _value > 0) { balances[_to] += _value; balances[_from] -= _value; allowed[_from][msg.sender] -= _value; Transfer(_from, _to, _value); return true; } else { return false; } } function balanceOf(address _owner) constant returns (uint256 balance) { return balances[_owner]; } function approve(address _spender, uint256 _value) returns (bool success) { allowed[msg.sender][_spender] = _value; Approval(msg.sender, _spender, _value); return true; } function allowance(address _owner, address _spender) constant returns (uint256 remaining) { return allowed[_owner][_spender]; } mapping(address => uint256) balances; mapping (address => mapping (address => uint256)) allowed; uint256 public totalSupply; } /** * Arcade City crowdsale crowdsale contract. * * Security criteria evaluated against http://ethereum.stackexchange.com/questions/8551/methodological-security-review-of-a-smart-contract * * */ contract ARCToken is StandardToken, SafeMath { string public name = "Arcade Token"; string public symbol = "ARC"; uint public decimals = 18; uint public startBlock; //crowdsale start block (set in constructor) uint public endBlock; //crowdsale end block (set in constructor) // Initial multisig address (set in constructor) // All deposited ETH will be instantly forwarded to this address. // Address is a multisig wallet. address public multisig = 0x0; address public founder = 0x0; address public developer = 0x0; address public rewards = 0x0; bool public rewardAddressesSet = false; address public owner = 0x0; bool public marketactive = false; uint public etherCap = 672000 * 10**18; //max amount raised during crowdsale (8.5M USD worth of ether will be measured with a moving average market price at beginning of the crowdsale) uint public rewardsAllocation = 2; //2% tokens allocated post-crowdsale for swarm rewards uint public developerAllocation = 6 ; //6% of token supply allocated post-crowdsale for the developer fund uint public founderAllocation = 8; //8% of token supply allocated post-crowdsale for the founder allocation bool public allocated = false; //this will change to true when the rewards are allocated uint public presaleTokenSupply = 0; //this will keep track of the token supply created during the crowdsale uint public presaleEtherRaised = 0; //this will keep track of the Ether raised during the crowdsale bool public halted = false; //the founder address can set this to true to halt the crowdsale due to emergency event Buy(address indexed sender, uint eth, uint fbt); function ARCToken(address multisigInput, uint startBlockInput, uint endBlockInput) { owner = msg.sender; multisig = multisigInput; startBlock = startBlockInput; endBlock = endBlockInput; } function setRewardAddresses(address founderInput, address developerInput, address rewardsInput){ if (msg.sender != owner) throw; if (rewardAddressesSet) throw; founder = founderInput; developer = developerInput; rewards = rewardsInput; rewardAddressesSet = true; } function price() constant returns(uint) { if (block.number>=startBlock && block.number<startBlock+250) return 125; //power hour if (block.numberendBlock) return 75; //default price return 75 + 4*(endBlock - block.number)/(endBlock - startBlock + 1)*34/4; //crowdsale price } // price() exposed for unit tests function testPrice(uint blockNumber) constant returns(uint) { if (blockNumber>=startBlock && blockNumber<startBlock+250) return 125; //power hour if (blockNumberendBlock) return 75; //default price return 75 + 4*(endBlock - blockNumber)/(endBlock - startBlock + 1)*34/4; //crowdsale price } // // Buy entry point function buy() { buyRecipient(msg.sender); } /** * Main token buy function. * * Security review * * - Integer math: ok - using SafeMath * * - halt flag added - ok * * Applicable tests: * * - Test halting, buying, and failing * - Test buying on behalf of a recipient * - Test buy * - Test unhalting, buying, and succeeding * - Test buying after the sale ends * */ function buyRecipient(address recipient) { if (block.numberendBlock || safeAdd(presaleEtherRaised,msg.value)>etherCap || halted) throw; uint tokens = safeMul(msg.value, price()); balances[recipient] = safeAdd(balances[recipient], tokens); totalSupply = safeAdd(totalSupply, tokens); presaleEtherRaised = safeAdd(presaleEtherRaised, msg.value); if (!multisig.send(msg.value)) throw; //immediately send Ether to multisig address // if etherCap is reached - activate the market if (presaleEtherRaised == etherCap && !marketactive){ marketactive = true; } Buy(recipient, msg.value, tokens); } /** * Set up founder address token balance. * * allocateBountyAndEcosystemTokens() must be calld first. * * Security review * * - Integer math: ok - only called once with fixed parameters * * Applicable tests: * * - Test bounty and ecosystem allocation * - Test bounty and ecosystem allocation twice * */ function allocateTokens() { // make sure founder/developer/rewards addresses are configured if(founder == 0x0 || developer == 0x0 || rewards == 0x0) throw; // owner/founder/developer/rewards addresses can call this function if (msg.sender != owner && msg.sender != founder && msg.sender != developer && msg.sender != rewards ) throw; // it should only continue if endBlock has passed OR presaleEtherRaised has not reached the cap yet if (block.number <= endBlock && presaleEtherRaised < etherCap) throw; if (allocated) throw; presaleTokenSupply = totalSupply; // total token allocations add up to 16% of total coins, so formula is reward=allocation_in_percent/84 . balances[founder] = safeAdd(balances[founder], presaleTokenSupply * founderAllocation / 84 ); totalSupply = safeAdd(totalSupply, presaleTokenSupply * founderAllocation / 84); balances[developer] = safeAdd(balances[developer], presaleTokenSupply * developerAllocation / 84); totalSupply = safeAdd(totalSupply, presaleTokenSupply * developerAllocation / 84); balances[rewards] = safeAdd(balances[rewards], presaleTokenSupply * rewardsAllocation / 84); totalSupply = safeAdd(totalSupply, presaleTokenSupply * rewardsAllocation / 84); allocated = true; } /** * Set up founder address token balance. * * Set up bounty pool. * * Security review * * - Integer math: ok - only called once with fixed parameters * * Applicable tests: * * - Test founder token allocation too early * - Test founder token allocation on time * - Test founder token allocation twice * */ // function allocateBountyAndEcosystemTokens() { // if (msg.sender!=founder) throw; // if (block.number <= endBlock) throw; // if (bountyAllocated || ecosystemAllocated) throw; // presaleTokenSupply = totalSupply; // balances[founder] = safeAdd(balances[founder], presaleTokenSupply * ecosystemAllocation / (1 ether)); // totalSupply = safeAdd(totalSupply, presaleTokenSupply * ecosystemAllocation / (1 ether)); // balances[founder] = safeAdd(balances[founder], bountyAllocation); // totalSupply = safeAdd(totalSupply, bountyAllocation); // bountyAllocated = true; // ecosystemAllocated = true; // AllocateBountyAndEcosystemTokens(msg.sender); // } /** * Emergency Stop crowdsale. * * Applicable tests: * * - Test unhalting, buying, and succeeding */ function halt() { if (msg.sender!=founder && msg.sender != developer) throw; halted = true; } function unhalt() { if (msg.sender!=founder && msg.sender != developer) throw; halted = false; } /** * Change founder address (where crowdsale ETH is being forwarded). * * Applicable tests: * * - Test founder change by hacker * - Test founder change * - Test founder token allocation twice * */ function changeMultisig(address newMultisig) { if (msg.sender!=owner) throw; multisig = newMultisig; } /** * ERC 20 Standard Token interface transfer function * * Prevent transfers until token sale is over. * * Applicable tests: * * - Test transfer after restricted period * - Test transfer after market activated */ function transfer(address _to, uint256 _value) returns (bool success) { if (block.number <= endBlock && marketactive == false) throw; return super.transfer(_to, _value); } /** * ERC 20 Standard Token interface transfer function * * Prevent transfers until token sale is over. */ function transferFrom(address _from, address _to, uint256 _value) returns (bool success) { if (block.number <= endBlock && marketactive == false) throw; return super.transferFrom(_from, _to, _value); } /** * Direct deposits buys tokens */ function() payable { buyRecipient(msg.sender); } } |
Migrations.sol
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 |
contract Migrations { address public owner; uint public last_completed_migration; modifier restricted() { if (msg.sender == owner) _ } function Migrations() { owner = msg.sender; } function setCompleted(uint completed) restricted { last_completed_migration = completed; } function upgrade(address new_address) restricted { Migrations upgraded = Migrations(new_address); upgraded.setCompleted(last_completed_migration); } } |
TokenVesting.sol
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 |
/** * ERC 20 token * * https://github.com/ethereum/EIPs/issues/20 */ contract Token { /// @return total amount of tokens function totalSupply() constant returns (uint256 supply) {} /// @param _owner The address from which the balance will be retrieved /// @return The balance function balanceOf(address _owner) constant returns (uint256 balance) {} /// @notice send `_value` token to `_to` from `msg.sender` /// @param _to The address of the recipient /// @param _value The amount of token to be transferred /// @return Whether the transfer was successful or not function transfer(address _to, uint256 _value) returns (bool success) {} /// @notice send `_value` token to `_to` from `_from` on the condition it is approved by `_from` /// @param _from The address of the sender /// @param _to The address of the recipient /// @param _value The amount of token to be transferred /// @return Whether the transfer was successful or not function transferFrom(address _from, address _to, uint256 _value) returns (bool success) {} /// @notice `msg.sender` approves `_addr` to spend `_value` tokens /// @param _spender The address of the account able to transfer the tokens /// @param _value The amount of wei to be approved for transfer /// @return Whether the approval was successful or not function approve(address _spender, uint256 _value) returns (bool success) {} /// @param _owner The address of the account owning tokens /// @param _spender The address of the account able to transfer the tokens /// @return Amount of remaining tokens allowed to spent function allowance(address _owner, address _spender) constant returns (uint256 remaining) {} event Transfer(address indexed _from, address indexed _to, uint256 _value); event Approval(address indexed _owner, address indexed _spender, uint256 _value); } /** * ERC 20 token * * https://github.com/ethereum/EIPs/issues/20 */ contract StandardToken is Token { /** * Reviewed: * - Interger overflow = OK, checked */ function transfer(address _to, uint256 _value) returns (bool success) { //Default assumes totalSupply can't be over max (2^256 - 1). //If your token leaves out totalSupply and can issue more tokens as time goes on, you need to check if it doesn't wrap. //Replace the if with this one instead. if (balances[msg.sender] >= _value && balances[_to] + _value > balances[_to]) { //if (balances[msg.sender] >= _value && _value > 0) { balances[msg.sender] -= _value; balances[_to] += _value; Transfer(msg.sender, _to, _value); return true; } else { return false; } } function transferFrom(address _from, address _to, uint256 _value) returns (bool success) { //same as above. Replace this line with the following if you want to protect against wrapping uints. if (balances[_from] >= _value && allowed[_from][msg.sender] >= _value && balances[_to] + _value > balances[_to]) { //if (balances[_from] >= _value && allowed[_from][msg.sender] >= _value && _value > 0) { balances[_to] += _value; balances[_from] -= _value; allowed[_from][msg.sender] -= _value; Transfer(_from, _to, _value); return true; } else { return false; } } function balanceOf(address _owner) constant returns (uint256 balance) { return balances[_owner]; } function approve(address _spender, uint256 _value) returns (bool success) { allowed[msg.sender][_spender] = _value; Approval(msg.sender, _spender, _value); return true; } function allowance(address _owner, address _spender) constant returns (uint256 remaining) { return allowed[_owner][_spender]; } mapping(address => uint256) balances; mapping (address => mapping (address => uint256)) allowed; uint256 public totalSupply; } /* Token Vesting contract A vesting contract that holds ERC20 coins and vests them over time. (start) >>>freezePeriod>>>(initalAmount released) >>>period>>>(amount released) >>>period>>>(amount released) (this repeats until my coinbalance < amount ) >>>period>>>() (end) example: TokenVesting(, 40000, 30 , 2000, 10, ) waits 40000 blocks to release the first 30 tokens ( by calling initial() ) then waits 2000 blocks to release 10 tokens ( by calling vest() ) ..etc.. */ contract TokenVesting { address public tokenRecepient; // recepient of the tokens uint public freezePeriod; // # blocks to wait before enable initial vesting uint public initialAmount; // tokens released at initial vesting ( in percent ) uint public amount; // tokens that can be vested in each period ( in percent ) uint public period; // length of period ( in blocks ) uint256 public initialVestAmount; uint256 public vestAmount; uint public vestingStartBlock; // blocknumber where recepient activated the contract uint public initialVestingBlock; // blocknumner where initial vestig occured uint public nextVestingBlock; // blocknumber where next vesting can occur StandardToken token; event Vested(uint256 amount); function TokenVesting(address _tokenRecepient, uint _freezePeriod, uint _initialAmount, uint _period, uint _amount,address _tokenContract){ // percentages should be between 0 and 100 inclusive if (_initialAmount == 0 || _amount == 0 || _initialAmount > 100 || _amount > 100) throw; tokenRecepient = _tokenRecepient; initialAmount = _initialAmount; freezePeriod = _freezePeriod; amount = _amount; period = _period; token = StandardToken(_tokenContract); } // Activate the vesting - aka start the frozenblocks countdown function activate(){ // you can only activate the vesting contract ( aka start the freeze period ) // when there is a token balance on this contract if (token.balanceOf(this) <= 0) throw; if (msg.sender != tokenRecepient) throw; if (nextVestingBlock != 0x0) throw; nextVestingBlock = block.number + freezePeriod; initialVestAmount = token.balanceOf(this) * initialAmount / 100; vestAmount = token.balanceOf(this) * amount / 100; } // request initial vesting function initial(){ // only recepient can request if (msg.sender != tokenRecepient) throw; // did you already call the initial vesting function ? if (initialVestingBlock != 0x0) throw; // check if it's not too early for the initial vesting to occur ? if (nextVestingBlock > block.number) throw; // send tokens and set next vesting block initialVestingBlock = block.number; nextVestingBlock = block.number + period; sendTokens(initialVestAmount); } function vest(){ if (msg.sender != tokenRecepient) throw; if (initialVestingBlock == 0x0) throw; if (nextVestingBlock > block.number) throw; sendTokens(vestAmount); nextVestingBlock = block.number + period; } function sendTokens(uint256 _amount) private { uint256 vestAmount = _amount; if (token.balanceOf(this) < _amount ) { // only send remaining tokens ( rounding errors ) vestAmount = token.balanceOf(this); } // send '_amount' tokens token.transfer(tokenRecepient,vestAmount); Vested(vestAmount); } } |
TokenVestingTestToken.sol
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 |
/** * Overflow aware uint math functions. * * Inspired by https://github.com/MakerDAO/maker-otc/blob/master/contracts/simple_market.sol */ contract SafeMath { //internals function safeMul(uint a, uint b) internal returns (uint) { uint c = a * b; assert(a == 0 || c / a == b); return c; } function safeSub(uint a, uint b) internal returns (uint) { assert(b <= a); return a - b; } function safeAdd(uint a, uint b) internal returns (uint) { uint c = a + b; assert(c>=a && c>=b); return c; } function assert(bool assertion) internal { if (!assertion) throw; } } /** * ERC 20 token * * https://github.com/ethereum/EIPs/issues/20 */ contract Token { /// @return total amount of tokens function totalSupply() constant returns (uint256 supply) {} /// @param _owner The address from which the balance will be retrieved /// @return The balance function balanceOf(address _owner) constant returns (uint256 balance) {} /// @notice send `_value` token to `_to` from `msg.sender` /// @param _to The address of the recipient /// @param _value The amount of token to be transferred /// @return Whether the transfer was successful or not function transfer(address _to, uint256 _value) returns (bool success) {} /// @notice send `_value` token to `_to` from `_from` on the condition it is approved by `_from` /// @param _from The address of the sender /// @param _to The address of the recipient /// @param _value The amount of token to be transferred /// @return Whether the transfer was successful or not function transferFrom(address _from, address _to, uint256 _value) returns (bool success) {} /// @notice `msg.sender` approves `_addr` to spend `_value` tokens /// @param _spender The address of the account able to transfer the tokens /// @param _value The amount of wei to be approved for transfer /// @return Whether the approval was successful or not function approve(address _spender, uint256 _value) returns (bool success) {} /// @param _owner The address of the account owning tokens /// @param _spender The address of the account able to transfer the tokens /// @return Amount of remaining tokens allowed to spent function allowance(address _owner, address _spender) constant returns (uint256 remaining) {} event Transfer(address indexed _from, address indexed _to, uint256 _value); event Approval(address indexed _owner, address indexed _spender, uint256 _value); } /** * ERC 20 token * * https://github.com/ethereum/EIPs/issues/20 */ contract StandardToken is Token { /** * Reviewed: * - Interger overflow = OK, checked */ function transfer(address _to, uint256 _value) returns (bool success) { //Default assumes totalSupply can't be over max (2^256 - 1). //If your token leaves out totalSupply and can issue more tokens as time goes on, you need to check if it doesn't wrap. //Replace the if with this one instead. if (balances[msg.sender] >= _value && balances[_to] + _value > balances[_to]) { //if (balances[msg.sender] >= _value && _value > 0) { balances[msg.sender] -= _value; balances[_to] += _value; Transfer(msg.sender, _to, _value); return true; } else { return false; } } function transferFrom(address _from, address _to, uint256 _value) returns (bool success) { //same as above. Replace this line with the following if you want to protect against wrapping uints. if (balances[_from] >= _value && allowed[_from][msg.sender] >= _value && balances[_to] + _value > balances[_to]) { //if (balances[_from] >= _value && allowed[_from][msg.sender] >= _value && _value > 0) { balances[_to] += _value; balances[_from] -= _value; allowed[_from][msg.sender] -= _value; Transfer(_from, _to, _value); return true; } else { return false; } } function balanceOf(address _owner) constant returns (uint256 balance) { return balances[_owner]; } function approve(address _spender, uint256 _value) returns (bool success) { allowed[msg.sender][_spender] = _value; Approval(msg.sender, _spender, _value); return true; } function allowance(address _owner, address _spender) constant returns (uint256 remaining) { return allowed[_owner][_spender]; } mapping(address => uint256) balances; mapping (address => mapping (address => uint256)) allowed; uint256 public totalSupply; } contract TokenVestingTestToken is StandardToken,SafeMath { function TokenVestingTestToken(){ } // mint tokens for testing vesting these tokens afterwards function mintToken(address recipient,uint _amount){ balances[recipient] = safeAdd(balances[recipient], _amount); } // do nothing function noop(){ } } |
Wallet.sol
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 |
//sol Wallet // Multi-sig, daily-limited account proxy/wallet. // @authors: // Gav Wood <g@ethdev.com> // inheritable "property" contract that enables methods to be protected by requiring the acquiescence of either a // single, or, crucially, each of a number of, designated owners. // usage: // use modifiers onlyowner (just own owned) or onlymanyowners(hash), whereby the same hash must be provided by // some number (specified in constructor) of the set of owners (specified in the constructor, modifiable) before the // interior is executed. contract multiowned { // TYPES // struct for the status of a pending operation. struct PendingState { uint yetNeeded; uint ownersDone; uint index; } // EVENTS // this contract only has six types of events: it can accept a confirmation, in which case // we record owner and operation (hash) alongside it. event Confirmation(address owner, bytes32 operation); event Revoke(address owner, bytes32 operation); // some others are in the case of an owner changing. event OwnerChanged(address oldOwner, address newOwner); event OwnerAdded(address newOwner); event OwnerRemoved(address oldOwner); // the last one is emitted if the required signatures change event RequirementChanged(uint newRequirement); // MODIFIERS // simple single-sig function modifier. modifier onlyowner { if (isOwner(msg.sender)) _ } // multi-sig function modifier: the operation must have an intrinsic hash in order // that later attempts can be realised as the same underlying operation and // thus count as confirmations. modifier onlymanyowners(bytes32 _operation) { if (confirmAndCheck(_operation)) _ } // METHODS // constructor is given number of sigs required to do protected "onlymanyowners" transactions // as well as the selection of addresses capable of confirming them. function multiowned(address[] _owners, uint _required) { m_numOwners = _owners.length + 1; m_owners[1] = uint(msg.sender); m_ownerIndex[uint(msg.sender)] = 1; for (uint i = 0; i < _owners.length; ++i) { m_owners[2 + i] = uint(_owners[i]); m_ownerIndex[uint(_owners[i])] = 2 + i; } m_required = _required; } // Revokes a prior confirmation of the given operation function revoke(bytes32 _operation) external { uint ownerIndex = m_ownerIndex[uint(msg.sender)]; // make sure they're an owner if (ownerIndex == 0) return; uint ownerIndexBit = 2**ownerIndex; var pending = m_pending[_operation]; if (pending.ownersDone & ownerIndexBit > 0) { pending.yetNeeded++; pending.ownersDone -= ownerIndexBit; Revoke(msg.sender, _operation); } } // Replaces an owner `_from` with another `_to`. function changeOwner(address _from, address _to) onlymanyowners(sha3(msg.data)) external { if (isOwner(_to)) return; uint ownerIndex = m_ownerIndex[uint(_from)]; if (ownerIndex == 0) return; clearPending(); m_owners[ownerIndex] = uint(_to); m_ownerIndex[uint(_from)] = 0; m_ownerIndex[uint(_to)] = ownerIndex; OwnerChanged(_from, _to); } function addOwner(address _owner) onlymanyowners(sha3(msg.data)) external { if (isOwner(_owner)) return; clearPending(); if (m_numOwners >= c_maxOwners) reorganizeOwners(); if (m_numOwners >= c_maxOwners) return; m_numOwners++; m_owners[m_numOwners] = uint(_owner); m_ownerIndex[uint(_owner)] = m_numOwners; OwnerAdded(_owner); } function removeOwner(address _owner) onlymanyowners(sha3(msg.data)) external { uint ownerIndex = m_ownerIndex[uint(_owner)]; if (ownerIndex == 0) return; if (m_required > m_numOwners - 1) return; m_owners[ownerIndex] = 0; m_ownerIndex[uint(_owner)] = 0; clearPending(); reorganizeOwners(); //make sure m_numOwner is equal to the number of owners and always points to the optimal free slot OwnerRemoved(_owner); } function changeRequirement(uint _newRequired) onlymanyowners(sha3(msg.data)) external { if (_newRequired > m_numOwners) return; m_required = _newRequired; clearPending(); RequirementChanged(_newRequired); } // Gets an owner by 0-indexed position (using numOwners as the count) function getOwner(uint ownerIndex) external constant returns (address) { return address(m_owners[ownerIndex + 1]); } function isOwner(address _addr) returns (bool) { return m_ownerIndex[uint(_addr)] > 0; } function hasConfirmed(bytes32 _operation, address _owner) constant returns (bool) { var pending = m_pending[_operation]; uint ownerIndex = m_ownerIndex[uint(_owner)]; // make sure they're an owner if (ownerIndex == 0) return false; // determine the bit to set for this owner. uint ownerIndexBit = 2**ownerIndex; return !(pending.ownersDone & ownerIndexBit == 0); } // INTERNAL METHODS function confirmAndCheck(bytes32 _operation) internal returns (bool) { // determine what index the present sender is: uint ownerIndex = m_ownerIndex[uint(msg.sender)]; // make sure they're an owner if (ownerIndex == 0) return; var pending = m_pending[_operation]; // if we're not yet working on this operation, switch over and reset the confirmation status. if (pending.yetNeeded == 0) { // reset count of confirmations needed. pending.yetNeeded = m_required; // reset which owners have confirmed (none) - set our bitmap to 0. pending.ownersDone = 0; pending.index = m_pendingIndex.length++; m_pendingIndex[pending.index] = _operation; } // determine the bit to set for this owner. uint ownerIndexBit = 2**ownerIndex; // make sure we (the message sender) haven't confirmed this operation previously. if (pending.ownersDone & ownerIndexBit == 0) { Confirmation(msg.sender, _operation); // ok - check if count is enough to go ahead. if (pending.yetNeeded <= 1) { // enough confirmations: reset and run interior. delete m_pendingIndex[m_pending[_operation].index]; delete m_pending[_operation]; return true; } else { // not enough: record that this owner in particular confirmed. pending.yetNeeded--; pending.ownersDone |= ownerIndexBit; } } } function reorganizeOwners() private { uint free = 1; while (free < m_numOwners) { while (free < m_numOwners && m_owners[free] != 0) free++; while (m_numOwners > 1 && m_owners[m_numOwners] == 0) m_numOwners--; if (free < m_numOwners && m_owners[m_numOwners] != 0 && m_owners[free] == 0) { m_owners[free] = m_owners[m_numOwners]; m_ownerIndex[m_owners[free]] = free; m_owners[m_numOwners] = 0; } } } function clearPending() internal { uint length = m_pendingIndex.length; for (uint i = 0; i < length; ++i) if (m_pendingIndex[i] != 0) delete m_pending[m_pendingIndex[i]]; delete m_pendingIndex; } // FIELDS // the number of owners that must confirm the same operation before it is run. uint public m_required; // pointer used to find a free slot in m_owners uint public m_numOwners; // list of owners uint[256] m_owners; uint constant c_maxOwners = 250; // index on the list of owners to allow reverse lookup mapping(uint => uint) m_ownerIndex; // the ongoing operations. mapping(bytes32 => PendingState) m_pending; bytes32[] m_pendingIndex; } // inheritable "property" contract that enables methods to be protected by placing a linear limit (specifiable) // on a particular resource per calendar day. is multiowned to allow the limit to be altered. resource that method // uses is specified in the modifier. contract daylimit is multiowned { // MODIFIERS // simple modifier for daily limit. modifier limitedDaily(uint _value) { if (underLimit(_value)) _ } // METHODS // constructor - stores initial daily limit and records the present day's index. function daylimit(uint _limit) { m_dailyLimit = _limit; m_lastDay = today(); } // (re)sets the daily limit. needs many of the owners to confirm. doesn't alter the amount already spent today. function setDailyLimit(uint _newLimit) onlymanyowners(sha3(msg.data)) external { m_dailyLimit = _newLimit; } // resets the amount already spent today. needs many of the owners to confirm. function resetSpentToday() onlymanyowners(sha3(msg.data)) external { m_spentToday = 0; } // INTERNAL METHODS // checks to see if there is at least `_value` left from the daily limit today. if there is, subtracts it and // returns true. otherwise just returns false. function underLimit(uint _value) internal onlyowner returns (bool) { // reset the spend limit if we're on a different day to last time. if (today() > m_lastDay) { m_spentToday = 0; m_lastDay = today(); } // check to see if there's enough left - if so, subtract and return true. // overflow protection // dailyLimit check if (m_spentToday + _value >= m_spentToday && m_spentToday + _value <= m_dailyLimit) { m_spentToday += _value; return true; } return false; } // determines today's index. function today() private constant returns (uint) { return now / 1 days; } // FIELDS uint public m_dailyLimit; uint public m_spentToday; uint public m_lastDay; } // interface contract for multisig proxy contracts; see below for docs. contract multisig { // EVENTS // logged events: // Funds has arrived into the wallet (record how much). event Deposit(address _from, uint value); // Single transaction going out of the wallet (record who signed for it, how much, and to whom it's going). event SingleTransact(address owner, uint value, address to, bytes data); // Multi-sig transaction going out of the wallet (record who signed for it last, the operation hash, how much, and to whom it's going). event MultiTransact(address owner, bytes32 operation, uint value, address to, bytes data); // Confirmation still needed for a transaction. event ConfirmationNeeded(bytes32 operation, address initiator, uint value, address to, bytes data); // FUNCTIONS // TODO: document function changeOwner(address _from, address _to) external; function execute(address _to, uint _value, bytes _data) external returns (bytes32); function confirm(bytes32 _h) returns (bool); } // usage: // bytes32 h = Wallet(w).from(oneOwner).execute(to, value, data); // Wallet(w).from(anotherOwner).confirm(h); contract Wallet is multisig, multiowned, daylimit { // TYPES // Transaction structure to remember details of transaction lest it need be saved for a later call. struct Transaction { address to; uint value; bytes data; } // METHODS // constructor - just pass on the owner array to the multiowned and // the limit to daylimit function Wallet(address[] _owners, uint _required, uint _daylimit) multiowned(_owners, _required) daylimit(_daylimit) { } // kills the contract sending everything to `_to`. function kill(address _to) onlymanyowners(sha3(msg.data)) external { suicide(_to); } // gets called when no other function matches function() { // just being sent some cash? if (msg.value > 0) Deposit(msg.sender, msg.value); } // Outside-visible transact entry point. Executes transaction immediately if below daily spend limit. // If not, goes into multisig process. We provide a hash on return to allow the sender to provide // shortcuts for the other confirmations (allowing them to avoid replicating the _to, _value // and _data arguments). They still get the option of using them if they want, anyways. function execute(address _to, uint _value, bytes _data) external onlyowner returns (bytes32 _r) { // first, take the opportunity to check that we're under the daily limit. if (underLimit(_value)) { SingleTransact(msg.sender, _value, _to, _data); // yes - just execute the call. _to.call.value(_value)(_data); return 0; } // determine our operation hash. _r = sha3(msg.data, block.number); if (!confirm(_r) && m_txs[_r].to == 0) { m_txs[_r].to = _to; m_txs[_r].value = _value; m_txs[_r].data = _data; ConfirmationNeeded(_r, msg.sender, _value, _to, _data); } } // confirm a transaction through just the hash. we use the previous transactions map, m_txs, in order // to determine the body of the transaction from the hash provided. function confirm(bytes32 _h) onlymanyowners(_h) returns (bool) { if (m_txs[_h].to != 0) { m_txs[_h].to.call.value(m_txs[_h].value)(m_txs[_h].data); MultiTransact(msg.sender, _h, m_txs[_h].value, m_txs[_h].to, m_txs[_h].data); delete m_txs[_h]; return true; } } // INTERNAL METHODS function clearPending() internal { uint length = m_pendingIndex.length; for (uint i = 0; i < length; ++i) delete m_txs[m_pendingIndex[i]]; super.clearPending(); } // FIELDS // pending transactions we have at present. mapping (bytes32 => Transaction) m_txs; } |