ETH Price: $3,417.55 (+3.18%)

Contract

0xbA9d387b05d652B147ee808419037139fcE580C6
 

Overview

ETH Balance

0 ETH

Eth Value

$0.00

Multichain Info

No addresses found
Transaction Hash
Method
Block
From
To

There are no matching entries

Please try again later

Latest 13 internal transactions

Advanced mode:
Parent Transaction Hash Block From To
172221052023-05-09 9:48:47564 days ago1683625727
0xbA9d387b...9fcE580C6
 Contract Creation0 ETH
167532242023-03-04 6:11:23630 days ago1677910283
0xbA9d387b...9fcE580C6
 Contract Creation0 ETH
166055742023-02-11 12:39:47651 days ago1676119187
0xbA9d387b...9fcE580C6
 Contract Creation0 ETH
165761902023-02-07 10:04:35655 days ago1675764275
0xbA9d387b...9fcE580C6
 Contract Creation0 ETH
160259972022-11-22 13:59:11732 days ago1669125551
0xbA9d387b...9fcE580C6
 Contract Creation0 ETH
159820562022-11-16 10:41:23738 days ago1668595283
0xbA9d387b...9fcE580C6
 Contract Creation0 ETH
159811432022-11-16 7:38:11738 days ago1668584291
0xbA9d387b...9fcE580C6
 Contract Creation0 ETH
153645002022-08-18 10:35:56828 days ago1660818956
0xbA9d387b...9fcE580C6
 Contract Creation0 ETH
148408992022-05-25 8:42:43913 days ago1653468163
0xbA9d387b...9fcE580C6
 Contract Creation0 ETH
148247252022-05-22 17:42:18915 days ago1653241338
0xbA9d387b...9fcE580C6
 Contract Creation0 ETH
143617342022-03-10 22:13:26988 days ago1646950406
0xbA9d387b...9fcE580C6
 Contract Creation0 ETH
142240052022-02-17 13:47:291010 days ago1645105649
0xbA9d387b...9fcE580C6
 Contract Creation0 ETH
142238772022-02-17 13:20:411010 days ago1645104041  Contract Creation0 ETH
Loading...
Loading

Similar Match Source Code
This contract matches the deployed Bytecode of the Source Code for Contract 0x497a9487...3Ae081fBe
The constructor portion of the code might be different and could alter the actual behaviour of the contract

Contract Name:
SubDAO

Compiler Version
v0.8.6+commit.11564f7e

Optimization Enabled:
Yes with 200 runs

Other Settings:
default evmVersion
File 1 of 18 : SubDAO.sol
// SPDX-License-Identifier: MIT
pragma solidity >=0.7.0;

import "../model/ISubDAO.sol";
import "../../../core/impl/Organization.sol";
import "../../../base/model/IProposalsManager.sol";
import { AddressUtilities, ReflectionUtilities, Bytes32Utilities } from "@ethereansos/swissknife/contracts/lib/GeneralUtilities.sol";
import { Getters } from "../../../base/lib/KnowledgeBase.sol";

contract SubDAO is ISubDAO, Organization {
    using ReflectionUtilities for address;
    using Getters for IOrganization;
    using Bytes32Utilities for bytes32;
    using AddressUtilities for address;

    mapping(bytes32 => bytes) private _ballotData;
    mapping(bytes32 => bytes32) private _ballotOptions;

    SubDAOProposalModel[] private _proposalModels;

    uint256 public override presetArrayMaxSize;

    bool private _initToBeFinalized;

    bool internal _firstProposalSet;

    mapping(bytes32 => bool) private _persistent;
    mapping(bytes32 => bool) private _deprecated;

    constructor(bytes memory lazyInitData) Organization(lazyInitData) {
    }

    function _dynamicMetadataElementLazyInit(bytes memory lazyInitData) internal virtual override returns(bytes memory lazyInitResponse) {
        (_initToBeFinalized, presetArrayMaxSize, lazyInitResponse) = abi.decode(lazyInitData, (bool, uint256, bytes));
        require(!_initToBeFinalized || host == address(0), "Init to be finalized");
        SubDAOProposalModel[] memory models;
        (models, lazyInitResponse) = abi.decode(lazyInitResponse, (SubDAOProposalModel[], bytes));
        if(models.length > 0) {
            _setProposalModels(models);
        }
        lazyInitResponse = abi.encode(_set(abi.decode(lazyInitResponse, (Component[]))));
    }

    function _dynamicMetadataElementSupportsInterface(bytes4 interfaceId) internal virtual pure override returns(bool) {
        return
            interfaceId == type(ISubDAO).interfaceId ||
            interfaceId == this.proposalModels.selector ||
            interfaceId == this.setProposalModels.selector ||
            interfaceId == this.setVotingRules.selector ||
            super._dynamicMetadataElementSupportsInterface(interfaceId);
    }

    function finalizeInit(address firstHost) external override authorizedOnly {
        _initToBeFinalized = false;
        host = firstHost;
        emit Host(address(0), host);
    }

    function proposalModels() external view override returns(SubDAOProposalModel[] memory) {
        return _proposalModels;
    }

    function setProposalModels(SubDAOProposalModel[] calldata newValue) external override authorizedOnly returns(SubDAOProposalModel[] memory oldValue) {
        return _setProposalModels(newValue);
    }

    function setInitialProposalModels(SubDAOProposalModel[] calldata newValue) external override {
        require(!_firstProposalSet, "already done");
        require(msg.sender == initializer, "unauthorized");
        _setProposalModels(newValue);
    }

    function setVotingRules(uint256 modelIndex, uint256 votingRulesIndex) external override authorizedOnly returns(address[] memory oldCanTerminateAddresses, address[] memory oldValidatorsAddresses) {
        require(modelIndex < _proposalModels.length, "index");
        SubDAOProposalModel storage proposalModel = _proposalModels[modelIndex];
        require(votingRulesIndex < proposalModel.canTerminateAddresses.length, "Invalid rule");
        oldCanTerminateAddresses = proposalModel.canTerminateAddresses[votingRulesIndex];
        oldValidatorsAddresses = proposalModel.validatorsAddresses[votingRulesIndex];
        proposalModel.votingRulesIndex = votingRulesIndex;
    }

    function setCreationAndTriggeringRules(uint256 modelIndex, address newCreationRules, address newTriggeringRules) external override authorizedOnly returns(address oldCreationRules, address oldTriggeringRules) {
        SubDAOProposalModel storage proposalModel = _proposalModels[modelIndex];

        oldCreationRules = proposalModel.creationRules;
        oldTriggeringRules = proposalModel.triggeringRules;

        proposalModel.creationRules = newCreationRules;
        proposalModel.triggeringRules = newTriggeringRules;
    }

    function setPresetValues(uint256 modelIndex, bytes[] memory newPresetValues) external override authorizedOnly returns(bytes[] memory oldPresetValues, bytes32[] memory deprecatedProposalIds) {
        SubDAOProposalModel storage proposalModel = _proposalModels[modelIndex];

        require(proposalModel.isPreset, "Not preset");

        oldPresetValues = proposalModel.presetValues;
        deprecatedProposalIds = proposalModel.presetProposals;

        for(uint256 i = 0; i < deprecatedProposalIds.length; i++) {
            bytes32 proposalId = deprecatedProposalIds[i];
            if(proposalId != bytes32(0)) {
                _deprecated[proposalId] = true;
            }
        }

        proposalModel.presetValues = newPresetValues;
        proposalModel.presetProposals = new bytes32[](newPresetValues.length);
    }

    function isPersistent(bytes32 proposalId) public override view returns(bool result, bool isDeprecated) {
        result = _persistent[proposalId];
        isDeprecated = _deprecated[proposalId];
    }

    function createProposalCodeSequence(bytes32 proposalId, IProposalsManager.ProposalCode[] memory codeSequenceInput, address) external authorizedOnly override virtual returns (address[] memory codeSequence, IProposalsManager.ProposalConfiguration memory localConfiguration) {

        uint256 modelIndex = uint160(codeSequenceInput[0].location);
        bytes memory lazyInitData = codeSequenceInput[0].bytecode;

        require(modelIndex < _proposalModels.length, "Invalid model");

        SubDAOProposalModel storage proposalModel = _proposalModels[modelIndex];

        uint256 presetIndex = 0;
        if(proposalModel.isPreset) {
            require((presetIndex = abi.decode(lazyInitData, (uint256))) < proposalModel.presetValues.length, "Invalid preset");
            require(proposalModel.presetProposals[presetIndex] == bytes32(0), "Preset created");
            proposalModel.presetProposals[presetIndex] = proposalId;
            _persistent[proposalId] = true;
            lazyInitData = proposalModel.presetValues[presetIndex];
        }

        emit Proposed(modelIndex, presetIndex, proposalId);

        codeSequence = proposalModel.source.clone().asSingletonArray();
        lazyInitData = ILazyInitCapableElement(codeSequence[0]).lazyInit(abi.encode(proposalModel.uri, lazyInitData));

        (address[] memory collections, uint256[] memory objectIds, uint256[] memory weights) = lazyInitData.length == 0 ? (new address[](0), new uint256[](0), new uint256[](0)) : abi.decode(lazyInitData, (address[], uint256[], uint256[]));
        localConfiguration = IProposalsManager.ProposalConfiguration(
            collections,
            objectIds,
            weights,
            proposalModel.creationRules,
            proposalModel.triggeringRules,
            proposalModel.canTerminateAddresses[proposalModel.votingRulesIndex],
            proposalModel.validatorsAddresses[proposalModel.votingRulesIndex]
        );
    }

    function proposalCanBeFinalized(bytes32 proposalId, IProposalsManager.Proposal memory, bool validationPassed, bool result) external override view virtual returns (bool) {
        (bool persistent, bool deprecated) = isPersistent(proposalId);
        require(!persistent || !deprecated, "deprecated");
        return !persistent && (!validationPassed || result);
    }

    function isVotable(bytes32 proposalId, IProposalsManager.Proposal memory, address, address, bool) external override view returns (bytes memory) {
        return _persistent[proposalId] ? abi.encode(true) : bytes("");
    }

    function _setProposalModels(SubDAOProposalModel[] memory newValue) private returns(SubDAOProposalModel[] memory oldValue) {
        oldValue = _proposalModels;
        delete _proposalModels;
        for(uint256 i = 0; i < newValue.length; i++) {
            SubDAOProposalModel memory proposalModel = newValue[i];
            proposalModel.presetProposals = new bytes32[](proposalModel.isPreset ? proposalModel.presetValues.length : 0);
            require(proposalModel.isPreset || proposalModel.presetValues.length == 0, "Not preset");
            require(presetArrayMaxSize == 0 || proposalModel.presetValues.length <= presetArrayMaxSize, "Preset length");
            require(proposalModel.canTerminateAddresses.length == 0 || proposalModel.votingRulesIndex < proposalModel.canTerminateAddresses.length, "Voting Rules");
            require(proposalModel.canTerminateAddresses.length == proposalModel.validatorsAddresses.length, "Voting Rules");
            _proposalModels.push(proposalModel);
        }
        _firstProposalSet = true;
    }

    function _subjectIsAuthorizedFor(address subject, address location, bytes4 selector, bytes calldata, uint256) internal virtual override view returns(bool, bool) {
        if(location == address(this) && subject == host ) {
            return (true, true);
        }
        if(location == address(this) && selector == this.finalizeInit.selector) {
            return (true, (host == address(0) && _initToBeFinalized));
        }
        return (true, isActive(subject));
    }
}

File 2 of 18 : KnowledgeBase.sol
// SPDX-License-Identifier: MIT
pragma solidity >=0.7.0;

import "../../core/model/IOrganization.sol";
import "../model/IMicroservicesManager.sol";
import "../model/IStateManager.sol";
import "../model/IProposalsManager.sol";
import "../model/ITreasuryManager.sol";
import { ReflectionUtilities, BytesUtilities } from "@ethereansos/swissknife/contracts/lib/GeneralUtilities.sol";

library Grimoire {
    bytes32 constant public COMPONENT_KEY_TREASURY_MANAGER = 0xcfe1633df53a0649d88d788961f26058c5e7a0b5644675f19f67bb2975827ba2;
    bytes32 constant public COMPONENT_KEY_STATE_MANAGER = 0xd1d09e8f5708558865b8acd5f13c69781ae600e42dbc7f52b8ef1b9e33dbcd36;
    bytes32 constant public COMPONENT_KEY_MICROSERVICES_MANAGER = 0x0aef4c8f864010d3e1817691f51ade95a646fffafd7f3df9cb8200def342cfd7;
    bytes32 constant public COMPONENT_KEY_PROPOSALS_MANAGER = 0xa504406933af7ca120d20b97dfc79ea9788beb3c4d3ac1ff9a2c292b2c28e0cc;
}

library Getters {

    function treasuryManager(IOrganization organization) internal view returns(ITreasuryManager) {
        return ITreasuryManager(organization.get(Grimoire.COMPONENT_KEY_TREASURY_MANAGER));
    }

    function stateManager(IOrganization organization) internal view returns(IStateManager) {
        return IStateManager(organization.get(Grimoire.COMPONENT_KEY_STATE_MANAGER));
    }

    function microservicesManager(IOrganization organization) internal view returns(IMicroservicesManager) {
        return IMicroservicesManager(organization.get(Grimoire.COMPONENT_KEY_MICROSERVICES_MANAGER));
    }

    function proposalsManager(IOrganization organization) internal view returns(IProposalsManager) {
        return IProposalsManager(organization.get(Grimoire.COMPONENT_KEY_PROPOSALS_MANAGER));
    }
}

library Setters {

    function replaceTreasuryManager(IOrganization organization, address newComponentAddress) internal returns(ITreasuryManager oldComponent) {
        require(newComponentAddress != address(0), "void");
        oldComponent = ITreasuryManager(organization.set(IOrganization.Component(Grimoire.COMPONENT_KEY_TREASURY_MANAGER, newComponentAddress, false, true)));
    }

    function replaceStateManager(IOrganization organization, address newComponentAddress) internal returns(IStateManager oldComponent) {
        require(newComponentAddress != address(0), "void");
        oldComponent = IStateManager(organization.set(IOrganization.Component(Grimoire.COMPONENT_KEY_STATE_MANAGER, newComponentAddress, false ,true)));
    }

    function replaceMicroservicesManager(IOrganization organization, address newComponentAddress) internal returns(IMicroservicesManager oldComponent) {
        require(newComponentAddress != address(0), "void");
        oldComponent = IMicroservicesManager(organization.set(IOrganization.Component(Grimoire.COMPONENT_KEY_MICROSERVICES_MANAGER, newComponentAddress, true, true)));
    }

    function replaceProposalsManager(IOrganization organization, address newComponentAddress) internal returns(IProposalsManager oldComponent) {
        require(newComponentAddress != address(0), "void");
        oldComponent = IProposalsManager(organization.set(IOrganization.Component(Grimoire.COMPONENT_KEY_PROPOSALS_MANAGER, newComponentAddress, true, true)));
    }
}

