Cryo Explorer Ethereum Mainnet

Address Contract Partially Verified

Address 0x28780349A33eEE56bb92241bAAB8095449e24306
Balance 0 ETH
Nonce 1
Code Size 1368 bytes
Indexed Transactions 0
External Etherscan · Sourcify

Contract Bytecode

1368 bytes
0x608060405234801561001057600080fd5b50600436106100625760003560e01c8063504f7f6f146100675780636a938567146100e0578063a230c52414610111578063ce757d2914610137578063d6354e1514610151578063eeb7286614610159575b600080fd5b6100de6004803603604081101561007d57600080fd5b8135919081019060408101602082013564010000000081111561009f57600080fd5b8201836020820111156100b157600080fd5b803590602001918460018302840111640100000000831117156100d357600080fd5b5090925090506101d6565b005b6100fd600480360360208110156100f657600080fd5b5035610421565b604080519115158252519081900360200190f35b6100fd6004803603602081101561012757600080fd5b50356001600160a01b0316610432565b61013f610447565b60408051918252519081900360200190f35b6100fd61044d565b610161610456565b6040805160208082528351818301528351919283929083019185019080838360005b8381101561019b578181015183820152602001610183565b50505050905090810190601f1680156101c85780820380516001836020036101000a031916815260200191505b509250505060405180910390f35b60025460410281101561021a5760405162461bcd60e51b81526004018080602001828103825260218152602001806104df6021913960400191505060405180910390fd5b600080805b60025481101561041057600061026c86868080601f01602080910402602001604051908101604052809392919081815260200183838082843760009201919091525088925061048d915050565b905060006102b387878080601f016020809104026020016040519081016040528093929190818152602001838380828437600092019190915250505060208801905061048d565b905060008787876040018181106102c657fe5b9050013560f81c60f81b60f81c9050604186019550600060018a83868660405160008152602001604052604051808581526020018460ff1660ff1681526020018381526020018281526020019450505050506020604051602081039080840390855afa15801561033a573d6000803e3d6000fd5b505060408051601f1901516001600160a01b03811660009081526003602052919091205490925060ff1690506103a15760405162461bcd60e51b81526004018080602001828103825260248152602001806105006024913960400191505060405180910390fd5b856001600160a01b0316816001600160a01b0316116103ff576040805162461bcd60e51b81526020600482015260156024820152744e4f4e5f534f525445445f5349474e41545552455360581b604482015290519081900360640190fd5b9450506001909201915061021f9050565b5061041a85610495565b5050505050565b600061042c826104c9565b92915050565b60036020526000908152604090205460ff1681565b60025481565b60015460ff1690565b60408051808201909152601a81527f537461726b576172655f436f6d6d69747465655f323031395f31000000000000602082015290565b016020015190565b6000818152602081905260409020805460ff191660019081179091555460ff166104c6576001805460ff1916811790555b50565b60009081526020819052604090205460ff169056fe494e56414c49445f415641494c4142494c4954595f50524f4f465f4c454e475448415641494c4142494c4954595f50524f5645525f4e4f545f494e5f434f4d4d4954544545a265627a7a72315820539ba46eae1e095e28dc7adcc6d7f9397980c17fe7c9a47ed448c8e42baad36964736f6c634300050f0032

Verified Source Code Partial Match

Compiler: v0.5.15+commit.6a57276f EVM: istanbul Optimization: Yes (100 runs)
Identity.sol 27 lines
/*
  Copyright 2019,2020 StarkWare Industries Ltd.

  Licensed under the Apache License, Version 2.0 (the "License").
  You may not use this file except in compliance with the License.
  You may obtain a copy of the License at

  https://www.starkware.co/open-source-license/

  Unless required by applicable law or agreed to in writing,
  software distributed under the License is distributed on an "AS IS" BASIS,
  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
  See the License for the specific language governing permissions
  and limitations under the License.
*/
pragma solidity ^0.5.2;

