Warning! Contract bytecode has been changed and doesn't match the verified one. Therefore, interaction with this smart contract may be risky.
This contract has been verified via Sourcify.
View contract in Sourcify repository
- Contract name:
- TokenRegistry
- Optimization enabled
- true
- Compiler version
- v0.7.6+commit.7338295f
- Optimization runs
- 200
- EVM Version
- istanbul
- Verified at
- 2026-06-08T11:28:49.066036Z
contracts/TokenRegistry.sol
// SPDX-License-Identifier: LGPL-3.0-or-later
pragma solidity 0.7.6;
import "@openzeppelin/contracts/access/Ownable.sol";
import "./interfaces/ITokenRegistry.sol";
/**
* @title Contract for managing maximum allowed funds to be escrowed.
* The purpose is to limit the total funds locked in escrow in the initial stages of the protocol.
*/
contract TokenRegistry is Ownable, ITokenRegistry {
uint256 private ethLimit;
mapping(address => uint256) private tokenLimits;
mapping(address => address) private tokenWrappers;
event LogETHLimitChanged(uint256 _newLimit, address indexed _triggeredBy);
event LogTokenLimitChanged(uint256 _newLimit, address indexed _triggeredBy);
event LogTokenWrapperChanged(address indexed _newWrapperAddress, address indexed _triggeredBy);
modifier notZeroAddress(address _tokenAddress) {
require(_tokenAddress != address(0), "INVALID_TOKEN_ADDRESS");
_;
}
constructor() {
ethLimit = 1 ether;
emit LogETHLimitChanged(ethLimit, msg.sender);
}
/**
* @notice Set new limit for ETH. It's used while seller tries to create a voucher. The limit is determined by a voucher set. Voucher price * quantity, seller deposit * quantity, buyer deposit * qty must be below the limit.
* @param _newLimit New limit which will be set.
*/
function setETHLimit(uint256 _newLimit) external override onlyOwner {
ethLimit = _newLimit;
emit LogETHLimitChanged(_newLimit, msg.sender);
}
/**
* @notice Set new limit for a token. It's used while seller tries to create a voucher. The limit is determined by a voucher set. Voucher price * quantity, seller deposit * quantity, buyer deposit * qty must be below the limit.
* @param _tokenAddress Address of the token which will be updated.
* @param _newLimit New limit which will be set. It must comply to the decimals of the token, so the limit is set in the correct decimals.
*/
function setTokenLimit(address _tokenAddress, uint256 _newLimit)
external
override
onlyOwner
notZeroAddress(_tokenAddress)
{
tokenLimits[_tokenAddress] = _newLimit;
emit LogTokenLimitChanged(_newLimit, msg.sender);
}
// // // // // // // //
// GETTERS
// // // // // // // //
/**
* @notice Get the maximum allowed ETH limit to set as price of voucher, buyer deposit or seller deposit.
*/
function getETHLimit() external view override returns (uint256) {
return ethLimit;
}
/**
* @notice Get the maximum allowed token limit for the specified Token.
* @param _tokenAddress Address of the token which will be update.
*/
function getTokenLimit(address _tokenAddress)
external
view
override
returns (uint256)
{
return tokenLimits[_tokenAddress];
}
/**
* @notice Set the address of the wrapper contract for the token. The wrapper is used to, for instance, allow the Boson Protocol functions that use permit functionality to work in a uniform way.
* @param _tokenAddress Address of the token for which the wrapper is being set
* @param _wrapperAddress Address of the token wrapper contract
*/
function setTokenWrapperAddress(address _tokenAddress, address _wrapperAddress)
external
override
onlyOwner
notZeroAddress(_tokenAddress)
{
tokenWrappers[_tokenAddress] = _wrapperAddress;
emit LogTokenWrapperChanged(_wrapperAddress, msg.sender);
}
/**
* @notice Get the address of the token wrapper contract for the specified token
* @param _tokenAddress Address of the token which will be updated.
* @return Address of the token wrapper contract
*/
function getTokenWrapperAddress(address _tokenAddress)
external
view
override
returns (address)
{
return tokenWrappers[_tokenAddress];
}
}
/Context.sol
// SPDX-License-Identifier: MIT
pragma solidity >=0.6.0 <0.8.0;
/*
* @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 GSN 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 payable) {
return msg.sender;
}
function _msgData() internal view virtual returns (bytes memory) {
this; // silence state mutability warning without generating bytecode - see https://github.com/ethereum/solidity/issues/2691
return msg.data;
}
}
/ITokenRegistry.sol
// SPDX-License-Identifier: LGPL-3.0-or-later
pragma solidity 0.7.6;
interface ITokenRegistry {
/**
* @notice Set new limit for a token. It's used while seller tries to create a voucher. The limit is determined by a voucher set. Voucher price * quantity, seller deposit * quantity, buyer deposit * qty must be below the limit.
* @param _tokenAddress Address of the token which will be updated.
* @param _newLimit New limit which will be set. It must comply to the decimals of the token, so the limit is set in the correct decimals.
*/
function setTokenLimit(address _tokenAddress, uint256 _newLimit) external;
/**
* @notice Get the maximum allowed token limit for the specified Token.
* @param _tokenAddress Address of the token which will be update.
* @return The max limit for this token
*/
function getTokenLimit(address _tokenAddress)
external
view
returns (uint256);
/**
* @notice Set new limit for ETH. It's used while seller tries to create a voucher. The limit is determined by a voucher set. Voucher price * quantity, seller deposit * quantity, buyer deposit * qty must be below the limit.
* @param _newLimit New limit which will be set.
*/
function setETHLimit(uint256 _newLimit) external;
/**
* @notice Get the maximum allowed ETH limit to set as price of voucher, buyer deposit or seller deposit.
* @return The max ETH limit
*/
function getETHLimit() external view returns (uint256);
/**
* @notice Set the address of the wrapper contract for the token. The wrapper is used to, for instance, allow the Boson Protocol functions that use permit functionality to work in a uniform way.
* @param _tokenAddress Address of the token which will be updated.
* @param _wrapperAddress Address of the wrapper contract
*/
function setTokenWrapperAddress(
address _tokenAddress,
address _wrapperAddress
) external;
/**
* @notice Get the address of the token wrapper contract for the specified token
* @param _tokenAddress Address of the token which will be updated.
* @return Address of the token wrapper contract
*/
function getTokenWrapperAddress(address _tokenAddress)
external
view
returns (address);
}
/Ownable.sol
// SPDX-License-Identifier: MIT
pragma solidity ^0.7.0;
import "../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.
*
* By default, the owner account will be the one that deploys the contract. 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;
event OwnershipTransferred(address indexed previousOwner, address indexed newOwner);
/**
* @dev Initializes the contract setting the deployer as the initial owner.
*/
constructor () {
address msgSender = _msgSender();
_owner = msgSender;
emit OwnershipTransferred(address(0), msgSender);
}
/**
* @dev Returns the address of the current owner.
*/
function owner() public view virtual returns (address) {
return _owner;
}
/**
* @dev Throws if called by any account other than the owner.
*/
modifier onlyOwner() {
require(owner() == _msgSender(), "Ownable: caller is not the owner");
_;
}
/**
* @dev Leaves the contract without owner. It will not be possible to call
* `onlyOwner` functions anymore. Can only be called by the current owner.
*
* NOTE: Renouncing ownership will leave the contract without an owner,
* thereby removing any functionality that is only available to the owner.
*/
function renounceOwnership() public virtual onlyOwner {
emit OwnershipTransferred(_owner, address(0));
_owner = 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 {
require(newOwner != address(0), "Ownable: new owner is the zero address");
emit OwnershipTransferred(_owner, newOwner);
_owner = newOwner;
}
}
Compiler Settings
{"remappings":[],"optimizer":{"runs":200,"enabled":true},"metadata":{"bytecodeHash":"ipfs"},"libraries":{},"evmVersion":"istanbul","compilationTarget":{"contracts/TokenRegistry.sol":"TokenRegistry"}}
Contract ABI
[{"type":"constructor","stateMutability":"nonpayable","inputs":[]},{"type":"event","name":"LogETHLimitChanged","inputs":[{"type":"uint256","name":"_newLimit","internalType":"uint256","indexed":false},{"type":"address","name":"_triggeredBy","internalType":"address","indexed":true}],"anonymous":false},{"type":"event","name":"LogTokenLimitChanged","inputs":[{"type":"uint256","name":"_newLimit","internalType":"uint256","indexed":false},{"type":"address","name":"_triggeredBy","internalType":"address","indexed":true}],"anonymous":false},{"type":"event","name":"LogTokenWrapperChanged","inputs":[{"type":"address","name":"_newWrapperAddress","internalType":"address","indexed":true},{"type":"address","name":"_triggeredBy","internalType":"address","indexed":true}],"anonymous":false},{"type":"event","name":"OwnershipTransferred","inputs":[{"type":"address","name":"previousOwner","internalType":"address","indexed":true},{"type":"address","name":"newOwner","internalType":"address","indexed":true}],"anonymous":false},{"type":"function","stateMutability":"view","outputs":[{"type":"uint256","name":"","internalType":"uint256"}],"name":"getETHLimit","inputs":[]},{"type":"function","stateMutability":"view","outputs":[{"type":"uint256","name":"","internalType":"uint256"}],"name":"getTokenLimit","inputs":[{"type":"address","name":"_tokenAddress","internalType":"address"}]},{"type":"function","stateMutability":"view","outputs":[{"type":"address","name":"","internalType":"address"}],"name":"getTokenWrapperAddress","inputs":[{"type":"address","name":"_tokenAddress","internalType":"address"}]},{"type":"function","stateMutability":"view","outputs":[{"type":"address","name":"","internalType":"address"}],"name":"owner","inputs":[]},{"type":"function","stateMutability":"nonpayable","outputs":[],"name":"renounceOwnership","inputs":[]},{"type":"function","stateMutability":"nonpayable","outputs":[],"name":"setETHLimit","inputs":[{"type":"uint256","name":"_newLimit","internalType":"uint256"}]},{"type":"function","stateMutability":"nonpayable","outputs":[],"name":"setTokenLimit","inputs":[{"type":"address","name":"_tokenAddress","internalType":"address"},{"type":"uint256","name":"_newLimit","internalType":"uint256"}]},{"type":"function","stateMutability":"nonpayable","outputs":[],"name":"setTokenWrapperAddress","inputs":[{"type":"address","name":"_tokenAddress","internalType":"address"},{"type":"address","name":"_wrapperAddress","internalType":"address"}]},{"type":"function","stateMutability":"nonpayable","outputs":[],"name":"transferOwnership","inputs":[{"type":"address","name":"newOwner","internalType":"address"}]}]
Contract Creation Code
0x608060405234801561001057600080fd5b50600061001b6100ad565b600080546001600160a01b0319166001600160a01b0383169081178255604051929350917f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e0908290a350670de0b6b3a76400006001819055604080519182525133917f9462735486103805dd471af708689460124c6d5016a7b7f897f887cf7020c521919081900360200190a26100b1565b3390565b610701806100c06000396000f3fe608060405234801561001057600080fd5b50600436106100935760003560e01c80638695332f116100665780638695332f146101245780638da5cb5b14610141578063bc01763714610149578063c448da3c14610175578063f2fde38b146101a357610093565b80630f878aed146100985780633ab6ad25146100b25780635a860c87146100f4578063715018a61461011a575b600080fd5b6100a06101c9565b60408051918252519081900360200190f35b6100d8600480360360208110156100c857600080fd5b50356001600160a01b03166101cf565b604080516001600160a01b039092168252519081900360200190f35b6100a06004803603602081101561010a57600080fd5b50356001600160a01b03166101ed565b610122610208565b005b6101226004803603602081101561013a57600080fd5b50356102b4565b6100d8610354565b6101226004803603604081101561015f57600080fd5b506001600160a01b038135169060200135610363565b6101226004803603604081101561018b57600080fd5b506001600160a01b038135811691602001351661046f565b610122600480360360208110156101b957600080fd5b50356001600160a01b031661057f565b60015490565b6001600160a01b039081166000908152600360205260409020541690565b6001600160a01b031660009081526002602052604090205490565b610210610681565b6001600160a01b0316610221610354565b6001600160a01b03161461026a576040805162461bcd60e51b815260206004820181905260248201526000805160206106ac833981519152604482015290519081900360640190fd5b600080546040516001600160a01b03909116907f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e0908390a3600080546001600160a01b0319169055565b6102bc610681565b6001600160a01b03166102cd610354565b6001600160a01b031614610316576040805162461bcd60e51b815260206004820181905260248201526000805160206106ac833981519152604482015290519081900360640190fd5b600181905560408051828152905133917f9462735486103805dd471af708689460124c6d5016a7b7f897f887cf7020c521919081900360200190a250565b6000546001600160a01b031690565b61036b610681565b6001600160a01b031661037c610354565b6001600160a01b0316146103c5576040805162461bcd60e51b815260206004820181905260248201526000805160206106ac833981519152604482015290519081900360640190fd5b816001600160a01b038116610419576040805162461bcd60e51b8152602060048201526015602482015274494e56414c49445f544f4b454e5f4144445245535360581b604482015290519081900360640190fd5b6001600160a01b0383166000908152600260209081526040918290208490558151848152915133927f6a209be2fe222988596b5f4dd242289077f0f05402d2f1848a97da68c235389492908290030190a2505050565b610477610681565b6001600160a01b0316610488610354565b6001600160a01b0316146104d1576040805162461bcd60e51b815260206004820181905260248201526000805160206106ac833981519152604482015290519081900360640190fd5b816001600160a01b038116610525576040805162461bcd60e51b8152602060048201526015602482015274494e56414c49445f544f4b454e5f4144445245535360581b604482015290519081900360640190fd5b6001600160a01b0383811660009081526003602052604080822080546001600160a01b0319169386169384179055513392917f4e03a5e51acaadf5c7fdf777c34f37cfd9ab3fc6dc448897d6d7c5c56d78fea991a3505050565b610587610681565b6001600160a01b0316610598610354565b6001600160a01b0316146105e1576040805162461bcd60e51b815260206004820181905260248201526000805160206106ac833981519152604482015290519081900360640190fd5b6001600160a01b0381166106265760405162461bcd60e51b81526004018080602001828103825260268152602001806106866026913960400191505060405180910390fd5b600080546040516001600160a01b03808516939216917f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e091a3600080546001600160a01b0319166001600160a01b0392909216919091179055565b339056fe4f776e61626c653a206e6577206f776e657220697320746865207a65726f20616464726573734f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e6572a2646970667358221220cb0a04a94d32a2c62a240f009a2e4eb204bb85195453fd371bab0eeef7c99b2b64736f6c63430007060033
Deployed ByteCode
0x608060405234801561001057600080fd5b50600436106100935760003560e01c80638695332f116100665780638695332f146101245780638da5cb5b14610141578063bc01763714610149578063c448da3c14610175578063f2fde38b146101a357610093565b80630f878aed146100985780633ab6ad25146100b25780635a860c87146100f4578063715018a61461011a575b600080fd5b6100a06101c9565b60408051918252519081900360200190f35b6100d8600480360360208110156100c857600080fd5b50356001600160a01b03166101cf565b604080516001600160a01b039092168252519081900360200190f35b6100a06004803603602081101561010a57600080fd5b50356001600160a01b03166101ed565b610122610208565b005b6101226004803603602081101561013a57600080fd5b50356102b4565b6100d8610354565b6101226004803603604081101561015f57600080fd5b506001600160a01b038135169060200135610363565b6101226004803603604081101561018b57600080fd5b506001600160a01b038135811691602001351661046f565b610122600480360360208110156101b957600080fd5b50356001600160a01b031661057f565b60015490565b6001600160a01b039081166000908152600360205260409020541690565b6001600160a01b031660009081526002602052604090205490565b610210610681565b6001600160a01b0316610221610354565b6001600160a01b03161461026a576040805162461bcd60e51b815260206004820181905260248201526000805160206106ac833981519152604482015290519081900360640190fd5b600080546040516001600160a01b03909116907f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e0908390a3600080546001600160a01b0319169055565b6102bc610681565b6001600160a01b03166102cd610354565b6001600160a01b031614610316576040805162461bcd60e51b815260206004820181905260248201526000805160206106ac833981519152604482015290519081900360640190fd5b600181905560408051828152905133917f9462735486103805dd471af708689460124c6d5016a7b7f897f887cf7020c521919081900360200190a250565b6000546001600160a01b031690565b61036b610681565b6001600160a01b031661037c610354565b6001600160a01b0316146103c5576040805162461bcd60e51b815260206004820181905260248201526000805160206106ac833981519152604482015290519081900360640190fd5b816001600160a01b038116610419576040805162461bcd60e51b8152602060048201526015602482015274494e56414c49445f544f4b454e5f4144445245535360581b604482015290519081900360640190fd5b6001600160a01b0383166000908152600260209081526040918290208490558151848152915133927f6a209be2fe222988596b5f4dd242289077f0f05402d2f1848a97da68c235389492908290030190a2505050565b610477610681565b6001600160a01b0316610488610354565b6001600160a01b0316146104d1576040805162461bcd60e51b815260206004820181905260248201526000805160206106ac833981519152604482015290519081900360640190fd5b816001600160a01b038116610525576040805162461bcd60e51b8152602060048201526015602482015274494e56414c49445f544f4b454e5f4144445245535360581b604482015290519081900360640190fd5b6001600160a01b0383811660009081526003602052604080822080546001600160a01b0319169386169384179055513392917f4e03a5e51acaadf5c7fdf777c34f37cfd9ab3fc6dc448897d6d7c5c56d78fea991a3505050565b610587610681565b6001600160a01b0316610598610354565b6001600160a01b0316146105e1576040805162461bcd60e51b815260206004820181905260248201526000805160206106ac833981519152604482015290519081900360640190fd5b6001600160a01b0381166106265760405162461bcd60e51b81526004018080602001828103825260268152602001806106866026913960400191505060405180910390fd5b600080546040516001600160a01b03808516939216917f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e091a3600080546001600160a01b0319166001600160a01b0392909216919091179055565b339056fe4f776e61626c653a206e6577206f776e657220697320746865207a65726f20616464726573734f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e6572a2646970667358221220cb0a04a94d32a2c62a240f009a2e4eb204bb85195453fd371bab0eeef7c99b2b64736f6c63430007060033