Skip to content

Instantly share code, notes, and snippets.

pragma solidity ^0.4.24;
contract BountyFactory {
address[] bounties;
function createBounty(bytes32 _reference, uint _deadline) external payable {
address newBounty = (new Bounty).value(msg.value)(_reference, msg.sender, _deadline, msg.value);
bounties.push(newBounty);
}
@kyriediculous
kyriediculous / bounties-monolith.sol
Last active August 21, 2018 13:37
Bounties-Monolith
pragma solidity ^0.4.24;
contract Bounties {
enum statusOptions {ACTIVE, COMPLETED, ABANDONED}
struct Bounty {
bytes32 reference;
address issuer;
uint timestamp;
uint deadline;
uint reward;
pragma solidity ^0.4.19;
import './CMCEnabled.sol';
contract Storage is CMCEnabled {
uint public x;
function setX(uint _x) external isCMCEnabled("Storage") {
x = _x;
pragma solidity ^0.4.19;
import './CMCEnabled.sol';
import './Ownable.sol';
contract CMC is Ownable {
mapping (bytes32 => address) public contracts;
function addContract(bytes32 _name, address _address) external onlyOwner {
CMCEnabled _CMCEnabled = CMCEnabled(_address);
pragma solidity ^0.4.19;
interface ContractProvider {
function contracts(bytes32 _name) external returns (address);
}
pragma solidity ^0.4.19;
import './ContractProvider.sol';
/**
* Base class for every contract (DB, Controller, ALC,)
* Once the CMC address being used by our newly added contract is set it can not be set again except by our CMC contract
**/
contract CMCEnabled {
<template>
<div class='metamask-info'>
<p v-if="isInjected" id="has-metamask"><i aria-hidden="true" class="fa fa-check"></i> Metamask installed</p>
<p v-else id="no-metamask"><i aria-hidden="true" class="fa fa-times"></i> Metamask not found</p>
<p>Network: {{ network }}</p>
<p>Account: {{ coinbase }}</p>
<p>Balance: {{ balance }} Wei </p>
</div>
</template>
methods: {
clickNumber (event) {
console.log(event.target.innerHTML, this.amount)
this.winEvent = null
this.pending = true
this.$store.state.contractInstance().bet(event.target.innerHTML, {
gas: 300000,
value: this.$store.state.web3.web3Instance().toWei(this.amount, 'ether'),
from: this.$store.state.web3.coinbase
}, (err, result) => {
import Web3 from 'web3'
import {store} from '../store/'
let pollWeb3 = function (state) {
let web3 = window.web3
web3 = new Web3(web3.currentProvider)
setInterval(() => {
if (web3 && store.state.web3.web3Instance) {
if (web3.eth.coinbase !== store.state.web3.coinbase) {
import Web3 from 'web3'
/*
* 1. Check for injected web3 (mist/metamask)
* 2. If metamask/mist create a new web3 instance and pass on result
* 3. Get networkId - Now we can check the user is connected to the right network to use our dApp
* 4. Get user account from metamask
* 5. Get user balance
*/