library Treasury {
    using ReflectionUtilities for address;

    function storeETH(IOrganization organization, uint256 value) internal {
        if(value != 0) {
            organization.get(Grimoire.COMPONENT_KEY_TREASURY_MANAGER).submit(value, "");
        }
    }

    function callTemporaryFunction(ITreasuryManager treasuryManager, bytes4 selector, address subject, uint256 value, bytes memory data) internal returns(bytes memory response) {
        address oldServer = treasuryManager.setAdditionalFunction(selector, subject, false);
        response = address(treasuryManager).submit(value, abi.encodePacked(selector, data));
        treasuryManager.setAdditionalFunction(selector, oldServer, false);
    }
}

library State {
    using BytesUtilities for bytes;

    bytes32 constant public ENTRY_TYPE_ADDRESS = 0x421683f821a0574472445355be6d2b769119e8515f8376a1d7878523dfdecf7b;
    bytes32 constant public ENTRY_TYPE_ADDRESS_ARRAY = 0x23d8ff3dc5aed4a634bcf123581c95e70c60ac0e5246916790aef6d4451ff4c1;
    bytes32 constant public ENTRY_TYPE_BOOL = 0xc1053bdab4a5cf55238b667c39826bbb11a58be126010e7db397c1b67c24271b;
    bytes32 constant public ENTRY_TYPE_BOOL_ARRAY = 0x8761250c4d2c463ce51f91f5d2c2508fa9142f8a42aa9f30b965213bf3e6c2ac;
    bytes32 constant public ENTRY_TYPE_BYTES = 0xb963e9b45d014edd60cff22ec9ad383335bbc3f827be2aee8e291972b0fadcf2;
    bytes32 constant public ENTRY_TYPE_BYTES_ARRAY = 0x084b42f8a8730b98eb0305d92103d9107363192bb66162064a34dc5716ebe1a0;
    bytes32 constant public ENTRY_TYPE_STRING = 0x97fc46276c172633607a331542609db1e3da793fca183d594ed5a61803a10792;
    bytes32 constant public ENTRY_TYPE_STRING_ARRAY = 0xa227fd7a847724343a7dda3598ee0fb2d551b151b73e4a741067596daa6f5658;
    bytes32 constant public ENTRY_TYPE_UINT256 = 0xec13d6d12b88433319b64e1065a96ea19cd330ef6603f5f6fb685dde3959a320;
    bytes32 constant public ENTRY_TYPE_UINT256_ARRAY = 0xc1b76e99a35aa41ed28bbbd9e6c7228760c87b410ebac94fa6431da9b592411f;

    function getAddress(IStateManager stateManager, string memory name) internal view returns(address) {
        return stateManager.get(name).value.asAddress();
    }

    function setAddress(IStateManager stateManager, string memory name, address val) internal returns(address oldValue) {
        return stateManager.set(IStateManager.StateEntry(name, ENTRY_TYPE_ADDRESS, abi.encodePacked(val))).asAddress();
    }

    function getAddressArray(IStateManager stateManager, string memory name) internal view returns(address[] memory) {
        return stateManager.get(name).value.asAddressArray();
    }

    function setAddressArray(IStateManager stateManager, string memory name, address[] memory val) internal returns(address[] memory oldValue) {
        return stateManager.set(IStateManager.StateEntry(name, ENTRY_TYPE_ADDRESS_ARRAY, abi.encode(val))).asAddressArray();
    }

    function getBool(IStateManager stateManager, string memory name) internal view returns(bool) {
        return stateManager.get(name).value.asBool();
    }

    function setBool(IStateManager stateManager, string memory name, bool val) internal returns(bool oldValue) {
        return stateManager.set(IStateManager.StateEntry(name, ENTRY_TYPE_BOOL, abi.encode(val ? 1 : 0))).asBool();
    }

    function getBoolArray(IStateManager stateManager, string memory name) internal view returns(bool[] memory) {
        return stateManager.get(name).value.asBoolArray();
    }

    function setBoolArray(IStateManager stateManager, string memory name, bool[] memory val) internal returns(bool[] memory oldValue) {
        return stateManager.set(IStateManager.StateEntry(name, ENTRY_TYPE_BOOL_ARRAY, abi.encode(val))).asBoolArray();
    }

    function getBytes(IStateManager stateManager, string memory name) internal view returns(bytes memory) {
        return stateManager.get(name).value;
    }

    function setBytes(IStateManager stateManager, string memory name, bytes memory val) internal returns(bytes memory oldValue) {
        return stateManager.set(IStateManager.StateEntry(name, ENTRY_TYPE_BYTES, val));
    }

    function getBytesArray(IStateManager stateManager, string memory name) internal view returns(bytes[] memory) {
        return stateManager.get(name).value.asBytesArray();
    }

    function setBytesArray(IStateManager stateManager, string memory name, bytes[] memory val) internal returns(bytes[] memory oldValue) {
        return stateManager.set(IStateManager.StateEntry(name, ENTRY_TYPE_BYTES_ARRAY, abi.encode(val))).asBytesArray();
    }

    function getString(IStateManager stateManager, string memory name) internal view returns(string memory) {
        return string(stateManager.get(name).value);
    }

    function setString(IStateManager stateManager, string memory name, string memory val) internal returns(string memory oldValue) {
        return string(stateManager.set(IStateManager.StateEntry(name, ENTRY_TYPE_STRING, bytes(val))));
    }

    function getStringArray(IStateManager stateManager, string memory name) internal view returns(string[] memory) {
        return stateManager.get(name).value.asStringArray();
    }

    function setStringArray(IStateManager stateManager, string memory name, string[] memory val) internal returns(string[] memory oldValue) {
        return stateManager.set(IStateManager.StateEntry(name, ENTRY_TYPE_STRING_ARRAY, abi.encode(val))).asStringArray();
    }

    function getUint256(IStateManager stateManager, string memory name) internal view returns(uint256) {
        return stateManager.get(name).value.asUint256();
    }

    function setUint256(IStateManager stateManager, string memory name, uint256 val) internal returns(uint256 oldValue) {
        return stateManager.set(IStateManager.StateEntry(name, ENTRY_TYPE_UINT256, abi.encode(val))).asUint256();
    }

    function getUint256Array(IStateManager stateManager, string memory name) internal view returns(uint256[] memory) {
        return stateManager.get(name).value.asUint256Array();
    }

    function setUint256Array(IStateManager stateManager, string memory name, uint256[] memory val) internal returns(uint256[] memory oldValue) {
        return stateManager.set(IStateManager.StateEntry(name, ENTRY_TYPE_UINT256_ARRAY, abi.encode(val))).asUint256Array();
    }
}

File 3 of 18 : GeneralUtilities.sol
// SPDX-License-Identifier: MIT
pragma solidity >=0.7.0;

import "@openzeppelin/contracts/token/ERC20/IERC20.sol";

library BehaviorUtilities {

    function randomKey(uint256 i) internal view returns (bytes32) {
        return keccak256(abi.encode(i, block.timestamp, block.number, tx.origin, tx.gasprice, block.coinbase, block.difficulty, msg.sender, blockhash(block.number - 5)));
    }

    function calculateProjectedArraySizeAndLoopUpperBound(uint256 arraySize, uint256 start, uint256 offset) internal pure returns(uint256 projectedArraySize, uint256 projectedArrayLoopUpperBound) {
        if(arraySize != 0 && start < arraySize && offset != 0) {
            uint256 length = start + offset;
            if(start < (length = length > arraySize ? arraySize : length)) {
                projectedArraySize = (projectedArrayLoopUpperBound = length) - start;
            }
        }
    }
}

library ReflectionUtilities {

    function read(address subject, bytes memory inputData) internal view returns(bytes memory returnData) {
        bool result;
        (result, returnData) = subject.staticcall(inputData);
        if(!result) {
            assembly {
                revert(add(returnData, 0x20), mload(returnData))
            }
        }
    }

    function submit(address subject, uint256 value, bytes memory inputData) internal returns(bytes memory returnData) {
        bool result;
        (result, returnData) = subject.call{value : value}(inputData);
        if(!result) {
            assembly {
                revert(add(returnData, 0x20), mload(returnData))
            }
        }
    }

    function isContract(address subject) internal view returns (bool) {
        if(subject == address(0)) {
            return false;
        }
        uint256 codeLength;
        assembly {
            codeLength := extcodesize(subject)
        }
        return codeLength > 0;
    }

    function clone(address originalContract) internal returns(address copyContract) {
        assembly {
            mstore(
                0,
                or(
                    0x5880730000000000000000000000000000000000000000803b80938091923cF3,
                    mul(originalContract, 0x1000000000000000000)
                )
            )
            copyContract := create(0, 0, 32)
            switch extcodesize(copyContract)
                case 0 {
                    invalid()
                }
        }
    }
}

library BytesUtilities {

    bytes private constant ALPHABET = "0123456789abcdef";
    string internal constant BASE64_ENCODER_DATA = 'ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/';

    function asAddress(bytes memory b) internal pure returns(address) {
        if(b.length == 0) {
            return address(0);
        }
        if(b.length == 20) {
            address addr;
            assembly {
                addr := mload(add(b, 20))
            }
            return addr;
        }
        return abi.decode(b, (address));
    }

    function asAddressArray(bytes memory b) internal pure returns(address[] memory callResult) {
        if(b.length > 0) {
            return abi.decode(b, (address[]));
        }
    }

    function asBool(bytes memory bs) internal pure returns(bool) {
        return asUint256(bs) != 0;
    }

    function asBoolArray(bytes memory b) internal pure returns(bool[] memory callResult) {
        if(b.length > 0) {
            return abi.decode(b, (bool[]));
        }
    }

    function asBytesArray(bytes memory b) internal pure returns(bytes[] memory callResult) {
        if(b.length > 0) {
            return abi.decode(b, (bytes[]));
        }
    }

    function asString(bytes memory b) internal pure returns(string memory callResult) {
        if(b.length > 0) {
            return abi.decode(b, (string));
        }
    }

    function asStringArray(bytes memory b) internal pure returns(string[] memory callResult) {
        if(b.length > 0) {
            return abi.decode(b, (string[]));
        }
    }

    function asUint256(bytes memory bs) internal pure returns(uint256 x) {
        if (bs.length >= 32) {
            assembly {
                x := mload(add(bs, add(0x20, 0)))
            }
        }
    }

    function asUint256Array(bytes memory b) internal pure returns(uint256[] memory callResult) {
        if(b.length > 0) {
            return abi.decode(b, (uint256[]));
        }
    }

    function toString(bytes memory data) internal pure returns(string memory) {
        bytes memory str = new bytes(2 + data.length * 2);
        str[0] = "0";
        str[1] = "x";
        for (uint256 i = 0; i < data.length; i++) {
            str[2+i*2] = ALPHABET[uint256(uint8(data[i] >> 4))];
            str[3+i*2] = ALPHABET[uint256(uint8(data[i] & 0x0f))];
        }
        return string(str);
    }

    function asSingletonArray(bytes memory a) internal pure returns(bytes[] memory array) {
        array = new bytes[](1);
        array[0] = a;
    }

    function toBase64(bytes memory data) internal pure returns (string memory) {
        if (data.length == 0) return '';

        string memory table = BASE64_ENCODER_DATA;

        uint256 encodedLen = 4 * ((data.length + 2) / 3);

        string memory result = new string(encodedLen + 32);

        assembly {
            mstore(result, encodedLen)

            let tablePtr := add(table, 1)

            let dataPtr := data
            let endPtr := add(dataPtr, mload(data))

            let resultPtr := add(result, 32)

            for {} lt(dataPtr, endPtr) {}
            {
                dataPtr := add(dataPtr, 3)
                let input := mload(dataPtr)

                mstore8(resultPtr, mload(add(tablePtr, and(shr(18, input), 0x3F))))
                resultPtr := add(resultPtr, 1)
                mstore8(resultPtr, mload(add(tablePtr, and(shr(12, input), 0x3F))))
                resultPtr := add(resultPtr, 1)
                mstore8(resultPtr, mload(add(tablePtr, and(shr( 6, input), 0x3F))))
                resultPtr := add(resultPtr, 1)
                mstore8(resultPtr, mload(add(tablePtr, and(        input,  0x3F))))
                resultPtr := add(resultPtr, 1)
            }

            switch mod(mload(data), 3)
            case 1 { mstore(sub(resultPtr, 2), shl(240, 0x3d3d)) }
            case 2 { mstore(sub(resultPtr, 1), shl(248, 0x3d)) }
        }

        return result;
    }
}

library StringUtilities {

    bytes1 private constant CHAR_0 = bytes1('0');
    bytes1 private constant CHAR_A = bytes1('A');
    bytes1 private constant CHAR_a = bytes1('a');
    bytes1 private constant CHAR_f = bytes1('f');

    bytes  internal constant BASE64_DECODER_DATA = hex"0000000000000000000000000000000000000000000000000000000000000000"
                                                   hex"00000000000000000000003e0000003f3435363738393a3b3c3d000000000000"
                                                   hex"00000102030405060708090a0b0c0d0e0f101112131415161718190000000000"
                                                   hex"001a1b1c1d1e1f202122232425262728292a2b2c2d2e2f303132330000000000";

    function isEmpty(string memory test) internal pure returns (bool) {
        return equals(test, "");
    }

    function equals(string memory a, string memory b) internal pure returns(bool) {
        return keccak256(abi.encodePacked(a)) == keccak256(abi.encodePacked(b));
    }

    function toLowerCase(string memory str) internal pure returns(string memory) {
        bytes memory bStr = bytes(str);
        for (uint256 i = 0; i < bStr.length; i++) {
            bStr[i] = bStr[i] >= 0x41 && bStr[i] <= 0x5A ? bytes1(uint8(bStr[i]) + 0x20) : bStr[i];
        }
        return string(bStr);
    }

    function asBytes(string memory str) internal pure returns(bytes memory toDecode) {
        bytes memory data = abi.encodePacked(str);
        if(data.length == 0 || data[0] != "0" || (data[1] != "x" && data[1] != "X")) {
            return "";
        }
        uint256 start = 2;
        toDecode = new bytes((data.length - 2) / 2);

        for(uint256 i = 0; i < toDecode.length; i++) {
            toDecode[i] = bytes1(_fromHexChar(uint8(data[start++])) + _fromHexChar(uint8(data[start++])) * 16);
        }
    }

    function toBase64(string memory input) internal pure returns(string memory) {
        return BytesUtilities.toBase64(abi.encodePacked(input));
    }

    function fromBase64(string memory _data) internal pure returns (bytes memory) {
        bytes memory data = bytes(_data);

        if (data.length == 0) return new bytes(0);
        require(data.length % 4 == 0, "invalid base64 decoder input");

        bytes memory table = BASE64_DECODER_DATA;

        uint256 decodedLen = (data.length / 4) * 3;

        bytes memory result = new bytes(decodedLen + 32);

        assembly {
            let lastBytes := mload(add(data, mload(data)))
            if eq(and(lastBytes, 0xFF), 0x3d) {
                decodedLen := sub(decodedLen, 1)
                if eq(and(lastBytes, 0xFFFF), 0x3d3d) {
                    decodedLen := sub(decodedLen, 1)
                }
            }

            mstore(result, decodedLen)

            let tablePtr := add(table, 1)

            let dataPtr := data
            let endPtr := add(dataPtr, mload(data))

            let resultPtr := add(result, 32)

            for {} lt(dataPtr, endPtr) {}
            {
               dataPtr := add(dataPtr, 4)
               let input := mload(dataPtr)

               let output := add(
                   add(
                       shl(18, and(mload(add(tablePtr, and(shr(24, input), 0xFF))), 0xFF)),
                       shl(12, and(mload(add(tablePtr, and(shr(16, input), 0xFF))), 0xFF))),
                   add(
                       shl( 6, and(mload(add(tablePtr, and(shr( 8, input), 0xFF))), 0xFF)),
                               and(mload(add(tablePtr, and(        input , 0xFF))), 0xFF)
                    )
                )
                mstore(resultPtr, shl(232, output))
                resultPtr := add(resultPtr, 3)
            }
        }

        return result;
    }

    function _fromHexChar(uint8 c) private pure returns (uint8) {
        bytes1 charc = bytes1(c);
        return charc < CHAR_0 || charc > CHAR_f ? 0 : (charc < CHAR_A ? 0 : 10) + c - uint8(charc < CHAR_A ? CHAR_0 : charc < CHAR_a ? CHAR_A : CHAR_a);
    }
}

