Contract Address Details

0xe3D6899425E678f51c913A94d4e26b70eF172310

Box Last Balance Update: Block #13749295
Created by 0x5d14–003ea0 at 0xa3da–6d262c

Balance

0 POA

(@ /POA)

Fetching tokens...

Contract name:
Box




Optimization enabled
true
Compiler version
v0.4.24+commit.e67f0147




Optimization runs
200
EVM Version
byzantium

Contract source code

/**
* Submitted for verification at blockscout.com on 2019-07-22 13:28:08.947993Z
*/
// File: openzeppelin-solidity/contracts/math/SafeMath.sol
pragma solidity ^0.4.24;
/**
* @title SafeMath
* @dev Math operations with safety checks that throw on error
*/
library SafeMath {
/**
* @dev Multiplies two numbers, throws on overflow.
*/
function mul(uint256 _a, uint256 _b) internal pure returns (uint256 c) {
// Gas optimization: this is cheaper than asserting 'a' not being zero, but the
// benefit is lost if 'b' is also tested.
// See: https://github.com/OpenZeppelin/openzeppelin-solidity/pull/522
if (_a == 0) {
return 0;
}
c = _a * _b;
assert(c / _a == _b);
return c;
}
/**
* @dev Integer division of two numbers, truncating the quotient.
*/
function div(uint256 _a, uint256 _b) internal pure returns (uint256) {
// assert(_b > 0); // Solidity automatically throws when dividing by 0
// uint256 c = _a / _b;
// assert(_a == _b * c + _a % _b); // There is no case in which this doesn't hold
return _a / _b;
}
/**
* @dev Subtracts two numbers, throws on overflow (i.e. if subtrahend is greater than minuend).
*/
function sub(uint256 _a, uint256 _b) internal pure returns (uint256) {
assert(_b <= _a);
return _a - _b;
}
/**
* @dev Adds two numbers, throws on overflow.
*/
function add(uint256 _a, uint256 _b) internal pure returns (uint256 c) {
c = _a + _b;
assert(c >= _a);
return c;
}
}
// File: contracts/upgradeable_contracts/arbitrary_message/MessageDelivery.sol
pragma solidity 0.4.24;
contract MessageDelivery {
using SafeMath for uint256;
function requireToPassMessage(address _contract, bytes _data, uint256 _gas) public {
require(isMessageDeliverySubsidizedMode());
require(_gas >= getMinimumGasUsage(_data) && _gas <= getMaxGasPerTx());
emitEventOnMessageRequest(abi.encodePacked(msg.sender, _contract, _gas, uint8(0x00), _data));
}
function requireToPassMessage(address _contract, bytes _data, uint256 _gas, uint256 _gasPrice) public {
if (isMessageDeliverySubsidizedMode())
requireToPassMessage(_contract, _data, _gas);
else {
require(_gas >= getMinimumGasUsage(_data) && _gas <= getMaxGasPerTx());
emitEventOnMessageRequest(abi.encodePacked(msg.sender, _contract, _gas, uint8(0x01), _gasPrice, _data));
}
}
function requireToPassMessage(address _contract, bytes _data, uint256 _gas, bytes1 _oracleGasPriceSpeed) public {
if (isMessageDeliverySubsidizedMode())
requireToPassMessage(_contract, _data, _gas);
else {
require(_gas >= getMinimumGasUsage(_data) && _gas <= getMaxGasPerTx());
emitEventOnMessageRequest(
abi.encodePacked(msg.sender, _contract, _gas, uint8(0x02), _oracleGasPriceSpeed, _data)
);
}
}
function getMinimumGasUsage(bytes _data) public pure returns(uint256 gas) {
//From Ethereum Yellow Paper
// 68 gas is paid for every non-zero byte of data or code for a transaction
return _data.length.mul(68);
}
function getMaxGasPerTx() internal returns(uint256);
function isMessageDeliverySubsidizedMode() internal returns(bool);
function emitEventOnMessageRequest(bytes encodedData) internal;
}
// File: contracts/test/IAMB.sol
pragma solidity 0.4.24;
interface IAMB {
function messageSender() external view returns(address);
}
// File: contracts/test/Box.sol
pragma solidity 0.4.24;
contract Box {
event dataEvent(bytes selectorData);
uint256 public value;
address public lastSender;
function setValue(uint256 _value) public {
value = _value;
lastSender = IAMB(msg.sender).messageSender();
}
function methodWillFail() public {
revert();
}
function methodOutOfGas() public {
uint256 a = 0;
for (uint i = 0; i < 1000; i++) {
a = a + i;
}
}
function methodWillFailOnOtherNetwork(address _bridge, address _executor) public {
bytes4 methodSelector = this.methodWillFail.selector;
bytes memory encodedData = abi.encodeWithSelector(methodSelector);
MessageDelivery bridge = MessageDelivery(_bridge);
bridge.requireToPassMessage(_executor, encodedData, 141647);
}
function methodOutOfGasOnOtherNetwork(address _bridge, address _executor) public {
bytes4 methodSelector = this.methodOutOfGas.selector;
bytes memory encodedData = abi.encodeWithSelector(methodSelector);
MessageDelivery bridge = MessageDelivery(_bridge);
bridge.requireToPassMessage(_executor, encodedData, 1000);
}
function setValueOnOtherNetwork(uint256 _i, address _bridge, address _executor) public {
bytes4 methodSelector = this.setValue.selector;
bytes memory encodedData = abi.encodeWithSelector(methodSelector, _i);
MessageDelivery bridge = MessageDelivery(_bridge);
bridge.requireToPassMessage(_executor, encodedData, 141647);
}
function setValueOnOtherNetworkGasPrice(uint256 _i, address _bridge, address _executor, uint256 _gasPrice) public {
bytes4 methodSelector = this.setValue.selector;
bytes memory encodedData = abi.encodeWithSelector(methodSelector, _i);
MessageDelivery bridge = MessageDelivery(_bridge);
bridge.requireToPassMessage(_executor, encodedData, 821254, _gasPrice);
}
function setValueOnOtherNetworkGasPriceOracle(uint256 _i, address _bridge, address _executor, bytes1 _oracleGasPriceSpeed) public {
bytes4 methodSelector = this.setValue.selector;
bytes memory encodedData = abi.encodeWithSelector(methodSelector, _i);
MessageDelivery bridge = MessageDelivery(_bridge);
bridge.requireToPassMessage(_executor, encodedData, 821254, _oracleGasPriceSpeed);
}
function withdrawFromDepositOnOtherNetworkGasPrice(address _recipient, address _bridge, address _executor, uint256 _gasPrice) public {
bytes4 methodSelector = this.withdrawFromDeposit.selector;
bytes memory encodedData = abi.encodeWithSelector(methodSelector, _recipient);
MessageDelivery bridge = MessageDelivery(_bridge);
bridge.requireToPassMessage(_executor, encodedData, 821254, _gasPrice);
}
function withdrawFromDeposit(address _recipient) public {
}
}

