Contract 0x621833db8F45eDefF0366DE74Ec00Bb7acD9ebb5

Contract Overview

Balance:
0 MATIC
Txn Hash Method
Block
From
To
Value [Txn Fee]
0x9a37ae971964acbb17ab3c12efa1c65f2a93d6002ca9c2f667a8229e1e722a820x60806040239114912022-01-15 11:38:2013 days 7 hrs ago0x938323b4fcbcd564332e7b3392dd07b7ec755e49 IN  Create: CampaignFactory0 MATIC0.002268122507 2.500000008
[ Download CSV Export 
Parent Txn Hash Block From To Value
Loading

Contract Source Code Verified (Exact Match)

Contract Name:
CampaignFactory

Compiler Version
v0.4.26+commit.4563c3fc

Optimization Enabled:
No with 200 runs

Other Settings:
default evmVersion, None license

Contract Source Code (Solidity Multiple files format)

File 1 of 2: CampaignFactory.sol
pragma solidity ^0.4.17;

import './Campaign.sol';

contract CampaignFactory { 
    address[] public deployedCampaigns;

    function createCampaign(uint minimum) public {
        address newCampaign = new Campaign(minimum, msg.sender);
        deployedCampaigns.push(newCampaign);
    }

    function getDeployedCampaigns() public view returns (address[]) {
        return deployedCampaigns;
    }
}

File 2 of 2: Campaign.sol
pragma solidity ^0.4.17;

contract Campaign {
    struct Request {
        string description;
        uint value;
        address recipient;
        bool complete;
        uint approvalCount;
        mapping(address => bool) approvals;
    }

    Request[] public requests;
    address public manager;
    uint public minimumContribution;
    mapping(address => bool) public approvers;
    uint public approversCount;

    modifier restricted() {
        require(msg.sender == manager);
        _;
    }

    constructor(uint minimum, address creator) public {
        manager = creator;
        minimumContribution = minimum;
    }

    function contribute() public payable {
        require(msg.value > minimumContribution);

        approvers[msg.sender] = true;
        approversCount++;
    }

    function createRequest(string description, uint value, address recipient) public restricted {
        Request memory newRequest = Request({
           description: description,
           value: value,
           recipient: recipient,
           complete: false,
           approvalCount: 0
        });

        requests.push(newRequest);
    }

    function approveRequest(uint index) public {
        Request storage request = requests[index];

        require(approvers[msg.sender]);
        require(!request.approvals[msg.sender]);

        request.approvals[msg.sender] = true;
        request.approvalCount++;
    }

    function finalizeRequest(uint index) public restricted {
        Request storage request = requests[index];

        require(request.approvalCount > (approversCount / 2));
        require(!request.complete);

        request.recipient.transfer(request.value);
        request.complete = true;
    }

    function getSummary() public view returns(
        uint, uint, uint, uint, address
    ) {
        return (
            minimumContribution,
            this.balance,
            requests.length,
            approversCount,
            manager
        );
    }

    function getRequestsCount() public view returns (uint){
        return requests.length;
    }
}

Contract ABI

[{"constant":true,"inputs":[{"name":"","type":"uint256"}],"name":"deployedCampaigns","outputs":[{"name":"","type":"address"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"getDeployedCampaigns","outputs":[{"name":"","type":"address[]"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":false,"inputs":[{"name":"minimum","type":"uint256"}],"name":"createCampaign","outputs":[],"payable":false,"stateMutability":"nonpayable","type":"function"}]

608060405234801561001057600080fd5b50610f79806100206000396000f300608060405260043610610057576000357c0100000000000000000000000000000000000000000000000000000000900463ffffffff168063339d50a51461005c5780634acb9d4f146100c9578063a3303a7514610135575b600080fd5b34801561006857600080fd5b5061008760048036038101908080359060200190929190505050610162565b604051808273ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200191505060405180910390f35b3480156100d557600080fd5b506100de6101a0565b6040518080602001828103825283818151815260200191508051906020019060200280838360005b83811015610121578082015181840152602081019050610106565b505050509050019250505060405180910390f35b34801561014157600080fd5b506101606004803603810190808035906020019092919050505061022e565b005b60008181548110151561017157fe5b906000526020600020016000915054906101000a900473ffffffffffffffffffffffffffffffffffffffff1681565b6060600080548060200260200160405190810160405280929190818152602001828054801561022457602002820191906000526020600020905b8160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190600101908083116101da575b5050505050905090565b6000813361023a610300565b808381526020018273ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200192505050604051809103906000f080158015610293573d6000803e3d6000fd5b50905060008190806001815401808255809150509060018203906000526020600020016000909192909190916101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff160217905550505050565b604051610c3d80610311833901905600608060405234801561001057600080fd5b50604051604080610c3d833981018060405281019080805190602001909291908051906020019092919050505080600160006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff160217905550816002819055505050610ba7806100966000396000f3006080604052600436106100af576000357c0100000000000000000000000000000000000000000000000000000000900463ffffffff16806303441006146100b45780630a144391146100e15780633410452a1461013c5780634051ddac14610167578063481c6a75146101da57806381d12c581461023157806382fde093146103235780638a9cfd551461034e578063937e09b1146103e1578063d7bb99ba1461040c578063d7d1bbdb14610416575b600080fd5b3480156100c057600080fd5b506100df60048036038101908080359060200190929190505050610443565b005b3480156100ed57600080fd5b50610122600480360381019080803573ffffffffffffffffffffffffffffffffffffffff16906020019092919050505061058e565b604051808215151515815260200191505060405180910390f35b34801561014857600080fd5b506101516105ae565b6040518082815260200191505060405180910390f35b34801561017357600080fd5b5061017c6105ba565b604051808681526020018581526020018481526020018381526020018273ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019550505050505060405180910390f35b3480156101e657600080fd5b506101ef61061a565b604051808273ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200191505060405180910390f35b34801561023d57600080fd5b5061025c60048036038101908080359060200190929190505050610640565b60405180806020018681526020018573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200184151515158152602001838152602001828103825287818151815260200191508051906020019080838360005b838110156102e45780820151818401526020810190506102c9565b50505050905090810190601f1680156103115780820380516001836020036101000a031916815260200191505b50965050505050505060405180910390f35b34801561032f57600080fd5b5061033861074a565b6040518082815260200191505060405180910390f35b34801561035a57600080fd5b506103df600480360381019080803590602001908201803590602001908080601f016020809104026020016040519081016040528093929190818152602001838380828437820191505050505050919291929080359060200190929190803573ffffffffffffffffffffffffffffffffffffffff169060200190929190505050610750565b005b3480156103ed57600080fd5b506103f66108c7565b6040518082815260200191505060405180910390f35b6104146108cd565b005b34801561042257600080fd5b5061044160048036038101908080359060200190929190505050610949565b005b6000600160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff161415156104a157600080fd5b6000828154811015156104b057fe5b9060005260206000209060050201905060026004548115156104ce57fe5b0481600301541115156104e057600080fd5b8060020160149054906101000a900460ff161515156104fe57600080fd5b8060020160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff166108fc82600101549081150290604051600060405180830381858888f1935050505015801561056c573d6000803e3d6000fd5b5060018160020160146101000a81548160ff0219169083151502179055505050565b60036020528060005260406000206000915054906101000a900460ff1681565b60008080549050905090565b60008060008060006002543073ffffffffffffffffffffffffffffffffffffffff1631600080549050600454600160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff16945094509450945094509091929394565b600160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1681565b60008181548110151561064f57fe5b9060005260206000209060050201600091509050806000018054600181600116156101000203166002900480601f0160208091040260200160405190810160405280929190818152602001828054600181600116156101000203166002900480156106fb5780601f106106d0576101008083540402835291602001916106fb565b820191906000526020600020905b8154815290600101906020018083116106de57829003601f168201915b5050505050908060010154908060020160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff16908060020160149054906101000a900460ff16908060030154905085565b60045481565b610758610a8e565b600160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff161415156107b457600080fd5b60a0604051908101604052808581526020018481526020018373ffffffffffffffffffffffffffffffffffffffff16815260200160001515815260200160008152509050600081908060018154018082558091505090600182039060005260206000209060050201600090919290919091506000820151816000019080519060200190610842929190610ad6565b506020820151816001015560408201518160020160006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff16021790555060608201518160020160146101000a81548160ff0219169083151502179055506080820151816003015550505050505050565b60025481565b600254341115156108dd57600080fd5b6001600360003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060006101000a81548160ff021916908315150217905550600460008154809291906001019190505550565b6000808281548110151561095957fe5b90600052602060002090600502019050600360003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff1615156109c157600080fd5b8060040160003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff16151515610a1c57600080fd5b60018160040160003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060006101000a81548160ff02191690831515021790555080600301600081548092919060010191905055505050565b60a0604051908101604052806060815260200160008152602001600073ffffffffffffffffffffffffffffffffffffffff168152602001600015158152602001600081525090565b828054600181600116156101000203166002900490600052602060002090601f016020900481019282601f10610b1757805160ff1916838001178555610b45565b82800160010185558215610b45579182015b82811115610b44578251825591602001919060010190610b29565b5b509050610b529190610b56565b5090565b610b7891905b80821115610b74576000816000905550600101610b5c565b5090565b905600a165627a7a72305820e6ea19e0bfd53554010adb3c9a3863bc0bf41801d6089d16de5776abd9bc4cf10029a165627a7a72305820b65ab494d4ca9be9725336477c4b16002aa48904bdacda7bfe86ff15820a23e80029

Deployed ByteCode Sourcemap

52:348:1:-;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;84:34;;8:9:-1;5:2;;;30:1;27;20:12;5:2;84:34:1;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;293:105;;8:9:-1;5:2;;;30:1;27;20:12;5:2;293:105:1;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;23:1:-1;8:100;33:3;30:1;27:10;8:100;;;99:1;94:3;90:11;84:18;80:1;75:3;71:11;64:39;52:2;49:1;45:10;40:15;;8:100;;;12:14;293:105:1;;;;;;;;;;;;;;;;;125:162;;8:9:-1;5:2;;;30:1;27;20:12;5:2;125:162:1;;;;;;;;;;;;;;;;;;;;;;;;;;84:34;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;:::o;293:105::-;346:9;374:17;367:24;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;293:105;:::o;125:162::-;180:19;215:7;224:10;202:33;;:::i;:::-;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;8:9:-1;5:2;;;45:16;42:1;39;24:38;77:16;74:1;67:27;5:2;202:33:1;180:55;;245:17;268:11;245:35;;39:1:-1;33:3;27:10;23:18;57:10;52:3;45:23;79:10;72:17;;0:93;245:35:1;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;125:162;;:::o;52:348::-;;;;;;;;;;:::o

Swarm Source

bzzr://b65ab494d4ca9be9725336477c4b16002aa48904bdacda7bfe86ff15820a23e8
Block Transaction Gas Used Reward
Age Block Fee Address BC Fee Address Voting Power Jailed Incoming
Block Uncle Number Difficulty Gas Used Reward
Loading