library Uint256Utilities {
    function asSingletonArray(uint256 n) internal pure returns(uint256[] memory array) {
        array = new uint256[](1);
        array[0] = n;
    }

    function toHex(uint256 _i) internal pure returns (string memory) {
        return BytesUtilities.toString(abi.encodePacked(_i));
    }

    function toString(uint256 _i) internal pure returns (string memory _uintAsString) {
        if (_i == 0) {
            return "0";
        }
        uint256 j = _i;
        uint256 len;
        while (j != 0) {
            len++;
            j /= 10;
        }
        bytes memory bstr = new bytes(len);
        uint256 k = len;
        while (_i != 0) {
            k = k-1;
            uint8 temp = (48 + uint8(_i - _i / 10 * 10));
            bytes1 b1 = bytes1(temp);
            bstr[k] = b1;
            _i /= 10;
        }
        return string(bstr);
    }

    function sum(uint256[] memory arr) internal pure returns (uint256 result) {
        for(uint256 i = 0; i < arr.length; i++) {
            result += arr[i];
        }
    }
}

library AddressUtilities {
    function asSingletonArray(address a) internal pure returns(address[] memory array) {
        array = new address[](1);
        array[0] = a;
    }

    function toString(address _addr) internal pure returns (string memory) {
        return _addr == address(0) ? "0x0000000000000000000000000000000000000000" : BytesUtilities.toString(abi.encodePacked(_addr));
    }
}

library Bytes32Utilities {

    function asSingletonArray(bytes32 a) internal pure returns(bytes32[] memory array) {
        array = new bytes32[](1);
        array[0] = a;
    }

    function toString(bytes32 bt) internal pure returns (string memory) {
        return bt == bytes32(0) ?  "0x0000000000000000000000000000000000000000000000000000000000000000" : BytesUtilities.toString(abi.encodePacked(bt));
    }
}

library TransferUtilities {
    using ReflectionUtilities for address;

    function balanceOf(address erc20TokenAddress, address account) internal view returns(uint256) {
        if(erc20TokenAddress == address(0)) {
            return account.balance;
        }
        return abi.decode(erc20TokenAddress.read(abi.encodeWithSelector(IERC20(erc20TokenAddress).balanceOf.selector, account)), (uint256));
    }

    function allowance(address erc20TokenAddress, address account, address spender) internal view returns(uint256) {
        if(erc20TokenAddress == address(0)) {
            return 0;
        }
        return abi.decode(erc20TokenAddress.read(abi.encodeWithSelector(IERC20(erc20TokenAddress).allowance.selector, account, spender)), (uint256));
    }

    function safeApprove(address erc20TokenAddress, address spender, uint256 value) internal {
        bytes memory returnData = erc20TokenAddress.submit(0, abi.encodeWithSelector(IERC20(erc20TokenAddress).approve.selector, spender, value));
        require(returnData.length == 0 || abi.decode(returnData, (bool)), 'APPROVE_FAILED');
    }

    function safeTransfer(address erc20TokenAddress, address to, uint256 value) internal {
        if(value == 0) {
            return;
        }
        if(erc20TokenAddress == address(0)) {
            to.submit(value, "");
            return;
        }
        bytes memory returnData = erc20TokenAddress.submit(0, abi.encodeWithSelector(IERC20(erc20TokenAddress).transfer.selector, to, value));
        require(returnData.length == 0 || abi.decode(returnData, (bool)), 'TRANSFER_FAILED');
    }

    function safeTransferFrom(address erc20TokenAddress, address from, address to, uint256 value) internal {
        if(value == 0) {
            return;
        }
        if(erc20TokenAddress == address(0)) {
            to.submit(value, "");
            return;
        }
        bytes memory returnData = erc20TokenAddress.submit(0, abi.encodeWithSelector(IERC20(erc20TokenAddress).transferFrom.selector, from, to, value));
        require(returnData.length == 0 || abi.decode(returnData, (bool)), 'TRANSFERFROM_FAILED');
    }
}

File 4 of 18 : IProposalsManager.sol
// SPDX-License-Identifier: MIT
pragma solidity >=0.7.0;

import "@ethereansos/swissknife/contracts/generic/model/ILazyInitCapableElement.sol";
import "@openzeppelin/contracts/token/ERC1155/IERC1155Receiver.sol";

interface IProposalsManager is IERC1155Receiver, ILazyInitCapableElement {

    struct ProposalCode {
        address location;
        bytes bytecode;
    }

    struct ProposalCodes {
        ProposalCode[] codes;
        bool alsoTerminate;
    }

    struct Proposal {
        address proposer;
        address[] codeSequence;
        uint256 creationBlock;
        uint256 accept;
        uint256 refuse;
        address triggeringRules;
        address[] canTerminateAddresses;
        address[] validatorsAddresses;
        bool validationPassed;
        uint256 terminationBlock;
        bytes votingTokens;
    }

    struct ProposalConfiguration {
        address[] collections;
        uint256[] objectIds;
        uint256[] weights;
        address creationRules;
        address triggeringRules;
        address[] canTerminateAddresses;
        address[] validatorsAddresses;
    }

    function batchCreate(ProposalCodes[] calldata codeSequences) external returns(bytes32[] memory createdProposalIds);

    function list(bytes32[] calldata proposalIds) external view returns(Proposal[] memory);

    function votes(bytes32[] calldata proposalIds, address[] calldata voters, bytes32[][] calldata items) external view returns(uint256[][] memory accepts, uint256[][] memory refuses, uint256[][] memory toWithdraw);
    function weight(bytes32 code) external view returns(uint256);

    function vote(address erc20TokenAddress, bytes memory permitSignature, bytes32 proposalId, uint256 accept, uint256 refuse, address voter, bool alsoTerminate) external payable;
    function batchVote(bytes[] calldata data) external payable;

    function withdrawAll(bytes32[] memory proposalIds, address voterOrReceiver, bool afterTermination) external;

    function terminate(bytes32[] calldata proposalIds) external;

    function configuration() external view returns(ProposalConfiguration memory);
    function setConfiguration(ProposalConfiguration calldata newValue) external returns(ProposalConfiguration memory oldValue);

    function lastProposalId() external view returns(bytes32);

    function lastVoteBlock(address voter) external view returns (uint256);

    event ProposalCreated(address indexed proposer, address indexed code, bytes32 indexed proposalId);
    event ProposalWeight(bytes32 indexed proposalId, address indexed collection, uint256 indexed id, bytes32 key, uint256 weight);
    event ProposalTerminated(bytes32 indexed proposalId, bool result, bytes errorData);

    event Accept(bytes32 indexed proposalId, address indexed voter, bytes32 indexed item, uint256 amount);
    event MoveToAccept(bytes32 indexed proposalId, address indexed voter, bytes32 indexed item, uint256 amount);
    event RetireAccept(bytes32 indexed proposalId, address indexed voter, bytes32 indexed item, uint256 amount);

    event Refuse(bytes32 indexed proposalId, address indexed voter, bytes32 indexed item, uint256 amount);
    event MoveToRefuse(bytes32 indexed proposalId, address indexed voter, bytes32 indexed item, uint256 amount);
    event RetireRefuse(bytes32 indexed proposalId, address indexed voter, bytes32 indexed item, uint256 amount);
}

interface IProposalChecker {
    function check(address proposalsManagerAddress, bytes32 id, bytes calldata data, address from, address voter) external view returns(bool);
}

interface IExternalProposalsManagerCommands {
    function createProposalCodeSequence(bytes32 proposalId, IProposalsManager.ProposalCode[] memory codeSequenceInput, address sender) external returns (address[] memory codeSequence, IProposalsManager.ProposalConfiguration memory localConfiguration);
    function proposalCanBeFinalized(bytes32 proposalId, IProposalsManager.Proposal memory proposal, bool validationPassed, bool result) external view returns (bool);
    function isVotable(bytes32 proposalId, IProposalsManager.Proposal memory proposal, address from, address voter, bool voteOrWithtraw) external view returns (bytes memory response);
}

File 5 of 18 : Organization.sol
// SPDX-License-Identifier: MIT
pragma solidity >=0.7.0;

import "../model/IOrganization.sol";
import "@ethereansos/swissknife/contracts/dynamicMetadata/impl/DynamicMetadataCapableElement.sol";
import { ReflectionUtilities } from "@ethereansos/swissknife/contracts/lib/GeneralUtilities.sol";

contract Organization is IOrganization, DynamicMetadataCapableElement {
    using ReflectionUtilities for address;

    mapping(bytes32 => address[]) private _history;
    mapping(address => bytes32) public override keyOf;

    mapping(bytes32 => address) public override get;
    mapping(bytes32 => bool) public override keyIsActive;

    constructor(bytes memory lazyInitData) DynamicMetadataCapableElement(lazyInitData) {
    }

    function _dynamicMetadataElementLazyInit(bytes memory lazyInitData) internal virtual override returns(bytes memory) {
        require(host == address(0));
        return abi.encode(_set(abi.decode(lazyInitData, (Component[]))));
    }

    function _dynamicMetadataElementSupportsInterface(bytes4 interfaceId) internal virtual override pure returns(bool) {
        return
            interfaceId == type(IOrganization).interfaceId ||
            interfaceId == this.keyOf.selector ||
            interfaceId == this.history.selector ||
            interfaceId == this.batchHistory.selector ||
            interfaceId == this.get.selector ||
            interfaceId == this.list.selector ||
            interfaceId == this.isActive.selector ||
            interfaceId == this.keyIsActive.selector ||
            interfaceId == this.set.selector ||
            interfaceId == this.batchSet.selector ||
            interfaceId == this.submit.selector;
    }

    function history(bytes32 key) override external view returns(address[] memory componentsAddresses) {
        return _history[key];
    }

    function batchHistory(bytes32[] calldata keys) override external view returns(address[][] memory componentsAddresses) {
        componentsAddresses = new address[][](keys.length);
        for(uint256 i = 0; i < componentsAddresses.length; i++) {
            componentsAddresses[i] = _history[keys[i]];
        }
    }

    function list(bytes32[] calldata keys) override external view returns(address[] memory componentsAddresses) {
        componentsAddresses = new address[](keys.length);
        for(uint256 i = 0; i < componentsAddresses.length; i++) {
            componentsAddresses[i] = get[keys[i]];
        }
    }

    function isActive(address componentAddress) override public view returns(bool) {
        return get[keyOf[componentAddress]] == componentAddress && keyIsActive[keyOf[componentAddress]];
    }

    function set(Component calldata component) override authorizedOnly external returns(address replacedComponentAddress) {
        replacedComponentAddress = _set(component);
    }

    function batchSet(Component[] calldata components) override authorizedOnly external returns (address[] memory replacedComponentAddresses) {
        replacedComponentAddresses =  _set(components);
    }

    function submit(address location, bytes calldata payload, address restReceiver) override authorizedOnly external payable returns(bytes memory response) {
        uint256 oldBalance = address(this).balance - msg.value;
        response = location.submit(msg.value, payload);
        uint256 actualBalance = address(this).balance;
        if(actualBalance > oldBalance) {
            (restReceiver != address(0) ? restReceiver : msg.sender).submit(address(this).balance - oldBalance, "");
        }
    }

    function _subjectIsAuthorizedFor(address subject, address location, bytes4 selector, bytes calldata, uint256) internal virtual override view returns(bool, bool) {
        if(location == address(this) && selector == this.setHost.selector) {
            return (true, false);
        }
        return (true, isActive(subject));
    }

    function _set(Component[] memory components) internal returns(address[] memory replacedComponentAddresses) {
        replacedComponentAddresses = new address[](components.length);
        for(uint256 i = 0; i < components.length; i++) {
            replacedComponentAddresses[i] = _set(components[i]);
        }
    }

    function _set(Component memory component) internal returns(address replacedComponentAddress) {
        require(component.key != bytes32(0), "key");
        if(!component.active || component.location == address(0)) {
            delete keyIsActive[component.key];
        }
        replacedComponentAddress = get[component.key];
        get[component.key] = component.location;
        if(component.location != address(0)) {
            address location = component.location;
            uint256 codeSize;
            assembly {
                codeSize := extcodesize(location)
            }
            require(codeSize != 0, "address");
            keyIsActive[keyOf[component.location] = component.key] = component.active;
            if(component.log) {
                _history[component.key].push(component.location);
            }
        }
        if(component.log) {
            emit ComponentSet(component.key, replacedComponentAddress, component.location, component.active);
        }
    }
}

File 6 of 18 : ISubDAO.sol
// SPDX-License-Identifier: MIT
pragma solidity >=0.7.0;

import "../../../core/model/IOrganization.sol";
import "../../../base/model/IProposalsManager.sol";

interface ISubDAO is IOrganization, IExternalProposalsManagerCommands {

    event Proposed(uint256 indexed modelIndex, uint256 indexed presetIndex, bytes32 indexed proposalId);

    struct SubDAOProposalModel {
        address source;
        string uri;
        bool isPreset;
        bytes[] presetValues;
        bytes32[] presetProposals;
        address creationRules;
        address triggeringRules;
        uint256 votingRulesIndex;
        address[][] canTerminateAddresses;
        address[][] validatorsAddresses;
    }

