Address Contract Verified
Address
0x0a3476c1EA4eF65416016876c67E1a14E3575D73
Balance
0 ETH
Nonce
1
Code Size
6505 bytes
Creator
0x6Ce7c64f...aFE6 at tx 0x79b30e50...0ed30c
Indexed Transactions
0
Contract Bytecode
6505 bytes
0x608060408181526004918236101561001657600080fd5b600092833560e01c918263081e3eda14611188575081630fb9e1ae14610f735781631069f3b514610ef0578163108c849214610c735781632f380b3514610bc75781632f4350c214610a375781633c66201f146109bf5781633fa4be7f146106d7578163530354ec146106af5781635b35f9c9146106875781635be863d514610627578163715018a6146105b35781637453bdbb146105345781638da5cb5b1461050e5781638dbb1e3a146104ec578163ab3c7e52146104cd578163cfc0d02414610429578163d08db5e814610401578163db006a75146102d7578163ec8a022414610274578163f2fde38b14610182575063fa8f5a161461011757600080fd5b3461017e576020908160031936011261017a579161013b6101366111d5565b61159f565b9083519383808695860192818752855180945286019401925b82811061016357505050500390f35b835185528695509381019392810192600101610154565b8280fd5b5080fd5b90503461017a57602060031936011261017a5761019d6111d5565b906101a66112ee565b6001600160a01b0380921692831561020b5750508254827fffffffffffffffffffffffff00000000000000000000000000000000000000008216178455167f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e08380a380f35b906020608492519162461bcd60e51b8352820152602660248201527f4f776e61626c653a206e6577206f776e657220697320746865207a65726f206160448201527f64647265737300000000000000000000000000000000000000000000000000006064820152fd5b90503461017a578160031936011261017a576008906102916111bf565b9061029a6112ee565b803585526020526001600160a01b03838520916102c060ff600785015460a01c1661136b565b168452016020528120600160ff1982541617905580f35b9190503461017a57602091826003193601126103fd57803592838552818152828520926005825280862033875282528086209261031e600285019582875491015490611592565b421115610396575061033033866113ed565b938415159061033e8261163d565b429055610349578580f35b60017fe5b754fb1abb7f01b499791d0b820ae3b6af3424ac1c59768edb53f4ec31a9299301610379858254611592565b9055610386843387611688565b519283523392a338808080808580f35b82608492519162461bcd60e51b8352820152602160248201527f646f65736e2774206d6565742074686520636c61696d2074696d65206c696d6960448201527f74000000000000000000000000000000000000000000000000000000000000006064820152fd5b8380fd5b50503461017e578160031936011261017e576020906001600160a01b03600154169051908152f35b90503461017a57602060031936011261017a576001600160a01b0361044c6111d5565b6104546112ee565b1691821561048a5750507fffffffffffffffffffffffff0000000000000000000000000000000000000000600254161760025580f35b906020606492519162461bcd60e51b8352820152601e60248201527f696e76616c696420726577617264732077616c6c6574206164647265737300006044820152fd5b50503461017e578160031936011261017e576020906003549051908152f35b50503461017e57602090610507610502366111a4565b6113e0565b9051908152f35b50503461017e578160031936011261017e576001600160a01b0360209254169051908152f35b9190503461017a5761054536611258565b939061054f6112ee565b8152602092835281812061056c60ff600783015460a01c1661136b565b600801815b85518110156105af57806001600160a01b036105906105aa93896113b6565b51168452828652848420600160ff19825416179055611346565b610571565b8280f35b83346106245780600319360112610624576105cc6112ee565b806001600160a01b0381547fffffffffffffffffffffffff000000000000000000000000000000000000000081168355167f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e08280a380f35b80fd5b90503461017a578160031936011261017a576008906106446111bf565b9061064d6112ee565b803585526020526001600160a01b038385209161067360ff600785015460a01c1661136b565b16845201602052812060ff19815416905580f35b50503461017e578160031936011261017e576020906001600160a01b03600254169051908152f35b828434610624578160031936011261062457506105076020926106d06111bf565b90356113ed565b83833461017e5761014060031936011261017e57823592604435916001600160a01b03928381168091036109bb576064359260a4359060e435928315158094036109b757610104359687168097036109b75761012435958615158097036109b3576107406112ee565b8915998a156109ae5750610755600354611346565b806003555b89526020838152868a2096908b158c816109a1575b1561095f578c610956575b156108ee57610dac861161088757600798999a9b61087d575b60098801908c83600a8b0191825481528484522080548603610851575b50505050505060018501907fffffffffffffffffffffffff000000000000000000000000000000000000000082541617905560843590840155600583015560c4356006830155600382019060ff60ff19835416911617905501917fffffffffffffffffffffff00000000000000000000000000000000000000000074ff000000000000000000000000000000000000000084549360a01b1692161717905580f35b6002429101556108618154611346565b8091558d52528a209081556001429101558980808080806107b0565b6024358855610793565b8490608492519162461bcd60e51b83528201526024808201527f70656e616c7479206665652063616e206e6f74206265206d6f7265207468616e60448201527f20333525000000000000000000000000000000000000000000000000000000006064820152fd5b8490608492519162461bcd60e51b8352820152603560248201527f4150592073686f756c6420626520626967676572207468616e207a65726f207760448201527f68656e20616464696e672061206e657720706f6f6c00000000000000000000006064820152fd5b5082151561077a565b6064868385519162461bcd60e51b8352820152601060248201527f706964206973206e6f74206578697374000000000000000000000000000000006044820152fd5b50600a890154151561076f565b61075a565b8880fd5b8780fd5b8480fd5b9190503461017a576109d036611258565b93906109da6112ee565b815260209283528181206109f760ff600783015460a01c1661136b565b600801815b85518110156105af57806001600160a01b03610a1b610a3293896113b6565b5116845282865284842060ff198154169055611346565b6109fc565b90508234610624578060031936011261062457610a533361159f565b90809381945b8351861015610a8657610a7a610a8091610a7388876113b6565b5190611592565b95611346565b94610a59565b610a928591151561163d565b60019081805b610aa0578480f35b6003548111610bc357808552602082815284862090600581528587203388528152858720906002820192610ada8454874293015490611592565b1015610b5b5792610b089281928795610af333856113ed565b924290558683610b0e575b5050505050611346565b90610a98565b7fe5b754fb1abb7f01b499791d0b820ae3b6af3424ac1c59768edb53f4ec31a9299201610b3c848254611592565b9055610b49833386611688565b89519283523392a38088808086610afe565b8460849188519162461bcd60e51b8352820152602160248201527f646f65736e2774206d6565742074686520636c61696d2074696d65206c696d6960448201527f74000000000000000000000000000000000000000000000000000000000000006064820152fd5b8480f35b90503461017a57602060031936011261017a57806101409360ff92358152816020528381208054946007820154936001600160a01b0391808360018601541695600a8601548152600986016020522054600285015491886003870154169386015494600660058801549701549782519b8c5260208c01528816908a015260608901526080880152151560a087015260c086015260e085015261010084015260a01c161515610120820152f35b90503461017a57610c83366111a4565b91909283855260209180835281862090600584528287203388528452828720908254421115610eae5760ff60038401541615610e6c5760ff600784015460a01c16158015610e51575b15610e0f578486610d37928454610dd7575b60015487517f23b872dd000000000000000000000000000000000000000000000000000000008152339281019283523060208401526040830193909352919384926001600160a01b03169183918d918391606090910190565b03925af18015610dcd57917f90890809c654f11d6e72a28fa60149770a0d11ec6c92319d6ceb2bb0a4ea1a1595949391600293610da0575b50610d7b878254611592565b8155428382015560034291015501610d94858254611592565b9055519283523392a380f35b610dbf90863d8811610dc6575b610db7818361121d565b810190611625565b5038610d6f565b503d610dad565b84513d8a823e3d90fd5b610de1338b6113ed565b80610ded575b50610cde565b610df881338d611688565b610e0760018701918254611592565b905538610de7565b6064908585519162461bcd60e51b8352820152600f60248201527f6e6f7420766970206164647265737300000000000000000000000000000000006044820152fd5b50338852600883018552600160ff858a205416151514610ccc565b6064908585519162461bcd60e51b8352820152600f60248201527f706f6f6c206e6f742061637469766500000000000000000000000000000000006044820152fd5b6064908585519162461bcd60e51b8352820152601960248201527f6d696e696e67206973206e6f74207374617274656420796574000000000000006044820152fd5b90503461017a578160031936011261017a5781608093606092610f116111bf565b9035825260056020526001600160a01b038383209116825260205220825192610f39846111eb565b8154938481526001830154908160208201526003600285015494858584015201549485910152815194855260208501528301526060820152f35b90503461017a57610f83366111a4565b91909283855260209180835281862090600584528287203388528452828720610fac33886113ed565b80611166575b50876003820192610fc98454600687015490611592565b4210611131575b6001600160a01b03806001541691610fe8848b6113e0565b92898d8a5192838092816110397fa9059cbb000000000000000000000000000000000000000000000000000000009a8b8352338a8401602090939291936001600160a01b0360408201951681520152565b03925af1801561112757908a9493929161110a575b508c82600154169260078a015416936110888b519788968795869485528401602090939291936001600160a01b0360408201951681520152565b03925af180156111005791600293917ff279e6a1f5e320cca91135676d9cb6e44ca8a08c0b88342bcdb1144f6511b568979695936110e3575b506110cd8882546113e0565b8155834291015542905501610d948582546113e0565b6110f990873d8911610dc657610db7818361121d565b50386110c1565b85513d8b823e3d90fd5b61112090853d8711610dc657610db7818361121d565b503861104e565b89513d8f823e3d90fd5b9050600584015480880290888204148815171561115357612710900490610fd0565b60248a601184634e487b7160e01b835252fd5b61117181338a611688565b61118060018301918254611592565b905538610fb2565b84903461017e578160031936011261017e576020906003548152f35b60031960409101126111ba576004359060243590565b600080fd5b602435906001600160a01b03821682036111ba57565b600435906001600160a01b03821682036111ba57565b6080810190811067ffffffffffffffff82111761120757604052565b634e487b7160e01b600052604160045260246000fd5b90601f601f19910116810190811067ffffffffffffffff82111761120757604052565b67ffffffffffffffff81116112075760051b60200190565b9060406003198301126111ba576004359160243567ffffffffffffffff81116111ba57816023820112156111ba5780600401359161129583611240565b926112a3604051948561121d565b80845260209260248486019260051b8201019283116111ba57602401905b8282106112cf575050505090565b81356001600160a01b03811681036111ba5781529083019083016112c1565b6001600160a01b0360005416330361130257565b606460405162461bcd60e51b815260206004820152602060248201527f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e65726044820152fd5b60001981146113555760010190565b634e487b7160e01b600052601160045260246000fd5b1561137257565b606460405162461bcd60e51b815260206004820152600c60248201527f6e6f742076697020706f6f6c00000000000000000000000000000000000000006044820152fd5b80518210156113ca5760209160051b010190565b634e487b7160e01b600052603260045260246000fd5b9190820391821161135557565b90600990600092835260049260209380855260409485832093600582526001600160a01b038785209116845281528583209580519061142b826111eb565b87548252600195868901548484015260029860038a82015491848601928352015460608501528699600a830154998a9301925b611470575b5050505050505050505090565b909192939495969798998a8952838752848920828101549081151590818092611587575b61157e57805415611575578551908d01548082111561156d5750915b429180611564575b61155c575b508082101561155457906114d0916113e0565b8b8a52848852858a2054908181029181830414901517156115415786519081810291818304149015171561154157906127106301e1338061151393040490611592565b995b801561152e57600019019897969594939291908961145e565b60248960118a634e487b7160e01b835252fd5b60248a60118b634e487b7160e01b835252fd5b505099611515565b9050386114bd565b508082116114b8565b9050916114b0565b50505099611515565b50505099611463565b508286511015611494565b9190820180921161135557565b6003546115ab81611240565b916115b9604051938461121d565b818352601f196115c883611240565b0136602085013760015b828111156115e05750505090565b6115ea82826113ed565b906000198101918183116116105761160561160b93876113b6565b52611346565b6115d2565b60246000634e487b7160e01b81526011600452fd5b908160209103126111ba575180151581036111ba5790565b1561164457565b606460405162461bcd60e51b815260206004820152601260248201527f6e6f2070656e64696e67207265776172647300000000000000000000000000006044820152fd5b60009081526004602090815260408083206001015460025482517f23b872dd000000000000000000000000000000000000000000000000000000008186019081526001600160a01b0392831660248301529682166044820152606480820198909852968752959695929491939192601f19911661170660848961121d565b8451938585019867ffffffffffffffff998681108b82111761184f5787528786527f5361666545524332303a206c6f772d6c6576656c2063616c6c206661696c65648689015251849182919082855af1913d1561183c573d9889116118285786979861177f879861178d985193601f840116018361121d565b81528093883d92013e611863565b805190838215928315611810575b505050156117a7575050565b60849250519062461bcd60e51b82526004820152602a60248201527f5361666545524332303a204552433230206f7065726174696f6e20646964206e60448201527f6f742073756363656564000000000000000000000000000000000000000000006064820152fd5b6118209350820181019101611625565b38838161179b565b602484634e487b7160e01b81526041600452fd5b50915061178d9394959650606091611863565b602486634e487b7160e01b81526041600452fd5b919290156118c45750815115611877575090565b3b156118805790565b606460405162461bcd60e51b815260206004820152601d60248201527f416464726573733a2063616c6c20746f206e6f6e2d636f6e74726163740000006044820152fd5b8251909150156118d75750805190602001fd5b6040519062461bcd60e51b825281602080600483015282519283602484015260005b84811061191c57505050601f19601f836000604480968601015201168101030190fd5b8181018301518682016044015285935082016118f956fea2646970667358221220ebb2baab1422ce80be36f09b2ca262dda7e8a00e6b683f25e8f75260ec5bff7764736f6c63430008130033
Verified Source Code Full Match
Compiler: v0.8.19+commit.7dd6d404
EVM: paris
Optimization: Yes (4000 runs)
Address.sol 244 lines
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v4.9.0) (utils/Address.sol)
pragma solidity ^0.8.1;
/**
* @dev Collection of functions related to the address type
*/
library Address {
/**
* @dev Returns true if `account` is a contract.
*
* [IMPORTANT]
* ====
* It is unsafe to assume that an address for which this function returns
* false is an externally-owned account (EOA) and not a contract.
*
* Among others, `isContract` will return false for the following
* types of addresses:
*
* - an externally-owned account
* - a contract in construction
* - an address where a contract will be created
* - an address where a contract lived, but was destroyed
*
* Furthermore, `isContract` will also return true if the target contract within
* the same transaction is already scheduled for destruction by `SELFDESTRUCT`,
* which only has an effect at the end of a transaction.
* ====
*
* [IMPORTANT]
* ====
* You shouldn't rely on `isContract` to protect against flash loan attacks!
*
* Preventing calls from contracts is highly discouraged. It breaks composability, breaks support for smart wallets
* like Gnosis Safe, and does not provide security since it can be circumvented by calling from a contract
* constructor.
* ====
*/
function isContract(address account) internal view returns (bool) {
// This method relies on extcodesize/address.code.length, which returns 0
// for contracts in construction, since the code is only stored at the end
// of the constructor execution.
return account.code.length > 0;
}
/**
* @dev Replacement for Solidity's `transfer`: sends `amount` wei to
* `recipient`, forwarding all available gas and reverting on errors.
*
* https://eips.ethereum.org/EIPS/eip-1884[EIP1884] increases the gas cost
* of certain opcodes, possibly making contracts go over the 2300 gas limit
* imposed by `transfer`, making them unable to receive funds via
* `transfer`. {sendValue} removes this limitation.
*
* https://consensys.net/diligence/blog/2019/09/stop-using-soliditys-transfer-now/[Learn more].
*
* IMPORTANT: because control is transferred to `recipient`, care must be
* taken to not create reentrancy vulnerabilities. Consider using
* {ReentrancyGuard} or the
* https://solidity.readthedocs.io/en/v0.8.0/security-considerations.html#use-the-checks-effects-interactions-pattern[checks-effects-interactions pattern].
*/
function sendValue(address payable recipient, uint256 amount) internal {
require(address(this).balance >= amount, "Address: insufficient balance");
(bool success, ) = recipient.call{value: amount}("");
require(success, "Address: unable to send value, recipient may have reverted");
}
/**
* @dev Performs a Solidity function call using a low level `call`. A
* plain `call` is an unsafe replacement for a function call: use this
* function instead.
*
* If `target` reverts with a revert reason, it is bubbled up by this
* function (like regular Solidity function calls).
*
* Returns the raw returned data. To convert to the expected return value,
* use https://solidity.readthedocs.io/en/latest/units-and-global-variables.html?highlight=abi.decode#abi-encoding-and-decoding-functions[`abi.decode`].
*
* Requirements:
*
* - `target` must be a contract.
* - calling `target` with `data` must not revert.
*
* _Available since v3.1._
*/
function functionCall(address target, bytes memory data) internal returns (bytes memory) {
return functionCallWithValue(target, data, 0, "Address: low-level call failed");
}
/**
* @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`], but with
* `errorMessage` as a fallback revert reason when `target` reverts.
*
* _Available since v3.1._
*/
function functionCall(
address target,
bytes memory data,
string memory errorMessage
) internal returns (bytes memory) {
return functionCallWithValue(target, data, 0, errorMessage);
}
/**
* @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`],
* but also transferring `value` wei to `target`.
*
* Requirements:
*
* - the calling contract must have an ETH balance of at least `value`.
* - the called Solidity function must be `payable`.
*
* _Available since v3.1._
*/
function functionCallWithValue(address target, bytes memory data, uint256 value) internal returns (bytes memory) {
return functionCallWithValue(target, data, value, "Address: low-level call with value failed");
}
/**
* @dev Same as {xref-Address-functionCallWithValue-address-bytes-uint256-}[`functionCallWithValue`], but
* with `errorMessage` as a fallback revert reason when `target` reverts.
*
* _Available since v3.1._
*/
function functionCallWithValue(
address target,
bytes memory data,
uint256 value,
string memory errorMessage
) internal returns (bytes memory) {
require(address(this).balance >= value, "Address: insufficient balance for call");
(bool success, bytes memory returndata) = target.call{value: value}(data);
return verifyCallResultFromTarget(target, success, returndata, errorMessage);
}
/**
* @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`],
* but performing a static call.
*
* _Available since v3.3._
*/
function functionStaticCall(address target, bytes memory data) internal view returns (bytes memory) {
return functionStaticCall(target, data, "Address: low-level static call failed");
}
/**
* @dev Same as {xref-Address-functionCall-address-bytes-string-}[`functionCall`],
* but performing a static call.
*
* _Available since v3.3._
*/
function functionStaticCall(
address target,
bytes memory data,
string memory errorMessage
) internal view returns (bytes memory) {
(bool success, bytes memory returndata) = target.staticcall(data);
return verifyCallResultFromTarget(target, success, returndata, errorMessage);
}
/**
* @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`],
* but performing a delegate call.
*
* _Available since v3.4._
*/
function functionDelegateCall(address target, bytes memory data) internal returns (bytes memory) {
return functionDelegateCall(target, data, "Address: low-level delegate call failed");
}
/**
* @dev Same as {xref-Address-functionCall-address-bytes-string-}[`functionCall`],
* but performing a delegate call.
*
* _Available since v3.4._
*/
function functionDelegateCall(
address target,
bytes memory data,
string memory errorMessage
) internal returns (bytes memory) {
(bool success, bytes memory returndata) = target.delegatecall(data);
return verifyCallResultFromTarget(target, success, returndata, errorMessage);
}
/**
* @dev Tool to verify that a low level call to smart-contract was successful, and revert (either by bubbling
* the revert reason or using the provided one) in case of unsuccessful call or if target was not a contract.
*
* _Available since v4.8._
*/
function verifyCallResultFromTarget(
address target,
bool success,
bytes memory returndata,
string memory errorMessage
) internal view returns (bytes memory) {
if (success) {
if (returndata.length == 0) {
// only check isContract if the call was successful and the return data is empty
// otherwise we already know that it was a contract
require(isContract(target), "Address: call to non-contract");
}
return returndata;
} else {
_revert(returndata, errorMessage);
}
}
/**
* @dev Tool to verify that a low level call was successful, and revert if it wasn't, either by bubbling the
* revert reason or using the provided one.
*
* _Available since v4.3._
*/
function verifyCallResult(
bool success,
bytes memory returndata,
string memory errorMessage
) internal pure returns (bytes memory) {
if (success) {
return returndata;
} else {
_revert(returndata, errorMessage);
}
}
function _revert(bytes memory returndata, string memory errorMessage) private pure {
// Look for revert reason and bubble it up if present
if (returndata.length > 0) {
// The easiest way to bubble the revert reason is using memory via assembly
/// @solidity memory-safe-assembly
assembly {
let returndata_size := mload(returndata)
revert(add(32, returndata), returndata_size)
}
} else {
revert(errorMessage);
}
}
}
Context.sol 24 lines
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts v4.4.1 (utils/Context.sol)
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 meta-transactions the account sending and
* paying for execution may not be the actual sender (as far as an application
* is concerned).
*
* This contract is only required for intermediate, library-like contracts.
*/
abstract contract Context {
function _msgSender() internal view virtual returns (address) {
return msg.sender;
}
function _msgData() internal view virtual returns (bytes calldata) {
return msg.data;
}
}
Ownable.sol 83 lines
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v4.9.0) (access/Ownable.sol)
pragma solidity ^0.8.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() {
_transferOwnership(_msgSender());
}
/**
* @dev Throws if called by any account other than the owner.
*/
modifier onlyOwner() {
_checkOwner();
_;
}
/**
* @dev Returns the address of the current owner.
*/
function owner() public view virtual returns (address) {
return _owner;
}
/**
* @dev Throws if the sender is not the owner.
*/
function _checkOwner() internal view virtual {
require(owner() == _msgSender(), "Ownable: caller is not the owner");
}
/**
* @dev Leaves the contract without owner. It will not be possible to call
* `onlyOwner` functions. Can only be called by the current owner.
*
* NOTE: Renouncing ownership will leave the contract without an owner,
* thereby disabling any functionality that is only available to the owner.
*/
function renounceOwnership() public virtual onlyOwner {
_transferOwnership(address(0));
}
/**
* @dev Transfers ownership of the contract to a new account (`newOwner`).
* Can only be called by the current owner.
*/
function transferOwnership(address newOwner) public virtual onlyOwner {
require(newOwner != address(0), "Ownable: new owner is the zero address");
_transferOwnership(newOwner);
}
/**
* @dev Transfers ownership of the contract to a new account (`newOwner`).
* Internal function without access restriction.
*/
function _transferOwnership(address newOwner) internal virtual {
address oldOwner = _owner;
_owner = newOwner;
emit OwnershipTransferred(oldOwner, newOwner);
}
}
PROPCStaking.sol 359 lines
// SPDX-License-Identifier: MIT
pragma solidity 0.8.19;
import "@openzeppelin/contracts/token/ERC20/IERC20.sol";
import "@openzeppelin/contracts/utils/math/SafeMath.sol";
import "@openzeppelin/contracts/utils/Address.sol";
import "@openzeppelin/contracts/token/ERC20/utils/SafeERC20.sol";
import "@openzeppelin/contracts/utils/Context.sol";
import "@openzeppelin/contracts/access/Ownable.sol";
interface IPropcToken {
function transferFrom(address sender, address recipient, uint256 amount) external returns (bool);
function transfer(address to, uint256 amount) external returns (bool);
}
contract PROPCStaking is Ownable {
using SafeMath for uint256;
using SafeERC20 for IERC20;
// Info of each user.
struct UserInfo {
uint256 amount;
uint256 totalRedeemed;
uint256 lastClaimTimestamp;
uint256 depositTimestamp;
}
struct APYInfo {
uint256 apyPercent; // 500 = 5%, 7545 = 75.45%, 10000 = 100%
uint256 startTime; // The block timestamp when this APY set
uint256 stopTime; // The block timestamp when the next APY set
}
// Info of each pool.
struct PoolInfo {
uint256 startTime; // The block timestamp when Rewards Token mining starts.
IERC20 rewardsToken;
uint256 totalStaked;
bool active;
uint256 claimTimeLimit;
uint256 penaltyFee; // 500 = 5%, 7545 = 75.45%, 10000 = 100%
uint256 penaltyTimeLimit;
address penaltyWallet;
bool isVIPPool;
mapping (address => bool) isVIPAddress;
mapping (uint256 => APYInfo) apyInfo;
uint256 lastAPYIndex;
}
IPropcToken public propcToken;
address public rewardsWallet;
uint256 public totalPools;
// Info of each pool.
mapping(uint256 => PoolInfo) private poolInfo;
// Info of each user that stakes tokens.
mapping (uint256 => mapping (address => UserInfo)) private userInfo;
event Deposit(address indexed user, uint256 indexed pid, uint256 amount);
event Withdraw(address indexed user, uint256 indexed pid, uint256 amount);
event Redeem(address indexed user, uint256 indexed pid, uint256 amount);
constructor(
IPropcToken _propc,
address _rewardsWallet
) {
propcToken = _propc;
rewardsWallet = _rewardsWallet;
}
function updateRewardsWallet(address _wallet) external onlyOwner {
require(_wallet != address(0x0), "invalid rewards wallet address");
rewardsWallet = _wallet;
}
function poolLength() public view returns (uint256) {
return totalPools;
}
// Can only be called by the owner.
// Add a new pool when _pid is 0.
// Update a pool when _pid is not 0.
function setPool(
uint256 _pid,
uint256 _startTime,
IERC20 _rewardsToken,
uint256 _apyPercent,
uint256 _claimTimeLimit,
uint256 _penaltyFee,
uint256 _penaltyTimeLimit,
bool _active,
address _penaltyWallet,
bool _isVIPPool
) public onlyOwner {
uint256 pid = _pid == 0 ? ++totalPools : _pid;
PoolInfo storage pool = poolInfo[pid];
require(_pid == 0 || pool.lastAPYIndex > 0, "pid is not exist");
require(_pid > 0 || _apyPercent > 0, "APY should be bigger than zero when adding a new pool");
require(_penaltyFee <= 3500, "penalty fee can not be more than 35%");
if (_pid == 0) {
pool.startTime = _startTime;
}
if (_apyPercent != pool.apyInfo[pool.lastAPYIndex].apyPercent) {
pool.apyInfo[pool.lastAPYIndex].stopTime = block.timestamp; // current apy
pool.lastAPYIndex ++; // new apy
APYInfo storage apyInfo = pool.apyInfo[pool.lastAPYIndex];
apyInfo.apyPercent = _apyPercent;
apyInfo.startTime = block.timestamp;
}
pool.rewardsToken = _rewardsToken;
pool.claimTimeLimit = _claimTimeLimit;
pool.penaltyFee = _penaltyFee;
pool.penaltyTimeLimit = _penaltyTimeLimit;
pool.active = _active;
pool.penaltyWallet = _penaltyWallet;
pool.isVIPPool = _isVIPPool;
}
function addVIPAddress(uint256 _pid, address _vipAddress) external onlyOwner {
PoolInfo storage pool = poolInfo[_pid];
require(pool.isVIPPool, "not vip pool");
pool.isVIPAddress[_vipAddress] = true;
}
function addVIPAddresses(uint256 _pid, address[] memory _vipAddresses) external onlyOwner {
PoolInfo storage pool = poolInfo[_pid];
require(pool.isVIPPool, "not vip pool");
for (uint256 i = 0; i < _vipAddresses.length; i++) {
pool.isVIPAddress[_vipAddresses[i]] = true;
}
}
function removeVIPAddress(uint256 _pid, address _vipAddress) external onlyOwner {
PoolInfo storage pool = poolInfo[_pid];
require(pool.isVIPPool, "not vip pool");
pool.isVIPAddress[_vipAddress] = false;
}
function removeVIPAddresses(uint256 _pid, address[] memory _vipAddresses) external onlyOwner {
PoolInfo storage pool = poolInfo[_pid];
require(pool.isVIPPool, "not vip pool");
for (uint256 i = 0; i < _vipAddresses.length; i++) {
pool.isVIPAddress[_vipAddresses[i]] = false;
}
}
// Return reward multiplier over the given _from to _to block.
function getMultiplier(uint256 _from, uint256 _to) public pure returns (uint256) {
return _to.sub(_from);
}
function _max(uint256 a, uint256 b) internal pure returns (uint256) {
return a > b ? a : b;
}
function _min(uint256 a, uint256 b) internal pure returns (uint256) {
return a < b ? a : b;
}
// View function to see pending Rewards Tokens on frontend.
function pendingRewardsToken(uint256 _pid, address _user) public view returns (uint256) {
PoolInfo storage pool = poolInfo[_pid];
UserInfo memory user = userInfo[_pid][_user];
uint256 pendingRewards = 0;
for (uint256 apyIndex = pool.lastAPYIndex; apyIndex > 0; apyIndex--) {
if (pool.apyInfo[apyIndex].stopTime > 0 && user.lastClaimTimestamp >= pool.apyInfo[apyIndex].stopTime) {
break;
}
if (pool.apyInfo[apyIndex].apyPercent == 0) {
continue;
}
uint256 _fromTime = _max(user.lastClaimTimestamp, pool.apyInfo[apyIndex].startTime);
uint256 _toTime = block.timestamp;
if (pool.apyInfo[apyIndex].stopTime > 0 && block.timestamp > pool.apyInfo[apyIndex].stopTime) {
_toTime = pool.apyInfo[apyIndex].stopTime;
}
if (_fromTime >= _toTime) {
continue;
}
uint256 multiplier = getMultiplier(_fromTime, _toTime);
uint256 rewardsPerAPYBlock = multiplier.mul(pool.apyInfo[apyIndex].apyPercent).mul(user.amount).div(365 days).div(10000);
pendingRewards = pendingRewards.add(rewardsPerAPYBlock);
}
return pendingRewards;
}
function allPendingRewardsToken(address _user) public view returns (uint256[] memory) {
uint256 length = poolLength();
uint256[] memory pendingRewards = new uint256[](length);
for(uint256 _pid = 1; _pid <= length; _pid++) {
pendingRewards[_pid - 1] = pendingRewardsToken(_pid, _user);
}
return pendingRewards;
}
// Stake tokens to contract for Rewards Token allocation.
function joinPool(uint256 _pid, uint256 _amount) external {
PoolInfo storage pool = poolInfo[_pid];
UserInfo storage user = userInfo[_pid][msg.sender];
require(pool.startTime < block.timestamp, "mining is not started yet");
require(pool.active, "pool not active");
require(!pool.isVIPPool || pool.isVIPAddress[msg.sender] == true, "not vip address");
if (user.amount > 0) {
uint256 pendingRewards = pendingRewardsToken(_pid, msg.sender);
if(pendingRewards > 0) {
safeRewardTransfer(_pid, msg.sender, pendingRewards);
user.totalRedeemed = user.totalRedeemed.add(pendingRewards);
}
}
propcToken.transferFrom(msg.sender, address(this), _amount);
user.amount = user.amount.add(_amount);
user.lastClaimTimestamp = block.timestamp;
user.depositTimestamp = block.timestamp;
pool.totalStaked = pool.totalStaked.add(_amount);
emit Deposit(msg.sender, _pid, _amount);
}
// Unstake token from pool.
function leavePool(uint256 _pid, uint256 _amount) external {
PoolInfo storage pool = poolInfo[_pid];
UserInfo storage user = userInfo[_pid][msg.sender];
uint256 pendingRewards = pendingRewardsToken(_pid, msg.sender);
if(pendingRewards > 0) {
safeRewardTransfer(_pid, msg.sender, pendingRewards);
user.totalRedeemed = user.totalRedeemed.add(pendingRewards);
}
uint256 penaltyAmount = 0;
if (user.depositTimestamp + pool.penaltyTimeLimit > block.timestamp) {
penaltyAmount = _amount.mul(pool.penaltyFee).div(10000);
}
propcToken.transfer(msg.sender, _amount.sub(penaltyAmount));
propcToken.transfer(pool.penaltyWallet, penaltyAmount);
user.amount = user.amount.sub(_amount);
user.lastClaimTimestamp = block.timestamp;
user.depositTimestamp = block.timestamp;
pool.totalStaked = pool.totalStaked.sub(_amount);
emit Withdraw(msg.sender, _pid, _amount);
}
function _redeem(uint256 _pid, bool _require) private {
PoolInfo storage pool = poolInfo[_pid];
UserInfo storage user = userInfo[_pid][msg.sender];
require(user.lastClaimTimestamp + pool.claimTimeLimit < block.timestamp, "doesn't meet the claim time limit");
uint256 pendingRewards = pendingRewardsToken(_pid, msg.sender);
if (_require) {
require(pendingRewards > 0, "no pending rewards");
}
user.lastClaimTimestamp = block.timestamp;
if (pendingRewards > 0) {
user.totalRedeemed += pendingRewards;
safeRewardTransfer(_pid, msg.sender, pendingRewards);
emit Redeem(msg.sender, _pid, pendingRewards);
}
}
// Redeem currently pending rewards
function redeem(uint256 _pid) public {
_redeem(_pid, true);
}
function redeemAll() public {
uint256[] memory pendingRewards = allPendingRewardsToken(msg.sender);
uint256 allPendingRewards = 0;
for (uint256 i = 0; i < pendingRewards.length; i++) {
allPendingRewards = allPendingRewards.add(pendingRewards[i]);
}
require(allPendingRewards > 0, "no pending rewards");
for(uint _pid = 1; _pid <= poolLength(); _pid++) {
_redeem(_pid, false);
}
}
function safeRewardTransfer(uint256 _pid, address _to, uint256 _amount) internal {
IERC20(poolInfo[_pid].rewardsToken).safeTransferFrom(rewardsWallet, _to, _amount);
}
function getUserInfo(uint256 _pid, address _account) public view returns(
uint256 amount,
uint256 totalRedeemed,
uint256 lastClaimTimestamp,
uint256 depositTimestamp
) {
UserInfo memory user = userInfo[_pid][_account];
return (
user.amount,
user.totalRedeemed,
user.lastClaimTimestamp,
user.depositTimestamp
);
}
function getPoolInfo(uint256 _pid) public view returns(
uint256 startTime,
address rewardsToken,
address penaltyWallet,
uint256 apyPercent,
uint256 totalStaked,
bool active,
uint256 claimTimeLimit,
uint256 penaltyFee,
uint256 penaltyTimeLimit,
bool isVIPPool
) {
PoolInfo storage pool = poolInfo[_pid];
startTime = pool.startTime;
penaltyWallet = pool.penaltyWallet;
isVIPPool = pool.isVIPPool;
rewardsToken = address(pool.rewardsToken);
apyPercent = pool.apyInfo[pool.lastAPYIndex].apyPercent;
totalStaked = pool.totalStaked;
active = pool.active;
claimTimeLimit = pool.claimTimeLimit;
penaltyFee = pool.penaltyFee;
penaltyTimeLimit = pool.penaltyTimeLimit;
}
}
IERC20.sol 78 lines
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v4.9.0) (token/ERC20/IERC20.sol)
pragma solidity ^0.8.0;
/**
* @dev Interface of the ERC20 standard as defined in the EIP.
*/
interface IERC20 {
/**
* @dev Emitted when `value` tokens are moved from one account (`from`) to
* another (`to`).
*
* Note that `value` may be zero.
*/
event Transfer(address indexed from, address indexed to, uint256 value);
/**
* @dev Emitted when the allowance of a `spender` for an `owner` is set by
* a call to {approve}. `value` is the new allowance.
*/
event Approval(address indexed owner, address indexed spender, uint256 value);
/**
* @dev Returns the 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 `to`.
*
* Returns a boolean value indicating whether the operation succeeded.
*
* Emits a {Transfer} event.
*/
function transfer(address to, 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 `from` to `to` 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 from, address to, uint256 amount) external returns (bool);
}
SafeMath.sol 215 lines
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v4.9.0) (utils/math/SafeMath.sol)
pragma solidity ^0.8.0;
// CAUTION
// This version of SafeMath should only be used with Solidity 0.8 or later,
// because it relies on the compiler's built in overflow checks.
/**
* @dev Wrappers over Solidity's arithmetic operations.
*
* NOTE: `SafeMath` is generally not needed starting with Solidity 0.8, since the compiler
* now has built in overflow checking.
*/
library SafeMath {
/**
* @dev Returns the addition of two unsigned integers, with an overflow flag.
*
* _Available since v3.4._
*/
function tryAdd(uint256 a, uint256 b) internal pure returns (bool, uint256) {
unchecked {
uint256 c = a + b;
if (c < a) return (false, 0);
return (true, c);
}
}
/**
* @dev Returns the subtraction of two unsigned integers, with an overflow flag.
*
* _Available since v3.4._
*/
function trySub(uint256 a, uint256 b) internal pure returns (bool, uint256) {
unchecked {
if (b > a) return (false, 0);
return (true, a - b);
}
}
/**
* @dev Returns the multiplication of two unsigned integers, with an overflow flag.
*
* _Available since v3.4._
*/
function tryMul(uint256 a, uint256 b) internal pure returns (bool, uint256) {
unchecked {
// Gas optimization: this is cheaper than requiring 'a' not being zero, but the
// benefit is lost if 'b' is also tested.
// See: https://github.com/OpenZeppelin/openzeppelin-contracts/pull/522
if (a == 0) return (true, 0);
uint256 c = a * b;
if (c / a != b) return (false, 0);
return (true, c);
}
}
/**
* @dev Returns the division of two unsigned integers, with a division by zero flag.
*
* _Available since v3.4._
*/
function tryDiv(uint256 a, uint256 b) internal pure returns (bool, uint256) {
unchecked {
if (b == 0) return (false, 0);
return (true, a / b);
}
}
/**
* @dev Returns the remainder of dividing two unsigned integers, with a division by zero flag.
*
* _Available since v3.4._
*/
function tryMod(uint256 a, uint256 b) internal pure returns (bool, uint256) {
unchecked {
if (b == 0) return (false, 0);
return (true, a % b);
}
}
/**
* @dev Returns the addition of two unsigned integers, reverting on
* overflow.
*
* Counterpart to Solidity's `+` operator.
*
* Requirements:
*
* - Addition cannot overflow.
*/
function add(uint256 a, uint256 b) internal pure returns (uint256) {
return a + b;
}
/**
* @dev Returns the subtraction of two unsigned integers, reverting on
* overflow (when the result is negative).
*
* Counterpart to Solidity's `-` operator.
*
* Requirements:
*
* - Subtraction cannot overflow.
*/
function sub(uint256 a, uint256 b) internal pure returns (uint256) {
return a - b;
}
/**
* @dev Returns the multiplication of two unsigned integers, reverting on
* overflow.
*
* Counterpart to Solidity's `*` operator.
*
* Requirements:
*
* - Multiplication cannot overflow.
*/
function mul(uint256 a, uint256 b) internal pure returns (uint256) {
return a * b;
}
/**
* @dev Returns the integer division of two unsigned integers, reverting on
* division by zero. The result is rounded towards zero.
*
* Counterpart to Solidity's `/` operator.
*
* Requirements:
*
* - The divisor cannot be zero.
*/
function div(uint256 a, uint256 b) internal pure returns (uint256) {
return a / b;
}
/**
* @dev Returns the remainder of dividing two unsigned integers. (unsigned integer modulo),
* reverting when dividing by zero.
*
* Counterpart to Solidity's `%` operator. This function uses a `revert`
* opcode (which leaves remaining gas untouched) while Solidity uses an
* invalid opcode to revert (consuming all remaining gas).
*
* Requirements:
*
* - The divisor cannot be zero.
*/
function mod(uint256 a, uint256 b) internal pure returns (uint256) {
return a % b;
}
/**
* @dev Returns the subtraction of two unsigned integers, reverting with custom message on
* overflow (when the result is negative).
*
* CAUTION: This function is deprecated because it requires allocating memory for the error
* message unnecessarily. For custom revert reasons use {trySub}.
*
* Counterpart to Solidity's `-` operator.
*
* Requirements:
*
* - Subtraction cannot overflow.
*/
function sub(uint256 a, uint256 b, string memory errorMessage) internal pure returns (uint256) {
unchecked {
require(b <= a, errorMessage);
return a - b;
}
}
/**
* @dev Returns the integer division of two unsigned integers, reverting with custom message on
* division by zero. The result is rounded towards zero.
*
* Counterpart to Solidity's `/` operator. Note: this function uses a
* `revert` opcode (which leaves remaining gas untouched) while Solidity
* uses an invalid opcode to revert (consuming all remaining gas).
*
* Requirements:
*
* - The divisor cannot be zero.
*/
function div(uint256 a, uint256 b, string memory errorMessage) internal pure returns (uint256) {
unchecked {
require(b > 0, errorMessage);
return a / b;
}
}
/**
* @dev Returns the remainder of dividing two unsigned integers. (unsigned integer modulo),
* reverting with custom message when dividing by zero.
*
* CAUTION: This function is deprecated because it requires allocating memory for the error
* message unnecessarily. For custom revert reasons use {tryMod}.
*
* Counterpart to Solidity's `%` operator. This function uses a `revert`
* opcode (which leaves remaining gas untouched) while Solidity uses an
* invalid opcode to revert (consuming all remaining gas).
*
* Requirements:
*
* - The divisor cannot be zero.
*/
function mod(uint256 a, uint256 b, string memory errorMessage) internal pure returns (uint256) {
unchecked {
require(b > 0, errorMessage);
return a % b;
}
}
}
SafeERC20.sol 143 lines
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v4.9.0) (token/ERC20/utils/SafeERC20.sol)
pragma solidity ^0.8.0;
import "../IERC20.sol";
import "../extensions/IERC20Permit.sol";
import "../../../utils/Address.sol";
/**
* @title SafeERC20
* @dev Wrappers around ERC20 operations that throw on failure (when the token
* contract returns false). Tokens that return no value (and instead revert or
* throw on failure) are also supported, non-reverting calls are assumed to be
* successful.
* To use this library you can add a `using SafeERC20 for IERC20;` statement to your contract,
* which allows you to call the safe operations as `token.safeTransfer(...)`, etc.
*/
library SafeERC20 {
using Address for address;
/**
* @dev Transfer `value` amount of `token` from the calling contract to `to`. If `token` returns no value,
* non-reverting calls are assumed to be successful.
*/
function safeTransfer(IERC20 token, address to, uint256 value) internal {
_callOptionalReturn(token, abi.encodeWithSelector(token.transfer.selector, to, value));
}
/**
* @dev Transfer `value` amount of `token` from `from` to `to`, spending the approval given by `from` to the
* calling contract. If `token` returns no value, non-reverting calls are assumed to be successful.
*/
function safeTransferFrom(IERC20 token, address from, address to, uint256 value) internal {
_callOptionalReturn(token, abi.encodeWithSelector(token.transferFrom.selector, from, to, value));
}
/**
* @dev Deprecated. This function has issues similar to the ones found in
* {IERC20-approve}, and its usage is discouraged.
*
* Whenever possible, use {safeIncreaseAllowance} and
* {safeDecreaseAllowance} instead.
*/
function safeApprove(IERC20 token, address spender, uint256 value) internal {
// safeApprove should only be called when setting an initial allowance,
// or when resetting it to zero. To increase and decrease it, use
// 'safeIncreaseAllowance' and 'safeDecreaseAllowance'
require(
(value == 0) || (token.allowance(address(this), spender) == 0),
"SafeERC20: approve from non-zero to non-zero allowance"
);
_callOptionalReturn(token, abi.encodeWithSelector(token.approve.selector, spender, value));
}
/**
* @dev Increase the calling contract's allowance toward `spender` by `value`. If `token` returns no value,
* non-reverting calls are assumed to be successful.
*/
function safeIncreaseAllowance(IERC20 token, address spender, uint256 value) internal {
uint256 oldAllowance = token.allowance(address(this), spender);
_callOptionalReturn(token, abi.encodeWithSelector(token.approve.selector, spender, oldAllowance + value));
}
/**
* @dev Decrease the calling contract's allowance toward `spender` by `value`. If `token` returns no value,
* non-reverting calls are assumed to be successful.
*/
function safeDecreaseAllowance(IERC20 token, address spender, uint256 value) internal {
unchecked {
uint256 oldAllowance = token.allowance(address(this), spender);
require(oldAllowance >= value, "SafeERC20: decreased allowance below zero");
_callOptionalReturn(token, abi.encodeWithSelector(token.approve.selector, spender, oldAllowance - value));
}
}
/**
* @dev Set the calling contract's allowance toward `spender` to `value`. If `token` returns no value,
* non-reverting calls are assumed to be successful. Compatible with tokens that require the approval to be set to
* 0 before setting it to a non-zero value.
*/
function forceApprove(IERC20 token, address spender, uint256 value) internal {
bytes memory approvalCall = abi.encodeWithSelector(token.approve.selector, spender, value);
if (!_callOptionalReturnBool(token, approvalCall)) {
_callOptionalReturn(token, abi.encodeWithSelector(token.approve.selector, spender, 0));
_callOptionalReturn(token, approvalCall);
}
}
/**
* @dev Use a ERC-2612 signature to set the `owner` approval toward `spender` on `token`.
* Revert on invalid signature.
*/
function safePermit(
IERC20Permit token,
address owner,
address spender,
uint256 value,
uint256 deadline,
uint8 v,
bytes32 r,
bytes32 s
) internal {
uint256 nonceBefore = token.nonces(owner);
token.permit(owner, spender, value, deadline, v, r, s);
uint256 nonceAfter = token.nonces(owner);
require(nonceAfter == nonceBefore + 1, "SafeERC20: permit did not succeed");
}
/**
* @dev Imitates a Solidity high-level call (i.e. a regular function call to a contract), relaxing the requirement
* on the return value: the return value is optional (but if data is returned, it must not be false).
* @param token The token targeted by the call.
* @param data The call data (encoded using abi.encode or one of its variants).
*/
function _callOptionalReturn(IERC20 token, bytes memory data) private {
// We need to perform a low level call here, to bypass Solidity's return data size checking mechanism, since
// we're implementing it ourselves. We use {Address-functionCall} to perform this call, which verifies that
// the target address contains contract code and also asserts for success in the low-level call.
bytes memory returndata = address(token).functionCall(data, "SafeERC20: low-level call failed");
require(returndata.length == 0 || abi.decode(returndata, (bool)), "SafeERC20: ERC20 operation did not succeed");
}
/**
* @dev Imitates a Solidity high-level call (i.e. a regular function call to a contract), relaxing the requirement
* on the return value: the return value is optional (but if data is returned, it must not be false).
* @param token The token targeted by the call.
* @param data The call data (encoded using abi.encode or one of its variants).
*
* This is a variant of {_callOptionalReturn} that silents catches all reverts and returns a bool instead.
*/
function _callOptionalReturnBool(IERC20 token, bytes memory data) private returns (bool) {
// We need to perform a low level call here, to bypass Solidity's return data size checking mechanism, since
// we're implementing it ourselves. We cannot use {Address-functionCall} here since this should return false
// and not revert is the subcall reverts.
(bool success, bytes memory returndata) = address(token).call(data);
return
success && (returndata.length == 0 || abi.decode(returndata, (bool))) && Address.isContract(address(token));
}
}
IERC20Permit.sol 60 lines
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v4.9.0) (token/ERC20/extensions/IERC20Permit.sol)
pragma solidity ^0.8.0;
/**
* @dev Interface of the ERC20 Permit extension allowing approvals to be made via signatures, as defined in
* https://eips.ethereum.org/EIPS/eip-2612[EIP-2612].
*
* Adds the {permit} method, which can be used to change an account's ERC20 allowance (see {IERC20-allowance}) by
* presenting a message signed by the account. By not relying on {IERC20-approve}, the token holder account doesn't
* need to send a transaction, and thus is not required to hold Ether at all.
*/
interface IERC20Permit {
/**
* @dev Sets `value` as the allowance of `spender` over ``owner``'s tokens,
* given ``owner``'s signed approval.
*
* IMPORTANT: The same issues {IERC20-approve} has related to transaction
* ordering also apply here.
*
* Emits an {Approval} event.
*
* Requirements:
*
* - `spender` cannot be the zero address.
* - `deadline` must be a timestamp in the future.
* - `v`, `r` and `s` must be a valid `secp256k1` signature from `owner`
* over the EIP712-formatted function arguments.
* - the signature must use ``owner``'s current nonce (see {nonces}).
*
* For more information on the signature format, see the
* https://eips.ethereum.org/EIPS/eip-2612#specification[relevant EIP
* section].
*/
function permit(
address owner,
address spender,
uint256 value,
uint256 deadline,
uint8 v,
bytes32 r,
bytes32 s
) external;
/**
* @dev Returns the current nonce for `owner`. This value must be
* included whenever a signature is generated for {permit}.
*
* Every successful call to {permit} increases ``owner``'s nonce by one. This
* prevents a signature from being used multiple times.
*/
function nonces(address owner) external view returns (uint256);
/**
* @dev Returns the domain separator used in the encoding of the signature for {permit}, as defined by {EIP712}.
*/
// solhint-disable-next-line func-name-mixedcase
function DOMAIN_SEPARATOR() external view returns (bytes32);
}
Read Contract
allPendingRewardsToken 0xfa8f5a16 → uint256[]
getMultiplier 0x8dbb1e3a → uint256
getPoolInfo 0x2f380b35 → uint256, address, address, uint256, uint256, bool, uint256, uint256, uint256, bool
getUserInfo 0x1069f3b5 → uint256, uint256, uint256, uint256
owner 0x8da5cb5b → address
pendingRewardsToken 0x530354ec → uint256
poolLength 0x081e3eda → uint256
propcToken 0xd08db5e8 → address
rewardsWallet 0x5b35f9c9 → address
totalPools 0xab3c7e52 → uint256
Write Contract 12 functions
These functions modify contract state and require a wallet transaction to execute.
addVIPAddress 0xec8a0224
uint256 _pid
address _vipAddress
addVIPAddresses 0x7453bdbb
uint256 _pid
address[] _vipAddresses
joinPool 0x108c8492
uint256 _pid
uint256 _amount
leavePool 0x0fb9e1ae
uint256 _pid
uint256 _amount
redeem 0xdb006a75
uint256 _pid
redeemAll 0x2f4350c2
No parameters
removeVIPAddress 0x5be863d5
uint256 _pid
address _vipAddress
removeVIPAddresses 0x3c66201f
uint256 _pid
address[] _vipAddresses
renounceOwnership 0x715018a6
No parameters
setPool 0x3fa4be7f
uint256 _pid
uint256 _startTime
address _rewardsToken
uint256 _apyPercent
uint256 _claimTimeLimit
uint256 _penaltyFee
uint256 _penaltyTimeLimit
bool _active
address _penaltyWallet
bool _isVIPPool
transferOwnership 0xf2fde38b
address newOwner
updateRewardsWallet 0xcfc0d024
address _wallet
Recent Transactions
No transactions found for this address