Contract ABI

[{"type":"function","stateMutability":"view","payable":false,"outputs":[{"type":"address","name":""}],"name":"lastSender","inputs":[],"constant":true},{"type":"function","stateMutability":"nonpayable","payable":false,"outputs":[],"name":"setValueOnOtherNetworkGasPrice","inputs":[{"type":"uint256","name":"_i"},{"type":"address","name":"_bridge"},{"type":"address","name":"_executor"},{"type":"uint256","name":"_gasPrice"}],"constant":false},{"type":"function","stateMutability":"nonpayable","payable":false,"outputs":[],"name":"methodWillFail","inputs":[],"constant":false},{"type":"function","stateMutability":"view","payable":false,"outputs":[{"type":"uint256","name":""}],"name":"value","inputs":[],"constant":true},{"type":"function","stateMutability":"nonpayable","payable":false,"outputs":[],"name":"setValue","inputs":[{"type":"uint256","name":"_value"}],"constant":false},{"type":"function","stateMutability":"nonpayable","payable":false,"outputs":[],"name":"setValueOnOtherNetworkGasPriceOracle","inputs":[{"type":"uint256","name":"_i"},{"type":"address","name":"_bridge"},{"type":"address","name":"_executor"},{"type":"bytes1","name":"_oracleGasPriceSpeed"}],"constant":false},{"type":"function","stateMutability":"nonpayable","payable":false,"outputs":[],"name":"setValueOnOtherNetwork","inputs":[{"type":"uint256","name":"_i"},{"type":"address","name":"_bridge"},{"type":"address","name":"_executor"}],"constant":false},{"type":"function","stateMutability":"nonpayable","payable":false,"outputs":[],"name":"withdrawFromDeposit","inputs":[{"type":"address","name":"_recipient"}],"constant":false},{"type":"function","stateMutability":"nonpayable","payable":false,"outputs":[],"name":"methodOutOfGasOnOtherNetwork","inputs":[{"type":"address","name":"_bridge"},{"type":"address","name":"_executor"}],"constant":false},{"type":"function","stateMutability":"nonpayable","payable":false,"outputs":[],"name":"methodOutOfGas","inputs":[],"constant":false},{"type":"function","stateMutability":"nonpayable","payable":false,"outputs":[],"name":"methodWillFailOnOtherNetwork","inputs":[{"type":"address","name":"_bridge"},{"type":"address","name":"_executor"}],"constant":false},{"type":"function","stateMutability":"nonpayable","payable":false,"outputs":[],"name":"withdrawFromDepositOnOtherNetworkGasPrice","inputs":[{"type":"address","name":"_recipient"},{"type":"address","name":"_bridge"},{"type":"address","name":"_executor"},{"type":"uint256","name":"_gasPrice"}],"constant":false},{"type":"event","name":"dataEvent","inputs":[{"type":"bytes","name":"selectorData","indexed":false}],"anonymous":false}]
            

Contract Byte Code