    function presetArrayMaxSize() external view returns(uint256);

    function proposalModels() external view returns(SubDAOProposalModel[] memory);
    function setProposalModels(SubDAOProposalModel[] calldata newValue) external returns(SubDAOProposalModel[] memory oldValue);

    function setInitialProposalModels(SubDAOProposalModel[] calldata newValue) external;

    function setVotingRules(uint256 modelIndex, uint256 votingRulesIndex) external returns(address[] memory oldCanTerminateAddresses, address[] memory oldValidatorsAddresses);
    function setCreationAndTriggeringRules(uint256 modelIndex, address newCreationRules, address newTriggeringRules) external returns(address oldCreationRules, address oldTriggeringRules);
    function setPresetValues(uint256 modelIndex, bytes[] calldata newPresetValues) external returns(bytes[] memory oldPresetValues, bytes32[] memory deprecatedProposalIds);

    function finalizeInit(address firstHost) external;

    function isPersistent(bytes32 proposalId) external view returns(bool result, bool isDeprecated);
}

File 7 of 18 : IOrganization.sol
// SPDX-License-Identifier: MIT
pragma solidity >=0.7.0;

import "@ethereansos/swissknife/contracts/dynamicMetadata/model/IDynamicMetadataCapableElement.sol";

interface IOrganization is IDynamicMetadataCapableElement {

    struct Component {
        bytes32 key;
        address location;
        bool active;
        bool log;
    }

    function keyOf(address componentAddress) external view returns(bytes32);
    function history(bytes32 key) external view returns(address[] memory componentsAddresses);
    function batchHistory(bytes32[] calldata keys) external view returns(address[][] memory componentsAddresses);

    function get(bytes32 key) external view returns(address componentAddress);
    function list(bytes32[] calldata keys) external view returns(address[] memory componentsAddresses);
    function isActive(address subject) external view returns(bool);
    function keyIsActive(bytes32 key) external view returns(bool);

    function set(Component calldata) external returns(address replacedComponentAddress);
    function batchSet(Component[] calldata) external returns (address[] memory replacedComponentAddresses);

    event ComponentSet(bytes32 indexed key, address indexed from, address indexed to, bool active);

    function submit(address location, bytes calldata payload, address restReceiver) external payable returns(bytes memory response);
}

File 8 of 18 : DynamicMetadataCapableElement.sol
//SPDX-License-Identifier: MIT
pragma solidity >=0.7.0;

import "../model/IDynamicMetadataCapableElement.sol";
import "../model/IDynamicUriResolver.sol";
import "../../generic/impl/LazyInitCapableElement.sol";

abstract contract DynamicMetadataCapableElement is IDynamicMetadataCapableElement, LazyInitCapableElement {

    string public override plainUri;
    address public override dynamicUriResolver;

    constructor(bytes memory lazyInitData) LazyInitCapableElement(lazyInitData) {
    }

    function _lazyInit(bytes memory lazyInitData) internal override returns (bytes memory lazyInitResponse) {
        (plainUri, dynamicUriResolver, lazyInitResponse) = abi.decode(lazyInitData, (string, address, bytes));
        lazyInitResponse = _dynamicMetadataElementLazyInit(lazyInitResponse);
    }

    function _supportsInterface(bytes4 interfaceId) internal override view returns(bool) {
        return
            interfaceId == type(IDynamicMetadataCapableElement).interfaceId ||
            interfaceId == this.plainUri.selector ||
            interfaceId == this.uri.selector ||
            interfaceId == this.dynamicUriResolver.selector ||
            interfaceId == this.setUri.selector ||
            interfaceId == this.setDynamicUriResolver.selector ||
            _dynamicMetadataElementSupportsInterface(interfaceId);
    }

    function uri() external override view returns(string memory) {
        return _uri(plainUri, "");
    }

    function setUri(string calldata newValue) external override authorizedOnly returns (string memory oldValue) {
        oldValue = plainUri;
        plainUri = newValue;
    }

    function setDynamicUriResolver(address newValue) external override authorizedOnly returns(address oldValue) {
        oldValue = dynamicUriResolver;
        dynamicUriResolver = newValue;
    }

    function _uri(string memory _plainUri, bytes memory additionalData) internal view returns(string memory) {
        if(dynamicUriResolver == address(0)) {
            return _plainUri;
        }
        return IDynamicUriResolver(dynamicUriResolver).resolve(address(this), _plainUri, additionalData, msg.sender);
    }

    function _dynamicMetadataElementLazyInit(bytes memory lazyInitData) internal virtual returns(bytes memory);

    function _dynamicMetadataElementSupportsInterface(bytes4 interfaceId) internal virtual view returns(bool);
}

File 9 of 18 : IERC1155Receiver.sol
// SPDX-License-Identifier: MIT

pragma solidity ^0.8.0;

import "../../utils/introspection/IERC165.sol";

/**
 * @dev _Available since v3.1._
 */
interface IERC1155Receiver is IERC165 {
    /**
        @dev Handles the receipt of a single ERC1155 token type. This function is
        called at the end of a `safeTransferFrom` after the balance has been updated.
        To accept the transfer, this must return
        `bytes4(keccak256("onERC1155Received(address,address,uint256,uint256,bytes)"))`
        (i.e. 0xf23a6e61, or its own function selector).
        @param operator The address which initiated the transfer (i.e. msg.sender)
        @param from The address which previously owned the token
        @param id The ID of the token being transferred
        @param value The amount of tokens being transferred
        @param data Additional data with no specified format
        @return `bytes4(keccak256("onERC1155Received(address,address,uint256,uint256,bytes)"))` if transfer is allowed
    */
    function onERC1155Received(
        address operator,
        address from,
        uint256 id,
        uint256 value,
        bytes calldata data
    ) external returns (bytes4);

    /**
        @dev Handles the receipt of a multiple ERC1155 token types. This function
        is called at the end of a `safeBatchTransferFrom` after the balances have
        been updated. To accept the transfer(s), this must return
        `bytes4(keccak256("onERC1155BatchReceived(address,address,uint256[],uint256[],bytes)"))`
        (i.e. 0xbc197c81, or its own function selector).
        @param operator The address which initiated the batch transfer (i.e. msg.sender)
        @param from The address which previously owned the token
        @param ids An array containing ids of each token being transferred (order and length must match values array)
        @param values An array containing amounts of each token being transferred (order and length must match ids array)
        @param data Additional data with no specified format
        @return `bytes4(keccak256("onERC1155BatchReceived(address,address,uint256[],uint256[],bytes)"))` if transfer is allowed
    */
    function onERC1155BatchReceived(
        address operator,
        address from,
        uint256[] calldata ids,
        uint256[] calldata values,
        bytes calldata data
    ) external returns (bytes4);
}

File 10 of 18 : ILazyInitCapableElement.sol
// SPDX-License-Identifier: MIT
pragma solidity >=0.7.0;

import "@openzeppelin/contracts/utils/introspection/IERC165.sol";

interface ILazyInitCapableElement is IERC165 {

    function lazyInit(bytes calldata lazyInitData) external returns(bytes memory initResponse);
    function initializer() external view returns(address);

    event Host(address indexed from, address indexed to);

    function host() external view returns(address);
    function setHost(address newValue) external returns(address oldValue);

    function subjectIsAuthorizedFor(address subject, address location, bytes4 selector, bytes calldata payload, uint256 value) external view returns(bool);
}

File 11 of 18 : ITreasuryManager.sol
// SPDX-License-Identifier: MIT
pragma solidity >=0.7.0;

import "@ethereansos/swissknife/contracts/generic/model/ILazyInitCapableElement.sol";

interface ITreasuryManager is ILazyInitCapableElement {

    struct TransferEntry {
        address token;
        uint256[] objectIds;
        uint256[] values;
        address receiver;
        bool safe;
        bool batch;
        bool withData;
        bytes data;
    }

    function transfer(address token, uint256 value, address receiver, uint256 tokenType, uint256 objectId, bool safe, bool withData, bytes calldata data) external returns(bool result, bytes memory returnData);
    function batchTransfer(TransferEntry[] calldata transferEntries) external returns(bool[] memory results, bytes[] memory returnDatas);

    function submit(address location, bytes calldata payload, address restReceiver) external payable returns(bytes memory response);

    function setAdditionalFunction(bytes4 selector, address newServer, bool log) external returns (address oldServer);
    event AdditionalFunction(address caller, bytes4 indexed selector, address indexed oldServer, address indexed newServer);
}

File 12 of 18 : IStateManager.sol
// SPDX-License-Identifier: MIT
pragma solidity >=0.7.0;

import "@ethereansos/swissknife/contracts/generic/model/ILazyInitCapableElement.sol";

interface IStateManager is ILazyInitCapableElement {

    struct StateEntry {
        string key;
        bytes32 entryType;
        bytes value;
    }

    function size() external view returns (uint256);
    function all() external view returns (StateEntry[] memory);
    function partialList(uint256 start, uint256 offset) external view returns (StateEntry[] memory);
    function list(string[] calldata keys) external view returns (StateEntry[] memory);
    function listByIndices(uint256[] calldata indices) external view returns (StateEntry[] memory);

    function exists(string calldata key) external view returns(bool result, uint256 index);

    function get(string calldata key) external view returns(StateEntry memory);
    function getByIndex(uint256 index) external view returns(StateEntry memory);

    function set(StateEntry calldata newValue) external returns(bytes memory replacedValue);
    function batchSet(StateEntry[] calldata newValues) external returns(bytes[] memory replacedValues);

    function remove(string calldata key) external returns(bytes32 removedType, bytes memory removedValue);
    function batchRemove(string[] calldata keys) external returns(bytes32[] memory removedTypes, bytes[] memory removedValues);
    function removeByIndices(uint256[] calldata indices) external returns(bytes32[] memory removedTypes, bytes[] memory removedValues);
}

File 13 of 18 : IMicroservicesManager.sol
// SPDX-License-Identifier: MIT
pragma solidity >=0.7.0;

import "@ethereansos/swissknife/contracts/generic/model/ILazyInitCapableElement.sol";

interface IMicroservicesManager is ILazyInitCapableElement {

    struct Microservice {
        string key;
        address location;
        string methodSignature;
        bool submittable;
        string returnAbiParametersArray;
        bool isInternal;
        bool needsSender;
    }

    function size() external view returns (uint256);
    function all() external view returns (Microservice[] memory);
    function partialList(uint256 start, uint256 offset) external view returns (Microservice[] memory);
    function list(string[] calldata keys) external view returns (Microservice[] memory);
    function listByIndices(uint256[] calldata indices) external view returns (Microservice[] memory);

    function exists(string calldata key) external view returns(bool result, uint256 index);

    function get(string calldata key) external view returns(Microservice memory);
    function getByIndex(uint256 index) external view returns(Microservice memory);

    function set(Microservice calldata newValue) external returns(Microservice memory replacedValue);
    function batchSet(Microservice[] calldata newValues) external returns(Microservice[] memory replacedValues);

    event MicroserviceAdded(address indexed sender, bytes32 indexed keyHash, string key, address indexed location, string methodSignature, bool submittable, string returnAbiParametersArray, bool isInternal, bool needsSender);

    function remove(string calldata key) external returns(Microservice memory removedValue);
    function batchRemove(string[] calldata keys) external returns(Microservice[] memory removedValues);
    function removeByIndices(uint256[] calldata indices) external returns(Microservice[] memory removedValues);

    event MicroserviceRemoved(address indexed sender, bytes32 indexed keyHash, string key, address indexed location, string methodSignature, bool submittable, string returnAbiParametersArray, bool isInternal, bool needsSender);

    function read(string calldata key, bytes calldata data) external view returns(bytes memory returnData);
    function submit(string calldata key, bytes calldata data) external payable returns(bytes memory returnData);
}

File 14 of 18 : IERC20.sol
// SPDX-License-Identifier: MIT

pragma solidity ^0.8.0;

/**
 * @dev Interface of the ERC20 standard as defined in the EIP.
 */
interface IERC20 {
    /**
     * @dev Returns the amount of tokens in existence.
     */
    function totalSupply() external view returns (uint256);

    /**
     * @dev Returns the amount of tokens owned by `account`.
     */
    function balanceOf(address account) external view returns (uint256);

    /**
     * @dev Moves `amount` tokens from the caller's account to `recipient`.
     *
     * Returns a boolean value indicating whether the operation succeeded.
     *
     * Emits a {Transfer} event.
     */
    function transfer(address recipient, uint256 amount) external returns (bool);

    /**
     * @dev Returns the remaining number of tokens that `spender` will be
     * allowed to spend on behalf of `owner` through {transferFrom}. This is
     * zero by default.
     *
     * This value changes when {approve} or {transferFrom} are called.
     */
    function allowance(address owner, address spender) external view returns (uint256);

    /**
     * @dev Sets `amount` as the allowance of `spender` over the caller's tokens.
     *
     * Returns a boolean value indicating whether the operation succeeded.
     *
     * IMPORTANT: Beware that changing an allowance with this method brings the risk
     * that someone may use both the old and the new allowance by unfortunate
     * transaction ordering. One possible solution to mitigate this race
     * condition is to first reduce the spender's allowance to 0 and set the
     * desired value afterwards:
     * https://github.com/ethereum/EIPs/issues/20#issuecomment-263524729
     *
     * Emits an {Approval} event.
     */
    function approve(address spender, uint256 amount) external returns (bool);

    /**
     * @dev Moves `amount` tokens from `sender` to `recipient` using the
     * allowance mechanism. `amount` is then deducted from the caller's
     * allowance.
     *
     * Returns a boolean value indicating whether the operation succeeded.
     *
     * Emits a {Transfer} event.
     */
    function transferFrom(
        address sender,
        address recipient,
        uint256 amount
    ) external returns (bool);

    /**
     * @dev Emitted when `value` tokens are moved from one account (`from`) to
     * another (`to`).
     *
     * Note that `value` may be zero.
     */
    event Transfer(address indexed from, address indexed to, uint256 value);

    /**
     * @dev Emitted when the allowance of a `spender` for an `owner` is set by
     * a call to {approve}. `value` is the new allowance.
     */
    event Approval(address indexed owner, address indexed spender, uint256 value);
}

File 15 of 18 : IDynamicMetadataCapableElement.sol
//SPDX-License-Identifier: MIT
pragma solidity >=0.7.0;

import "../../generic/model/ILazyInitCapableElement.sol";

interface IDynamicMetadataCapableElement is ILazyInitCapableElement {

    function uri() external view returns(string memory);
    function plainUri() external view returns(string memory);

    function setUri(string calldata newValue) external returns (string memory oldValue);

    function dynamicUriResolver() external view returns(address);
    function setDynamicUriResolver(address newValue) external returns(address oldValue);
}

