Source Code
Overview
ETH Balance
0 ETH
Token Holdings
Multichain Info
N/A
Latest 25 from a total of 34,019 transactions
| Transaction Hash |
Method
|
Block
|
From
|
To
|
Amount
|
||||
|---|---|---|---|---|---|---|---|---|---|
| Submit Task | 6151349 | 509 days ago | IN | 0 ETH | 0 | ||||
| Submit Task | 6150185 | 509 days ago | IN | 0 ETH | 0.00000002 | ||||
| Submit Task | 6137720 | 511 days ago | IN | 0 ETH | 0.00000001 | ||||
| Submit Task | 6137673 | 511 days ago | IN | 0 ETH | 0 | ||||
| Submit Task | 6137622 | 511 days ago | IN | 0 ETH | 0 | ||||
| Submit Task | 6137579 | 511 days ago | IN | 0 ETH | 0 | ||||
| Submit Task | 6137528 | 511 days ago | IN | 0 ETH | 0 | ||||
| Submit Task | 6137429 | 511 days ago | IN | 0 ETH | 0 | ||||
| Submit Task | 6123240 | 513 days ago | IN | 0 ETH | 0.00000001 | ||||
| Submit Task | 6123046 | 513 days ago | IN | 0 ETH | 0.00000001 | ||||
| Submit Task | 6122847 | 513 days ago | IN | 0 ETH | 0.00000005 | ||||
| Submit Task | 6122548 | 513 days ago | IN | 0 ETH | 0.00000006 | ||||
| Submit Task | 6116483 | 514 days ago | IN | 0 ETH | 0.00000008 | ||||
| Submit Task | 6115729 | 514 days ago | IN | 0 ETH | 0.00000009 | ||||
| Submit Task | 6074664 | 520 days ago | IN | 0 ETH | 0.00000008 | ||||
| Submit Task | 6074558 | 520 days ago | IN | 0 ETH | 0.00000008 | ||||
| Submit Task | 6074510 | 520 days ago | IN | 0 ETH | 0.00000009 | ||||
| Submit Task | 6074458 | 520 days ago | IN | 0 ETH | 0.00000009 | ||||
| Submit Task | 6074248 | 520 days ago | IN | 0 ETH | 0.00000016 | ||||
| Submit Task | 6074197 | 520 days ago | IN | 0 ETH | 0.00000014 | ||||
| Submit Task | 6074152 | 520 days ago | IN | 0 ETH | 0.00000015 | ||||
| Submit Task | 6074097 | 520 days ago | IN | 0 ETH | 0.00000022 | ||||
| Submit Task | 6073942 | 520 days ago | IN | 0 ETH | 0.00000025 | ||||
| Submit Task | 6073678 | 520 days ago | IN | 0 ETH | 0.00000027 | ||||
| Submit Task | 6073575 | 520 days ago | IN | 0 ETH | 0.0000002 |
View more zero value Internal Transactions in Advanced View mode
Advanced mode:
Loading...
Loading
Loading...
Loading
Contract Name:
ProofPool
Compiler Version
v0.8.20+commit.a1b79de6
Optimization Enabled:
Yes with 200 runs
Other Settings:
paris EvmVersion
Contract Source Code (Solidity Standard Json-Input format)
// SPDX-License-Identifier: MIT
// _ ___ ____ _ _ _____ _ _ ____ ____
// / \ / _ \| _ \ / \ | |/ |_ _| | | / \ | __ / ___|
// / _ \| | | | |_) | / _ \ | ' / | | | | / _ \ | _ \___ \
// / ___ | |_| | _ < / ___ \| . \ | | | |___ / ___ \| |_) ___) |
// /_/ \_\___/|_| \_/_/ \_|_|\_|___| |_____/_/ \_|____|____/
pragma solidity ^0.8.20;
import { Address } from "@openzeppelin/contracts/utils/Address.sol";
import { ECDSA } from "@openzeppelin/contracts/utils/cryptography/ECDSA.sol";
import { IERC1271 } from "@openzeppelin/contracts/interfaces/IERC1271.sol";
import { IERC165 }
from "@openzeppelin/contracts/utils/introspection/IERC165.sol";
import { IERC20 } from "@openzeppelin/contracts/token/ERC20/IERC20.sol";
import { Ownable } from "@openzeppelin/contracts/access/Ownable.sol";
import { ReentrancyGuard }
from "@openzeppelin/contracts/utils/ReentrancyGuard.sol";
import { LibBytesUtils } from "./libs/LibBytesUtils.sol";
struct TaskAssignment {
address prover;
address rewardToken;
uint256 rewardAmount;
uint64 liabilityWindow;
address liabilityToken;
uint256 liabilityAmount;
uint64 expiry;
bytes signature;
}
struct TaskStatus {
bytes instance;
address prover;
uint64 submittedAt;
bool proven;
}
contract ProofPool is Ownable, ReentrancyGuard {
using ECDSA for bytes32;
bytes4 internal constant EIP1271_MAGICVALUE = 0x1626ba7e;
address bondToken;
uint256 bondAmount;
address verifierAddress;
// The maximum time window allowed for a proof submission (in seconds).
uint32 proofWindow;
// The length of instance (in bytes).
uint8 instanceLength;
mapping(bytes32 => TaskStatus) public taskStatusMap;
event TaskSubmitted(
address indexed requester,
address indexed prover,
bytes instance,
bytes32 taskKey,
address rewardToken,
uint256 rewardAmount,
uint64 liabilityWindow,
address liabilityToken,
uint256 liabilityAmount
);
event TaskProven(
address indexed prover,
bytes32 taskKey,
bytes proof
);
event BondDeposited(
address indexed from,
bytes32 taskKey,
uint256 amount
);
event BondReleased(
address indexed to,
bytes32 taskKey,
uint256 amount
);
event Transfer(
address indexed from,
address indexed to,
uint256 value
);
error INVALID_ASSIGNMENT();
error INVALID_PROVER();
error INVALID_PROVER_SIG();
error TASK_ALREADY_SUBMITTED();
error TASK_ALREADY_PROVEN();
error TASK_NONE_EXIST();
error TASK_NOT_THE_SAME();
error INVALID_PROOF();
error TASK_NOT_OPEN();
error TASK_ALREADY_OPEN();
constructor(
address _owner,
address _bondToken,
uint256 _bondAmount,
address _verifierAddress,
uint32 _proofWindow,
uint8 _instanceLength
)
Ownable(_owner)
{
bondToken = _bondToken;
bondAmount = _bondAmount;
verifierAddress = _verifierAddress;
proofWindow = _proofWindow;
instanceLength = _instanceLength;
}
function updateConfig(
address _bondToken,
uint256 _bondAmount,
address _verifierAddress,
uint32 _proofWindow,
uint8 _instanceLength
)
external
onlyOwner
{
bondToken = _bondToken;
bondAmount = _bondAmount;
verifierAddress = _verifierAddress;
proofWindow = _proofWindow;
instanceLength = _instanceLength;
}
function submitTask(
bytes calldata instance,
// bytes calldata txList,
// TaskAssignment memory assignment
address _prover,
address _rewardToken,
uint256 _rewardAmount,
uint64 _liabilityWindow,
address _liabilityToken,
uint256 _liabilityAmount,
uint64 _expiry,
bytes calldata _signature
)
external
nonReentrant
returns (bytes32 taskKey)
{
// Check prover assignment
if (_expiry <= block.number) {
revert INVALID_ASSIGNMENT();
}
// Check task already submitted
taskKey = keccak256(instance);
if (taskStatusMap[taskKey].prover != address(0)) {
revert TASK_ALREADY_SUBMITTED();
}
// Pay the reward
IERC20(_rewardToken).transferFrom(
msg.sender,
_prover,
_rewardAmount
);
emit Transfer(
msg.sender,
_prover,
_rewardAmount
);
// Deposit the bond
IERC20(bondToken).transferFrom(
_prover,
address(this),
bondAmount
);
emit Transfer(
_prover,
address(this),
bondAmount
);
emit BondDeposited(
_prover,
taskKey,
bondAmount
);
// Check the signature
if (!_isContract(_prover)) {
// address assignedProver = _prover;
if (
keccak256(
abi.encodePacked(
"\u0019Ethereum Signed Message:\n32",
bytes.concat(
_hashAssignment(
instance,
_rewardToken,
_rewardAmount,
_liabilityWindow,
_liabilityToken,
_liabilityAmount,
_expiry
)
)
)
).recover(_signature) != _prover
) {
revert INVALID_PROVER_SIG();
}
} else if (
IERC165(
_prover
).supportsInterface(type(IERC1271).interfaceId)
) {
if (
IERC1271(_prover).isValidSignature(
_hashAssignment(
instance,
_rewardToken,
_rewardAmount,
_liabilityWindow,
_liabilityToken,
_liabilityAmount,
_expiry
),
_signature
) != EIP1271_MAGICVALUE
) {
revert INVALID_PROVER_SIG();
}
} else {
revert INVALID_PROVER();
}
// Save the task status
taskStatusMap[taskKey] = TaskStatus({
instance: instance,
prover: _prover,
submittedAt: uint64(block.timestamp),
proven: false
});
emit TaskSubmitted(
msg.sender,
_prover,
instance,
taskKey,
_rewardToken,
_rewardAmount,
_liabilityWindow,
_liabilityToken,
_liabilityAmount
);
}
function proveTask(
bytes32 taskKey,
bytes calldata proof
)
external
nonReentrant
{
TaskStatus storage taskStatus = taskStatusMap[taskKey];
if (taskStatus.prover == address(0) && taskStatus.submittedAt == 0) {
revert TASK_NONE_EXIST();
}
// if (
// !LibBytesUtils.equal(
// taskStatus.instance,
// LibBytesUtils.slice(proof, 0, instanceLength)
// )
// ) {
// revert TASK_NOT_THE_SAME();
// }
if (
taskStatus.submittedAt + proofWindow > block.timestamp
&& taskStatus.prover != msg.sender
) {
revert TASK_NOT_OPEN();
} else if (
taskStatus.submittedAt + proofWindow <= block.timestamp
&& taskStatus.prover == msg.sender
) {
revert TASK_ALREADY_OPEN();
}
// Since risc0's solidity verifier is not open sourced
// the verifying process is done by default for demo purposes.
// (bool _isCallSuccess, ) = verifierAddress.staticcall(proof);
bool _isCallSuccess = true;
if (!_isCallSuccess) {
revert INVALID_PROOF();
}
// Update status
taskStatus.proven = true;
// Release the bond
IERC20(bondToken).transfer(
msg.sender,
bondAmount
);
// emit Transfer(
// address(this),
// msg.sender,
// bondAmount
// );
emit BondReleased(
msg.sender,
taskKey,
bondAmount
);
emit TaskProven(
msg.sender,
taskKey,
proof
);
}
function readProofStatus(
bytes32 taskKey
)
external
view
returns (TaskStatus memory taskStatus)
{
taskStatus = taskStatusMap[taskKey];
if (taskStatus.prover == address(0) && taskStatus.submittedAt == 0) {
revert TASK_NONE_EXIST();
}
}
function _isContract(address _addr)
private
view
returns (bool isContract)
{
uint32 size;
assembly {
size := extcodesize(_addr)
}
return (size > 0);
}
function _hashAssignment(
bytes memory _instance,
address _rewardToken,
uint256 _rewardAmount,
uint64 _liabilityWindow,
address _liabilityToken,
uint256 _liabilityAmount,
uint64 _expiry
)
private
pure
returns (bytes32)
{
return keccak256(
abi.encode(
_instance,
_rewardToken,
_rewardAmount,
_liabilityToken,
_liabilityAmount,
_expiry,
_liabilityWindow
)
);
}
}// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v5.0.0) (utils/Address.sol)
pragma solidity ^0.8.20;
/**
* @dev Collection of functions related to the address type
*/
library Address {
/**
* @dev The ETH balance of the account is not enough to perform the operation.
*/
error AddressInsufficientBalance(address account);
/**
* @dev There's no code at `target` (it is not a contract).
*/
error AddressEmptyCode(address target);
/**
* @dev A call to an address target failed. The target may have reverted.
*/
error FailedInnerCall();
/**
* @dev Replacement for Solidity's `transfer`: sends `amount` wei to
* `recipient`, forwarding all available gas and reverting on errors.
*
* https://eips.ethereum.org/EIPS/eip-1884[EIP1884] increases the gas cost
* of certain opcodes, possibly making contracts go over the 2300 gas limit
* imposed by `transfer`, making them unable to receive funds via
* `transfer`. {sendValue} removes this limitation.
*
* https://consensys.net/diligence/blog/2019/09/stop-using-soliditys-transfer-now/[Learn more].
*
* IMPORTANT: because control is transferred to `recipient`, care must be
* taken to not create reentrancy vulnerabilities. Consider using
* {ReentrancyGuard} or the
* https://solidity.readthedocs.io/en/v0.8.20/security-considerations.html#use-the-checks-effects-interactions-pattern[checks-effects-interactions pattern].
*/
function sendValue(address payable recipient, uint256 amount) internal {
if (address(this).balance < amount) {
revert AddressInsufficientBalance(address(this));
}
(bool success, ) = recipient.call{value: amount}("");
if (!success) {
revert FailedInnerCall();
}
}
/**
* @dev Performs a Solidity function call using a low level `call`. A
* plain `call` is an unsafe replacement for a function call: use this
* function instead.
*
* If `target` reverts with a revert reason or custom error, it is bubbled
* up by this function (like regular Solidity function calls). However, if
* the call reverted with no returned reason, this function reverts with a
* {FailedInnerCall} error.
*
* Returns the raw returned data. To convert to the expected return value,
* use https://solidity.readthedocs.io/en/latest/units-and-global-variables.html?highlight=abi.decode#abi-encoding-and-decoding-functions[`abi.decode`].
*
* Requirements:
*
* - `target` must be a contract.
* - calling `target` with `data` must not revert.
*/
function functionCall(address target, bytes memory data) internal returns (bytes memory) {
return functionCallWithValue(target, data, 0);
}
/**
* @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`],
* but also transferring `value` wei to `target`.
*
* Requirements:
*
* - the calling contract must have an ETH balance of at least `value`.
* - the called Solidity function must be `payable`.
*/
function functionCallWithValue(address target, bytes memory data, uint256 value) internal returns (bytes memory) {
if (address(this).balance < value) {
revert AddressInsufficientBalance(address(this));
}
(bool success, bytes memory returndata) = target.call{value: value}(data);
return verifyCallResultFromTarget(target, success, returndata);
}
/**
* @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`],
* but performing a static call.
*/
function functionStaticCall(address target, bytes memory data) internal view returns (bytes memory) {
(bool success, bytes memory returndata) = target.staticcall(data);
return verifyCallResultFromTarget(target, success, returndata);
}
/**
* @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`],
* but performing a delegate call.
*/
function functionDelegateCall(address target, bytes memory data) internal returns (bytes memory) {
(bool success, bytes memory returndata) = target.delegatecall(data);
return verifyCallResultFromTarget(target, success, returndata);
}
/**
* @dev Tool to verify that a low level call to smart-contract was successful, and reverts if the target
* was not a contract or bubbling up the revert reason (falling back to {FailedInnerCall}) in case of an
* unsuccessful call.
*/
function verifyCallResultFromTarget(
address target,
bool success,
bytes memory returndata
) internal view returns (bytes memory) {
if (!success) {
_revert(returndata);
} else {
// only check if target is a contract if the call was successful and the return data is empty
// otherwise we already know that it was a contract
if (returndata.length == 0 && target.code.length == 0) {
revert AddressEmptyCode(target);
}
return returndata;
}
}
/**
* @dev Tool to verify that a low level call was successful, and reverts if it wasn't, either by bubbling the
* revert reason or with a default {FailedInnerCall} error.
*/
function verifyCallResult(bool success, bytes memory returndata) internal pure returns (bytes memory) {
if (!success) {
_revert(returndata);
} else {
return returndata;
}
}
/**
* @dev Reverts with returndata if present. Otherwise reverts with {FailedInnerCall}.
*/
function _revert(bytes memory returndata) private pure {
// Look for revert reason and bubble it up if present
if (returndata.length > 0) {
// The easiest way to bubble the revert reason is using memory via assembly
/// @solidity memory-safe-assembly
assembly {
let returndata_size := mload(returndata)
revert(add(32, returndata), returndata_size)
}
} else {
revert FailedInnerCall();
}
}
}// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v5.0.0) (utils/cryptography/ECDSA.sol)
pragma solidity ^0.8.20;
/**
* @dev Elliptic Curve Digital Signature Algorithm (ECDSA) operations.
*
* These functions can be used to verify that a message was signed by the holder
* of the private keys of a given address.
*/
library ECDSA {
enum RecoverError {
NoError,
InvalidSignature,
InvalidSignatureLength,
InvalidSignatureS
}
/**
* @dev The signature derives the `address(0)`.
*/
error ECDSAInvalidSignature();
/**
* @dev The signature has an invalid length.
*/
error ECDSAInvalidSignatureLength(uint256 length);
/**
* @dev The signature has an S value that is in the upper half order.
*/
error ECDSAInvalidSignatureS(bytes32 s);
/**
* @dev Returns the address that signed a hashed message (`hash`) with `signature` or an error. This will not
* return address(0) without also returning an error description. Errors are documented using an enum (error type)
* and a bytes32 providing additional information about the error.
*
* If no error is returned, then the address can be used for verification purposes.
*
* The `ecrecover` EVM precompile allows for malleable (non-unique) signatures:
* this function rejects them by requiring the `s` value to be in the lower
* half order, and the `v` value to be either 27 or 28.
*
* IMPORTANT: `hash` _must_ be the result of a hash operation for the
* verification to be secure: it is possible to craft signatures that
* recover to arbitrary addresses for non-hashed data. A safe way to ensure
* this is by receiving a hash of the original message (which may otherwise
* be too long), and then calling {MessageHashUtils-toEthSignedMessageHash} on it.
*
* Documentation for signature generation:
* - with https://web3js.readthedocs.io/en/v1.3.4/web3-eth-accounts.html#sign[Web3.js]
* - with https://docs.ethers.io/v5/api/signer/#Signer-signMessage[ethers]
*/
function tryRecover(bytes32 hash, bytes memory signature) internal pure returns (address, RecoverError, bytes32) {
if (signature.length == 65) {
bytes32 r;
bytes32 s;
uint8 v;
// ecrecover takes the signature parameters, and the only way to get them
// currently is to use assembly.
/// @solidity memory-safe-assembly
assembly {
r := mload(add(signature, 0x20))
s := mload(add(signature, 0x40))
v := byte(0, mload(add(signature, 0x60)))
}
return tryRecover(hash, v, r, s);
} else {
return (address(0), RecoverError.InvalidSignatureLength, bytes32(signature.length));
}
}
/**
* @dev Returns the address that signed a hashed message (`hash`) with
* `signature`. This address can then be used for verification purposes.
*
* The `ecrecover` EVM precompile allows for malleable (non-unique) signatures:
* this function rejects them by requiring the `s` value to be in the lower
* half order, and the `v` value to be either 27 or 28.
*
* IMPORTANT: `hash` _must_ be the result of a hash operation for the
* verification to be secure: it is possible to craft signatures that
* recover to arbitrary addresses for non-hashed data. A safe way to ensure
* this is by receiving a hash of the original message (which may otherwise
* be too long), and then calling {MessageHashUtils-toEthSignedMessageHash} on it.
*/
function recover(bytes32 hash, bytes memory signature) internal pure returns (address) {
(address recovered, RecoverError error, bytes32 errorArg) = tryRecover(hash, signature);
_throwError(error, errorArg);
return recovered;
}
/**
* @dev Overload of {ECDSA-tryRecover} that receives the `r` and `vs` short-signature fields separately.
*
* See https://eips.ethereum.org/EIPS/eip-2098[EIP-2098 short signatures]
*/
function tryRecover(bytes32 hash, bytes32 r, bytes32 vs) internal pure returns (address, RecoverError, bytes32) {
unchecked {
bytes32 s = vs & bytes32(0x7fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff);
// We do not check for an overflow here since the shift operation results in 0 or 1.
uint8 v = uint8((uint256(vs) >> 255) + 27);
return tryRecover(hash, v, r, s);
}
}
/**
* @dev Overload of {ECDSA-recover} that receives the `r and `vs` short-signature fields separately.
*/
function recover(bytes32 hash, bytes32 r, bytes32 vs) internal pure returns (address) {
(address recovered, RecoverError error, bytes32 errorArg) = tryRecover(hash, r, vs);
_throwError(error, errorArg);
return recovered;
}
/**
* @dev Overload of {ECDSA-tryRecover} that receives the `v`,
* `r` and `s` signature fields separately.
*/
function tryRecover(
bytes32 hash,
uint8 v,
bytes32 r,
bytes32 s
) internal pure returns (address, RecoverError, bytes32) {
// EIP-2 still allows signature malleability for ecrecover(). Remove this possibility and make the signature
// unique. Appendix F in the Ethereum Yellow paper (https://ethereum.github.io/yellowpaper/paper.pdf), defines
// the valid range for s in (301): 0 < s < secp256k1n ÷ 2 + 1, and for v in (302): v ∈ {27, 28}. Most
// signatures from current libraries generate a unique signature with an s-value in the lower half order.
//
// If your library generates malleable signatures, such as s-values in the upper range, calculate a new s-value
// with 0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFEBAAEDCE6AF48A03BBFD25E8CD0364141 - s1 and flip v from 27 to 28 or
// vice versa. If your library also generates signatures with 0/1 for v instead 27/28, add 27 to v to accept
// these malleable signatures as well.
if (uint256(s) > 0x7FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF5D576E7357A4501DDFE92F46681B20A0) {
return (address(0), RecoverError.InvalidSignatureS, s);
}
// If the signature is valid (and not malleable), return the signer address
address signer = ecrecover(hash, v, r, s);
if (signer == address(0)) {
return (address(0), RecoverError.InvalidSignature, bytes32(0));
}
return (signer, RecoverError.NoError, bytes32(0));
}
/**
* @dev Overload of {ECDSA-recover} that receives the `v`,
* `r` and `s` signature fields separately.
*/
function recover(bytes32 hash, uint8 v, bytes32 r, bytes32 s) internal pure returns (address) {
(address recovered, RecoverError error, bytes32 errorArg) = tryRecover(hash, v, r, s);
_throwError(error, errorArg);
return recovered;
}
/**
* @dev Optionally reverts with the corresponding custom error according to the `error` argument provided.
*/
function _throwError(RecoverError error, bytes32 errorArg) private pure {
if (error == RecoverError.NoError) {
return; // no error: do nothing
} else if (error == RecoverError.InvalidSignature) {
revert ECDSAInvalidSignature();
} else if (error == RecoverError.InvalidSignatureLength) {
revert ECDSAInvalidSignatureLength(uint256(errorArg));
} else if (error == RecoverError.InvalidSignatureS) {
revert ECDSAInvalidSignatureS(errorArg);
}
}
}// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v5.0.0) (interfaces/IERC1271.sol)
pragma solidity ^0.8.20;
/**
* @dev Interface of the ERC1271 standard signature validation method for
* contracts as defined in https://eips.ethereum.org/EIPS/eip-1271[ERC-1271].
*/
interface IERC1271 {
/**
* @dev Should return whether the signature provided is valid for the provided data
* @param hash Hash of the data to be signed
* @param signature Signature byte array associated with _data
*/
function isValidSignature(bytes32 hash, bytes memory signature) external view returns (bytes4 magicValue);
}// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v5.0.0) (utils/introspection/IERC165.sol)
pragma solidity ^0.8.20;
/**
* @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);
}// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v5.0.0) (token/ERC20/IERC20.sol)
pragma solidity ^0.8.20;
/**
* @dev Interface of the ERC20 standard as defined in the EIP.
*/
interface IERC20 {
/**
* @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);
/**
* @dev Returns the value of tokens in existence.
*/
function totalSupply() external view returns (uint256);
/**
* @dev Returns the value of tokens owned by `account`.
*/
function balanceOf(address account) external view returns (uint256);
/**
* @dev Moves a `value` amount of tokens from the caller's account to `to`.
*
* Returns a boolean value indicating whether the operation succeeded.
*
* Emits a {Transfer} event.
*/
function transfer(address to, uint256 value) 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 a `value` amount of tokens 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 value) external returns (bool);
/**
* @dev Moves a `value` amount of tokens from `from` to `to` using the
* allowance mechanism. `value` is then deducted from the caller's
* allowance.
*
* Returns a boolean value indicating whether the operation succeeded.
*
* Emits a {Transfer} event.
*/
function transferFrom(address from, address to, uint256 value) external returns (bool);
}// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v5.0.0) (access/Ownable.sol)
pragma solidity ^0.8.20;
import {Context} from "../utils/Context.sol";
/**
* @dev Contract module which provides a basic access control mechanism, where
* there is an account (an owner) that can be granted exclusive access to
* specific functions.
*
* The initial owner is set to the address provided by the deployer. This can
* later be changed with {transferOwnership}.
*
* This module is used through inheritance. It will make available the modifier
* `onlyOwner`, which can be applied to your functions to restrict their use to
* the owner.
*/
abstract contract Ownable is Context {
address private _owner;
/**
* @dev The caller account is not authorized to perform an operation.
*/
error OwnableUnauthorizedAccount(address account);
/**
* @dev The owner is not a valid owner account. (eg. `address(0)`)
*/
error OwnableInvalidOwner(address owner);
event OwnershipTransferred(address indexed previousOwner, address indexed newOwner);
/**
* @dev Initializes the contract setting the address provided by the deployer as the initial owner.
*/
constructor(address initialOwner) {
if (initialOwner == address(0)) {
revert OwnableInvalidOwner(address(0));
}
_transferOwnership(initialOwner);
}
/**
* @dev Throws if called by any account other than the owner.
*/
modifier onlyOwner() {
_checkOwner();
_;
}
/**
* @dev Returns the address of the current owner.
*/
function owner() public view virtual returns (address) {
return _owner;
}
/**
* @dev Throws if the sender is not the owner.
*/
function _checkOwner() internal view virtual {
if (owner() != _msgSender()) {
revert OwnableUnauthorizedAccount(_msgSender());
}
}
/**
* @dev Leaves the contract without owner. It will not be possible to call
* `onlyOwner` functions. Can only be called by the current owner.
*
* NOTE: Renouncing ownership will leave the contract without an owner,
* thereby disabling any functionality that is only available to the owner.
*/
function renounceOwnership() public virtual onlyOwner {
_transferOwnership(address(0));
}
/**
* @dev Transfers ownership of the contract to a new account (`newOwner`).
* Can only be called by the current owner.
*/
function transferOwnership(address newOwner) public virtual onlyOwner {
if (newOwner == address(0)) {
revert OwnableInvalidOwner(address(0));
}
_transferOwnership(newOwner);
}
/**
* @dev Transfers ownership of the contract to a new account (`newOwner`).
* Internal function without access restriction.
*/
function _transferOwnership(address newOwner) internal virtual {
address oldOwner = _owner;
_owner = newOwner;
emit OwnershipTransferred(oldOwner, newOwner);
}
}// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v5.0.0) (utils/ReentrancyGuard.sol)
pragma solidity ^0.8.20;
/**
* @dev Contract module that helps prevent reentrant calls to a function.
*
* Inheriting from `ReentrancyGuard` will make the {nonReentrant} modifier
* available, which can be applied to functions to make sure there are no nested
* (reentrant) calls to them.
*
* Note that because there is a single `nonReentrant` guard, functions marked as
* `nonReentrant` may not call one another. This can be worked around by making
* those functions `private`, and then adding `external` `nonReentrant` entry
* points to them.
*
* TIP: If you would like to learn more about reentrancy and alternative ways
* to protect against it, check out our blog post
* https://blog.openzeppelin.com/reentrancy-after-istanbul/[Reentrancy After Istanbul].
*/
abstract contract ReentrancyGuard {
// Booleans are more expensive than uint256 or any type that takes up a full
// word because each write operation emits an extra SLOAD to first read the
// slot's contents, replace the bits taken up by the boolean, and then write
// back. This is the compiler's defense against contract upgrades and
// pointer aliasing, and it cannot be disabled.
// The values being non-zero value makes deployment a bit more expensive,
// but in exchange the refund on every call to nonReentrant will be lower in
// amount. Since refunds are capped to a percentage of the total
// transaction's gas, it is best to keep them low in cases like this one, to
// increase the likelihood of the full refund coming into effect.
uint256 private constant NOT_ENTERED = 1;
uint256 private constant ENTERED = 2;
uint256 private _status;
/**
* @dev Unauthorized reentrant call.
*/
error ReentrancyGuardReentrantCall();
constructor() {
_status = NOT_ENTERED;
}
/**
* @dev Prevents a contract from calling itself, directly or indirectly.
* Calling a `nonReentrant` function from another `nonReentrant`
* function is not supported. It is possible to prevent this from happening
* by making the `nonReentrant` function external, and making it call a
* `private` function that does the actual work.
*/
modifier nonReentrant() {
_nonReentrantBefore();
_;
_nonReentrantAfter();
}
function _nonReentrantBefore() private {
// On the first call to nonReentrant, _status will be NOT_ENTERED
if (_status == ENTERED) {
revert ReentrancyGuardReentrantCall();
}
// Any calls to nonReentrant after this point will fail
_status = ENTERED;
}
function _nonReentrantAfter() private {
// By storing the original value once again, a refund is triggered (see
// https://eips.ethereum.org/EIPS/eip-2200)
_status = NOT_ENTERED;
}
/**
* @dev Returns true if the reentrancy guard is currently set to "entered", which indicates there is a
* `nonReentrant` function in the call stack.
*/
function _reentrancyGuardEntered() internal view returns (bool) {
return _status == ENTERED;
}
}// SPDX-License-Identifier: MIT
// Taken from
// https://github.com/ethereum-optimism/optimism/blob/develop/packages/contracts/contracts/libraries/utils/LibBytesUtils.sol
// (The MIT License)
//
// Copyright 2020-2021 Optimism
// Copyright 2022-2023 Taiko Labs
//
// Permission is hereby granted, free of charge, to any person obtaining
// a copy of this software and associated documentation files (the
// "Software"), to deal in the Software without restriction, including
// without limitation the rights to use, copy, modify, merge, publish,
// distribute, sublicense, and/or sell copies of the Software, and to
// permit persons to whom the Software is furnished to do so, subject to
// the following conditions:
//
// The above copyright notice and this permission notice shall be
// included in all copies or substantial portions of the Software.
//
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
// IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY
// CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
// TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
// SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
pragma solidity ^0.8.20;
/**
* @title LibBytesUtils
*/
library LibBytesUtils {
function slice(
bytes memory _bytes,
uint256 _start,
uint256 _length
)
internal
pure
returns (bytes memory)
{
require(_length + 31 >= _length, "slice_overflow");
require(_start + _length >= _start, "slice_overflow");
require(_bytes.length >= _start + _length, "slice_outOfBounds");
bytes memory tempBytes;
assembly {
switch iszero(_length)
case 0 {
// Get a location of some free memory and store it in tempBytes
// as
// Solidity does for memory variables.
tempBytes := mload(0x40)
// The first word of the slice result is potentially a partial
// word read from the original array. To read it, we calculate
// the length of that partial word and start copying that many
// bytes into the array. The first word we copy will start with
// data we don't care about, but the last `lengthmod` bytes will
// land at the beginning of the contents of the new array. When
// we're done copying, we overwrite the full first word with
// the actual length of the slice.
let lengthmod := and(_length, 31)
// The multiplication in the next line is necessary
// because when slicing multiples of 32 bytes (lengthmod == 0)
// the following copy loop was copying the origin's length
// and then ending prematurely not copying everything it should.
let mc :=
add(add(tempBytes, lengthmod), mul(0x20, iszero(lengthmod)))
let end := add(mc, _length)
for {
// The multiplication in the next line has the same exact
// purpose
// as the one above.
let cc :=
add(
add(
add(_bytes, lengthmod), mul(0x20, iszero(lengthmod))
),
_start
)
} lt(mc, end) {
mc := add(mc, 0x20)
cc := add(cc, 0x20)
} { mstore(mc, mload(cc)) }
mstore(tempBytes, _length)
//update free-memory pointer
//allocating the array padded to 32 bytes like the compiler does
// now
mstore(0x40, and(add(mc, 31), not(31)))
}
//if we want a zero-length slice let's just return a zero-length
// array
default {
tempBytes := mload(0x40)
//zero out the 32 bytes slice we are about to return
//we need to do it because Solidity does not garbage collect
mstore(tempBytes, 0)
mstore(0x40, add(tempBytes, 0x20))
}
}
return tempBytes;
}
function slice(
bytes memory _bytes,
uint256 _start
)
internal
pure
returns (bytes memory)
{
if (_start >= _bytes.length) {
return bytes("");
}
return slice(_bytes, _start, _bytes.length - _start);
}
function toBytes32(bytes memory _bytes) internal pure returns (bytes32) {
if (_bytes.length < 32) {
bytes32 ret;
assembly {
ret := mload(add(_bytes, 32))
}
return ret;
}
return abi.decode(_bytes, (bytes32)); // will truncate if input length >
// 32 bytes
}
function toNibbles(bytes memory _bytes)
internal
pure
returns (bytes memory)
{
bytes memory nibbles = new bytes(_bytes.length * 2);
for (uint256 i; i < _bytes.length; ++i) {
nibbles[i * 2] = _bytes[i] >> 4;
nibbles[i * 2 + 1] = bytes1(uint8(_bytes[i]) % 16);
}
return nibbles;
}
function equal(
bytes memory _bytes,
bytes memory _other
)
internal
pure
returns (bool)
{
return keccak256(_bytes) == keccak256(_other);
}
}// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v5.0.0) (utils/Context.sol)
pragma solidity ^0.8.20;
/**
* @dev Provides information about the current execution context, including the
* sender of the transaction and its data. While these are generally available
* via msg.sender and msg.data, they should not be accessed in such a direct
* manner, since when dealing with meta-transactions the account sending and
* paying for execution may not be the actual sender (as far as an application
* is concerned).
*
* This contract is only required for intermediate, library-like contracts.
*/
abstract contract Context {
function _msgSender() internal view virtual returns (address) {
return msg.sender;
}
function _msgData() internal view virtual returns (bytes calldata) {
return msg.data;
}
}{
"remappings": [
"@openzeppelin/contracts-upgradeable/=lib/openzeppelin-contracts-upgradeable/contracts/",
"@openzeppelin/contracts/=lib/openzeppelin-contracts/contracts/",
"ds-test/=lib/forge-std/lib/ds-test/src/",
"erc4626-tests/=lib/openzeppelin-contracts-upgradeable/lib/erc4626-tests/",
"forge-std/=lib/forge-std/src/",
"openzeppelin-contracts-upgradeable/=lib/openzeppelin-contracts-upgradeable/",
"openzeppelin-contracts/=lib/openzeppelin-contracts/"
],
"optimizer": {
"enabled": true,
"runs": 200
},
"metadata": {
"useLiteralContent": false,
"bytecodeHash": "ipfs",
"appendCBOR": true
},
"outputSelection": {
"*": {
"*": [
"evm.bytecode",
"evm.deployedBytecode",
"devdoc",
"userdoc",
"metadata",
"abi"
]
}
},
"evmVersion": "paris",
"libraries": {}
}Contract ABI
API[{"inputs":[{"internalType":"address","name":"_owner","type":"address"},{"internalType":"address","name":"_bondToken","type":"address"},{"internalType":"uint256","name":"_bondAmount","type":"uint256"},{"internalType":"address","name":"_verifierAddress","type":"address"},{"internalType":"uint32","name":"_proofWindow","type":"uint32"},{"internalType":"uint8","name":"_instanceLength","type":"uint8"}],"stateMutability":"nonpayable","type":"constructor"},{"inputs":[],"name":"ECDSAInvalidSignature","type":"error"},{"inputs":[{"internalType":"uint256","name":"length","type":"uint256"}],"name":"ECDSAInvalidSignatureLength","type":"error"},{"inputs":[{"internalType":"bytes32","name":"s","type":"bytes32"}],"name":"ECDSAInvalidSignatureS","type":"error"},{"inputs":[],"name":"INVALID_ASSIGNMENT","type":"error"},{"inputs":[],"name":"INVALID_PROOF","type":"error"},{"inputs":[],"name":"INVALID_PROVER","type":"error"},{"inputs":[],"name":"INVALID_PROVER_SIG","type":"error"},{"inputs":[{"internalType":"address","name":"owner","type":"address"}],"name":"OwnableInvalidOwner","type":"error"},{"inputs":[{"internalType":"address","name":"account","type":"address"}],"name":"OwnableUnauthorizedAccount","type":"error"},{"inputs":[],"name":"ReentrancyGuardReentrantCall","type":"error"},{"inputs":[],"name":"TASK_ALREADY_OPEN","type":"error"},{"inputs":[],"name":"TASK_ALREADY_PROVEN","type":"error"},{"inputs":[],"name":"TASK_ALREADY_SUBMITTED","type":"error"},{"inputs":[],"name":"TASK_NONE_EXIST","type":"error"},{"inputs":[],"name":"TASK_NOT_OPEN","type":"error"},{"inputs":[],"name":"TASK_NOT_THE_SAME","type":"error"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"from","type":"address"},{"indexed":false,"internalType":"bytes32","name":"taskKey","type":"bytes32"},{"indexed":false,"internalType":"uint256","name":"amount","type":"uint256"}],"name":"BondDeposited","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"to","type":"address"},{"indexed":false,"internalType":"bytes32","name":"taskKey","type":"bytes32"},{"indexed":false,"internalType":"uint256","name":"amount","type":"uint256"}],"name":"BondReleased","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"previousOwner","type":"address"},{"indexed":true,"internalType":"address","name":"newOwner","type":"address"}],"name":"OwnershipTransferred","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"prover","type":"address"},{"indexed":false,"internalType":"bytes32","name":"taskKey","type":"bytes32"},{"indexed":false,"internalType":"bytes","name":"proof","type":"bytes"}],"name":"TaskProven","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"requester","type":"address"},{"indexed":true,"internalType":"address","name":"prover","type":"address"},{"indexed":false,"internalType":"bytes","name":"instance","type":"bytes"},{"indexed":false,"internalType":"bytes32","name":"taskKey","type":"bytes32"},{"indexed":false,"internalType":"address","name":"rewardToken","type":"address"},{"indexed":false,"internalType":"uint256","name":"rewardAmount","type":"uint256"},{"indexed":false,"internalType":"uint64","name":"liabilityWindow","type":"uint64"},{"indexed":false,"internalType":"address","name":"liabilityToken","type":"address"},{"indexed":false,"internalType":"uint256","name":"liabilityAmount","type":"uint256"}],"name":"TaskSubmitted","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"from","type":"address"},{"indexed":true,"internalType":"address","name":"to","type":"address"},{"indexed":false,"internalType":"uint256","name":"value","type":"uint256"}],"name":"Transfer","type":"event"},{"inputs":[],"name":"owner","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"bytes32","name":"taskKey","type":"bytes32"},{"internalType":"bytes","name":"proof","type":"bytes"}],"name":"proveTask","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"bytes32","name":"taskKey","type":"bytes32"}],"name":"readProofStatus","outputs":[{"components":[{"internalType":"bytes","name":"instance","type":"bytes"},{"internalType":"address","name":"prover","type":"address"},{"internalType":"uint64","name":"submittedAt","type":"uint64"},{"internalType":"bool","name":"proven","type":"bool"}],"internalType":"struct TaskStatus","name":"taskStatus","type":"tuple"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"renounceOwnership","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"bytes","name":"instance","type":"bytes"},{"internalType":"address","name":"_prover","type":"address"},{"internalType":"address","name":"_rewardToken","type":"address"},{"internalType":"uint256","name":"_rewardAmount","type":"uint256"},{"internalType":"uint64","name":"_liabilityWindow","type":"uint64"},{"internalType":"address","name":"_liabilityToken","type":"address"},{"internalType":"uint256","name":"_liabilityAmount","type":"uint256"},{"internalType":"uint64","name":"_expiry","type":"uint64"},{"internalType":"bytes","name":"_signature","type":"bytes"}],"name":"submitTask","outputs":[{"internalType":"bytes32","name":"taskKey","type":"bytes32"}],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"bytes32","name":"","type":"bytes32"}],"name":"taskStatusMap","outputs":[{"internalType":"bytes","name":"instance","type":"bytes"},{"internalType":"address","name":"prover","type":"address"},{"internalType":"uint64","name":"submittedAt","type":"uint64"},{"internalType":"bool","name":"proven","type":"bool"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"newOwner","type":"address"}],"name":"transferOwnership","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"_bondToken","type":"address"},{"internalType":"uint256","name":"_bondAmount","type":"uint256"},{"internalType":"address","name":"_verifierAddress","type":"address"},{"internalType":"uint32","name":"_proofWindow","type":"uint32"},{"internalType":"uint8","name":"_instanceLength","type":"uint8"}],"name":"updateConfig","outputs":[],"stateMutability":"nonpayable","type":"function"}]Contract Creation Code
60806040523480156200001157600080fd5b50604051620018c3380380620018c383398101604081905262000034916200014d565b856001600160a01b0381166200006457604051631e4fbdf760e01b81526000600482015260240160405180910390fd5b6200006f81620000e0565b5060018055600280546001600160a01b0319166001600160a01b0396871617905560039390935560048054929094166001600160c01b031990921691909117600160a01b63ffffffff92909216919091021760ff60c01b1916600160c01b60ff9092169190910217905550620001d9565b600080546001600160a01b038381166001600160a01b0319831681178455604051919092169283917f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e09190a35050565b80516001600160a01b03811681146200014857600080fd5b919050565b60008060008060008060c087890312156200016757600080fd5b620001728762000130565b9550620001826020880162000130565b945060408701519350620001996060880162000130565b9250608087015163ffffffff81168114620001b357600080fd5b60a088015190925060ff81168114620001cb57600080fd5b809150509295509295509295565b6116da80620001e96000396000f3fe608060405234801561001057600080fd5b50600436106100885760003560e01c8063910f40371161005b578063910f4037146100f1578063ddacac9c14610104578063e0bd2aea14610124578063f2fde38b1461014557600080fd5b80632007a0161461008d5780633c577249146100a2578063715018a6146100ce5780638da5cb5b146100d6575b600080fd5b6100a061009b36600461106c565b610158565b005b6100b56100b03660046110b7565b6103c0565b6040516100c59493929190611120565b60405180910390f35b6100a061048b565b6000546040516001600160a01b0390911681526020016100c5565b6100a06100ff36600461117a565b61049f565b6101176101123660046110b7565b61050e565b6040516100c591906111ed565b61013761013236600461125d565b610663565b6040519081526020016100c5565b6100a0610153366004611337565b610cf5565b610160610d38565b600083815260056020526040902060018101546001600160a01b031615801561019b57506001810154600160a01b90046001600160401b0316155b156101b95760405163629b6c7d60e01b815260040160405180910390fd5b600454600182015442916101e79163ffffffff600160a01b9283900416916001600160401b03910416611359565b6001600160401b031611801561020a575060018101546001600160a01b03163314155b156102285760405163ece03c3160e01b815260040160405180910390fd5b600454600182015442916102569163ffffffff600160a01b9283900416916001600160401b03910416611359565b6001600160401b031611158015610279575060018101546001600160a01b031633145b156102975760405163513ca4af60e11b815260040160405180910390fd5b6001818101805460ff60e01b1916600160e01b17905560025460035460405163a9059cbb60e01b815233600482015260248101919091526001600160a01b039091169063a9059cbb906044016020604051808303816000875af1158015610302573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610326919061138e565b5060035460405133917f2643f0e004b9c44af9a6dc8e20da5b95eb5d79682ccf4b2ee42dc544832a6ee89161036391898252602082015260400190565b60405180910390a2336001600160a01b03167f4201b13d3f0fa3e3af7cee574abec6196aefafa83cd14ce1c965c4fcca5851f48686866040516103a8939291906113d9565b60405180910390a250506103bb60018055565b505050565b6005602052600090815260409020805481906103db906113fc565b80601f0160208091040260200160405190810160405280929190818152602001828054610407906113fc565b80156104545780601f1061042957610100808354040283529160200191610454565b820191906000526020600020905b81548152906001019060200180831161043757829003601f168201915b505050600190930154919250506001600160a01b038116906001600160401b03600160a01b8204169060ff600160e01b9091041684565b610493610d62565b61049d6000610d8f565b565b6104a7610d62565b600280546001600160a01b0319166001600160a01b0396871617905560039390935560048054929094166001600160c01b031990921691909117600160a01b63ffffffff92909216919091021760ff60c01b1916600160c01b60ff90921691909102179055565b6040805160808101825260608082526000602083018190529282018390528101919091526000828152600560205260409081902081516080810190925280548290829061055a906113fc565b80601f0160208091040260200160405190810160405280929190818152602001828054610586906113fc565b80156105d35780601f106105a8576101008083540402835291602001916105d3565b820191906000526020600020905b8154815290600101906020018083116105b657829003601f168201915b5050509183525050600191909101546001600160a01b03808216602080850191909152600160a01b83046001600160401b03166040850152600160e01b90920460ff16151560609093019290925282015191925016158015610640575060408101516001600160401b0316155b1561065e5760405163629b6c7d60e01b815260040160405180910390fd5b919050565b600061066d610d38565b43846001600160401b0316116106965760405163d78817c560e01b815260040160405180910390fd5b8b8b6040516106a6929190611436565b60408051918290039091206000818152600560205291909120600101549091506001600160a01b0316156106ed576040516318db23d560e31b815260040160405180910390fd5b6040516323b872dd60e01b81523360048201526001600160a01b038b81166024830152604482018a90528a16906323b872dd906064016020604051808303816000875af1158015610742573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610766919061138e565b506040518881526001600160a01b038b169033907fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef9060200160405180910390a36002546003546040516323b872dd60e01b81526001600160a01b038d8116600483015230602483015260448201929092529116906323b872dd906064016020604051808303816000875af1158015610803573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610827919061138e565b50306001600160a01b03168a6001600160a01b03167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef60035460405161086f91815260200190565b60405180910390a3896001600160a01b03167fa8b3514dced40754a3e57d724ef847e309dfa32f6d68dd4c4afdb3fc17bdb2e0826003546040516108bd929190918252602082015260400190565b60405180910390a2893b63ffffffff166109f557896001600160a01b03166109c984848080601f016020809104026020016040519081016040528093929190818152602001838380828437600081840152601f19601f820116905080830192505050505050506109768f8f8080601f016020809104026020016040519081016040528093929190818152602001838380828437600081840152601f19601f820116905080830192505050505050508d8d8d8d8d8d610ddf565b60405160200161098891815260200190565b60408051601f19818403018152908290526109a591602001611446565b60405160208183030381529060405280519060200120610e2190919063ffffffff16565b6001600160a01b0316146109f0576040516334f331ab60e01b815260040160405180910390fd5b610b7f565b6040516301ffc9a760e01b8152630b135d3f60e11b60048201526001600160a01b038b16906301ffc9a790602401602060405180830381865afa158015610a40573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610a64919061138e565b15610b6657631626ba7e60e01b6001600160e01b0319168a6001600160a01b0316631626ba7e610add8f8f8080601f016020809104026020016040519081016040528093929190818152602001838380828437600081840152601f19601f820116905080830192505050505050508d8d8d8d8d8d610ddf565b86866040518463ffffffff1660e01b8152600401610afd939291906113d9565b602060405180830381865afa158015610b1a573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610b3e919061148b565b6001600160e01b031916146109f0576040516334f331ab60e01b815260040160405180910390fd5b604051633b86cf5560e11b815260040160405180910390fd5b60405180608001604052808d8d8080601f01602080910402602001604051908101604052809392919081815260200183838082843760009201829052509385525050506001600160a01b038d166020808401919091526001600160401b0342166040808501919091526060909301829052848252600590522081518190610c069082611519565b5060208201518160010160006101000a8154816001600160a01b0302191690836001600160a01b0316021790555060408201518160010160146101000a8154816001600160401b0302191690836001600160401b03160217905550606082015181600101601c6101000a81548160ff021916908315150217905550905050896001600160a01b0316336001600160a01b03167f2f0e91b74bddefdea711077d50794a1c996bc60a49283034146698c7383994468e8e858e8e8e8e8e604051610cd59897969594939291906115d8565b60405180910390a3610ce660018055565b9b9a5050505050505050505050565b610cfd610d62565b6001600160a01b038116610d2c57604051631e4fbdf760e01b8152600060048201526024015b60405180910390fd5b610d3581610d8f565b50565b600260015403610d5b57604051633ee5aeb560e01b815260040160405180910390fd5b6002600155565b6000546001600160a01b0316331461049d5760405163118cdaa760e01b8152336004820152602401610d23565b600080546001600160a01b038381166001600160a01b0319831681178455604051919092169283917f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e09190a35050565b60008787878686868a604051602001610dfe9796959493929190611630565b604051602081830303815290604052805190602001209050979650505050505050565b600080600080610e318686610e4b565b925092509250610e418282610e98565b5090949350505050565b60008060008351604103610e855760208401516040850151606086015160001a610e7788828585610f55565b955095509550505050610e91565b50508151600091506002905b9250925092565b6000826003811115610eac57610eac61168e565b03610eb5575050565b6001826003811115610ec957610ec961168e565b03610ee75760405163f645eedf60e01b815260040160405180910390fd5b6002826003811115610efb57610efb61168e565b03610f1c5760405163fce698f760e01b815260048101829052602401610d23565b6003826003811115610f3057610f3061168e565b03610f51576040516335e2f38360e21b815260048101829052602401610d23565b5050565b600080807f7fffffffffffffffffffffffffffffff5d576e7357a4501ddfe92f46681b20a0841115610f90575060009150600390508261101a565b604080516000808252602082018084528a905260ff891692820192909252606081018790526080810186905260019060a0016020604051602081039080840390855afa158015610fe4573d6000803e3d6000fd5b5050604051601f1901519150506001600160a01b0381166110105750600092506001915082905061101a565b9250600091508190505b9450945094915050565b60008083601f84011261103657600080fd5b5081356001600160401b0381111561104d57600080fd5b60208301915083602082850101111561106557600080fd5b9250929050565b60008060006040848603121561108157600080fd5b8335925060208401356001600160401b0381111561109e57600080fd5b6110aa86828701611024565b9497909650939450505050565b6000602082840312156110c957600080fd5b5035919050565b60005b838110156110eb5781810151838201526020016110d3565b50506000910152565b6000815180845261110c8160208601602086016110d0565b601f01601f19169290920160200192915050565b60808152600061113360808301876110f4565b6001600160a01b03959095166020830152506001600160401b039290921660408301521515606090910152919050565b80356001600160a01b038116811461065e57600080fd5b600080600080600060a0868803121561119257600080fd5b61119b86611163565b9450602086013593506111b060408701611163565b9250606086013563ffffffff811681146111c957600080fd5b9150608086013560ff811681146111df57600080fd5b809150509295509295909350565b60208152600082516080602084015261120960a08401826110f4565b905060018060a01b0360208501511660408401526001600160401b0360408501511660608401526060840151151560808401528091505092915050565b80356001600160401b038116811461065e57600080fd5b60008060008060008060008060008060006101208c8e03121561127f57600080fd5b6001600160401b03808d35111561129557600080fd5b6112a28e8e358f01611024565b909c509a506112b360208e01611163565b99506112c160408e01611163565b985060608d013597506112d660808e01611246565b96506112e460a08e01611163565b955060c08d013594506112f960e08e01611246565b9350806101008e0135111561130d57600080fd5b5061131f8d6101008e01358e01611024565b81935080925050509295989b509295989b9093969950565b60006020828403121561134957600080fd5b61135282611163565b9392505050565b6001600160401b0381811683821601908082111561138757634e487b7160e01b600052601160045260246000fd5b5092915050565b6000602082840312156113a057600080fd5b8151801515811461135257600080fd5b81835281816020850137506000828201602090810191909152601f909101601f19169091010190565b8381526040602082015260006113f36040830184866113b0565b95945050505050565b600181811c9082168061141057607f821691505b60208210810361143057634e487b7160e01b600052602260045260246000fd5b50919050565b8183823760009101908152919050565b7f19457468657265756d205369676e6564204d6573736167653a0a33320000000081526000825161147e81601c8501602087016110d0565b91909101601c0192915050565b60006020828403121561149d57600080fd5b81516001600160e01b03198116811461135257600080fd5b634e487b7160e01b600052604160045260246000fd5b601f8211156103bb57600081815260208120601f850160051c810160208610156114f25750805b601f850160051c820191505b81811015611511578281556001016114fe565b505050505050565b81516001600160401b03811115611532576115326114b5565b6115468161154084546113fc565b846114cb565b602080601f83116001811461157b57600084156115635750858301515b600019600386901b1c1916600185901b178555611511565b600085815260208120601f198616915b828110156115aa5788860151825594840194600190910190840161158b565b50858210156115c85787850151600019600388901b60f8161c191681555b5050505050600190811b01905550565b60e0815260006115ec60e083018a8c6113b0565b6020830198909852506001600160a01b03958616604082015260608101949094526001600160401b0392909216608084015290921660a082015260c0015292915050565b60e08152600061164360e083018a6110f4565b6001600160a01b03988916602084015260408301979097525093909516606084015260808301919091526001600160401b0390811660a083015290921660c090920191909152919050565b634e487b7160e01b600052602160045260246000fdfea2646970667358221220a230a235dd643b5314b23b900182eb4293cfe319790a1edcfa70ba330274664264736f6c63430008140033000000000000000000000000d8c19b45061b8fc74136c06ee5cb464e6aa7cbba000000000000000000000000fdfd239c9dd30445d0e080ecf055a5cc53456a720000000000000000000000000000000000000000000000008ac7230489e8000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000008ca00000000000000000000000000000000000000000000000000000000000000020
Deployed Bytecode
0x608060405234801561001057600080fd5b50600436106100885760003560e01c8063910f40371161005b578063910f4037146100f1578063ddacac9c14610104578063e0bd2aea14610124578063f2fde38b1461014557600080fd5b80632007a0161461008d5780633c577249146100a2578063715018a6146100ce5780638da5cb5b146100d6575b600080fd5b6100a061009b36600461106c565b610158565b005b6100b56100b03660046110b7565b6103c0565b6040516100c59493929190611120565b60405180910390f35b6100a061048b565b6000546040516001600160a01b0390911681526020016100c5565b6100a06100ff36600461117a565b61049f565b6101176101123660046110b7565b61050e565b6040516100c591906111ed565b61013761013236600461125d565b610663565b6040519081526020016100c5565b6100a0610153366004611337565b610cf5565b610160610d38565b600083815260056020526040902060018101546001600160a01b031615801561019b57506001810154600160a01b90046001600160401b0316155b156101b95760405163629b6c7d60e01b815260040160405180910390fd5b600454600182015442916101e79163ffffffff600160a01b9283900416916001600160401b03910416611359565b6001600160401b031611801561020a575060018101546001600160a01b03163314155b156102285760405163ece03c3160e01b815260040160405180910390fd5b600454600182015442916102569163ffffffff600160a01b9283900416916001600160401b03910416611359565b6001600160401b031611158015610279575060018101546001600160a01b031633145b156102975760405163513ca4af60e11b815260040160405180910390fd5b6001818101805460ff60e01b1916600160e01b17905560025460035460405163a9059cbb60e01b815233600482015260248101919091526001600160a01b039091169063a9059cbb906044016020604051808303816000875af1158015610302573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610326919061138e565b5060035460405133917f2643f0e004b9c44af9a6dc8e20da5b95eb5d79682ccf4b2ee42dc544832a6ee89161036391898252602082015260400190565b60405180910390a2336001600160a01b03167f4201b13d3f0fa3e3af7cee574abec6196aefafa83cd14ce1c965c4fcca5851f48686866040516103a8939291906113d9565b60405180910390a250506103bb60018055565b505050565b6005602052600090815260409020805481906103db906113fc565b80601f0160208091040260200160405190810160405280929190818152602001828054610407906113fc565b80156104545780601f1061042957610100808354040283529160200191610454565b820191906000526020600020905b81548152906001019060200180831161043757829003601f168201915b505050600190930154919250506001600160a01b038116906001600160401b03600160a01b8204169060ff600160e01b9091041684565b610493610d62565b61049d6000610d8f565b565b6104a7610d62565b600280546001600160a01b0319166001600160a01b0396871617905560039390935560048054929094166001600160c01b031990921691909117600160a01b63ffffffff92909216919091021760ff60c01b1916600160c01b60ff90921691909102179055565b6040805160808101825260608082526000602083018190529282018390528101919091526000828152600560205260409081902081516080810190925280548290829061055a906113fc565b80601f0160208091040260200160405190810160405280929190818152602001828054610586906113fc565b80156105d35780601f106105a8576101008083540402835291602001916105d3565b820191906000526020600020905b8154815290600101906020018083116105b657829003601f168201915b5050509183525050600191909101546001600160a01b03808216602080850191909152600160a01b83046001600160401b03166040850152600160e01b90920460ff16151560609093019290925282015191925016158015610640575060408101516001600160401b0316155b1561065e5760405163629b6c7d60e01b815260040160405180910390fd5b919050565b600061066d610d38565b43846001600160401b0316116106965760405163d78817c560e01b815260040160405180910390fd5b8b8b6040516106a6929190611436565b60408051918290039091206000818152600560205291909120600101549091506001600160a01b0316156106ed576040516318db23d560e31b815260040160405180910390fd5b6040516323b872dd60e01b81523360048201526001600160a01b038b81166024830152604482018a90528a16906323b872dd906064016020604051808303816000875af1158015610742573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610766919061138e565b506040518881526001600160a01b038b169033907fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef9060200160405180910390a36002546003546040516323b872dd60e01b81526001600160a01b038d8116600483015230602483015260448201929092529116906323b872dd906064016020604051808303816000875af1158015610803573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610827919061138e565b50306001600160a01b03168a6001600160a01b03167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef60035460405161086f91815260200190565b60405180910390a3896001600160a01b03167fa8b3514dced40754a3e57d724ef847e309dfa32f6d68dd4c4afdb3fc17bdb2e0826003546040516108bd929190918252602082015260400190565b60405180910390a2893b63ffffffff166109f557896001600160a01b03166109c984848080601f016020809104026020016040519081016040528093929190818152602001838380828437600081840152601f19601f820116905080830192505050505050506109768f8f8080601f016020809104026020016040519081016040528093929190818152602001838380828437600081840152601f19601f820116905080830192505050505050508d8d8d8d8d8d610ddf565b60405160200161098891815260200190565b60408051601f19818403018152908290526109a591602001611446565b60405160208183030381529060405280519060200120610e2190919063ffffffff16565b6001600160a01b0316146109f0576040516334f331ab60e01b815260040160405180910390fd5b610b7f565b6040516301ffc9a760e01b8152630b135d3f60e11b60048201526001600160a01b038b16906301ffc9a790602401602060405180830381865afa158015610a40573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610a64919061138e565b15610b6657631626ba7e60e01b6001600160e01b0319168a6001600160a01b0316631626ba7e610add8f8f8080601f016020809104026020016040519081016040528093929190818152602001838380828437600081840152601f19601f820116905080830192505050505050508d8d8d8d8d8d610ddf565b86866040518463ffffffff1660e01b8152600401610afd939291906113d9565b602060405180830381865afa158015610b1a573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610b3e919061148b565b6001600160e01b031916146109f0576040516334f331ab60e01b815260040160405180910390fd5b604051633b86cf5560e11b815260040160405180910390fd5b60405180608001604052808d8d8080601f01602080910402602001604051908101604052809392919081815260200183838082843760009201829052509385525050506001600160a01b038d166020808401919091526001600160401b0342166040808501919091526060909301829052848252600590522081518190610c069082611519565b5060208201518160010160006101000a8154816001600160a01b0302191690836001600160a01b0316021790555060408201518160010160146101000a8154816001600160401b0302191690836001600160401b03160217905550606082015181600101601c6101000a81548160ff021916908315150217905550905050896001600160a01b0316336001600160a01b03167f2f0e91b74bddefdea711077d50794a1c996bc60a49283034146698c7383994468e8e858e8e8e8e8e604051610cd59897969594939291906115d8565b60405180910390a3610ce660018055565b9b9a5050505050505050505050565b610cfd610d62565b6001600160a01b038116610d2c57604051631e4fbdf760e01b8152600060048201526024015b60405180910390fd5b610d3581610d8f565b50565b600260015403610d5b57604051633ee5aeb560e01b815260040160405180910390fd5b6002600155565b6000546001600160a01b0316331461049d5760405163118cdaa760e01b8152336004820152602401610d23565b600080546001600160a01b038381166001600160a01b0319831681178455604051919092169283917f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e09190a35050565b60008787878686868a604051602001610dfe9796959493929190611630565b604051602081830303815290604052805190602001209050979650505050505050565b600080600080610e318686610e4b565b925092509250610e418282610e98565b5090949350505050565b60008060008351604103610e855760208401516040850151606086015160001a610e7788828585610f55565b955095509550505050610e91565b50508151600091506002905b9250925092565b6000826003811115610eac57610eac61168e565b03610eb5575050565b6001826003811115610ec957610ec961168e565b03610ee75760405163f645eedf60e01b815260040160405180910390fd5b6002826003811115610efb57610efb61168e565b03610f1c5760405163fce698f760e01b815260048101829052602401610d23565b6003826003811115610f3057610f3061168e565b03610f51576040516335e2f38360e21b815260048101829052602401610d23565b5050565b600080807f7fffffffffffffffffffffffffffffff5d576e7357a4501ddfe92f46681b20a0841115610f90575060009150600390508261101a565b604080516000808252602082018084528a905260ff891692820192909252606081018790526080810186905260019060a0016020604051602081039080840390855afa158015610fe4573d6000803e3d6000fd5b5050604051601f1901519150506001600160a01b0381166110105750600092506001915082905061101a565b9250600091508190505b9450945094915050565b60008083601f84011261103657600080fd5b5081356001600160401b0381111561104d57600080fd5b60208301915083602082850101111561106557600080fd5b9250929050565b60008060006040848603121561108157600080fd5b8335925060208401356001600160401b0381111561109e57600080fd5b6110aa86828701611024565b9497909650939450505050565b6000602082840312156110c957600080fd5b5035919050565b60005b838110156110eb5781810151838201526020016110d3565b50506000910152565b6000815180845261110c8160208601602086016110d0565b601f01601f19169290920160200192915050565b60808152600061113360808301876110f4565b6001600160a01b03959095166020830152506001600160401b039290921660408301521515606090910152919050565b80356001600160a01b038116811461065e57600080fd5b600080600080600060a0868803121561119257600080fd5b61119b86611163565b9450602086013593506111b060408701611163565b9250606086013563ffffffff811681146111c957600080fd5b9150608086013560ff811681146111df57600080fd5b809150509295509295909350565b60208152600082516080602084015261120960a08401826110f4565b905060018060a01b0360208501511660408401526001600160401b0360408501511660608401526060840151151560808401528091505092915050565b80356001600160401b038116811461065e57600080fd5b60008060008060008060008060008060006101208c8e03121561127f57600080fd5b6001600160401b03808d35111561129557600080fd5b6112a28e8e358f01611024565b909c509a506112b360208e01611163565b99506112c160408e01611163565b985060608d013597506112d660808e01611246565b96506112e460a08e01611163565b955060c08d013594506112f960e08e01611246565b9350806101008e0135111561130d57600080fd5b5061131f8d6101008e01358e01611024565b81935080925050509295989b509295989b9093969950565b60006020828403121561134957600080fd5b61135282611163565b9392505050565b6001600160401b0381811683821601908082111561138757634e487b7160e01b600052601160045260246000fd5b5092915050565b6000602082840312156113a057600080fd5b8151801515811461135257600080fd5b81835281816020850137506000828201602090810191909152601f909101601f19169091010190565b8381526040602082015260006113f36040830184866113b0565b95945050505050565b600181811c9082168061141057607f821691505b60208210810361143057634e487b7160e01b600052602260045260246000fd5b50919050565b8183823760009101908152919050565b7f19457468657265756d205369676e6564204d6573736167653a0a33320000000081526000825161147e81601c8501602087016110d0565b91909101601c0192915050565b60006020828403121561149d57600080fd5b81516001600160e01b03198116811461135257600080fd5b634e487b7160e01b600052604160045260246000fd5b601f8211156103bb57600081815260208120601f850160051c810160208610156114f25750805b601f850160051c820191505b81811015611511578281556001016114fe565b505050505050565b81516001600160401b03811115611532576115326114b5565b6115468161154084546113fc565b846114cb565b602080601f83116001811461157b57600084156115635750858301515b600019600386901b1c1916600185901b178555611511565b600085815260208120601f198616915b828110156115aa5788860151825594840194600190910190840161158b565b50858210156115c85787850151600019600388901b60f8161c191681555b5050505050600190811b01905550565b60e0815260006115ec60e083018a8c6113b0565b6020830198909852506001600160a01b03958616604082015260608101949094526001600160401b0392909216608084015290921660a082015260c0015292915050565b60e08152600061164360e083018a6110f4565b6001600160a01b03988916602084015260408301979097525093909516606084015260808301919091526001600160401b0390811660a083015290921660c090920191909152919050565b634e487b7160e01b600052602160045260246000fdfea2646970667358221220a230a235dd643b5314b23b900182eb4293cfe319790a1edcfa70ba330274664264736f6c63430008140033
Constructor Arguments (ABI-Encoded and is the last bytes of the Contract Creation Code above)
000000000000000000000000d8c19b45061b8fc74136c06ee5cb464e6aa7cbba000000000000000000000000fdfd239c9dd30445d0e080ecf055a5cc53456a720000000000000000000000000000000000000000000000008ac7230489e8000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000008ca00000000000000000000000000000000000000000000000000000000000000020
-----Decoded View---------------
Arg [0] : _owner (address): 0xd8C19B45061B8fc74136c06Ee5CB464e6aa7CbbA
Arg [1] : _bondToken (address): 0xfDfd239c9dD30445d0e080Ecf055A5cc53456A72
Arg [2] : _bondAmount (uint256): 10000000000000000000
Arg [3] : _verifierAddress (address): 0x0000000000000000000000000000000000000000
Arg [4] : _proofWindow (uint32): 36000
Arg [5] : _instanceLength (uint8): 32
-----Encoded View---------------
6 Constructor Arguments found :
Arg [0] : 000000000000000000000000d8c19b45061b8fc74136c06ee5cb464e6aa7cbba
Arg [1] : 000000000000000000000000fdfd239c9dd30445d0e080ecf055a5cc53456a72
Arg [2] : 0000000000000000000000000000000000000000000000008ac7230489e80000
Arg [3] : 0000000000000000000000000000000000000000000000000000000000000000
Arg [4] : 0000000000000000000000000000000000000000000000000000000000008ca0
Arg [5] : 0000000000000000000000000000000000000000000000000000000000000020
Loading...
Loading
Loading...
Loading
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.