Source Code
Overview
ETH Balance
0 ETH
Eth Value
$0.00| Transaction Hash |
Method
|
Block
|
From
|
|
To
|
||||
|---|---|---|---|---|---|---|---|---|---|
Latest 1 internal transaction
Advanced mode:
| Parent Transaction Hash | Method | Block |
From
|
|
To
|
||
|---|---|---|---|---|---|---|---|
| 0x60c03460 | 22670009 | 249 days ago | Contract Creation | 0 ETH |
Loading...
Loading
Loading...
Loading
Cross-Chain Transactions
Loading...
Loading
Contract Name:
CanonicalTournamentParametersProvider
Compiler Version
v0.8.27+commit.40a35a09
Optimization Enabled:
Yes with 200 runs
Other Settings:
cancun EvmVersion
Contract Source Code (Solidity Standard Json-Input format)
// (c) Cartesi and individual authors (see AUTHORS)
// SPDX-License-Identifier: Apache-2.0 (see LICENSE)
pragma solidity ^0.8.17;
import "./ITournamentParametersProvider.sol";
import "./ArbitrationConstants.sol";
contract CanonicalTournamentParametersProvider is
ITournamentParametersProvider
{
Time.Duration immutable _matchEffort;
Time.Duration immutable _maxAllowance;
constructor(Time.Duration matchEffort, Time.Duration maxAllowance) {
_matchEffort = matchEffort;
_maxAllowance = maxAllowance;
}
/// @inheritdoc ITournamentParametersProvider
function tournamentParameters(uint64 level)
external
view
override
returns (TournamentParameters memory)
{
return TournamentParameters({
levels: ArbitrationConstants.LEVELS,
log2step: ArbitrationConstants.log2step(level),
height: ArbitrationConstants.height(level),
matchEffort: _matchEffort,
maxAllowance: _maxAllowance
});
}
}// (c) Cartesi and individual authors (see AUTHORS)
// SPDX-License-Identifier: Apache-2.0 (see LICENSE)
pragma solidity ^0.8.17;
import "prt-contracts/types/TournamentParameters.sol";
interface ITournamentParametersProvider {
/// @notice Get tournament parameters for a given level.
/// @param level The tournament level (0 = top)
function tournamentParameters(uint64 level)
external
view
returns (TournamentParameters memory);
}// (c) Cartesi and individual authors (see AUTHORS)
// SPDX-License-Identifier: Apache-2.0 (see LICENSE)
pragma solidity ^0.8.17;
import "prt-contracts/tournament/libs/Time.sol";
library ArbitrationConstants {
// 3-level tournament
uint64 constant LEVELS = 3;
/// @return log2step gap of each leaf in the tournament[level]
function log2step(uint64 level) internal pure returns (uint64) {
uint64[LEVELS] memory arr = [uint64(44), uint64(27), uint64(0)];
return arr[level];
}
/// @return height of the tournament[level] tree which is calculated by subtracting the log2step[level] from the log2step[level - 1]
function height(uint64 level) internal pure returns (uint64) {
uint64[LEVELS] memory arr = [uint64(48), uint64(17), uint64(27)];
return arr[level];
}
}// (c) Cartesi and individual authors (see AUTHORS)
// SPDX-License-Identifier: Apache-2.0 (see LICENSE)
pragma solidity ^0.8.17;
import "prt-contracts/tournament/libs/Time.sol";
struct TournamentParameters {
uint64 levels;
uint64 log2step;
uint64 height;
Time.Duration matchEffort;
Time.Duration maxAllowance;
}// (c) Cartesi and individual authors (see AUTHORS)
// SPDX-License-Identifier: Apache-2.0 (see LICENSE)
pragma solidity ^0.8.17;
library Time {
type Instant is uint64;
type Duration is uint64;
using Time for Instant;
using Time for Duration;
Instant constant ZERO_INSTANT = Instant.wrap(0);
Duration constant ZERO_DURATION = Duration.wrap(0);
function currentTime() internal view returns (Instant) {
return Instant.wrap(uint64(block.number));
}
function add(Instant timestamp, Duration duration)
internal
pure
returns (Instant)
{
uint64 t = Instant.unwrap(timestamp);
uint64 d = Duration.unwrap(duration);
return Instant.wrap(t + d);
}
function gt(Instant left, Instant right) internal pure returns (bool) {
uint64 l = Instant.unwrap(left);
uint64 r = Instant.unwrap(right);
return l > r;
}
function gt(Duration left, Duration right) internal pure returns (bool) {
uint64 l = Duration.unwrap(left);
uint64 r = Duration.unwrap(right);
return l > r;
}
function isZero(Instant timestamp) internal pure returns (bool) {
uint64 t = Instant.unwrap(timestamp);
return t == 0;
}
function isZero(Duration duration) internal pure returns (bool) {
uint64 d = Duration.unwrap(duration);
return d == 0;
}
function add(Duration left, Duration right)
internal
pure
returns (Duration)
{
uint64 l = Duration.unwrap(left);
uint64 r = Duration.unwrap(right);
return Duration.wrap(l + r);
}
function sub(Duration left, Duration right)
internal
pure
returns (Duration)
{
uint64 l = Duration.unwrap(left);
uint64 r = Duration.unwrap(right);
return Duration.wrap(l - r);
}
function monus(Duration left, Duration right)
internal
pure
returns (Duration)
{
uint64 l = Duration.unwrap(left);
uint64 r = Duration.unwrap(right);
return Duration.wrap(l < r ? 0 : l - r);
}
function timeSpan(Instant left, Instant right)
internal
pure
returns (Duration)
{
uint64 l = Instant.unwrap(left);
uint64 r = Instant.unwrap(right);
return Duration.wrap(l - r);
}
function timeoutElapsedSince(
Instant timestamp,
Duration duration,
Instant current
) internal pure returns (bool) {
return !timestamp.add(duration).gt(current);
}
function timeoutElapsed(Instant timestamp, Duration duration)
internal
view
returns (bool)
{
return timestamp.timeoutElapsedSince(duration, currentTime());
}
function min(Duration left, Duration right)
internal
pure
returns (Duration)
{
return left.gt(right) ? right : left;
}
function max(Instant left, Instant right) internal pure returns (Instant) {
return left.gt(right) ? left : right;
}
}{
"remappings": [
"@openzeppelin-contracts-5.2.0/=dependencies/@openzeppelin-contracts-5.2.0/",
"forge-std-1.9.6/=dependencies/forge-std-1.9.6/",
"prt-contracts/=src/",
"step/=../../machine/step/"
],
"optimizer": {
"enabled": true,
"runs": 200
},
"metadata": {
"useLiteralContent": false,
"bytecodeHash": "ipfs",
"appendCBOR": true
},
"outputSelection": {
"*": {
"*": [
"evm.bytecode",
"evm.deployedBytecode",
"devdoc",
"userdoc",
"metadata",
"abi"
]
}
},
"evmVersion": "cancun",
"viaIR": true,
"libraries": {}
}Contract Security Audit
- No Contract Security Audit Submitted- Submit Audit Here
Contract ABI
API[{"inputs":[{"internalType":"Time.Duration","name":"matchEffort","type":"uint64"},{"internalType":"Time.Duration","name":"maxAllowance","type":"uint64"}],"stateMutability":"nonpayable","type":"constructor"},{"inputs":[{"internalType":"uint64","name":"level","type":"uint64"}],"name":"tournamentParameters","outputs":[{"components":[{"internalType":"uint64","name":"levels","type":"uint64"},{"internalType":"uint64","name":"log2step","type":"uint64"},{"internalType":"uint64","name":"height","type":"uint64"},{"internalType":"Time.Duration","name":"matchEffort","type":"uint64"},{"internalType":"Time.Duration","name":"maxAllowance","type":"uint64"}],"internalType":"struct TournamentParameters","name":"","type":"tuple"}],"stateMutability":"view","type":"function"}]Contract Creation Code
60c034607257601f6102aa38819003918201601f19168301916001600160401b038311848410176076578084926040948552833981010312607257604b6020604583608a565b9201608a565b9060805260a05260405161020c908161009e82396080518160e9015260a051816101100152f35b5f80fd5b634e487b7160e01b5f52604160045260245ffd5b51906001600160401b038216820360725756fe60806040526004361015610011575f80fd5b5f3560e01c63e05cc93f14610024575f80fd5b346101595760203660031901126101595760043567ffffffffffffffff81168091036101595760a0905f608061005861015d565b828152826020820152826040820152826060820152015267ffffffffffffffff806100c18161009f85610089610191565b602c8152601b60208201525f60408201526101b1565b5116936100aa610191565b6030815260116020820152601b60408201526101b1565b5116816100cc61015d565b6003815260208101948552604081019283528160806060830192827f00000000000000000000000000000000000000000000000000000000000000001684520193817f000000000000000000000000000000000000000000000000000000000000000016855281604051976003895251166020880152511660408601525116606084015251166080820152f35b5f80fd5b6040519060a0820182811067ffffffffffffffff82111761017d57604052565b634e487b7160e01b5f52604160045260245ffd5b604051906060820182811067ffffffffffffffff82111761017d57604052565b9060038110156101c25760051b0190565b634e487b7160e01b5f52603260045260245ffdfea2646970667358221220c74e73d1dfc70369040ec5b702966dcf17f40f1094eced944c3a2a71aa6b40fb64736f6c634300081b003300000000000000000000000000000000000000000000000000000000000008fc000000000000000000000000000000000000000000000000000000000000c60c
Deployed Bytecode
0x60806040526004361015610011575f80fd5b5f3560e01c63e05cc93f14610024575f80fd5b346101595760203660031901126101595760043567ffffffffffffffff81168091036101595760a0905f608061005861015d565b828152826020820152826040820152826060820152015267ffffffffffffffff806100c18161009f85610089610191565b602c8152601b60208201525f60408201526101b1565b5116936100aa610191565b6030815260116020820152601b60408201526101b1565b5116816100cc61015d565b6003815260208101948552604081019283528160806060830192827f00000000000000000000000000000000000000000000000000000000000008fc1684520193817f000000000000000000000000000000000000000000000000000000000000c60c16855281604051976003895251166020880152511660408601525116606084015251166080820152f35b5f80fd5b6040519060a0820182811067ffffffffffffffff82111761017d57604052565b634e487b7160e01b5f52604160045260245ffd5b604051906060820182811067ffffffffffffffff82111761017d57604052565b9060038110156101c25760051b0190565b634e487b7160e01b5f52603260045260245ffdfea2646970667358221220c74e73d1dfc70369040ec5b702966dcf17f40f1094eced944c3a2a71aa6b40fb64736f6c634300081b0033
Constructor Arguments (ABI-Encoded and is the last bytes of the Contract Creation Code above)
00000000000000000000000000000000000000000000000000000000000008fc000000000000000000000000000000000000000000000000000000000000c60c
-----Decoded View---------------
Arg [0] : matchEffort (uint64): 2300
Arg [1] : maxAllowance (uint64): 50700
-----Encoded View---------------
2 Constructor Arguments found :
Arg [0] : 00000000000000000000000000000000000000000000000000000000000008fc
Arg [1] : 000000000000000000000000000000000000000000000000000000000000c60c
Loading...
Loading
Loading...
Loading
Net Worth in USD
$0.00
Net Worth in ETH
0
Multichain Portfolio | 34 Chains
| Chain | Token | Portfolio % | Price | Amount | Value |
|---|
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.