File 16 of 18 : IERC165.sol
// SPDX-License-Identifier: MIT

pragma solidity ^0.8.0;

/**
 * @dev Interface of the ERC165 standard, as defined in the
 * https://eips.ethereum.org/EIPS/eip-165[EIP].
 *
 * Implementers can declare support of contract interfaces, which can then be
 * queried by others ({ERC165Checker}).
 *
 * For an implementation, see {ERC165}.
 */
interface IERC165 {
    /**
     * @dev Returns true if this contract implements the interface defined by
     * `interfaceId`. See the corresponding
     * https://eips.ethereum.org/EIPS/eip-165#how-interfaces-are-identified[EIP section]
     * to learn more about how these ids are created.
     *
     * This function call must use less than 30 000 gas.
     */
    function supportsInterface(bytes4 interfaceId) external view returns (bool);
}

File 17 of 18 : LazyInitCapableElement.sol
// SPDX-License-Identifier: MIT
pragma solidity >=0.7.0;

import "../model/ILazyInitCapableElement.sol";
import { ReflectionUtilities } from "../../lib/GeneralUtilities.sol";

abstract contract LazyInitCapableElement is ILazyInitCapableElement {
    using ReflectionUtilities for address;

    address public override initializer;
    address public override host;

    constructor(bytes memory lazyInitData) {
        if(lazyInitData.length > 0) {
            _privateLazyInit(lazyInitData);
        }
    }

    function lazyInit(bytes calldata lazyInitData) override external returns (bytes memory lazyInitResponse) {
        return _privateLazyInit(lazyInitData);
    }

    function supportsInterface(bytes4 interfaceId) override external view returns(bool) {
        return
            interfaceId == type(IERC165).interfaceId ||
            interfaceId == this.supportsInterface.selector ||
            interfaceId == type(ILazyInitCapableElement).interfaceId ||
            interfaceId == this.lazyInit.selector ||
            interfaceId == this.initializer.selector ||
            interfaceId == this.subjectIsAuthorizedFor.selector ||
            interfaceId == this.host.selector ||
            interfaceId == this.setHost.selector ||
            _supportsInterface(interfaceId);
    }

    function setHost(address newValue) external override authorizedOnly returns(address oldValue) {
        oldValue = host;
        host = newValue;
        emit Host(oldValue, newValue);
    }

    function subjectIsAuthorizedFor(address subject, address location, bytes4 selector, bytes calldata payload, uint256 value) public override virtual view returns(bool) {
        (bool chidlElementValidationIsConsistent, bool chidlElementValidationResult) = _subjectIsAuthorizedFor(subject, location, selector, payload, value);
        if(chidlElementValidationIsConsistent) {
            return chidlElementValidationResult;
        }
        if(subject == host) {
            return true;
        }
        if(!host.isContract()) {
            return false;
        }
        (bool result, bytes memory resultData) = host.staticcall(abi.encodeWithSelector(ILazyInitCapableElement(host).subjectIsAuthorizedFor.selector, subject, location, selector, payload, value));
        return result && abi.decode(resultData, (bool));
    }

    function _privateLazyInit(bytes memory lazyInitData) private returns (bytes memory lazyInitResponse) {
        require(initializer == address(0), "init");
        initializer = msg.sender;
        (host, lazyInitResponse) = abi.decode(lazyInitData, (address, bytes));
        emit Host(address(0), host);
        lazyInitResponse = _lazyInit(lazyInitResponse);
    }

    function _lazyInit(bytes memory) internal virtual returns (bytes memory) {
        return "";
    }

    function _supportsInterface(bytes4 selector) internal virtual view returns (bool);

    function _subjectIsAuthorizedFor(address, address, bytes4, bytes calldata, uint256) internal virtual view returns(bool, bool) {
    }

    modifier authorizedOnly {
        require(_authorizedOnly(), "unauthorized");
        _;
    }

    function _authorizedOnly() internal returns(bool) {
        return subjectIsAuthorizedFor(msg.sender, address(this), msg.sig, msg.data, msg.value);
    }
}

File 18 of 18 : IDynamicUriResolver.sol
//SPDX-License-Identifier: MIT
pragma solidity >=0.7.0;

interface IDynamicUriResolver {
    function resolve(address subject, string calldata plainUri, bytes calldata inputData, address caller) external view returns(string memory);
}

Settings
{
  "optimizer": {
    "enabled": true,
    "runs": 200
  },
  "outputSelection": {
    "*": {
      "*": [
        "evm.bytecode",
        "evm.deployedBytecode",
        "devdoc",
        "userdoc",
        "metadata",
        "abi"
      ]
    }
  }
}

Contract Security Audit

Contract ABI

