Source Code
View more zero value Internal Transactions in Advanced View mode
Advanced mode:
Cross-Chain Transactions
Loading...
Loading
Contract Name:
EmissionManager
Compiler Version
v0.8.24+commit.e11b9ed9
Contract Source Code (Solidity Standard Json-Input format)
// SPDX-License-Identifier: AGPL-3.0
/* ———————————————————————————————————————————————————————————————————————————————— *
* _____ ______ ______ __ __ __ __ ______ __ __ *
* /\ __-. /\__ _\ /\ == \ /\ \ /\ "-.\ \ /\ \ /\__ _\ /\ \_\ \ *
* \ \ \/\ \ \/_/\ \/ \ \ __< \ \ \ \ \ \-. \ \ \ \ \/_/\ \/ \ \____ \ *
* \ \____- \ \_\ \ \_\ \_\ \ \_\ \ \_\\"\_\ \ \_\ \ \_\ \/\_____\ *
* \/____/ \/_/ \/_/ /_/ \/_/ \/_/ \/_/ \/_/ \/_/ \/_____/ *
* *
* ————————————————————————————————— dtrinity.org ————————————————————————————————— *
* *
* ▲ *
* ▲ ▲ *
* *
* ———————————————————————————————————————————————————————————————————————————————— *
* dTRINITY Protocol: https://github.com/dtrinity *
* ———————————————————————————————————————————————————————————————————————————————— */
pragma solidity ^0.8.10;
import {IAaveOracle} from "contracts/lending/core/interfaces/IAaveOracle.sol";
import {Ownable} from "contracts/lending/core/dependencies/openzeppelin/contracts/Ownable.sol";
import {IEmissionManager} from "./interfaces/IEmissionManager.sol";
import {ITransferStrategyBase} from "./interfaces/ITransferStrategyBase.sol";
import {IRewardsController} from "./interfaces/IRewardsController.sol";
import {RewardsDataTypes} from "./libraries/RewardsDataTypes.sol";
import {IERC20} from "contracts/lending/core/dependencies/openzeppelin/contracts/IERC20.sol";
/**
* @title EmissionManager
* @author Aave
* @notice It manages the list of admins of reward emissions and provides functions to control reward emissions.
*/
contract EmissionManager is Ownable, IEmissionManager {
// reward => emissionAdmin
mapping(address => address) internal _emissionAdmins;
IRewardsController internal _rewardsController;
/**
* @dev Only emission admin of the given reward can call functions marked by this modifier.
**/
modifier onlyEmissionAdmin(address reward) {
require(msg.sender == _emissionAdmins[reward], "ONLY_EMISSION_ADMIN");
_;
}
/**
* Constructor.
* @param owner The address of the owner
*/
constructor(address owner) {
transferOwnership(owner);
}
/// @inheritdoc IEmissionManager
function configureAssets(
RewardsDataTypes.RewardsConfigInput[] memory config
) external override {
for (uint256 i = 0; i < config.length; i++) {
require(
_emissionAdmins[config[i].reward] == msg.sender,
"ONLY_EMISSION_ADMIN"
);
}
_rewardsController.configureAssets(config);
}
/// @inheritdoc IEmissionManager
function setTransferStrategy(
address reward,
ITransferStrategyBase transferStrategy
) external override onlyEmissionAdmin(reward) {
_rewardsController.setTransferStrategy(reward, transferStrategy);
}
/// @inheritdoc IEmissionManager
function setRewardOracle(
address reward,
IAaveOracle rewardOracle
) external override onlyEmissionAdmin(reward) {
_rewardsController.setRewardOracle(reward, rewardOracle);
}
/// @inheritdoc IEmissionManager
function setDistributionEnd(
address asset,
address reward,
uint32 newDistributionEnd
) external override onlyEmissionAdmin(reward) {
_rewardsController.setDistributionEnd(
asset,
reward,
newDistributionEnd
);
}
/// @inheritdoc IEmissionManager
function setEmissionPerSecond(
address asset,
address[] calldata rewards,
uint88[] calldata newEmissionsPerSecond
) external override {
for (uint256 i = 0; i < rewards.length; i++) {
require(
_emissionAdmins[rewards[i]] == msg.sender,
"ONLY_EMISSION_ADMIN"
);
}
_rewardsController.setEmissionPerSecond(
asset,
rewards,
newEmissionsPerSecond
);
}
/// @inheritdoc IEmissionManager
function setClaimer(
address user,
address claimer
) external override onlyOwner {
_rewardsController.setClaimer(user, claimer);
}
/// @inheritdoc IEmissionManager
function setEmissionAdmin(
address reward,
address admin
) external override onlyOwner {
address oldAdmin = _emissionAdmins[reward];
_emissionAdmins[reward] = admin;
emit EmissionAdminUpdated(reward, oldAdmin, admin);
}
/// @inheritdoc IEmissionManager
function setRewardsController(
address controller
) external override onlyOwner {
_rewardsController = IRewardsController(controller);
}
/// @inheritdoc IEmissionManager
function getRewardsController()
external
view
override
returns (IRewardsController)
{
return _rewardsController;
}
/// @inheritdoc IEmissionManager
function getEmissionAdmin(
address reward
) external view override returns (address) {
return _emissionAdmins[reward];
}
/// @inheritdoc IEmissionManager
function depositReward(address reward, uint256 amount) external {
require(amount > 0, "ZERO_AMOUNT");
_rewardsController.depositRewardFrom(reward, amount, msg.sender);
}
}// SPDX-License-Identifier: MIT
/* ———————————————————————————————————————————————————————————————————————————————— *
* _____ ______ ______ __ __ __ __ ______ __ __ *
* /\ __-. /\__ _\ /\ == \ /\ \ /\ "-.\ \ /\ \ /\__ _\ /\ \_\ \ *
* \ \ \/\ \ \/_/\ \/ \ \ __< \ \ \ \ \ \-. \ \ \ \ \/_/\ \/ \ \____ \ *
* \ \____- \ \_\ \ \_\ \_\ \ \_\ \ \_\\"\_\ \ \_\ \ \_\ \/\_____\ *
* \/____/ \/_/ \/_/ /_/ \/_/ \/_/ \/_/ \/_/ \/_/ \/_____/ *
* *
* ————————————————————————————————— dtrinity.org ————————————————————————————————— *
* *
* ▲ *
* ▲ ▲ *
* *
* ———————————————————————————————————————————————————————————————————————————————— *
* dTRINITY Protocol: https://github.com/dtrinity *
* ———————————————————————————————————————————————————————————————————————————————— */
pragma solidity ^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 payable(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;
}
}// SPDX-License-Identifier: AGPL-3.0
/* ———————————————————————————————————————————————————————————————————————————————— *
* _____ ______ ______ __ __ __ __ ______ __ __ *
* /\ __-. /\__ _\ /\ == \ /\ \ /\ "-.\ \ /\ \ /\__ _\ /\ \_\ \ *
* \ \ \/\ \ \/_/\ \/ \ \ __< \ \ \ \ \ \-. \ \ \ \ \/_/\ \/ \ \____ \ *
* \ \____- \ \_\ \ \_\ \_\ \ \_\ \ \_\\"\_\ \ \_\ \ \_\ \/\_____\ *
* \/____/ \/_/ \/_/ /_/ \/_/ \/_/ \/_/ \/_/ \/_/ \/_____/ *
* *
* ————————————————————————————————— dtrinity.org ————————————————————————————————— *
* *
* ▲ *
* ▲ ▲ *
* *
* ———————————————————————————————————————————————————————————————————————————————— *
* dTRINITY Protocol: https://github.com/dtrinity *
* ———————————————————————————————————————————————————————————————————————————————— */
pragma solidity ^0.8.0;
/**
* @dev Interface of the ERC20 standard as defined in the EIP.
*/
interface IERC20 {
/**
* @dev Returns the amount of tokens in existence.
*/
function totalSupply() external view returns (uint256);
/**
* @dev Returns the amount of tokens owned by `account`.
*/
function balanceOf(address account) external view returns (uint256);
/**
* @dev Moves `amount` tokens from the caller's account to `recipient`.
*
* Returns a boolean value indicating whether the operation succeeded.
*
* Emits a {Transfer} event.
*/
function transfer(
address recipient,
uint256 amount
) 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 `amount` 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 amount) external returns (bool);
/**
* @dev Moves `amount` tokens from `sender` to `recipient` using the
* allowance mechanism. `amount` is then deducted from the caller's
* allowance.
*
* Returns a boolean value indicating whether the operation succeeded.
*
* Emits a {Transfer} event.
*/
function transferFrom(
address sender,
address recipient,
uint256 amount
) external returns (bool);
/**
* @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
);
}// SPDX-License-Identifier: MIT
/* ———————————————————————————————————————————————————————————————————————————————— *
* _____ ______ ______ __ __ __ __ ______ __ __ *
* /\ __-. /\__ _\ /\ == \ /\ \ /\ "-.\ \ /\ \ /\__ _\ /\ \_\ \ *
* \ \ \/\ \ \/_/\ \/ \ \ __< \ \ \ \ \ \-. \ \ \ \ \/_/\ \/ \ \____ \ *
* \ \____- \ \_\ \ \_\ \_\ \ \_\ \ \_\\"\_\ \ \_\ \ \_\ \/\_____\ *
* \/____/ \/_/ \/_/ /_/ \/_/ \/_/ \/_/ \/_/ \/_/ \/_____/ *
* *
* ————————————————————————————————— dtrinity.org ————————————————————————————————— *
* *
* ▲ *
* ▲ ▲ *
* *
* ———————————————————————————————————————————————————————————————————————————————— *
* dTRINITY Protocol: https://github.com/dtrinity *
* ———————————————————————————————————————————————————————————————————————————————— */
pragma solidity ^0.8.0;
import "./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.
*/
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 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;
}
}// SPDX-License-Identifier: AGPL-3.0
/* ———————————————————————————————————————————————————————————————————————————————— *
* _____ ______ ______ __ __ __ __ ______ __ __ *
* /\ __-. /\__ _\ /\ == \ /\ \ /\ "-.\ \ /\ \ /\__ _\ /\ \_\ \ *
* \ \ \/\ \ \/_/\ \/ \ \ __< \ \ \ \ \ \-. \ \ \ \ \/_/\ \/ \ \____ \ *
* \ \____- \ \_\ \ \_\ \_\ \ \_\ \ \_\\"\_\ \ \_\ \ \_\ \/\_____\ *
* \/____/ \/_/ \/_/ /_/ \/_/ \/_/ \/_/ \/_/ \/_/ \/_____/ *
* *
* ————————————————————————————————— dtrinity.org ————————————————————————————————— *
* *
* ▲ *
* ▲ ▲ *
* *
* ———————————————————————————————————————————————————————————————————————————————— *
* dTRINITY Protocol: https://github.com/dtrinity *
* ———————————————————————————————————————————————————————————————————————————————— */
pragma solidity ^0.8.0;
import {IPriceOracleGetter} from "./IPriceOracleGetter.sol";
import {IPoolAddressesProvider} from "./IPoolAddressesProvider.sol";
/**
* @title IAaveOracle
* @author Aave
* @notice Defines the basic interface for the Aave Oracle
*/
interface IAaveOracle is IPriceOracleGetter {
/**
* @dev Emitted after the base currency is set
* @param baseCurrency The base currency of used for price quotes
* @param baseCurrencyUnit The unit of the base currency
*/
event BaseCurrencySet(
address indexed baseCurrency,
uint256 baseCurrencyUnit
);
/**
* @dev Emitted after the price source of an asset is updated
* @param asset The address of the asset
* @param source The price source of the asset
*/
event AssetSourceUpdated(address indexed asset, address indexed source);
/**
* @dev Emitted after the address of fallback oracle is updated
* @param fallbackOracle The address of the fallback oracle
*/
event FallbackOracleUpdated(address indexed fallbackOracle);
/**
* @notice Returns the PoolAddressesProvider
* @return The address of the PoolAddressesProvider contract
*/
function ADDRESSES_PROVIDER()
external
view
returns (IPoolAddressesProvider);
/**
* @notice Sets or replaces price sources of assets
* @param assets The addresses of the assets
* @param sources The addresses of the price sources
*/
function setAssetSources(
address[] calldata assets,
address[] calldata sources
) external;
/**
* @notice Sets the fallback oracle
* @param fallbackOracle The address of the fallback oracle
*/
function setFallbackOracle(address fallbackOracle) external;
/**
* @notice Returns a list of prices from a list of assets addresses
* @param assets The list of assets addresses
* @return The prices of the given assets
*/
function getAssetsPrices(
address[] calldata assets
) external view returns (uint256[] memory);
/**
* @notice Returns the address of the source for an asset address
* @param asset The address of the asset
* @return The address of the source
*/
function getSourceOfAsset(address asset) external view returns (address);
/**
* @notice Returns the address of the fallback oracle
* @return The address of the fallback oracle
*/
function getFallbackOracle() external view returns (address);
}// SPDX-License-Identifier: AGPL-3.0
/* ———————————————————————————————————————————————————————————————————————————————— *
* _____ ______ ______ __ __ __ __ ______ __ __ *
* /\ __-. /\__ _\ /\ == \ /\ \ /\ "-.\ \ /\ \ /\__ _\ /\ \_\ \ *
* \ \ \/\ \ \/_/\ \/ \ \ __< \ \ \ \ \ \-. \ \ \ \ \/_/\ \/ \ \____ \ *
* \ \____- \ \_\ \ \_\ \_\ \ \_\ \ \_\\"\_\ \ \_\ \ \_\ \/\_____\ *
* \/____/ \/_/ \/_/ /_/ \/_/ \/_/ \/_/ \/_/ \/_/ \/_____/ *
* *
* ————————————————————————————————— dtrinity.org ————————————————————————————————— *
* *
* ▲ *
* ▲ ▲ *
* *
* ———————————————————————————————————————————————————————————————————————————————— *
* dTRINITY Protocol: https://github.com/dtrinity *
* ———————————————————————————————————————————————————————————————————————————————— */
pragma solidity ^0.8.0;
/**
* @title IPoolAddressesProvider
* @author Aave
* @notice Defines the basic interface for a Pool Addresses Provider.
*/
interface IPoolAddressesProvider {
/**
* @dev Emitted when the market identifier is updated.
* @param oldMarketId The old id of the market
* @param newMarketId The new id of the market
*/
event MarketIdSet(string indexed oldMarketId, string indexed newMarketId);
/**
* @dev Emitted when the pool is updated.
* @param oldAddress The old address of the Pool
* @param newAddress The new address of the Pool
*/
event PoolUpdated(address indexed oldAddress, address indexed newAddress);
/**
* @dev Emitted when the pool configurator is updated.
* @param oldAddress The old address of the PoolConfigurator
* @param newAddress The new address of the PoolConfigurator
*/
event PoolConfiguratorUpdated(
address indexed oldAddress,
address indexed newAddress
);
/**
* @dev Emitted when the price oracle is updated.
* @param oldAddress The old address of the PriceOracle
* @param newAddress The new address of the PriceOracle
*/
event PriceOracleUpdated(
address indexed oldAddress,
address indexed newAddress
);
/**
* @dev Emitted when the ACL manager is updated.
* @param oldAddress The old address of the ACLManager
* @param newAddress The new address of the ACLManager
*/
event ACLManagerUpdated(
address indexed oldAddress,
address indexed newAddress
);
/**
* @dev Emitted when the ACL admin is updated.
* @param oldAddress The old address of the ACLAdmin
* @param newAddress The new address of the ACLAdmin
*/
event ACLAdminUpdated(
address indexed oldAddress,
address indexed newAddress
);
/**
* @dev Emitted when the price oracle sentinel is updated.
* @param oldAddress The old address of the PriceOracleSentinel
* @param newAddress The new address of the PriceOracleSentinel
*/
event PriceOracleSentinelUpdated(
address indexed oldAddress,
address indexed newAddress
);
/**
* @dev Emitted when the pool data provider is updated.
* @param oldAddress The old address of the PoolDataProvider
* @param newAddress The new address of the PoolDataProvider
*/
event PoolDataProviderUpdated(
address indexed oldAddress,
address indexed newAddress
);
/**
* @dev Emitted when a new proxy is created.
* @param id The identifier of the proxy
* @param proxyAddress The address of the created proxy contract
* @param implementationAddress The address of the implementation contract
*/
event ProxyCreated(
bytes32 indexed id,
address indexed proxyAddress,
address indexed implementationAddress
);
/**
* @dev Emitted when a new non-proxied contract address is registered.
* @param id The identifier of the contract
* @param oldAddress The address of the old contract
* @param newAddress The address of the new contract
*/
event AddressSet(
bytes32 indexed id,
address indexed oldAddress,
address indexed newAddress
);
/**
* @dev Emitted when the implementation of the proxy registered with id is updated
* @param id The identifier of the contract
* @param proxyAddress The address of the proxy contract
* @param oldImplementationAddress The address of the old implementation contract
* @param newImplementationAddress The address of the new implementation contract
*/
event AddressSetAsProxy(
bytes32 indexed id,
address indexed proxyAddress,
address oldImplementationAddress,
address indexed newImplementationAddress
);
/**
* @notice Returns the id of the Aave market to which this contract points to.
* @return The market id
*/
function getMarketId() external view returns (string memory);
/**
* @notice Associates an id with a specific PoolAddressesProvider.
* @dev This can be used to create an onchain registry of PoolAddressesProviders to
* identify and validate multiple Aave markets.
* @param newMarketId The market id
*/
function setMarketId(string calldata newMarketId) external;
/**
* @notice Returns an address by its identifier.
* @dev The returned address might be an EOA or a contract, potentially proxied
* @dev It returns ZERO if there is no registered address with the given id
* @param id The id
* @return The address of the registered for the specified id
*/
function getAddressFromID(bytes32 id) external view returns (address);
/**
* @notice General function to update the implementation of a proxy registered with
* certain `id`. If there is no proxy registered, it will instantiate one and
* set as implementation the `newImplementationAddress`.
* @dev IMPORTANT Use this function carefully, only for ids that don't have an explicit
* setter function, in order to avoid unexpected consequences
* @param id The id
* @param newImplementationAddress The address of the new implementation
*/
function setAddressAsProxy(
bytes32 id,
address newImplementationAddress
) external;
/**
* @notice Sets an address for an id replacing the address saved in the addresses map.
* @dev IMPORTANT Use this function carefully, as it will do a hard replacement
* @param id The id
* @param newAddress The address to set
*/
function setAddress(bytes32 id, address newAddress) external;
/**
* @notice Returns the address of the Pool proxy.
* @return The Pool proxy address
*/
function getPool() external view returns (address);
/**
* @notice Updates the implementation of the Pool, or creates a proxy
* setting the new `pool` implementation when the function is called for the first time.
* @param newPoolImpl The new Pool implementation
*/
function setPoolImpl(address newPoolImpl) external;
/**
* @notice Returns the address of the PoolConfigurator proxy.
* @return The PoolConfigurator proxy address
*/
function getPoolConfigurator() external view returns (address);
/**
* @notice Updates the implementation of the PoolConfigurator, or creates a proxy
* setting the new `PoolConfigurator` implementation when the function is called for the first time.
* @param newPoolConfiguratorImpl The new PoolConfigurator implementation
*/
function setPoolConfiguratorImpl(address newPoolConfiguratorImpl) external;
/**
* @notice Returns the address of the price oracle.
* @return The address of the PriceOracle
*/
function getPriceOracle() external view returns (address);
/**
* @notice Updates the address of the price oracle.
* @param newPriceOracle The address of the new PriceOracle
*/
function setPriceOracle(address newPriceOracle) external;
/**
* @notice Returns the address of the ACL manager.
* @return The address of the ACLManager
*/
function getACLManager() external view returns (address);
/**
* @notice Updates the address of the ACL manager.
* @param newAclManager The address of the new ACLManager
*/
function setACLManager(address newAclManager) external;
/**
* @notice Returns the address of the ACL admin.
* @return The address of the ACL admin
*/
function getACLAdmin() external view returns (address);
/**
* @notice Updates the address of the ACL admin.
* @param newAclAdmin The address of the new ACL admin
*/
function setACLAdmin(address newAclAdmin) external;
/**
* @notice Returns the address of the price oracle sentinel.
* @return The address of the PriceOracleSentinel
*/
function getPriceOracleSentinel() external view returns (address);
/**
* @notice Updates the address of the price oracle sentinel.
* @param newPriceOracleSentinel The address of the new PriceOracleSentinel
*/
function setPriceOracleSentinel(address newPriceOracleSentinel) external;
/**
* @notice Returns the address of the data provider.
* @return The address of the DataProvider
*/
function getPoolDataProvider() external view returns (address);
/**
* @notice Updates the address of the data provider.
* @param newDataProvider The address of the new DataProvider
*/
function setPoolDataProvider(address newDataProvider) external;
}// SPDX-License-Identifier: AGPL-3.0
/* ———————————————————————————————————————————————————————————————————————————————— *
* _____ ______ ______ __ __ __ __ ______ __ __ *
* /\ __-. /\__ _\ /\ == \ /\ \ /\ "-.\ \ /\ \ /\__ _\ /\ \_\ \ *
* \ \ \/\ \ \/_/\ \/ \ \ __< \ \ \ \ \ \-. \ \ \ \ \/_/\ \/ \ \____ \ *
* \ \____- \ \_\ \ \_\ \_\ \ \_\ \ \_\\"\_\ \ \_\ \ \_\ \/\_____\ *
* \/____/ \/_/ \/_/ /_/ \/_/ \/_/ \/_/ \/_/ \/_/ \/_____/ *
* *
* ————————————————————————————————— dtrinity.org ————————————————————————————————— *
* *
* ▲ *
* ▲ ▲ *
* *
* ———————————————————————————————————————————————————————————————————————————————— *
* dTRINITY Protocol: https://github.com/dtrinity *
* ———————————————————————————————————————————————————————————————————————————————— */
pragma solidity ^0.8.0;
/**
* @title IPriceOracleGetter
* @author Aave
* @notice Interface for the Aave price oracle.
*/
interface IPriceOracleGetter {
/**
* @notice Returns the base currency address
* @dev Address 0x0 is reserved for USD as base currency.
* @return Returns the base currency address.
*/
function BASE_CURRENCY() external view returns (address);
/**
* @notice Returns the base currency unit
* @dev 1 ether for ETH, 1e8 for USD.
* @return Returns the base currency unit.
*/
function BASE_CURRENCY_UNIT() external view returns (uint256);
/**
* @notice Returns the asset price in the base currency
* @param asset The address of the asset
* @return The price of the asset
*/
function getAssetPrice(address asset) external view returns (uint256);
}// SPDX-License-Identifier: AGPL-3.0
/* ———————————————————————————————————————————————————————————————————————————————— *
* _____ ______ ______ __ __ __ __ ______ __ __ *
* /\ __-. /\__ _\ /\ == \ /\ \ /\ "-.\ \ /\ \ /\__ _\ /\ \_\ \ *
* \ \ \/\ \ \/_/\ \/ \ \ __< \ \ \ \ \ \-. \ \ \ \ \/_/\ \/ \ \____ \ *
* \ \____- \ \_\ \ \_\ \_\ \ \_\ \ \_\\"\_\ \ \_\ \ \_\ \/\_____\ *
* \/____/ \/_/ \/_/ /_/ \/_/ \/_/ \/_/ \/_/ \/_/ \/_____/ *
* *
* ————————————————————————————————— dtrinity.org ————————————————————————————————— *
* *
* ▲ *
* ▲ ▲ *
* *
* ———————————————————————————————————————————————————————————————————————————————— *
* dTRINITY Protocol: https://github.com/dtrinity *
* ———————————————————————————————————————————————————————————————————————————————— */
pragma solidity ^0.8.10;
import {IAaveOracle} from "contracts/lending/core/interfaces/IAaveOracle.sol";
import {RewardsDataTypes} from "../libraries/RewardsDataTypes.sol";
import {ITransferStrategyBase} from "./ITransferStrategyBase.sol";
import {IRewardsController} from "./IRewardsController.sol";
/**
* @title IEmissionManager
* @author Aave
* @notice Defines the basic interface for the Emission Manager
*/
interface IEmissionManager {
/**
* @dev Emitted when the admin of a reward emission is updated.
* @param reward The address of the rewarding token
* @param oldAdmin The address of the old emission admin
* @param newAdmin The address of the new emission admin
*/
event EmissionAdminUpdated(
address indexed reward,
address indexed oldAdmin,
address indexed newAdmin
);
/**
* @dev Configure assets to incentivize with an emission of rewards per second until the end of distribution.
* @dev Only callable by the emission admin of the given rewards
* @param config The assets configuration input, the list of structs contains the following fields:
* uint104 emissionPerSecond: The emission per second following rewards unit decimals.
* uint256 totalSupply: The total supply of the asset to incentivize
* uint40 distributionEnd: The end of the distribution of the incentives for an asset
* address asset: The asset address to incentivize
* address reward: The reward token address
* ITransferStrategy transferStrategy: The TransferStrategy address with the install hook and claim logic.
* IEACAggregatorProxy rewardOracle: The Price Oracle of a reward to visualize the incentives at the UI Frontend.
* Must follow Chainlink Aggregator IEACAggregatorProxy interface to be compatible.
*/
function configureAssets(
RewardsDataTypes.RewardsConfigInput[] memory config
) external;
/**
* @dev Sets a TransferStrategy logic contract that determines the logic of the rewards transfer
* @dev Only callable by the emission admin of the given reward
* @param reward The address of the reward token
* @param transferStrategy The address of the TransferStrategy logic contract
*/
function setTransferStrategy(
address reward,
ITransferStrategyBase transferStrategy
) external;
/**
* @dev Sets an Aave Oracle contract to enforce rewards with a source of value.
* @dev Only callable by the emission admin of the given reward
* @notice At the moment of reward configuration, the Incentives Controller performs
* a check to see if the reward asset oracle is compatible with IAaveOracle interface.
* This check is enforced for integrators to be able to show incentives at
* the current Aave UI without the need to setup an external price registry
* @param reward The address of the reward to set the price aggregator
* @param rewardOracle The address of price aggregator that follows IAaveOracle interface
*/
function setRewardOracle(address reward, IAaveOracle rewardOracle) external;
/**
* @dev Sets the end date for the distribution
* @dev Only callable by the emission admin of the given reward
* @param asset The asset to incentivize
* @param reward The reward token that incentives the asset
* @param newDistributionEnd The end date of the incentivization, in unix time format
**/
function setDistributionEnd(
address asset,
address reward,
uint32 newDistributionEnd
) external;
/**
* @dev Sets the emission per second of a set of reward distributions
* @param asset The asset is being incentivized
* @param rewards List of reward addresses are being distributed
* @param newEmissionsPerSecond List of new reward emissions per second
*/
function setEmissionPerSecond(
address asset,
address[] calldata rewards,
uint88[] calldata newEmissionsPerSecond
) external;
/**
* @dev Whitelists an address to claim the rewards on behalf of another address
* @dev Only callable by the owner of the EmissionManager
* @param user The address of the user
* @param claimer The address of the claimer
*/
function setClaimer(address user, address claimer) external;
/**
* @dev Updates the admin of the reward emission
* @dev Only callable by the owner of the EmissionManager
* @param reward The address of the reward token
* @param admin The address of the new admin of the emission
*/
function setEmissionAdmin(address reward, address admin) external;
/**
* @dev Updates the address of the rewards controller
* @dev Only callable by the owner of the EmissionManager
* @param controller the address of the RewardsController contract
*/
function setRewardsController(address controller) external;
/**
* @dev Returns the rewards controller address
* @return The address of the RewardsController contract
*/
function getRewardsController() external view returns (IRewardsController);
/**
* @dev Returns the admin of the given reward emission
* @param reward The address of the reward token
* @return The address of the emission admin
*/
function getEmissionAdmin(address reward) external view returns (address);
/**
* @dev Recieve more fund from the user to existing reward
* @param reward The reward address is being distributed
* @param amount The token amount is being funded
*/
function depositReward(address reward, uint256 amount) external;
}// SPDX-License-Identifier: AGPL-3.0
/* ———————————————————————————————————————————————————————————————————————————————— *
* _____ ______ ______ __ __ __ __ ______ __ __ *
* /\ __-. /\__ _\ /\ == \ /\ \ /\ "-.\ \ /\ \ /\__ _\ /\ \_\ \ *
* \ \ \/\ \ \/_/\ \/ \ \ __< \ \ \ \ \ \-. \ \ \ \ \/_/\ \/ \ \____ \ *
* \ \____- \ \_\ \ \_\ \_\ \ \_\ \ \_\\"\_\ \ \_\ \ \_\ \/\_____\ *
* \/____/ \/_/ \/_/ /_/ \/_/ \/_/ \/_/ \/_/ \/_/ \/_____/ *
* *
* ————————————————————————————————— dtrinity.org ————————————————————————————————— *
* *
* ▲ *
* ▲ ▲ *
* *
* ———————————————————————————————————————————————————————————————————————————————— *
* dTRINITY Protocol: https://github.com/dtrinity *
* ———————————————————————————————————————————————————————————————————————————————— */
pragma solidity ^0.8.10;
import {IAaveOracle} from "contracts/lending/core/interfaces/IAaveOracle.sol";
import {IRewardsDistributor} from "./IRewardsDistributor.sol";
import {ITransferStrategyBase} from "./ITransferStrategyBase.sol";
import {RewardsDataTypes} from "../libraries/RewardsDataTypes.sol";
/**
* @title IRewardsController
* @author Aave
* @notice Defines the basic interface for a Rewards Controller.
*/
interface IRewardsController is IRewardsDistributor {
/**
* @dev Emitted when a new address is whitelisted as claimer of rewards on behalf of a user
* @param user The address of the user
* @param claimer The address of the claimer
*/
event ClaimerSet(address indexed user, address indexed claimer);
/**
* @dev Emitted when rewards are claimed
* @param user The address of the user rewards has been claimed on behalf of
* @param reward The address of the token reward is claimed
* @param to The address of the receiver of the rewards
* @param claimer The address of the claimer
* @param amount The amount of rewards claimed
*/
event RewardsClaimed(
address indexed user,
address indexed reward,
address indexed to,
address claimer,
uint256 amount
);
/**
* @dev Emitted when a transfer strategy is installed for the reward distribution
* @param reward The address of the token reward
* @param transferStrategy The address of TransferStrategy contract
*/
event TransferStrategyInstalled(
address indexed reward,
address indexed transferStrategy
);
/**
* @dev Emitted when the reward oracle is updated
* @param reward The address of the token reward
* @param rewardOracle The address of oracle
*/
event RewardOracleUpdated(
address indexed reward,
address indexed rewardOracle
);
/**
* @dev Whitelists an address to claim the rewards on behalf of another address
* @param user The address of the user
* @param claimer The address of the claimer
*/
function setClaimer(address user, address claimer) external;
/**
* @dev Sets a TransferStrategy logic contract that determines the logic of the rewards transfer
* @param reward The address of the reward token
* @param transferStrategy The address of the TransferStrategy logic contract
*/
function setTransferStrategy(
address reward,
ITransferStrategyBase transferStrategy
) external;
/**
* @dev Sets an Aave Oracle contract to enforce rewards with a source of value.
* @notice At the moment of reward configuration, the Incentives Controller performs
* a check to see if the reward asset oracle is compatible with IAaveOracle interface.
* This check is enforced for integrators to be able to show incentives at
* the current Aave UI without the need to setup an external price registry
* @param reward The address of the reward to set the price aggregator
* @param rewardOracle The address of price aggregator that follows IAaveOracle interface
*/
function setRewardOracle(address reward, IAaveOracle rewardOracle) external;
/**
* @dev Get the price aggregator oracle address
* @param reward The address of the reward
* @return The price oracle of the reward
*/
function getRewardOracle(address reward) external view returns (address);
/**
* @dev Returns the whitelisted claimer for a certain address (0x0 if not set)
* @param user The address of the user
* @return The claimer address
*/
function getClaimer(address user) external view returns (address);
/**
* @dev Returns the Transfer Strategy implementation contract address being used for a reward address
* @param reward The address of the reward
* @return The address of the TransferStrategy contract
*/
function getTransferStrategy(
address reward
) external view returns (address);
/**
* @dev Configure assets to incentivize with an emission of rewards per second until the end of distribution.
* @param config The assets configuration input, the list of structs contains the following fields:
* uint104 emissionPerSecond: The emission per second following rewards unit decimals.
* uint256 totalSupply: The total supply of the asset to incentivize
* uint40 distributionEnd: The end of the distribution of the incentives for an asset
* address asset: The asset address to incentivize
* address reward: The reward token address
* ITransferStrategy transferStrategy: The TransferStrategy address with the install hook and claim logic.
* IEACAggregatorProxy rewardOracle: The Price Oracle of a reward to visualize the incentives at the UI Frontend.
* Must follow Chainlink Aggregator IEACAggregatorProxy interface to be compatible.
*/
function configureAssets(
RewardsDataTypes.RewardsConfigInput[] memory config
) external;
/**
* @dev Called by the corresponding asset on transfer hook in order to update the rewards distribution.
* @dev The units of `totalSupply` and `userBalance` should be the same.
* @param user The address of the user whose asset balance has changed
* @param totalSupply The total supply of the asset prior to user balance change
* @param userBalance The previous user balance prior to balance change
**/
function handleAction(
address user,
uint256 totalSupply,
uint256 userBalance
) external;
/**
* @dev Claims reward for a user to the desired address, on all the assets of the pool, accumulating the pending rewards
* @param assets List of assets to check eligible distributions before claiming rewards
* @param amount The amount of rewards to claim
* @param to The address that will be receiving the rewards
* @param reward The address of the reward token
* @return The amount of rewards claimed
**/
function claimRewards(
address[] calldata assets,
uint256 amount,
address to,
address reward
) external returns (uint256);
/**
* @dev Claims reward for a user on behalf, on all the assets of the pool, accumulating the pending rewards. The
* caller must be whitelisted via "allowClaimOnBehalf" function by the RewardsAdmin role manager
* @param assets The list of assets to check eligible distributions before claiming rewards
* @param amount The amount of rewards to claim
* @param user The address to check and claim rewards
* @param to The address that will be receiving the rewards
* @param reward The address of the reward token
* @return The amount of rewards claimed
**/
function claimRewardsOnBehalf(
address[] calldata assets,
uint256 amount,
address user,
address to,
address reward
) external returns (uint256);
/**
* @dev Claims reward for msg.sender, on all the assets of the pool, accumulating the pending rewards
* @param assets The list of assets to check eligible distributions before claiming rewards
* @param amount The amount of rewards to claim
* @param reward The address of the reward token
* @return The amount of rewards claimed
**/
function claimRewardsToSelf(
address[] calldata assets,
uint256 amount,
address reward
) external returns (uint256);
/**
* @dev Claims all rewards for a user to the desired address, on all the assets of the pool, accumulating the pending rewards
* @param assets The list of assets to check eligible distributions before claiming rewards
* @param to The address that will be receiving the rewards
* @return rewardsList List of addresses of the reward tokens
* @return claimedAmounts List that contains the claimed amount per reward, following same order as "rewardList"
**/
function claimAllRewards(
address[] calldata assets,
address to
)
external
returns (address[] memory rewardsList, uint256[] memory claimedAmounts);
/**
* @dev Claims all rewards for a user on behalf, on all the assets of the pool, accumulating the pending rewards. The caller must
* be whitelisted via "allowClaimOnBehalf" function by the RewardsAdmin role manager
* @param assets The list of assets to check eligible distributions before claiming rewards
* @param user The address to check and claim rewards
* @param to The address that will be receiving the rewards
* @return rewardsList List of addresses of the reward tokens
* @return claimedAmounts List that contains the claimed amount per reward, following same order as "rewardsList"
**/
function claimAllRewardsOnBehalf(
address[] calldata assets,
address user,
address to
)
external
returns (address[] memory rewardsList, uint256[] memory claimedAmounts);
/**
* @dev Claims all reward for msg.sender, on all the assets of the pool, accumulating the pending rewards
* @param assets The list of assets to check eligible distributions before claiming rewards
* @return rewardsList List of addresses of the reward tokens
* @return claimedAmounts List that contains the claimed amount per reward, following same order as "rewardsList"
**/
function claimAllRewardsToSelf(
address[] calldata assets
)
external
returns (address[] memory rewardsList, uint256[] memory claimedAmounts);
/**
* @dev Recieve more fund from the user to existing reward
* @param reward The reward address is being distributed
* @param amount The token amount is being funded
* @param from The address of the one who funds the rewards
*/
function depositRewardFrom(
address reward,
uint256 amount,
address from
) external;
}// SPDX-License-Identifier: AGPL-3.0
/* ———————————————————————————————————————————————————————————————————————————————— *
* _____ ______ ______ __ __ __ __ ______ __ __ *
* /\ __-. /\__ _\ /\ == \ /\ \ /\ "-.\ \ /\ \ /\__ _\ /\ \_\ \ *
* \ \ \/\ \ \/_/\ \/ \ \ __< \ \ \ \ \ \-. \ \ \ \ \/_/\ \/ \ \____ \ *
* \ \____- \ \_\ \ \_\ \_\ \ \_\ \ \_\\"\_\ \ \_\ \ \_\ \/\_____\ *
* \/____/ \/_/ \/_/ /_/ \/_/ \/_/ \/_/ \/_/ \/_/ \/_____/ *
* *
* ————————————————————————————————— dtrinity.org ————————————————————————————————— *
* *
* ▲ *
* ▲ ▲ *
* *
* ———————————————————————————————————————————————————————————————————————————————— *
* dTRINITY Protocol: https://github.com/dtrinity *
* ———————————————————————————————————————————————————————————————————————————————— */
pragma solidity ^0.8.10;
/**
* @title IRewardsDistributor
* @author Aave
* @notice Defines the basic interface for a Rewards Distributor.
*/
interface IRewardsDistributor {
/**
* @dev Emitted when the configuration of the rewards of an asset is updated.
* @param asset The address of the incentivized asset
* @param reward The address of the reward token
* @param oldEmission The old emissions per second value of the reward distribution
* @param newEmission The new emissions per second value of the reward distribution
* @param oldDistributionEnd The old end timestamp of the reward distribution
* @param newDistributionEnd The new end timestamp of the reward distribution
* @param assetIndex The index of the asset distribution
*/
event AssetConfigUpdated(
address indexed asset,
address indexed reward,
uint256 oldEmission,
uint256 newEmission,
uint256 oldDistributionEnd,
uint256 newDistributionEnd,
uint256 assetIndex
);
/**
* @dev Emitted when rewards of an asset are accrued on behalf of a user.
* @param asset The address of the incentivized asset
* @param reward The address of the reward token
* @param user The address of the user that rewards are accrued on behalf of
* @param assetIndex The index of the asset distribution
* @param userIndex The index of the asset distribution on behalf of the user
* @param rewardsAccrued The amount of rewards accrued
*/
event Accrued(
address indexed asset,
address indexed reward,
address indexed user,
uint256 assetIndex,
uint256 userIndex,
uint256 rewardsAccrued
);
/**
* @dev Sets the end date for the distribution
* @param asset The asset to incentivize
* @param reward The reward token that incentives the asset
* @param newDistributionEnd The end date of the incentivization, in unix time format
**/
function setDistributionEnd(
address asset,
address reward,
uint32 newDistributionEnd
) external;
/**
* @dev Sets the emission per second of a set of reward distributions
* @param asset The asset is being incentivized
* @param rewards List of reward addresses are being distributed
* @param newEmissionsPerSecond List of new reward emissions per second
*/
function setEmissionPerSecond(
address asset,
address[] calldata rewards,
uint88[] calldata newEmissionsPerSecond
) external;
/**
* @dev Gets the end date for the distribution
* @param asset The incentivized asset
* @param reward The reward token of the incentivized asset
* @return The timestamp with the end of the distribution, in unix time format
**/
function getDistributionEnd(
address asset,
address reward
) external view returns (uint256);
/**
* @dev Returns the index of a user on a reward distribution
* @param user Address of the user
* @param asset The incentivized asset
* @param reward The reward token of the incentivized asset
* @return The current user asset index, not including new distributions
**/
function getUserAssetIndex(
address user,
address asset,
address reward
) external view returns (uint256);
/**
* @dev Returns the configuration of the distribution reward for a certain asset
* @param asset The incentivized asset
* @param reward The reward token of the incentivized asset
* @return The index of the asset distribution
* @return The emission per second of the reward distribution
* @return The timestamp of the last update of the index
* @return The timestamp of the distribution end
**/
function getRewardsData(
address asset,
address reward
) external view returns (uint256, uint256, uint256, uint256);
/**
* @dev Calculates the next value of an specific distribution index, with validations.
* @param asset The incentivized asset
* @param reward The reward token of the incentivized asset
* @return The old index of the asset distribution
* @return The new index of the asset distribution
**/
function getAssetIndex(
address asset,
address reward
) external view returns (uint256, uint256);
/**
* @dev Returns the list of available reward token addresses of an incentivized asset
* @param asset The incentivized asset
* @return List of rewards addresses of the input asset
**/
function getRewardsByAsset(
address asset
) external view returns (address[] memory);
/**
* @dev Returns the list of available reward addresses
* @return List of rewards supported in this contract
**/
function getRewardsList() external view returns (address[] memory);
/**
* @dev Returns the accrued rewards balance of a user, not including virtually accrued rewards since last distribution.
* @param user The address of the user
* @param reward The address of the reward token
* @return Unclaimed rewards, not including new distributions
**/
function getUserAccruedRewards(
address user,
address reward
) external view returns (uint256);
/**
* @dev Returns a single rewards balance of a user, including virtually accrued and unrealized claimable rewards.
* @param assets List of incentivized assets to check eligible distributions
* @param user The address of the user
* @param reward The address of the reward token
* @return The rewards amount
**/
function getUserRewards(
address[] calldata assets,
address user,
address reward
) external view returns (uint256);
/**
* @dev Returns a list all rewards of a user, including already accrued and unrealized claimable rewards
* @param assets List of incentivized assets to check eligible distributions
* @param user The address of the user
* @return The list of reward addresses
* @return The list of unclaimed amount of rewards
**/
function getAllUserRewards(
address[] calldata assets,
address user
) external view returns (address[] memory, uint256[] memory);
/**
* @dev Returns the decimals of an asset to calculate the distribution delta
* @param asset The address to retrieve decimals
* @return The decimals of an underlying asset
*/
function getAssetDecimals(address asset) external view returns (uint8);
/**
* @dev Returns the address of the emission manager
* @return The address of the EmissionManager
*/
function EMISSION_MANAGER() external view returns (address);
/**
* @dev Returns the address of the emission manager.
* Deprecated: This getter is maintained for compatibility purposes. Use the `EMISSION_MANAGER()` function instead.
* @return The address of the EmissionManager
*/
function getEmissionManager() external view returns (address);
}// SPDX-License-Identifier: AGPL-3.0
/* ———————————————————————————————————————————————————————————————————————————————— *
* _____ ______ ______ __ __ __ __ ______ __ __ *
* /\ __-. /\__ _\ /\ == \ /\ \ /\ "-.\ \ /\ \ /\__ _\ /\ \_\ \ *
* \ \ \/\ \ \/_/\ \/ \ \ __< \ \ \ \ \ \-. \ \ \ \ \/_/\ \/ \ \____ \ *
* \ \____- \ \_\ \ \_\ \_\ \ \_\ \ \_\\"\_\ \ \_\ \ \_\ \/\_____\ *
* \/____/ \/_/ \/_/ /_/ \/_/ \/_/ \/_/ \/_/ \/_/ \/_____/ *
* *
* ————————————————————————————————— dtrinity.org ————————————————————————————————— *
* *
* ▲ *
* ▲ ▲ *
* *
* ———————————————————————————————————————————————————————————————————————————————— *
* dTRINITY Protocol: https://github.com/dtrinity *
* ———————————————————————————————————————————————————————————————————————————————— */
pragma solidity ^0.8.10;
interface ITransferStrategyBase {
event EmergencyWithdrawal(
address indexed caller,
address indexed token,
address indexed to,
uint256 amount
);
/**
* @dev Perform custom transfer logic via delegate call from source contract to a TransferStrategy implementation
* @param to Account to transfer rewards
* @param reward Address of the reward token
* @param amount Amount to transfer to the "to" address parameter
* @return Returns true bool if transfer logic succeeds
*/
function performTransfer(
address to,
address reward,
uint256 amount
) external returns (bool);
/**
* @return Returns the address of the Incentives Controller
*/
function getIncentivesController() external view returns (address);
/**
* @return Returns the address of the Rewards admin
*/
function getRewardsAdmin() external view returns (address);
/**
* @dev Perform an emergency token withdrawal only callable by the Rewards admin
* @param token Address of the token to withdraw funds from this contract
* @param to Address of the recipient of the withdrawal
* @param amount Amount of the withdrawal
*/
function emergencyWithdrawal(
address token,
address to,
uint256 amount
) external;
}// SPDX-License-Identifier: AGPL-3.0
/* ———————————————————————————————————————————————————————————————————————————————— *
* _____ ______ ______ __ __ __ __ ______ __ __ *
* /\ __-. /\__ _\ /\ == \ /\ \ /\ "-.\ \ /\ \ /\__ _\ /\ \_\ \ *
* \ \ \/\ \ \/_/\ \/ \ \ __< \ \ \ \ \ \-. \ \ \ \ \/_/\ \/ \ \____ \ *
* \ \____- \ \_\ \ \_\ \_\ \ \_\ \ \_\\"\_\ \ \_\ \ \_\ \/\_____\ *
* \/____/ \/_/ \/_/ /_/ \/_/ \/_/ \/_/ \/_/ \/_/ \/_____/ *
* *
* ————————————————————————————————— dtrinity.org ————————————————————————————————— *
* *
* ▲ *
* ▲ ▲ *
* *
* ———————————————————————————————————————————————————————————————————————————————— *
* dTRINITY Protocol: https://github.com/dtrinity *
* ———————————————————————————————————————————————————————————————————————————————— */
pragma solidity ^0.8.10;
import {IAaveOracle} from "contracts/lending/core/interfaces/IAaveOracle.sol";
import {ITransferStrategyBase} from "../interfaces/ITransferStrategyBase.sol";
library RewardsDataTypes {
struct RewardsConfigInput {
uint88 emissionPerSecond;
uint256 totalSupply;
uint32 distributionEnd;
address asset;
address reward;
ITransferStrategyBase transferStrategy;
IAaveOracle rewardOracle;
}
struct UserAssetBalance {
address asset;
uint256 userBalance;
uint256 totalSupply;
}
struct UserData {
// Liquidity index of the reward distribution for the user
uint104 index;
// Amount of accrued rewards for the user since last user index update
uint128 accrued;
}
struct RewardData {
// Liquidity index of the reward distribution
uint104 index;
// Amount of reward tokens distributed per second
uint88 emissionPerSecond;
// Timestamp of the last reward index update
uint32 lastUpdateTimestamp;
// The end of the distribution of rewards (in seconds)
uint32 distributionEnd;
// Map of user addresses and their rewards data (userAddress => userData)
mapping(address => UserData) usersData;
}
struct AssetData {
// Map of reward token addresses and their data (rewardTokenAddress => rewardData)
mapping(address => RewardData) rewards;
// List of reward token addresses for the asset
mapping(uint128 => address) availableRewards;
// Count of reward tokens for the asset
uint128 availableRewardsCount;
// Number of decimals of the asset
uint8 decimals;
}
}{
"evmVersion": "paris",
"libraries": {},
"metadata": {
"bytecodeHash": "ipfs",
"useLiteralContent": true
},
"optimizer": {
"enabled": true,
"runs": 200
},
"remappings": [],
"viaIR": true,
"outputSelection": {
"*": {
"*": [
"evm.bytecode",
"evm.deployedBytecode",
"devdoc",
"userdoc",
"metadata",
"abi"
]
}
}
}Contract Security Audit
- No Contract Security Audit Submitted- Submit Audit Here
Contract ABI
API[{"inputs":[{"internalType":"address","name":"owner","type":"address"}],"stateMutability":"nonpayable","type":"constructor"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"reward","type":"address"},{"indexed":true,"internalType":"address","name":"oldAdmin","type":"address"},{"indexed":true,"internalType":"address","name":"newAdmin","type":"address"}],"name":"EmissionAdminUpdated","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"},{"inputs":[{"components":[{"internalType":"uint88","name":"emissionPerSecond","type":"uint88"},{"internalType":"uint256","name":"totalSupply","type":"uint256"},{"internalType":"uint32","name":"distributionEnd","type":"uint32"},{"internalType":"address","name":"asset","type":"address"},{"internalType":"address","name":"reward","type":"address"},{"internalType":"contract ITransferStrategyBase","name":"transferStrategy","type":"address"},{"internalType":"contract IAaveOracle","name":"rewardOracle","type":"address"}],"internalType":"struct RewardsDataTypes.RewardsConfigInput[]","name":"config","type":"tuple[]"}],"name":"configureAssets","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"reward","type":"address"},{"internalType":"uint256","name":"amount","type":"uint256"}],"name":"depositReward","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"reward","type":"address"}],"name":"getEmissionAdmin","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"getRewardsController","outputs":[{"internalType":"contract IRewardsController","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"owner","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"renounceOwnership","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"user","type":"address"},{"internalType":"address","name":"claimer","type":"address"}],"name":"setClaimer","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"asset","type":"address"},{"internalType":"address","name":"reward","type":"address"},{"internalType":"uint32","name":"newDistributionEnd","type":"uint32"}],"name":"setDistributionEnd","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"reward","type":"address"},{"internalType":"address","name":"admin","type":"address"}],"name":"setEmissionAdmin","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"asset","type":"address"},{"internalType":"address[]","name":"rewards","type":"address[]"},{"internalType":"uint88[]","name":"newEmissionsPerSecond","type":"uint88[]"}],"name":"setEmissionPerSecond","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"reward","type":"address"},{"internalType":"contract IAaveOracle","name":"rewardOracle","type":"address"}],"name":"setRewardOracle","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"controller","type":"address"}],"name":"setRewardsController","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"reward","type":"address"},{"internalType":"contract ITransferStrategyBase","name":"transferStrategy","type":"address"}],"name":"setTransferStrategy","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"newOwner","type":"address"}],"name":"transferOwnership","outputs":[],"stateMutability":"nonpayable","type":"function"}]Contract Creation Code
60803461010157601f610cf438819003918201601f19168301916001600160401b038311848410176101065780849260209460405283398101031261010157516001600160a01b0381169081900361010157600080547f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e092906001600160a01b0319908116903384868180a382156100ad57826040519533908680a3331617179055610bd7908161011d8239f35b60405162461bcd60e51b815260206004820152602660248201527f4f776e61626c653a206e6577206f776e657220697320746865207a65726f206160448201526564647265737360d01b6064820152608490fd5b600080fd5b634e487b7160e01b600052604160045260246000fdfe608060409080825260048036101561001657600080fd5b60009160e08335811c918263529b1e8714610a29575081635453ba1014610996578163715018a61461093a5781637db4e28f146108925781638da5cb5b1461086a578163955c2ad7146105e857508063a286c6b414610562578063bee36bb314610513578063c5a7b53814610468578063de2627381461043f578063e15ac623146103ba578063f2fde38b146102f2578063f5cf673b146102705763f996868b146100c057600080fd5b3461026c5760031992606036850112610268576100db610a61565b9367ffffffffffffffff90602435828111610264576100fd9036908601610ae3565b92604435908111610260576101159036908701610ae3565b929093875b81811061022057506002546001600160a01b03908116998a3b1561021c57875163f996868b60e01b8152908216988101989098526060602489015260648801829052608488019493919089905b8282106101f6575050505085830301604486015280825260208092019291865b8281106101c95750505050828495818681819503925af19081156101c057506101ad5750f35b6101b690610aa1565b6101bd5780f35b80fd5b513d84823e3d90fd5b9091929382806001926affffffffffffffffffffff6101e789610acb565b16815201950193929101610187565b90919294956001908261020888610a8d565b168152602090810197960193920190610167565b8980fd5b6001600160a01b03600582901b8501358181169081900361025c5760019291610256918c528360205233908a8d20541614610b14565b0161011a565b8a80fd5b8680fd5b8580fd5b8280fd5b5080fd5b508192346102ee57806003193601126102ee5761028b610a61565b610293610a77565b845490916001600160a01b03916102ad9083163314610b56565b816002541690813b1561026057866044928482968851998a97889663f5cf673b60e01b885216908601521660248401525af19081156101c057506101ad5750f35b5050fd5b508290346102685760203660031901126102685761030e610a61565b8354916001600160a01b0380841692610328338514610b56565b1693841561036857505082907f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e08580a36001600160a01b03191617815580f35b906020608492519162461bcd60e51b8352820152602660248201527f4f776e61626c653a206e6577206f776e657220697320746865207a65726f206160448201526564647265737360d01b6064820152fd5b508192346102ee57806003193601126102ee576103d5610a61565b6103dd610a77565b9260018060a01b038092169081865260016020526104018385882054163314610b14565b826002541690813b15610260578660449281958751988996879563e15ac62360e01b87528601521660248401525af19081156101c057506101ad5750f35b82843461026c578160031936011261026c5760025490516001600160a01b039091168152602090f35b5082903461026857606036600319011261026857610484610a61565b9161048d610a77565b926044359363ffffffff851680950361050e57859460018060a01b038092169283875260016020526104c58386892054163314610b14565b826002541693843b1561050a57879460649386928851998a9788966318b4f6a760e31b88521690860152602485015260448401525af19081156101c057506101ad5750f35b8780fd5b600080fd5b82346101bd5760203660031901126101bd5761052d610a61565b81546001600160a01b0391906105469083163314610b56565b166bffffffffffffffffffffffff60a01b600254161760025580f35b82843461026c578060031936011261026c5761057c610a61565b90610585610a77565b9160018060a01b03809161059d828754163314610b56565b16808552600160205291842080546001600160a01b0319811694831694851790915516907fda40ea421dd7e42cf8be71255facac4fdc12a3f70f4d5fd373cb16cec4cb53848480a480f35b8491503461086657602090816003193601126108625783359067ffffffffffffffff9081831161026057366023840112156102605760248684013583811161085057600594875194601f19603f8460051b011686018681108282111761083c57895282865287860190848683950284010192368411610838578501915b83831061078c5750505050885b84518110156106b25780861b8501870151608001516001600160a01b039081168b526001808952898c20549092916106ac91163314610b14565b01610672565b506002546001600160a01b03948a94899392871692918b918a91853b1561078857828794939294519863955c2ad760e01b8a528901938901525180925260448701939288905b83821061071c5789808a8a8282808c0381838f5af19081156101c057506101ad5750f35b845180516affffffffffffffffffffff16875280840151878501528881015163ffffffff16898801526060808201518d16908801526080808201518d169088015260a0808201518d169088015260c0908101518c169087015294850194938201936001909101906106f8565b8880fd5b8683360312610838578a519087820182811084821117610824578c526107b184610acb565b82528a8401358b8301528b8401359063ffffffff8216820361050e57828c928e8b95015260606107e2818801610a8d565b9082015260806107f3818801610a8d565b9082015260a0610804818801610a8d565b9082015260c0610815818801610a8d565b90820152815201920191610665565b8760418f634e487b7160e01b600052526000fd5b8c80fd5b8460418c634e487b7160e01b600052526000fd5b50634e487b7160e01b88526041875287fd5b8480fd5b8380fd5b83853461026c578160031936011261026c57905490516001600160a01b039091168152602090f35b50503461026c578260031936011261026c576108ac610a61565b92602435801561090957600254939485946001600160a01b039190821690813b15610260578660649281958751988996879563618825d360e01b8752169085015260248401523360448401525af19081156101c057506101ad5750f35b815162461bcd60e51b8152602081850152600b60248201526a16915493d7d05353d5539560aa1b6044820152606490fd5b83346101bd57806003193601126101bd578054816001600160a01b038216610963338214610b56565b7f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e08280a36001600160a01b031916815580f35b50508234610268578060031936011261026857826109b2610a61565b926109bb610a77565b9360018060a01b038091169182845260016020526109df8286862054163314610b14565b816002541691823b15610862576044928591875198899687956305453ba160e41b87528601521660248401525af19081156101c05750610a1d575080f35b610a2690610aa1565b80f35b84908634610268576020366003190112610268576020926001600160a01b03919082610a53610a61565b168152600185522054168152f35b600435906001600160a01b038216820361050e57565b602435906001600160a01b038216820361050e57565b35906001600160a01b038216820361050e57565b67ffffffffffffffff8111610ab557604052565b634e487b7160e01b600052604160045260246000fd5b35906affffffffffffffffffffff8216820361050e57565b9181601f8401121561050e5782359167ffffffffffffffff831161050e576020808501948460051b01011161050e57565b15610b1b57565b60405162461bcd60e51b815260206004820152601360248201527227a7262cafa2a6a4a9a9a4a7a72fa0a226a4a760691b6044820152606490fd5b15610b5d57565b606460405162461bcd60e51b815260206004820152602060248201527f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e65726044820152fdfea2646970667358221220d373005e6b16afa60d6229f1cd6a1eda3fd003cb97e38a5c5af8af6f1f3b774e64736f6c634300081800330000000000000000000000000f5e3d9aee7ab5fda909af1ef147d98a7f4b3022
Deployed Bytecode
0x608060409080825260048036101561001657600080fd5b60009160e08335811c918263529b1e8714610a29575081635453ba1014610996578163715018a61461093a5781637db4e28f146108925781638da5cb5b1461086a578163955c2ad7146105e857508063a286c6b414610562578063bee36bb314610513578063c5a7b53814610468578063de2627381461043f578063e15ac623146103ba578063f2fde38b146102f2578063f5cf673b146102705763f996868b146100c057600080fd5b3461026c5760031992606036850112610268576100db610a61565b9367ffffffffffffffff90602435828111610264576100fd9036908601610ae3565b92604435908111610260576101159036908701610ae3565b929093875b81811061022057506002546001600160a01b03908116998a3b1561021c57875163f996868b60e01b8152908216988101989098526060602489015260648801829052608488019493919089905b8282106101f6575050505085830301604486015280825260208092019291865b8281106101c95750505050828495818681819503925af19081156101c057506101ad5750f35b6101b690610aa1565b6101bd5780f35b80fd5b513d84823e3d90fd5b9091929382806001926affffffffffffffffffffff6101e789610acb565b16815201950193929101610187565b90919294956001908261020888610a8d565b168152602090810197960193920190610167565b8980fd5b6001600160a01b03600582901b8501358181169081900361025c5760019291610256918c528360205233908a8d20541614610b14565b0161011a565b8a80fd5b8680fd5b8580fd5b8280fd5b5080fd5b508192346102ee57806003193601126102ee5761028b610a61565b610293610a77565b845490916001600160a01b03916102ad9083163314610b56565b816002541690813b1561026057866044928482968851998a97889663f5cf673b60e01b885216908601521660248401525af19081156101c057506101ad5750f35b5050fd5b508290346102685760203660031901126102685761030e610a61565b8354916001600160a01b0380841692610328338514610b56565b1693841561036857505082907f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e08580a36001600160a01b03191617815580f35b906020608492519162461bcd60e51b8352820152602660248201527f4f776e61626c653a206e6577206f776e657220697320746865207a65726f206160448201526564647265737360d01b6064820152fd5b508192346102ee57806003193601126102ee576103d5610a61565b6103dd610a77565b9260018060a01b038092169081865260016020526104018385882054163314610b14565b826002541690813b15610260578660449281958751988996879563e15ac62360e01b87528601521660248401525af19081156101c057506101ad5750f35b82843461026c578160031936011261026c5760025490516001600160a01b039091168152602090f35b5082903461026857606036600319011261026857610484610a61565b9161048d610a77565b926044359363ffffffff851680950361050e57859460018060a01b038092169283875260016020526104c58386892054163314610b14565b826002541693843b1561050a57879460649386928851998a9788966318b4f6a760e31b88521690860152602485015260448401525af19081156101c057506101ad5750f35b8780fd5b600080fd5b82346101bd5760203660031901126101bd5761052d610a61565b81546001600160a01b0391906105469083163314610b56565b166bffffffffffffffffffffffff60a01b600254161760025580f35b82843461026c578060031936011261026c5761057c610a61565b90610585610a77565b9160018060a01b03809161059d828754163314610b56565b16808552600160205291842080546001600160a01b0319811694831694851790915516907fda40ea421dd7e42cf8be71255facac4fdc12a3f70f4d5fd373cb16cec4cb53848480a480f35b8491503461086657602090816003193601126108625783359067ffffffffffffffff9081831161026057366023840112156102605760248684013583811161085057600594875194601f19603f8460051b011686018681108282111761083c57895282865287860190848683950284010192368411610838578501915b83831061078c5750505050885b84518110156106b25780861b8501870151608001516001600160a01b039081168b526001808952898c20549092916106ac91163314610b14565b01610672565b506002546001600160a01b03948a94899392871692918b918a91853b1561078857828794939294519863955c2ad760e01b8a528901938901525180925260448701939288905b83821061071c5789808a8a8282808c0381838f5af19081156101c057506101ad5750f35b845180516affffffffffffffffffffff16875280840151878501528881015163ffffffff16898801526060808201518d16908801526080808201518d169088015260a0808201518d169088015260c0908101518c169087015294850194938201936001909101906106f8565b8880fd5b8683360312610838578a519087820182811084821117610824578c526107b184610acb565b82528a8401358b8301528b8401359063ffffffff8216820361050e57828c928e8b95015260606107e2818801610a8d565b9082015260806107f3818801610a8d565b9082015260a0610804818801610a8d565b9082015260c0610815818801610a8d565b90820152815201920191610665565b8760418f634e487b7160e01b600052526000fd5b8c80fd5b8460418c634e487b7160e01b600052526000fd5b50634e487b7160e01b88526041875287fd5b8480fd5b8380fd5b83853461026c578160031936011261026c57905490516001600160a01b039091168152602090f35b50503461026c578260031936011261026c576108ac610a61565b92602435801561090957600254939485946001600160a01b039190821690813b15610260578660649281958751988996879563618825d360e01b8752169085015260248401523360448401525af19081156101c057506101ad5750f35b815162461bcd60e51b8152602081850152600b60248201526a16915493d7d05353d5539560aa1b6044820152606490fd5b83346101bd57806003193601126101bd578054816001600160a01b038216610963338214610b56565b7f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e08280a36001600160a01b031916815580f35b50508234610268578060031936011261026857826109b2610a61565b926109bb610a77565b9360018060a01b038091169182845260016020526109df8286862054163314610b14565b816002541691823b15610862576044928591875198899687956305453ba160e41b87528601521660248401525af19081156101c05750610a1d575080f35b610a2690610aa1565b80f35b84908634610268576020366003190112610268576020926001600160a01b03919082610a53610a61565b168152600185522054168152f35b600435906001600160a01b038216820361050e57565b602435906001600160a01b038216820361050e57565b35906001600160a01b038216820361050e57565b67ffffffffffffffff8111610ab557604052565b634e487b7160e01b600052604160045260246000fd5b35906affffffffffffffffffffff8216820361050e57565b9181601f8401121561050e5782359167ffffffffffffffff831161050e576020808501948460051b01011161050e57565b15610b1b57565b60405162461bcd60e51b815260206004820152601360248201527227a7262cafa2a6a4a9a9a4a7a72fa0a226a4a760691b6044820152606490fd5b15610b5d57565b606460405162461bcd60e51b815260206004820152602060248201527f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e65726044820152fdfea2646970667358221220d373005e6b16afa60d6229f1cd6a1eda3fd003cb97e38a5c5af8af6f1f3b774e64736f6c63430008180033
Constructor Arguments (ABI-Encoded and is the last bytes of the Contract Creation Code above)
0000000000000000000000000f5e3d9aee7ab5fda909af1ef147d98a7f4b3022
-----Decoded View---------------
Arg [0] : owner (address): 0x0f5e3D9AEe7Ab5fDa909Af1ef147D98a7f4B3022
-----Encoded View---------------
1 Constructor Arguments found :
Arg [0] : 0000000000000000000000000f5e3d9aee7ab5fda909af1ef147d98a7f4b3022
Loading...
Loading
Loading...
Loading
Loading...
Loading
Net Worth in USD
$0.00
Net Worth in FRAX
0
Multichain Portfolio | 35 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.