contract Identity {

    /*
      Allows a caller, typically another contract,
      to ensure that the provided address is of the expected type and version.
    */
    function identify()
        external pure
        returns(string memory);
}
Committee.sol 107 lines
/*
  Copyright 2019,2020 StarkWare Industries Ltd.

  Licensed under the Apache License, Version 2.0 (the "License").
  You may not use this file except in compliance with the License.
  You may obtain a copy of the License at

  https://www.starkware.co/open-source-license/

  Unless required by applicable law or agreed to in writing,
  software distributed under the License is distributed on an "AS IS" BASIS,
  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
  See the License for the specific language governing permissions
  and limitations under the License.
*/
// Solidity 0.5.4 has this bug: https://github.com/ethereum/solidity/issues/5997
// It's already fixed: https://github.com/ethereum/solidity/pull/6000 and will be released in 0.5.5.
pragma solidity ^0.5.2;

import "FactRegistry.sol";
import "Identity.sol";

contract Committee is FactRegistry, Identity {

    uint256 constant SIGNATURE_LENGTH = 32 * 2 + 1; // r(32) + s(32) +  v(1).
    uint256 public signaturesRequired;
    mapping (address => bool) public isMember;

    /// @dev Contract constructor sets initial members and required number of signatures.
    /// @param committeeMembers List of committee members.
    /// @param numSignaturesRequired Number of required signatures.
    constructor (address[] memory committeeMembers, uint256 numSignaturesRequired)
        public
    {
        require(numSignaturesRequired <= committeeMembers.length, "TOO_MANY_REQUIRED_SIGNATURES");
        for (uint256 idx = 0; idx < committeeMembers.length; idx++) {
            require(!isMember[committeeMembers[idx]], "NON_UNIQUE_COMMITTEE_MEMBERS");
            isMember[committeeMembers[idx]] = true;
        }
        signaturesRequired = numSignaturesRequired;
    }

    function identify()
        external pure
        returns(string memory)
    {
        return "StarkWare_Committee_2019_1";
    }

    /// @dev Verifies the availability proof. Reverts if invalid.
    /// An availability proof should have a form of a concatenation of ec-signatures by signatories.
    /// Signatures should be sorted by signatory address ascendingly.
    /// Signatures should be 65 bytes long. r(32) + s(32) + v(1).
    /// There should be at least the number of required signatures as defined in this contract
    /// and all signatures provided should be from signatories.
    ///
    /// See :sol:mod:`AvailabilityVerifiers` for more information on when this is used.
    ///
    /// @param claimHash The hash of the claim the committee is signing on.
    /// The format is keccak256(abi.encodePacked(
    ///    newVaultRoot, vaultTreeHeight, newOrderRoot, orderTreeHeight sequenceNumber))
    /// @param availabilityProofs Concatenated ec signatures by committee members.
    function verifyAvailabilityProof(
        bytes32 claimHash,
        bytes calldata availabilityProofs
    )
        external
    {
        require(
            availabilityProofs.length >= signaturesRequired * SIGNATURE_LENGTH,
            "INVALID_AVAILABILITY_PROOF_LENGTH");

        uint256 offset = 0;
        address prevRecoveredAddress = address(0);
        for (uint256 proofIdx = 0; proofIdx < signaturesRequired; proofIdx++) {
            bytes32 r = bytesToBytes32(availabilityProofs, offset);
            bytes32 s = bytesToBytes32(availabilityProofs, offset + 32);
            uint8 v = uint8(availabilityProofs[offset + 64]);
            offset += SIGNATURE_LENGTH;
            address recovered = ecrecover(
                claimHash,
                v,
                r,
                s
            );
            // Signatures should be sorted off-chain before submitting to enable cheap uniqueness
            // check on-chain.
            require(isMember[recovered], "AVAILABILITY_PROVER_NOT_IN_COMMITTEE");
            require(recovered > prevRecoveredAddress, "NON_SORTED_SIGNATURES");
            prevRecoveredAddress = recovered;
        }
        registerFact(claimHash);
    }

    function bytesToBytes32(bytes memory array, uint256 offset)
        private pure
        returns (bytes32 result) {
        // Arrays are prefixed by a 256 bit length parameter.
        uint256 actualOffset = offset + 32;

        // Read the bytes32 from array memory.
        // solium-disable-next-line security/no-inline-assembly
        assembly {
            result := mload(add(array, actualOffset))
        }
    }
}
FactRegistry.sol 75 lines
/*
  Copyright 2019,2020 StarkWare Industries Ltd.

  Licensed under the Apache License, Version 2.0 (the "License").
  You may not use this file except in compliance with the License.
  You may obtain a copy of the License at

  https://www.starkware.co/open-source-license/

  Unless required by applicable law or agreed to in writing,
  software distributed under the License is distributed on an "AS IS" BASIS,
  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
  See the License for the specific language governing permissions
  and limitations under the License.
*/
pragma solidity ^0.5.2;