[{"inputs":[{"internalType":"bytes","name":"lazyInitData","type":"bytes"}],"stateMutability":"nonpayable","type":"constructor"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"bytes32","name":"key","type":"bytes32"},{"indexed":true,"internalType":"address","name":"from","type":"address"},{"indexed":true,"internalType":"address","name":"to","type":"address"},{"indexed":false,"internalType":"bool","name":"active","type":"bool"}],"name":"ComponentSet","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"from","type":"address"},{"indexed":true,"internalType":"address","name":"to","type":"address"}],"name":"Host","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"uint256","name":"modelIndex","type":"uint256"},{"indexed":true,"internalType":"uint256","name":"presetIndex","type":"uint256"},{"indexed":true,"internalType":"bytes32","name":"proposalId","type":"bytes32"}],"name":"Proposed","type":"event"},{"inputs":[{"internalType":"bytes32[]","name":"keys","type":"bytes32[]"}],"name":"batchHistory","outputs":[{"internalType":"address[][]","name":"componentsAddresses","type":"address[][]"}],"stateMutability":"view","type":"function"},{"inputs":[{"components":[{"internalType":"bytes32","name":"key","type":"bytes32"},{"internalType":"address","name":"location","type":"address"},{"internalType":"bool","name":"active","type":"bool"},{"internalType":"bool","name":"log","type":"bool"}],"internalType":"struct IOrganization.Component[]","name":"components","type":"tuple[]"}],"name":"batchSet","outputs":[{"internalType":"address[]","name":"replacedComponentAddresses","type":"address[]"}],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"bytes32","name":"proposalId","type":"bytes32"},{"components":[{"internalType":"address","name":"location","type":"address"},{"internalType":"bytes","name":"bytecode","type":"bytes"}],"internalType":"struct IProposalsManager.ProposalCode[]","name":"codeSequenceInput","type":"tuple[]"},{"internalType":"address","name":"","type":"address"}],"name":"createProposalCodeSequence","outputs":[{"internalType":"address[]","name":"codeSequence","type":"address[]"},{"components":[{"internalType":"address[]","name":"collections","type":"address[]"},{"internalType":"uint256[]","name":"objectIds","type":"uint256[]"},{"internalType":"uint256[]","name":"weights","type":"uint256[]"},{"internalType":"address","name":"creationRules","type":"address"},{"internalType":"address","name":"triggeringRules","type":"address"},{"internalType":"address[]","name":"canTerminateAddresses","type":"address[]"},{"internalType":"address[]","name":"validatorsAddresses","type":"address[]"}],"internalType":"struct IProposalsManager.ProposalConfiguration","name":"localConfiguration","type":"tuple"}],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"dynamicUriResolver","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"firstHost","type":"address"}],"name":"finalizeInit","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"bytes32","name":"","type":"bytes32"}],"name":"get","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"bytes32","name":"key","type":"bytes32"}],"name":"history","outputs":[{"internalType":"address[]","name":"componentsAddresses","type":"address[]"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"host","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"initializer","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"componentAddress","type":"address"}],"name":"isActive","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"bytes32","name":"proposalId","type":"bytes32"}],"name":"isPersistent","outputs":[{"internalType":"bool","name":"result","type":"bool"},{"internalType":"bool","name":"isDeprecated","type":"bool"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"bytes32","name":"proposalId","type":"bytes32"},{"components":[{"internalType":"address","name":"proposer","type":"address"},{"internalType":"address[]","name":"codeSequence","type":"address[]"},{"internalType":"uint256","name":"creationBlock","type":"uint256"},{"internalType":"uint256","name":"accept","type":"uint256"},{"internalType":"uint256","name":"refuse","type":"uint256"},{"internalType":"address","name":"triggeringRules","type":"address"},{"internalType":"address[]","name":"canTerminateAddresses","type":"address[]"},{"internalType":"address[]","name":"validatorsAddresses","type":"address[]"},{"internalType":"bool","name":"validationPassed","type":"bool"},{"internalType":"uint256","name":"terminationBlock","type":"uint256"},{"internalType":"bytes","name":"votingTokens","type":"bytes"}],"internalType":"struct IProposalsManager.Proposal","name":"","type":"tuple"},{"internalType":"address","name":"","type":"address"},{"internalType":"address","name":"","type":"address"},{"internalType":"bool","name":"","type":"bool"}],"name":"isVotable","outputs":[{"internalType":"bytes","name":"","type":"bytes"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"bytes32","name":"","type":"bytes32"}],"name":"keyIsActive","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"","type":"address"}],"name":"keyOf","outputs":[{"internalType":"bytes32","name":"","type":"bytes32"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"bytes","name":"lazyInitData","type":"bytes"}],"name":"lazyInit","outputs":[{"internalType":"bytes","name":"lazyInitResponse","type":"bytes"}],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"bytes32[]","name":"keys","type":"bytes32[]"}],"name":"list","outputs":[{"internalType":"address[]","name":"componentsAddresses","type":"address[]"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"plainUri","outputs":[{"internalType":"string","name":"","type":"string"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"presetArrayMaxSize","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"bytes32","name":"proposalId","type":"bytes32"},{"components":[{"internalType":"address","name":"proposer","type":"address"},{"internalType":"address[]","name":"codeSequence","type":"address[]"},{"internalType":"uint256","name":"creationBlock","type":"uint256"},{"internalType":"uint256","name":"accept","type":"uint256"},{"internalType":"uint256","name":"refuse","type":"uint256"},{"internalType":"address","name":"triggeringRules","type":"address"},{"internalType":"address[]","name":"canTerminateAddresses","type":"address[]"},{"internalType":"address[]","name":"validatorsAddresses","type":"address[]"},{"internalType":"bool","name":"validationPassed","type":"bool"},{"internalType":"uint256","name":"terminationBlock","type":"uint256"},{"internalType":"bytes","name":"votingTokens","type":"bytes"}],"internalType":"struct IProposalsManager.Proposal","name":"","type":"tuple"},{"internalType":"bool","name":"validationPassed","type":"bool"},{"internalType":"bool","name":"result","type":"bool"}],"name":"proposalCanBeFinalized","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"proposalModels","outputs":[{"components":[{"internalType":"address","name":"source","type":"address"},{"internalType":"string","name":"uri","type":"string"},{"internalType":"bool","name":"isPreset","type":"bool"},{"internalType":"bytes[]","name":"presetValues","type":"bytes[]"},{"internalType":"bytes32[]","name":"presetProposals","type":"bytes32[]"},{"internalType":"address","name":"creationRules","type":"address"},{"internalType":"address","name":"triggeringRules","type":"address"},{"internalType":"uint256","name":"votingRulesIndex","type":"uint256"},{"internalType":"address[][]","name":"canTerminateAddresses","type":"address[][]"},{"internalType":"address[][]","name":"validatorsAddresses","type":"address[][]"}],"internalType":"struct ISubDAO.SubDAOProposalModel[]","name":"","type":"tuple[]"}],"stateMutability":"view","type":"function"},{"inputs":[{"components":[{"internalType":"bytes32","name":"key","type":"bytes32"},{"internalType":"address","name":"location","type":"address"},{"internalType":"bool","name":"active","type":"bool"},{"internalType":"bool","name":"log","type":"bool"}],"internalType":"struct IOrganization.Component","name":"component","type":"tuple"}],"name":"set","outputs":[{"internalType":"address","name":"replacedComponentAddress","type":"address"}],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint256","name":"modelIndex","type":"uint256"},{"internalType":"address","name":"newCreationRules","type":"address"},{"internalType":"address","name":"newTriggeringRules","type":"address"}],"name":"setCreationAndTriggeringRules","outputs":[{"internalType":"address","name":"oldCreationRules","type":"address"},{"internalType":"address","name":"oldTriggeringRules","type":"address"}],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"newValue","type":"address"}],"name":"setDynamicUriResolver","outputs":[{"internalType":"address","name":"oldValue","type":"address"}],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"newValue","type":"address"}],"name":"setHost","outputs":[{"internalType":"address","name":"oldValue","type":"address"}],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"components":[{"internalType":"address","name":"source","type":"address"},{"internalType":"string","name":"uri","type":"string"},{"internalType":"bool","name":"isPreset","type":"bool"},{"internalType":"bytes[]","name":"presetValues","type":"bytes[]"},{"internalType":"bytes32[]","name":"presetProposals","type":"bytes32[]"},{"internalType":"address","name":"creationRules","type":"address"},{"internalType":"address","name":"triggeringRules","type":"address"},{"internalType":"uint256","name":"votingRulesIndex","type":"uint256"},{"internalType":"address[][]","name":"canTerminateAddresses","type":"address[][]"},{"internalType":"address[][]","name":"validatorsAddresses","type":"address[][]"}],"internalType":"struct ISubDAO.SubDAOProposalModel[]","name":"newValue","type":"tuple[]"}],"name":"setInitialProposalModels","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint256","name":"modelIndex","type":"uint256"},{"internalType":"bytes[]","name":"newPresetValues","type":"bytes[]"}],"name":"setPresetValues","outputs":[{"internalType":"bytes[]","name":"oldPresetValues","type":"bytes[]"},{"internalType":"bytes32[]","name":"deprecatedProposalIds","type":"bytes32[]"}],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"components":[{"internalType":"address","name":"source","type":"address"},{"internalType":"string","name":"uri","type":"string"},{"internalType":"bool","name":"isPreset","type":"bool"},{"internalType":"bytes[]","name":"presetValues","type":"bytes[]"},{"internalType":"bytes32[]","name":"presetProposals","type":"bytes32[]"},{"internalType":"address","name":"creationRules","type":"address"},{"internalType":"address","name":"triggeringRules","type":"address"},{"internalType":"uint256","name":"votingRulesIndex","type":"uint256"},{"internalType":"address[][]","name":"canTerminateAddresses","type":"address[][]"},{"internalType":"address[][]","name":"validatorsAddresses","type":"address[][]"}],"internalType":"struct ISubDAO.SubDAOProposalModel[]","name":"newValue","type":"tuple[]"}],"name":"setProposalModels","outputs":[{"components":[{"internalType":"address","name":"source","type":"address"},{"internalType":"string","name":"uri","type":"string"},{"internalType":"bool","name":"isPreset","type":"bool"},{"internalType":"bytes[]","name":"presetValues","type":"bytes[]"},{"internalType":"bytes32[]","name":"presetProposals","type":"bytes32[]"},{"internalType":"address","name":"creationRules","type":"address"},{"internalType":"address","name":"triggeringRules","type":"address"},{"internalType":"uint256","name":"votingRulesIndex","type":"uint256"},{"internalType":"address[][]","name":"canTerminateAddresses","type":"address[][]"},{"internalType":"address[][]","name":"validatorsAddresses","type":"address[][]"}],"internalType":"struct ISubDAO.SubDAOProposalModel[]","name":"oldValue","type":"tuple[]"}],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"string","name":"newValue","type":"string"}],"name":"setUri","outputs":[{"internalType":"string","name":"oldValue","type":"string"}],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint256","name":"modelIndex","type":"uint256"},{"internalType":"uint256","name":"votingRulesIndex","type":"uint256"}],"name":"setVotingRules","outputs":[{"internalType":"address[]","name":"oldCanTerminateAddresses","type":"address[]"},{"internalType":"address[]","name":"oldValidatorsAddresses","type":"address[]"}],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"subject","type":"address"},{"internalType":"address","name":"location","type":"address"},{"internalType":"bytes4","name":"selector","type":"bytes4"},{"internalType":"bytes","name":"payload","type":"bytes"},{"internalType":"uint256","name":"value","type":"uint256"}],"name":"subjectIsAuthorizedFor","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"location","type":"address"},{"internalType":"bytes","name":"payload","type":"bytes"},{"internalType":"address","name":"restReceiver","type":"address"}],"name":"submit","outputs":[{"internalType":"bytes","name":"response","type":"bytes"}],"stateMutability":"payable","type":"function"},{"inputs":[{"internalType":"bytes4","name":"interfaceId","type":"bytes4"}],"name":"supportsInterface","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"uri","outputs":[{"internalType":"string","name":"","type":"string"}],"stateMutability":"view","type":"function"}]

Deployed Bytecode

0x6080604052600436106101ee5760003560e01c80638eaa6ac01161010d578063c71bf12d116100a0578063e3fbf9851161006f578063e3fbf9851461065f578063eac989f81461067f578063ed26bceb14610694578063f437bc59146106b4578063fa073d76146106d457600080fd5b8063c71bf12d146105ea578063c85e0be2146105ff578063ccfec2fb1461061f578063cd6e1d7c1461063f57600080fd5b80639f8a13d7116100dc5780639f8a13d714610566578063b0db74ab14610586578063bea96d88146105aa578063c189dce4146105ca57600080fd5b80638eaa6ac0146104d057806394d1c6b5146105065780639b642de1146105265780639ce110d71461054657600080fd5b8063348fea83116101855780634afcac8d116101545780634afcac8d146103dc5780638ac1ff9e1461041c5780638b062a14146104745780638cf4c52a146104a257600080fd5b8063348fea831461034f5780633d0d364f1461037c578063457f4bcc1461039c578063477f4fef146103c957600080fd5b806308b3fff9116101c157806308b3fff9146102a4578063090be5e1146102d45780631621c7c8146102f45780632152c66d1461032157600080fd5b806301ffc9a7146101f357806303fbd7fd1461022857806305177fbd1461026057806307840bf214610282575b600080fd5b3480156101ff57600080fd5b5061021361020e36600461439e565b610701565b60405190151581526020015b60405180910390f35b34801561023457600080fd5b50610248610243366004613bb0565b6107e9565b6040516001600160a01b03909116815260200161021f565b34801561026c57600080fd5b5061027561083b565b60405161021f9190614915565b34801561028e57600080fd5b506102a261029d366004613d8c565b610bfb565b005b3480156102b057600080fd5b506102136102bf366004614185565b60076020526000908152604090205460ff1681565b3480156102e057600080fd5b506102136102ef36600461433e565b610c83565b34801561030057600080fd5b5061031461030f366004613d8c565b610d06565b60405161021f91906148dd565b34801561032d57600080fd5b5061034161033c3660046145b2565b610e1d565b60405161021f9291906147ed565b34801561035b57600080fd5b5061036f61036a366004613dcd565b610fea565b60405161021f91906147da565b34801561038857600080fd5b5061036f610397366004613d8c565b611072565b3480156103a857600080fd5b506103bc6103b73660046143b9565b61113f565b60405161021f9190614a43565b6103bc6103d7366004613c9e565b611180565b3480156103e857600080fd5b506103fc6103f7366004614534565b611259565b604080516001600160a01b0393841681529290911660208301520161021f565b34801561042857600080fd5b5061045d610437366004614185565b6000908152600d6020908152604080832054600e9092529091205460ff91821692911690565b60408051921515835290151560208301520161021f565b34801561048057600080fd5b5061049461048f36600461419e565b6112e8565b60405161021f92919061481b565b3480156104ae57600080fd5b506104c26104bd366004614576565b61186f565b60405161021f9291906148f0565b3480156104dc57600080fd5b506102486104eb366004614185565b6006602052600090815260409020546001600160a01b031681565b34801561051257600080fd5b50610275610521366004613d8c565b611b04565b34801561053257600080fd5b506103bc6105413660046143b9565b611b37565b34801561055257600080fd5b50600054610248906001600160a01b031681565b34801561057257600080fd5b50610213610581366004613bb0565b611bfb565b34801561059257600080fd5b5061059c600b5481565b60405190815260200161021f565b3480156105b657600080fd5b506102486105c536600461448e565b611c59565b3480156105d657600080fd5b506103bc6105e53660046142be565b611c96565b3480156105f657600080fd5b506103bc611cea565b34801561060b57600080fd5b5061024861061a366004613bb0565b611d78565b34801561062b57600080fd5b50600354610248906001600160a01b031681565b34801561064b57600080fd5b5061021361065a366004613c1d565b611df2565b34801561066b57600080fd5b506102a261067a366004613bb0565b611f43565b34801561068b57600080fd5b506103bc611fbd565b3480156106a057600080fd5b5061036f6106af366004614185565b612067565b3480156106c057600080fd5b50600154610248906001600160a01b031681565b3480156106e057600080fd5b5061059c6106ef366004613bb0565b60056020526000908152604090205481565b60006001600160e01b031982166301ffc9a760e01b148061073257506001600160e01b031982166301ffc9a760e01b145b8061074d57506001600160e01b03198216630a267c7760e21b145b8061076857506001600160e01b0319821663115fd2f360e21b145b8061078357506001600160e01b03198216639ce110d760e01b145b8061079e57506001600160e01b0319821663335b875f60e21b145b806107b957506001600160e01b0319821663f437bc5960e01b145b806107d457506001600160e01b0319821663642f05f160e11b145b806107e357506107e3826120d3565b92915050565b60006107f361217f565b6108185760405162461bcd60e51b815260040161080f90614b09565b60405180910390fd5b50600380546001600160a01b039283166001600160a01b03198216179091551690565b6060600a805480602002602001604051908101604052809291908181526020016000905b82821015610bf2576000848152602090819020604080516101408101909152600a850290910180546001600160a01b0316825260018101805492939192918401916108a990614e0e565b80601f01602080910402602001604051908101604052809291908181526020018280546108d590614e0e565b80156109225780601f106108f757610100808354040283529160200191610922565b820191906000526020600020905b81548152906001019060200180831161090557829003601f168201915b5050509183525050600282015460ff161515602080830191909152600383018054604080518285028101850182528281529401939260009084015b82821015610a0957838290600052602060002001805461097c90614e0e565b80601f01602080910402602001604051908101604052809291908181526020018280546109a890614e0e565b80156109f55780601f106109ca576101008083540402835291602001916109f5565b820191906000526020600020905b8154815290600101906020018083116109d857829003601f168201915b50505050508152602001906001019061095d565b50505050815260200160048201805480602002602001604051908101604052809291908181526020018280548015610a6057602002820191906000526020600020905b815481526020019060010190808311610a4c575b505050918352505060058201546001600160a01b03908116602080840191909152600684015490911660408084019190915260078401546060840152600884018054825181850281018501909352808352608090940193919290919060009084015b82821015610b3857600084815260209081902083018054604080518285028101850190915281815292830182828015610b2457602002820191906000526020600020905b81546001600160a01b03168152600190910190602001808311610b06575b505050505081526020019060010190610ac2565b50505050815260200160098201805480602002602001604051908101604052809291908181526020016000905b82821015610bdb57600084815260209081902083018054604080518285028101850190915281815292830182828015610bc757602002820191906000526020600020905b81546001600160a01b03168152600190910190602001808311610ba9575b505050505081526020019060010190610b65565b50505050815250508152602001906001019061085f565b50505050905090565b600c54610100900460ff1615610c425760405162461bcd60e51b815260206004820152600c60248201526b616c726561647920646f6e6560a01b604482015260640161080f565b6000546001600160a01b03163314610c6c5760405162461bcd60e51b815260040161080f90614b09565b610c7e610c798284614c50565b61219c565b505050565b6000848152600d6020908152604080832054600e90925282205460ff9182169116811580610caf575080155b610ce85760405162461bcd60e51b815260206004820152600a60248201526919195c1c9958d85d195960b21b604482015260640161080f565b81158015610cfb5750841580610cfb5750835b979650505050505050565b6060816001600160401b03811115610d2057610d20614e8a565b604051908082528060200260200182016040528015610d5357816020015b6060815260200190600190039081610d3e5790505b50905060005b8151811015610e165760046000858584818110610d7857610d78614e74565b905060200201358152602001908152602001600020805480602002602001604051908101604052809291908181526020018280548015610de157602002820191906000526020600020905b81546001600160a01b03168152600190910190602001808311610dc3575b5050505050828281518110610df857610df8614e74565b60200260200101819052508080610e0e90614e43565b915050610d59565b5092915050565b606080610e2861217f565b610e445760405162461bcd60e51b815260040161080f90614b09565b600a548410610e7d5760405162461bcd60e51b81526020600482015260056024820152640d2dcc8caf60db1b604482015260640161080f565b6000600a8581548110610e9257610e92614e74565b90600052602060002090600a0201905080600801805490508410610ee75760405162461bcd60e51b815260206004820152600c60248201526b496e76616c69642072756c6560a01b604482015260640161080f565b806008018481548110610efc57610efc614e74565b90600052602060002001805480602002602001604051908101604052809291908181526020018280548015610f5a57602002820191906000526020600020905b81546001600160a01b03168152600190910190602001808311610f3c575b50505050509250806009018481548110610f7657610f76614e74565b90600052602060002001805480602002602001604051908101604052809291908181526020018280548015610fd457602002820191906000526020600020905b81546001600160a01b03168152600190910190602001808311610fb6575b5050505060079092019490945550909391925050565b6060610ff461217f565b6110105760405162461bcd60e51b815260040161080f90614b09565b61106b8383808060200260200160405190810160405280939291908181526020016000905b8282101561106157611052608083028601368190038101906144a0565b81526020019060010190611035565b50505050506128b7565b9392505050565b6060816001600160401b0381111561108c5761108c614e8a565b6040519080825280602002602001820160405280156110b5578160200160208202803683370190505b50905060005b8151811015610e1657600660008585848181106110da576110da614e74565b90506020020135815260200190815260200160002060009054906101000a90046001600160a01b031682828151811061111557611115614e74565b6001600160a01b03909216602092830291909101909101528061113781614e43565b9150506110bb565b606061106b83838080601f01602080910402602001604051908101604052809392919081815260200183838082843760009201919091525061296e92505050565b606061118a61217f565b6111a65760405162461bcd60e51b815260040161080f90614b09565b60006111b23447614c39565b90506112003486868080601f016020809104026020016040519081016040528093929190818152602001838380828437600092019190915250506001600160a01b038b169392915050612a30565b9150478181111561124f5761124d6112188347614c39565b6040805160208101909152600081526001600160a01b03871661123b573361123d565b865b6001600160a01b03169190612a30565b505b5050949350505050565b60008061126461217f565b6112805760405162461bcd60e51b815260040161080f90614b09565b6000600a868154811061129557611295614e74565b60009182526020909120600a90910201600581018054600690920180546001600160a01b03198085166001600160a01b039a8b161790935591821696881696909617909555851696949093169450505050565b6040805160e0810182526060808252602082018190529181018290526000818301819052608082015260a0810182905260c0810182905261132761217f565b6113435760405162461bcd60e51b815260040161080f90614b09565b60008460008151811061135857611358614e74565b6020026020010151600001516001600160a01b0316905060008560008151811061138457611384614e74565b6020026020010151602001519050600a8054905082106113d65760405162461bcd60e51b815260206004820152600d60248201526c125b9d985b1a59081b5bd9195b609a1b604482015260640161080f565b6000600a83815481106113eb576113eb614e74565b6000918252602082206002600a909202019081015490925060ff16156115b25760038201548351611425908501602090810190860161451b565b915081106114665760405162461bcd60e51b815260206004820152600e60248201526d125b9d985b1a59081c1c995cd95d60921b604482015260640161080f565b6000801b82600401828154811061147f5761147f614e74565b9060005260206000200154146114c85760405162461bcd60e51b815260206004820152600e60248201526d141c995cd95d0818dc99585d195960921b604482015260640161080f565b888260040182815481106114de576114de614e74565b60009182526020808320909101929092558a8152600d90915260409020805460ff191660011790556003820180548290811061151c5761151c614e74565b90600052602060002001805461153190614e0e565b80601f016020809104026020016040519081016040528092919081815260200182805461155d90614e0e565b80156115aa5780601f1061157f576101008083540402835291602001916115aa565b820191906000526020600020905b81548152906001019060200180831161158d57829003601f168201915b505050505092505b8881857f60466ff473b953c013aea34e63edf0135746b8b8ac087aaa6bc45d891fbcdb1660405160405180910390a48154611607906115f9906001600160a01b0316612aa9565b6001600160a01b0316612ae5565b95508560008151811061161c5761161c614e74565b60200260200101516001600160a01b031663457f4bcc8360010185604051602001611648929190614a56565b6040516020818303038152906040526040518263ffffffff1660e01b81526004016116739190614a43565b600060405180830381600087803b15801561168d57600080fd5b505af11580156116a1573d6000803e3d6000fd5b505050506040513d6000823e601f3d908101601f191682016040526116c991908101906143ee565b9250600080600085516000146116f257858060200190518101906116ed9190613d05565b611713565b60408051600080825260208201818152828401918252606083019093529091905b6040805160e0810182528481526020810184905290810182905260058901546001600160a01b03908116606083015260068a0154166080820152600789015460088a0180549598509396509194509260a08401929190811061177757611777614e74565b906000526020600020018054806020026020016040519081016040528092919081815260200182805480156117d557602002820191906000526020600020905b81546001600160a01b031681526001909101906020018083116117b7575b50505050508152602001866009018760070154815481106117f8576117f8614e74565b9060005260206000200180548060200260200160405190810160405280929190818152602001828054801561185657602002820191906000526020600020905b81546001600160a01b03168152600190910190602001808311611838575b5050505050815250975050505050505050935093915050565b60608061187a61217f565b6118965760405162461bcd60e51b815260040161080f90614b09565b6000600a85815481106118ab576118ab614e74565b60009182526020909120600a90910201600281015490915060ff166118ff5760405162461bcd60e51b815260206004820152600a602482015269139bdd081c1c995cd95d60b21b604482015260640161080f565b80600301805480602002602001604051908101604052809291908181526020016000905b828210156119cf57838290600052602060002001805461194290614e0e565b80601f016020809104026020016040519081016040528092919081815260200182805461196e90614e0e565b80156119bb5780601f10611990576101008083540402835291602001916119bb565b820191906000526020600020905b81548152906001019060200180831161199e57829003601f168201915b505050505081526020019060010190611923565b50505050925080600401805480602002602001604051908101604052809291908181526020018280548015611a2357602002820191906000526020600020905b815481526020019060010190808311611a0f575b5050505050915060005b8251811015611a8b576000838281518110611a4a57611a4a614e74565b602002602001015190506000801b8114611a78576000818152600e60205260409020805460ff191660011790555b5080611a8381614e43565b915050611a2d565b508351611aa1906003830190602087019061318d565b5083516001600160401b03811115611abb57611abb614e8a565b604051908082528060200260200182016040528015611ae4578160200160208202803683370190505b508051611afb9160048401916020909101906131ea565b50509250929050565b6060611b0e61217f565b611b2a5760405162461bcd60e51b815260040161080f90614b09565b61106b610c798385614c50565b6060611b4161217f565b611b5d5760405162461bcd60e51b815260040161080f90614b09565b60028054611b6a90614e0e565b80601f0160208091040260200160405190810160405280929190818152602001828054611b9690614e0e565b8015611be35780601f10611bb857610100808354040283529160200191611be3565b820191906000526020600020905b815481529060010190602001808311611bc657829003601f168201915b50505050509050828260029190610e16929190613231565b6001600160a01b03808216600081815260056020908152604080832054835260069091528120549092161480156107e35750506001600160a01b03166000908152600560209081526040808320548352600790915290205460ff1690565b6000611c6361217f565b611c7f5760405162461bcd60e51b815260040161080f90614b09565b6107e3611c91368490038401846144a0565b612b40565b6000858152600d602052604090205460609060ff16611cc45760405180602001604052806000815250611ce0565b6040805160016020820152016040516020818303038152906040525b9695505050505050565b60028054611cf790614e0e565b80601f0160208091040260200160405190810160405280929190818152602001828054611d2390614e0e565b8015611d705780601f10611d4557610100808354040283529160200191611d70565b820191906000526020600020905b815481529060010190602001808311611d5357829003601f168201915b505050505081565b6000611d8261217f565b611d9e5760405162461bcd60e51b815260040161080f90614b09565b50600180546001600160a01b038381166001600160a01b0319831681179093556040519116919082907fe2302c6b581cf0c2edec4248d3a7af323db67692e29b6dc37a7d9736bf5e436990600090a3919050565b6000806000611e05898989898989612d36565b915091508115611e18579150611ce09050565b6001546001600160a01b038a811691161415611e3957600192505050611ce0565b600154611e4e906001600160a01b0316612ddb565b611e5d57600092505050611ce0565b60015460405160009182916001600160a01b039091169063335b875f60e21b90611e95908e908e908e908e908e908e9060240161472d565b60408051601f198184030181529181526020820180516001600160e01b03166001600160e01b0319909416939093179092529051611ed39190614711565b600060405180830381855afa9150503d8060008114611f0e576040519150601f19603f3d011682016040523d82523d6000602084013e611f13565b606091505b5091509150818015611f34575080806020019051810190611f349190614119565b9b9a5050505050505050505050565b611f4b61217f565b611f675760405162461bcd60e51b815260040161080f90614b09565b600c805460ff19169055600180546001600160a01b0319166001600160a01b0383169081179091556040516000907fe2302c6b581cf0c2edec4248d3a7af323db67692e29b6dc37a7d9736bf5e4369908290a350565b606061206260028054611fcf90614e0e565b80601f0160208091040260200160405190810160405280929190818152602001828054611ffb90614e0e565b80156120485780601f1061201d57610100808354040283529160200191612048565b820191906000526020600020905b81548152906001019060200180831161202b57829003601f168201915b505050505060405180602001604052806000815250612dfa565b905090565b6000818152600460209081526040918290208054835181840281018401909452808452606093928301828280156120c757602002820191906000526020600020905b81546001600160a01b031681526001909101906020018083116120a9575b50505050509050919050565b60006001600160e01b03198216633cd9a01960e11b148061210457506001600160e01b0319821663c71bf12d60e01b145b8061211f57506001600160e01b03198216631d59313f60e31b145b8061213a57506001600160e01b0319821663ccfec2fb60e01b145b8061215557506001600160e01b03198216639b642de160e01b145b8061217057506001600160e01b031982166303fbd7fd60e01b145b806107e357506107e382612e9e565b600061206233306000356001600160e01b03191660003634611df2565b6060600a805480602002602001604051908101604052809291908181526020016000905b82821015612553576000848152602090819020604080516101408101909152600a850290910180546001600160a01b03168252600181018054929391929184019161220a90614e0e565b80601f016020809104026020016040519081016040528092919081815260200182805461223690614e0e565b80156122835780601f1061225857610100808354040283529160200191612283565b820191906000526020600020905b81548152906001019060200180831161226657829003601f168201915b5050509183525050600282015460ff161515602080830191909152600383018054604080518285028101850182528281529401939260009084015b8282101561236a5783829060005260206000200180546122dd90614e0e565b80601f016020809104026020016040519081016040528092919081815260200182805461230990614e0e565b80156123565780601f1061232b57610100808354040283529160200191612356565b820191906000526020600020905b81548152906001019060200180831161233957829003601f168201915b5050505050815260200190600101906122be565b505050508152602001600482018054806020026020016040519081016040528092919081815260200182805480156123c157602002820191906000526020600020905b8154815260200190600101908083116123ad575b505050918352505060058201546001600160a01b03908116602080840191909152600684015490911660408084019190915260078401546060840152600884018054825181850281018501909352808352608090940193919290919060009084015b828210156124995760008481526020908190208301805460408051828502810185019091528181529283018282801561248557602002820191906000526020600020905b81546001600160a01b03168152600190910190602001808311612467575b505050505081526020019060010190612423565b50505050815260200160098201805480602002602001604051908101604052809291908181526020016000905b8282101561253c5760008481526020908190208301805460408051828502810185019091528181529283018282801561252857602002820191906000526020600020905b81546001600160a01b0316815260019091019060200180831161250a575b5050505050815260200190600101906124c6565b5050505081525050815260200190600101906121c0565b505050509050600a600061256791906132a5565b60005b82518110156128a257600083828151811061258757612587614e74565b6020026020010151905080604001516125a15760006125a8565b8060600151515b6001600160401b038111156125bf576125bf614e8a565b6040519080825280602002602001820160405280156125e8578160200160208202803683370190505b5060808201526040810151806126015750606081015151155b61263a5760405162461bcd60e51b815260206004820152600a602482015269139bdd081c1c995cd95d60b21b604482015260640161080f565b600b5415806126505750600b5481606001515111155b61268c5760405162461bcd60e51b815260206004820152600d60248201526c0a0e4cae6cae840d8cadccee8d609b1b604482015260640161080f565b6101008101515115806126a85750806101000151518160e00151105b6126e35760405162461bcd60e51b815260206004820152600c60248201526b566f74696e672052756c657360a01b604482015260640161080f565b80610120015151816101000151511461272d5760405162461bcd60e51b815260206004820152600c60248201526b566f74696e672052756c657360a01b604482015260640161080f565b600a80546001810182556000829052825191027fc65a7bb8d6351c1cf70c95a316cc6a92839c986682d98bc35f958f4883f9d2a8810180546001600160a01b039093166001600160a01b031990931692909217825560208084015180518594936127bd937fc65a7bb8d6351c1cf70c95a316cc6a92839c986682d98bc35f958f4883f9d2a99091019201906132c9565b50604082015160028201805460ff1916911515919091179055606082015180516127f191600384019160209091019061318d565b506080820151805161280d9160048401916020909101906131ea565b5060a08201516005820180546001600160a01b039283166001600160a01b03199182161790915560c084015160068401805491909316911617905560e08201516007820155610100820151805161286e91600884019160209091019061333c565b50610120820151805161288b91600984019160209091019061333c565b50505050808061289a90614e43565b91505061256a565b50600c805461ff001916610100179055919050565b606081516001600160401b038111156128d2576128d2614e8a565b6040519080825280602002602001820160405280156128fb578160200160208202803683370190505b50905060005b82518110156129685761292c83828151811061291f5761291f614e74565b6020026020010151612b40565b82828151811061293e5761293e614e74565b6001600160a01b03909216602092830291909101909101528061296081614e43565b915050612901565b50919050565b6000546060906001600160a01b0316156129b35760405162461bcd60e51b815260040161080f906020808252600490820152631a5b9a5d60e21b604082015260600190565b600080546001600160a01b0319163317905581516129da9083016020908101908401613bcd565b600180546001600160a01b039093166001600160a01b0319909316831790556040519092506000907fe2302c6b581cf0c2edec4248d3a7af323db67692e29b6dc37a7d9736bf5e4369908290a36107e381612f14565b60606000846001600160a01b03168484604051612a4d9190614711565b60006040518083038185875af1925050503d8060008114612a8a576040519150601f19603f3d011682016040523d82523d6000602084013e612a8f565b606091505b509250905080612aa157815160208301fd5b509392505050565b60006901000000000000000000820268803b80938091923cf36258807360e81b01176000526020600080f09050803b8015612ae357612968565bfe5b604080516001808252818301909252606091602080830190803683370190505090508181600081518110612b1b57612b1b614e74565b60200260200101906001600160a01b031690816001600160a01b031681525050919050565b8051600090612b775760405162461bcd60e51b81526020600482015260036024820152626b657960e81b604482015260640161080f565b81604001511580612b93575060208201516001600160a01b0316155b15612bb15781516000908152600760205260409020805460ff191690555b5080516000908152600660209081526040808320549184018051855185529190932080546001600160a01b0319166001600160a01b039283161790559151908216911615612cca576020820151803b80612c375760405162461bcd60e51b81526020600482015260076024820152666164647265737360c81b604482015260640161080f565b60408481015185516020808801516001600160a01b03166000908152600582528481208390559182526007905291909120805460ff1916911515919091179055606084015115612cc7578351600090815260046020908152604082208187015181546001810183559184529190922090910180546001600160a01b0319166001600160a01b039092169190911790555b50505b816060015115612d315781602001516001600160a01b0316816001600160a01b031683600001517f317e0d2bcf0367c836271129281791d7bf72d590fa46bb663cc33e9da7b64fc08560400151604051612d28911515815260200190565b60405180910390a45b919050565b6000806001600160a01b03871630148015612d5e57506001546001600160a01b038981169116145b15612d6e57506001905080612dd0565b6001600160a01b03871630148015612d9657506001600160e01b0319861663e3fbf98560e01b145b15612dc057600180546001600160a01b0316158015612db75750600c5460ff165b91509150612dd0565b6001612dcb89611bfb565b915091505b965096945050505050565b60006001600160a01b038216612df357506000919050565b503b151590565b6003546060906001600160a01b0316612e145750816107e3565b60035460405163f709c9b760e01b81526001600160a01b039091169063f709c9b790612e4a903090879087903390600401614791565b60006040518083038186803b158015612e6257600080fd5b505afa158015612e76573d6000803e3d6000fd5b505050506040513d6000823e601f3d908101601f1916820160405261106b91908101906143ee565b60006001600160e01b03198216630151f2df60e71b1480612ecf57506001600160e01b031982166305177fbd60e01b145b80612eea57506001600160e01b031982166394d1c6b560e01b145b80612f0557506001600160e01b03198216632152c66d60e01b145b806107e357506107e382612f6a565b606081806020019051810190612f2a9190614422565b600380546001600160a01b0319166001600160a01b03841617905582519093508390612f5d9060029060208601906132c9565b505050506107e381613093565b60006001600160e01b03198216630e8c73e160e41b1480612f9b57506001600160e01b03198216637d039ebb60e11b145b80612fb657506001600160e01b0319821663ed26bceb60e01b145b80612fd157506001600160e01b031982166302c438f960e31b145b80612fec57506001600160e01b0319821663023aa9ab60e61b145b8061300757506001600160e01b03198216633d0d364f60e01b145b8061302257506001600160e01b03198216639f8a13d760e01b145b8061303d57506001600160e01b031982166308b3fff960e01b145b8061305857506001600160e01b031982166317d52db160e31b145b8061307357506001600160e01b0319821663348fea8360e01b145b806107e357506001600160e01b0319821663477f4fef60e01b1492915050565b6060818060200190518101906130a99190614136565b600b91909155600c805460ff19169215159283179055915060ff1615806130d957506001546001600160a01b0316155b61311c5760405162461bcd60e51b8152602060048201526014602482015273125b9a5d081d1bc8189948199a5b985b1a5e995960621b604482015260640161080f565b6060818060200190518101906131329190613f2b565b81519093509091501561314a576131488161219c565b505b613166828060200190518101906131619190613e41565b6128b7565b60405160200161317691906147da565b604051602081830303815290604052915050919050565b8280548282559060005260206000209081019282156131da579160200282015b828111156131da57825180516131ca9184916020909101906132c9565b50916020019190600101906131ad565b506131e6929150613395565b5090565b828054828255906000526020600020908101928215613225579160200282015b8281111561322557825182559160200191906001019061320a565b506131e69291506133b2565b82805461323d90614e0e565b90600052602060002090601f01602090048101928261325f5760008555613225565b82601f106132785782800160ff19823516178555613225565b82800160010185558215613225579182015b8281111561322557823582559160200191906001019061328a565b50805460008255600a02906000526020600020908101906132c691906133c7565b50565b8280546132d590614e0e565b90600052602060002090601f0160209004810192826132f75760008555613225565b82601f1061331057805160ff1916838001178555613225565b82800160010185558215613225579182018281111561322557825182559160200191906001019061320a565b828054828255906000526020600020908101928215613389579160200282015b828111156133895782518051613379918491602090910190613462565b509160200191906001019061335c565b506131e69291506134b7565b808211156131e65760006133a982826134d4565b50600101613395565b5b808211156131e657600081556001016133b3565b808211156131e65780546001600160a01b031916815560006133ec60018301826134d4565b60028201805460ff1916905561340660038301600061350e565b61341460048301600061352c565b6005820180546001600160a01b0319908116909155600683018054909116905560006007830181905561344b90600884019061354a565b61345960098301600061354a565b50600a016133c7565b828054828255906000526020600020908101928215613225579160200282015b8281111561322557825182546001600160a01b0319166001600160a01b03909116178255602090920191600190910190613482565b808211156131e65760006134cb828261352c565b506001016134b7565b5080546134e090614e0e565b6000825580601f106134f0575050565b601f0160209004906000526020600020908101906132c691906133b2565b50805460008255906000526020600020908101906132c69190613395565b50805460008255906000526020600020908101906132c691906133b2565b50805460008255906000526020600020908101906132c691906134b7565b8035612d3181614ea0565b8051612d3181614ea0565b600082601f83011261358f57600080fd5b813560206135a461359f83614bef565b614bbf565b80838252828201915082860187848660051b89010111156135c457600080fd5b60005b858110156135ec5781356135da81614ea0565b845292840192908401906001016135c7565b5090979650505050505050565b600082601f83011261360a57600080fd5b8151602061361a61359f83614bef565b80838252828201915082860187848660051b890101111561363a57600080fd5b60005b858110156135ec57815161365081614ea0565b8452928401929084019060010161363d565b600082601f83011261367357600080fd5b8135602061368361359f83614bef565b80838252828201915082860187848660051b89010111156136a357600080fd5b6000805b868110156136e55782356001600160401b038111156136c4578283fd5b6136d28b88838d010161357e565b86525093850193918501916001016136a7565b509198975050505050505050565b600082601f83011261370457600080fd5b8151602061371461359f83614bef565b80838252828201915082860187848660051b890101111561373457600080fd5b6000805b868110156136e55782516001600160401b03811115613755578283fd5b6137638b88838d01016135f9565b8652509385019391850191600101613738565b60008083601f84011261378857600080fd5b5081356001600160401b0381111561379f57600080fd5b6020830191508360208260051b85010111156137ba57600080fd5b9250929050565b600082601f8301126137d257600080fd5b813560206137e261359f83614bef565b80838252828201915082860187848660051b890101111561380257600080fd5b60005b858110156135ec57813584529284019290840190600101613805565b600082601f83011261383257600080fd5b8151602061384261359f83614bef565b80838252828201915082860187848660051b890101111561386257600080fd5b60005b858110156135ec57815184529284019290840190600101613865565b600082601f83011261389257600080fd5b813560206138a261359f83614bef565b80838252828201915082860187848660051b89010111156138c257600080fd5b6000805b868110156136e55782356001600160401b038111156138e3578283fd5b6138f18b88838d01016139f6565b86525093850193918501916001016138c6565b600082601f83011261391557600080fd5b8151602061392561359f83614bef565b80838252828201915082860187848660051b890101111561394557600080fd5b6000805b868110156136e55782516001600160401b03811115613966578283fd5b6139748b88838d0101613a47565b8652509385019391850191600101613949565b8035612d3181614eb5565b8051612d3181614eb5565b80356001600160e01b031981168114612d3157600080fd5b60008083601f8401126139c757600080fd5b5081356001600160401b038111156139de57600080fd5b6020830191508360208285010111156137ba57600080fd5b600082601f830112613a0757600080fd5b8135613a1561359f82614c12565b818152846020838601011115613a2a57600080fd5b816020850160208301376000918101602001919091529392505050565b600082601f830112613a5857600080fd5b8151613a6661359f82614c12565b818152846020838601011115613a7b57600080fd5b613a8c826020830160208701614dde565b949350505050565b60006101608284031215613aa757600080fd5b613aaf614b2f565b9050613aba82613568565b815260208201356001600160401b0380821115613ad657600080fd5b613ae28583860161357e565b6020840152604084013560408401526060840135606084015260808401356080840152613b1160a08501613568565b60a084015260c0840135915080821115613b2a57600080fd5b613b368583860161357e565b60c084015260e0840135915080821115613b4f57600080fd5b613b5b8583860161357e565b60e08401526101009150613b70828501613987565b828401526101209150818401358284015261014091508184013581811115613b9757600080fd5b613ba3868287016139f6565b8385015250505092915050565b600060208284031215613bc257600080fd5b813561106b81614ea0565b60008060408385031215613be057600080fd5b8251613beb81614ea0565b60208401519092506001600160401b03811115613c0757600080fd5b613c1385828601613a47565b9150509250929050565b60008060008060008060a08789031215613c3657600080fd5b8635613c4181614ea0565b95506020870135613c5181614ea0565b9450613c5f6040880161399d565b935060608701356001600160401b03811115613c7a57600080fd5b613c8689828a016139b5565b979a9699509497949695608090950135949350505050565b60008060008060608587031215613cb457600080fd5b8435613cbf81614ea0565b935060208501356001600160401b03811115613cda57600080fd5b613ce6878288016139b5565b9094509250506040850135613cfa81614ea0565b939692955090935050565b600080600060608486031215613d1a57600080fd5b83516001600160401b0380821115613d3157600080fd5b613d3d878388016135f9565b94506020860151915080821115613d5357600080fd5b613d5f87838801613821565b93506040860151915080821115613d7557600080fd5b50613d8286828701613821565b9150509250925092565b60008060208385031215613d9f57600080fd5b82356001600160401b03811115613db557600080fd5b613dc185828601613776565b90969095509350505050565b60008060208385031215613de057600080fd5b82356001600160401b0380821115613df757600080fd5b818501915085601f830112613e0b57600080fd5b813581811115613e1a57600080fd5b8660208260071b8501011115613e2f57600080fd5b60209290920196919550909350505050565b60006020808385031215613e5457600080fd5b82516001600160401b03811115613e6a57600080fd5b8301601f81018513613e7b57600080fd5b8051613e8961359f82614bef565b80828252848201915084840188868560071b8701011115613ea957600080fd5b60009450845b84811015613f1d57608080838c031215613ec7578687fd5b613ecf614b58565b8351815288840151613ee081614ea0565b818a0152604084810151613ef381614eb5565b90820152606084810151613f0681614eb5565b908201528552938701939190910190600101613eaf565b509098975050505050505050565b60008060408385031215613f3e57600080fd5b82516001600160401b0380821115613f5557600080fd5b818501915085601f830112613f6957600080fd5b81516020613f7961359f83614bef565b8083825282820191508286018a848660051b8901011115613f9957600080fd5b60005b858110156140f157815187811115613fb357600080fd5b8801610140818e03601f19011215613fca57600080fd5b613fd2614b7a565b613fdd878301613573565b8152604082015189811115613ff157600080fd5b613fff8f8983860101613a47565b888301525061401060608301613992565b604082015260808201518981111561402757600080fd5b6140358f8983860101613904565b60608301525060a08201518981111561404d57600080fd5b61405b8f8983860101613821565b60808301525061406d60c08301613573565b60a082015261407e60e08301613573565b60c082015261010082015160e0820152610120820151898111156140a157600080fd5b6140af8f89838601016136f3565b61010083015250610140820151898111156140c957600080fd5b6140d78f89838601016136f3565b610120830152508552509284019290840190600101613f9c565b50509188015191965090935050508082111561410c57600080fd5b50613c1385828601613a47565b60006020828403121561412b57600080fd5b815161106b81614eb5565b60008060006060848603121561414b57600080fd5b835161415681614eb5565b6020850151604086015191945092506001600160401b0381111561417957600080fd5b613d8286828701613a47565b60006020828403121561419757600080fd5b5035919050565b6000806000606084860312156141b357600080fd5b8335925060208401356001600160401b03808211156141d157600080fd5b818601915086601f8301126141e557600080fd5b81356141f361359f82614bef565b80828252602082019150602085018a60208560051b880101111561421657600080fd5b60005b8481101561429f57858235111561422f57600080fd5b813587016040818e03601f1901121561424757600080fd5b61424f614b9d565b602082013561425d81614ea0565b815260408201358881111561427157600080fd5b6142808f6020838601016139f6565b6020838101919091529187525094850194929092019150600101614219565b505080965050505050506142b560408501613568565b90509250925092565b600080600080600060a086880312156142d657600080fd5b8535945060208601356001600160401b038111156142f357600080fd5b6142ff88828901613a94565b945050604086013561431081614ea0565b9250606086013561432081614ea0565b9150608086013561433081614eb5565b809150509295509295909350565b6000806000806080858703121561435457600080fd5b8435935060208501356001600160401b0381111561437157600080fd5b61437d87828801613a94565b935050604085013561438e81614eb5565b91506060850135613cfa81614eb5565b6000602082840312156143b057600080fd5b61106b8261399d565b600080602083850312156143cc57600080fd5b82356001600160401b038111156143e257600080fd5b613dc1858286016139b5565b60006020828403121561440057600080fd5b81516001600160401b0381111561441657600080fd5b613a8c84828501613a47565b60008060006060848603121561443757600080fd5b83516001600160401b038082111561444e57600080fd5b61445a87838801613a47565b94506020860151915061446c82614ea0565b60408601519193508082111561448157600080fd5b50613d8286828701613a47565b60006080828403121561296857600080fd5b6000608082840312156144b257600080fd5b604051608081018181106001600160401b03821117156144d4576144d4614e8a565b6040528235815260208301356144e981614ea0565b602082015260408301356144fc81614eb5565b6040820152606083013561450f81614eb5565b60608201529392505050565b60006020828403121561452d57600080fd5b5051919050565b60008060006060848603121561454957600080fd5b83359250602084013561455b81614ea0565b9150604084013561456b81614ea0565b809150509250925092565b6000806040838503121561458957600080fd5b8235915060208301356001600160401b038111156145a657600080fd5b613c1385828601613881565b600080604083850312156145c557600080fd5b50508035926020909101359150565b600081518084526020808501945080840160005b8381101561460d5781516001600160a01b0316875295820195908201906001016145e8565b509495945050505050565b600081518084526020808501808196508360051b8101915082860160005b8581101561466057828403895261464e8483516145d4565b98850198935090840190600101614636565b5091979650505050505050565b600081518084526020808501945080840160005b8381101561460d57815187529582019590820190600101614681565b600081518084526020808501808196508360051b8101915082860160005b858110156146605782840389526146d38483516146e5565b988501989350908401906001016146bb565b600081518084526146fd816020860160208601614dde565b601f01601f19169290920160200192915050565b60008251614723818460208701614dde565b9190910192915050565b6001600160a01b038781168252861660208201526001600160e01b03198516604082015260a06060820181905281018390526000838560c0840137600060c0858401015260c0601f19601f8601168301019050826080830152979650505050505050565b600060018060a01b038087168352608060208401526147b360808401876146e5565b83810360408501526147c581876146e5565b92505080841660608401525095945050505050565b60208152600061106b60208301846145d4565b60408152600061480060408301856145d4565b828103602084015261481281856145d4565b95945050505050565b60408152600061482e60408301856145d4565b8281036020840152835160e0825261484960e08301826145d4565b905060208501518282036020840152614862828261466d565b9150506040850151828203604084015261487c828261466d565b91505060018060a01b03606086015116606083015260808501516148ab60808401826001600160a01b03169052565b5060a085015182820360a08401526148c382826145d4565b91505060c085015182820360c0840152610cfb82826145d4565b60208152600061106b6020830184614618565b604081526000614903604083018561469d565b8281036020840152614812818561466d565b60006020808301818452808551808352604092508286019150828160051b87010184880160005b83811015613f1d57888303603f19018552815180516001600160a01b0316845261014088820151818a870152614974828701826146e5565b915050878201516149888987018215159052565b50606080830151868303828801526149a0838261469d565b92505050608080830151868303828801526149bb838261466d565b9250505060a0808301516149d9828801826001600160a01b03169052565b505060c0828101516001600160a01b03169086015260e080830151908601526101008083015186830382880152614a108382614618565b925050506101208083015192508582038187015250614a2f8183614618565b96890196945050509086019060010161493c565b60208152600061106b60208301846146e5565b60408152600080845481600182811c915080831680614a7657607f831692505b6020808410821415614a9657634e487b7160e01b86526022600452602486fd5b6040880184905260608801828015614ab55760018114614ac657614af1565b60ff19871682528282019750614af1565b60008c81526020902060005b87811015614aeb57815484820152908601908401614ad2565b83019850505b505087860381890152505050505061481281856146e5565b6020808252600c908201526b1d5b985d5d1a1bdc9a5e995960a21b604082015260600190565b60405161016081016001600160401b0381118282101715614b5257614b52614e8a565b60405290565b604051608081016001600160401b0381118282101715614b5257614b52614e8a565b60405161014081016001600160401b0381118282101715614b5257614b52614e8a565b604080519081016001600160401b0381118282101715614b5257614b52614e8a565b604051601f8201601f191681016001600160401b0381118282101715614be757614be7614e8a565b604052919050565b60006001600160401b03821115614c0857614c08614e8a565b5060051b60200190565b60006001600160401b03821115614c2b57614c2b614e8a565b50601f01601f191660200190565b600082821015614c4b57614c4b614e5e565b500390565b6000614c5e61359f84614bef565b808482526020808301925084368760051b87011115614c7c57600080fd5b60005b87811015614dd25781356001600160401b0380821115614c9e57600080fd5b81890191506101408236031215614cb457600080fd5b614cbc614b7a565b614cc583613568565b81528583013582811115614cd857600080fd5b614ce4368286016139f6565b87830152506040614cf6818501613987565b9082015260608381013583811115614d0d57600080fd5b614d1936828701613881565b82840152505060808084013583811115614d3257600080fd5b614d3e368287016137c1565b82840152505060a0614d51818501613568565b9082015260c0614d62848201613568565b9082015260e083810135908201526101008084013583811115614d8457600080fd5b614d9036828701613662565b8284015250506101208084013583811115614daa57600080fd5b614db636828701613662565b9183019190915250875250509382019390820190600101614c7f565b50919695505050505050565b60005b83811015614df9578181015183820152602001614de1565b83811115614e08576000848401525b50505050565b600181811c90821680614e2257607f821691505b6020821081141561296857634e487b7160e01b600052602260045260246000fd5b6000600019821415614e5757614e57614e5e565b5060010190565b634e487b7160e01b600052601160045260246000fd5b634e487b7160e01b600052603260045260246000fd5b634e487b7160e01b600052604160045260246000fd5b6001600160a01b03811681146132c657600080fd5b80151581146132c657600080fdfea26469706673582212203bc26effdb591b084e42403d8c14211de1c710c58e59c0872ec8ef5d65211fa764736f6c63430008060033

Block Transaction Difficulty Gas Used Reward
View All Blocks Produced

Block Uncle Number Difficulty Gas Used Reward
View All Uncles
Loading...
Loading
Loading...
Loading

Validator Index Block Amount
View All Withdrawals

Transaction Hash Block Value Eth2 PubKey Valid
View All Deposits
Loading...
Loading
[ Download: CSV Export  ]

A contract address hosts a smart contract, which is a set of code stored on the blockchain that runs when predetermined conditions are met. Learn more about addresses in our Knowledge Base.