0x6080604052600436106100b95763ffffffff7c0100000000000000000000000000000000000000000000000000000000600035041663256fec8881146100be578063323aff1a146100ef5780633b1718581461011e5780633fa4f24514610133578063552410771461015a5780635c37d3fa146101725780636b75f02b146101c15780637fefda37146101eb578063b23332101461020c578063b2d2868814610233578063e6d0031914610248578063fc8eff001461026f575b600080fd5b3480156100ca57600080fd5b506100d361029f565b60408051600160a060020a039092168252519081900360200190f35b3480156100fb57600080fd5b5061011c600435600160a060020a03602435811690604435166064356102ae565b005b34801561012a57600080fd5b5061011c6100b9565b34801561013f57600080fd5b50610148610407565b60408051918252519081900360200190f35b34801561016657600080fd5b5061011c60043561040d565b34801561017e57600080fd5b5061011c600435600160a060020a03602435811690604435167fff00000000000000000000000000000000000000000000000000000000000000606435166104c6565b3480156101cd57600080fd5b5061011c600435600160a060020a03602435811690604435166105cf565b3480156101f757600080fd5b5061011c600160a060020a036004351661071b565b34801561021857600080fd5b5061011c600160a060020a036004358116906024351661071e565b34801561023f57600080fd5b5061011c610857565b34801561025457600080fd5b5061011c600160a060020a0360043581169060243516610875565b34801561027b57600080fd5b5061011c600160a060020a0360043581169060243581169060443516606435610941565b600154600160a060020a031681565b60408051602480820187905282518083038201815260449283018452602081018051600160e060020a03167f5524107700000000000000000000000000000000000000000000000000000000908117825294517fe8490e4d000000000000000000000000000000000000000000000000000000008152600160a060020a0388811660048301908152620c880696830187905260648301899052608095830195865284516084840152845194968b969287169563e8490e4d958c958a9593948d949093909260a4909201919080838360005b8381101561039757818101518382015260200161037f565b50505050905090810190601f1680156103c45780820380516001836020036101000a031916815260200191505b5095505050505050600060405180830381600087803b1580156103e657600080fd5b505af11580156103fa573d6000803e3d6000fd5b5050505050505050505050565b60005481565b8060008190555033600160a060020a031663d67bdd256040518163ffffffff167c0100000000000000000000000000000000000000000000000000000000028152600401602060405180830381600087803b15801561046b57600080fd5b505af115801561047f573d6000803e3d6000fd5b505050506040513d602081101561049557600080fd5b50516001805473ffffffffffffffffffffffffffffffffffffffff1916600160a060020a0390921691909117905550565b60408051602480820187905282518083038201815260449283018452602081018051600160e060020a03167f5524107700000000000000000000000000000000000000000000000000000000908117825294517f0ff43918000000000000000000000000000000000000000000000000000000008152600160a060020a0388811660048301908152620c88069683018790527fff0000000000000000000000000000000000000000000000000000000000000089166064840152608095830195865284516084840152845194968b9692871695630ff43918958c958a9593948d949093909260a4909201919080838360008381101561039757818101518382015260200161037f565b60408051602480820186905282518083038201815260449283018452602081018051600160e060020a03167f5524107700000000000000000000000000000000000000000000000000000000908117825294517fdc8601b3000000000000000000000000000000000000000000000000000000008152600160a060020a03878116600483019081526202294f968301879052606095830195865284516064840152845194968a969287169563dc8601b3958b958a95939493926084909101919080838360005b838110156106ad578181015183820152602001610695565b50505050905090810190601f1680156106da5780820380516001836020036101000a031916815260200191505b50945050505050600060405180830381600087803b1580156106fb57600080fd5b505af115801561070f573d6000803e3d6000fd5b50505050505050505050565b50565b60408051600480825260248083018452602083018051600160e060020a03167fb2d2868800000000000000000000000000000000000000000000000000000000908117825294517fdc8601b3000000000000000000000000000000000000000000000000000000008152600160a060020a038781169482019485526103e86044830181905260609483019485528651606484015286518a969287169563dc8601b3958b958a95936084909101919080838360005b838110156107ea5781810151838201526020016107d2565b50505050905090810190601f1680156108175780820380516001836020036101000a031916815260200191505b50945050505050600060405180830381600087803b15801561083857600080fd5b505af115801561084c573d6000803e3d6000fd5b505050505050505050565b6000805b6103e8811015610871579081019060010161085b565b5050565b60408051600480825260248083018452602083018051600160e060020a03167f3b17185800000000000000000000000000000000000000000000000000000000908117825294517fdc8601b3000000000000000000000000000000000000000000000000000000008152600160a060020a038781169482019485526202294f6044830181905260609483019485528651606484015286518a969287169563dc8601b3958b958a9593608490910191908083836000838110156107ea5781810151838201526020016107d2565b60408051600160a060020a0380871660248084019190915283518084038201815260449384018552602081018051600160e060020a03167f7fefda3700000000000000000000000000000000000000000000000000000000908117825295517fe8490e4d00000000000000000000000000000000000000000000000000000000815288851660048201908152620c880696820187905260648201899052608094820194855283516084830152835193968b9687169563e8490e4d958c958a9593948d9490939260a4909101919080838360008381101561039757818101518382015260200161037f5600a165627a7a72305820e71d2436f01a786633407a51e5c7e81bb2260e78be8d1fe568a93f835fb7280e0029