import "IQueryableFactRegistry.sol";

contract FactRegistry is IQueryableFactRegistry {
    // Mapping: fact hash -> true.
    mapping (bytes32 => bool) private verifiedFact;

    // Indicates whether the Fact Registry has at least one fact registered.
    bool anyFactRegistered;

    /*
      Checks if a fact has been verified.
    */
    function isValid(bytes32 fact)
        external view
        returns(bool)
    {
        return _factCheck(fact);
    }


    /*
      This is an internal method to check if the fact is already registered.
      In current implementation of FactRegistry it's identical to isValid().
      But the check is against the local fact registry,
      So for a derived referral fact registry, it's not the same.
    */
    function _factCheck(bytes32 fact)
        internal view
        returns(bool)
    {
        return verifiedFact[fact];
    }

    function registerFact(
        bytes32 factHash
        )
        internal
    {
        // This function stores the fact hash in the mapping.
        verifiedFact[factHash] = true;

        // Mark first time off.
        if (!anyFactRegistered) {
            anyFactRegistered = true;
        }
    }

    /*
      Indicates whether at least one fact was registered.
    */
    function hasRegisteredFact()
        external view
        returns(bool)
    {
        return anyFactRegistered;
    }

}
IFactRegistry.sol 40 lines
/*
  Copyright 2019,2020 StarkWare Industries Ltd.

  Licensed under the Apache License, Version 2.0 (the "License").
  You may not use this file except in compliance with the License.
  You may obtain a copy of the License at

  https://www.starkware.co/open-source-license/

  Unless required by applicable law or agreed to in writing,
  software distributed under the License is distributed on an "AS IS" BASIS,
  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
  See the License for the specific language governing permissions
  and limitations under the License.
*/
pragma solidity ^0.5.2;

/*
  The Fact Registry design pattern is a way to separate cryptographic verification from the
  business logic of the contract flow.

  A fact registry holds a hash table of verified "facts" which are represented by a hash of claims
  that the registry hash check and found valid. This table may be queried by accessing the
  isValid() function of the registry with a given hash.

  In addition, each fact registry exposes a registry specific function for submitting new claims
  together with their proofs. The information submitted varies from one registry to the other
  depending of the type of fact requiring verification.

  For further reading on the Fact Registry design pattern see this
  `StarkWare blog post <https://medium.com/starkware/the-fact-registry-a64aafb598b6>`_.
*/
contract IFactRegistry {
    /*
      Returns true if the given fact was previously registered in the contract.
    */
    function isValid(bytes32 fact)
        external view
        returns(bool);
}
IQueryableFactRegistry.sol 33 lines
/*
  Copyright 2019,2020 StarkWare Industries Ltd.

  Licensed under the Apache License, Version 2.0 (the "License").
  You may not use this file except in compliance with the License.
  You may obtain a copy of the License at

  https://www.starkware.co/open-source-license/

  Unless required by applicable law or agreed to in writing,
  software distributed under the License is distributed on an "AS IS" BASIS,
  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
  See the License for the specific language governing permissions
  and limitations under the License.
*/
pragma solidity ^0.5.2;

import "IFactRegistry.sol";

/*
  Extends the IFactRegistry interface with a query method that indicates
  whether the fact registry has successfully registered any fact or is still empty of such facts.
*/
contract IQueryableFactRegistry is IFactRegistry {

    /*
      Returns true if at least one fact has been registered.
    */
    function hasRegisteredFact()
        external view
        returns(bool);

}

Read Contract

hasRegisteredFact 0xd6354e15 → bool
identify 0xeeb72866 → string
isMember 0xa230c524 → bool
isValid 0x6a938567 → bool
signaturesRequired 0xce757d29 → uint256

Write Contract 1 functions

These functions modify contract state and require a wallet transaction to execute.

verifyAvailabilityProof 0x504f7f6f
bytes32 claimHash
bytes availabilityProofs

Recent Transactions

No transactions found for this address