comment
stringlengths 1
211
⌀ | input
stringlengths 155
20k
| label
stringlengths 4
1k
| original_idx
int64 203
514k
| predicate
stringlengths 1
1k
|
---|---|---|---|---|
null | pragma solidity ^0.5.2;
/// @title Math library - Allows calculation of logarithmic and exponential functions
/// @author Alan Lu - <alan.lu@gnosis.pm>
/// @author Stefan George - <stefan@gnosis.pm>
library GnosisMath {
/*
* Constants
*/
// This is equal to 1 in our calculations
uint public constant ONE = 0x10000000000000000;
uint public constant LN2 = 0xb17217f7d1cf79ac;
uint public constant LOG2_E = 0x171547652b82fe177;
/*
* Public functions
*/
/// @dev Returns natural exponential function value of given x
/// @param x x
/// @return e**x
function exp(int x) public pure returns (uint) {
}
/// @dev Returns natural logarithm value of given x
/// @param x x
/// @return ln(x)
function ln(uint x) public pure returns (int) {
}
/// @dev Returns base 2 logarithm value of given x
/// @param x x
/// @return logarithmic value
function floorLog2(uint x) public pure returns (int lo) {
}
/// @dev Returns maximum of an array
/// @param nums Numbers to look through
/// @return Maximum number
function max(int[] memory nums) public pure returns (int maxNum) {
}
/// @dev Returns whether an add operation causes an overflow
/// @param a First addend
/// @param b Second addend
/// @return Did no overflow occur?
function safeToAdd(uint a, uint b) internal pure returns (bool) {
}
/// @dev Returns whether a subtraction operation causes an underflow
/// @param a Minuend
/// @param b Subtrahend
/// @return Did no underflow occur?
function safeToSub(uint a, uint b) internal pure returns (bool) {
}
/// @dev Returns whether a multiply operation causes an overflow
/// @param a First factor
/// @param b Second factor
/// @return Did no overflow occur?
function safeToMul(uint a, uint b) internal pure returns (bool) {
}
/// @dev Returns sum if no overflow occurred
/// @param a First addend
/// @param b Second addend
/// @return Sum
function add(uint a, uint b) internal pure returns (uint) {
}
/// @dev Returns difference if no overflow occurred
/// @param a Minuend
/// @param b Subtrahend
/// @return Difference
function sub(uint a, uint b) internal pure returns (uint) {
}
/// @dev Returns product if no overflow occurred
/// @param a First factor
/// @param b Second factor
/// @return Product
function mul(uint a, uint b) internal pure returns (uint) {
require(<FILL_ME>)
return a * b;
}
/// @dev Returns whether an add operation causes an overflow
/// @param a First addend
/// @param b Second addend
/// @return Did no overflow occur?
function safeToAdd(int a, int b) internal pure returns (bool) {
}
/// @dev Returns whether a subtraction operation causes an underflow
/// @param a Minuend
/// @param b Subtrahend
/// @return Did no underflow occur?
function safeToSub(int a, int b) internal pure returns (bool) {
}
/// @dev Returns whether a multiply operation causes an overflow
/// @param a First factor
/// @param b Second factor
/// @return Did no overflow occur?
function safeToMul(int a, int b) internal pure returns (bool) {
}
/// @dev Returns sum if no overflow occurred
/// @param a First addend
/// @param b Second addend
/// @return Sum
function add(int a, int b) internal pure returns (int) {
}
/// @dev Returns difference if no overflow occurred
/// @param a Minuend
/// @param b Subtrahend
/// @return Difference
function sub(int a, int b) internal pure returns (int) {
}
/// @dev Returns product if no overflow occurred
/// @param a First factor
/// @param b Second factor
/// @return Product
function mul(int a, int b) internal pure returns (int) {
}
}
| safeToMul(a,b) | 6,749 | safeToMul(a,b) |
"ERC721Metadata: URI query for nonexistent token" | pragma solidity ^0.8.0;
/**
* @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() {
}
/**
* @dev Returns the address of the current owner.
*/
function owner() public view virtual returns (address) {
}
/**
* @dev Throws if called by any account other than the owner.
*/
modifier onlyOwner() {
}
/**
* @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 {
}
/**
* @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 {
}
function _setOwner(address newOwner) private {
}
}
pragma solidity ^0.8.0;
contract Smol is Ownable, ERC721 {
using SafeMath for uint256;
using Counters for Counters.Counter;
Counters.Counter private _tokenIdCounter;
uint256 public mintPrice = .01 ether;
uint256 public maxSupply = 3333;
uint256 public freeMintAmount = 666;
uint256 private mintLimit = 3;
string private baseURI;
bool public publicSaleState = false;
bool public revealed = false;
string private base_URI_tail = ".json";
string private hiddenURI = "ipfs://Qmc9sSJVnFgDPmbJz1fLiYmHsMoTWTaDWxkwadV49WgvuB/hidden.json";
constructor() ERC721("SmolPunks", "SMOL") {
}
function _hiddenURI() internal view returns (string memory) {
}
function _baseURI() internal view override returns (string memory) {
}
function setBaseURI(string calldata newBaseURI) external onlyOwner {
}
function tokenURI(uint256 _tokenId) public view override returns (string memory) {
require(<FILL_ME>)
if(revealed == false) {
return hiddenURI;
}
string memory currentBaseURI = _baseURI();
return string(abi.encodePacked(currentBaseURI, Strings.toString(_tokenId), base_URI_tail));
}
function reveal() public onlyOwner returns(bool) {
}
function changeStatePublicSale() public onlyOwner returns(bool) {
}
function mint(uint numberOfTokens) external payable {
}
function mintInternal(address wallet, uint amount) internal {
}
function reserve(uint256 numberOfTokens) external onlyOwner {
}
function setfreeAmount(uint16 _newFreeMints) public onlyOwner() {
}
function totalSupply() public view returns (uint){
}
function withdraw() public onlyOwner {
}
}
| _exists(_tokenId),"ERC721Metadata: URI query for nonexistent token" | 6,810 | _exists(_tokenId) |
"Not enough tokens left" | pragma solidity ^0.8.0;
/**
* @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() {
}
/**
* @dev Returns the address of the current owner.
*/
function owner() public view virtual returns (address) {
}
/**
* @dev Throws if called by any account other than the owner.
*/
modifier onlyOwner() {
}
/**
* @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 {
}
/**
* @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 {
}
function _setOwner(address newOwner) private {
}
}
pragma solidity ^0.8.0;
contract Smol is Ownable, ERC721 {
using SafeMath for uint256;
using Counters for Counters.Counter;
Counters.Counter private _tokenIdCounter;
uint256 public mintPrice = .01 ether;
uint256 public maxSupply = 3333;
uint256 public freeMintAmount = 666;
uint256 private mintLimit = 3;
string private baseURI;
bool public publicSaleState = false;
bool public revealed = false;
string private base_URI_tail = ".json";
string private hiddenURI = "ipfs://Qmc9sSJVnFgDPmbJz1fLiYmHsMoTWTaDWxkwadV49WgvuB/hidden.json";
constructor() ERC721("SmolPunks", "SMOL") {
}
function _hiddenURI() internal view returns (string memory) {
}
function _baseURI() internal view override returns (string memory) {
}
function setBaseURI(string calldata newBaseURI) external onlyOwner {
}
function tokenURI(uint256 _tokenId) public view override returns (string memory) {
}
function reveal() public onlyOwner returns(bool) {
}
function changeStatePublicSale() public onlyOwner returns(bool) {
}
function mint(uint numberOfTokens) external payable {
require(publicSaleState, "Sale is not active");
require(<FILL_ME>)
require(numberOfTokens <= mintLimit, "Too many tokens for one transaction");
if(_tokenIdCounter.current() >= freeMintAmount){
require(msg.value >= mintPrice.mul(numberOfTokens), "Insufficient payment");
}
mintInternal(msg.sender, numberOfTokens);
}
function mintInternal(address wallet, uint amount) internal {
}
function reserve(uint256 numberOfTokens) external onlyOwner {
}
function setfreeAmount(uint16 _newFreeMints) public onlyOwner() {
}
function totalSupply() public view returns (uint){
}
function withdraw() public onlyOwner {
}
}
| _tokenIdCounter.current()<=maxSupply,"Not enough tokens left" | 6,810 | _tokenIdCounter.current()<=maxSupply |
"Not enough tokens left" | pragma solidity ^0.8.0;
/**
* @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() {
}
/**
* @dev Returns the address of the current owner.
*/
function owner() public view virtual returns (address) {
}
/**
* @dev Throws if called by any account other than the owner.
*/
modifier onlyOwner() {
}
/**
* @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 {
}
/**
* @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 {
}
function _setOwner(address newOwner) private {
}
}
pragma solidity ^0.8.0;
contract Smol is Ownable, ERC721 {
using SafeMath for uint256;
using Counters for Counters.Counter;
Counters.Counter private _tokenIdCounter;
uint256 public mintPrice = .01 ether;
uint256 public maxSupply = 3333;
uint256 public freeMintAmount = 666;
uint256 private mintLimit = 3;
string private baseURI;
bool public publicSaleState = false;
bool public revealed = false;
string private base_URI_tail = ".json";
string private hiddenURI = "ipfs://Qmc9sSJVnFgDPmbJz1fLiYmHsMoTWTaDWxkwadV49WgvuB/hidden.json";
constructor() ERC721("SmolPunks", "SMOL") {
}
function _hiddenURI() internal view returns (string memory) {
}
function _baseURI() internal view override returns (string memory) {
}
function setBaseURI(string calldata newBaseURI) external onlyOwner {
}
function tokenURI(uint256 _tokenId) public view override returns (string memory) {
}
function reveal() public onlyOwner returns(bool) {
}
function changeStatePublicSale() public onlyOwner returns(bool) {
}
function mint(uint numberOfTokens) external payable {
}
function mintInternal(address wallet, uint amount) internal {
uint currentTokenSupply = _tokenIdCounter.current();
require(<FILL_ME>)
for(uint i = 0; i< amount; i++){
currentTokenSupply++;
_safeMint(wallet, currentTokenSupply);
_tokenIdCounter.increment();
}
}
function reserve(uint256 numberOfTokens) external onlyOwner {
}
function setfreeAmount(uint16 _newFreeMints) public onlyOwner() {
}
function totalSupply() public view returns (uint){
}
function withdraw() public onlyOwner {
}
}
| currentTokenSupply.add(amount)<=maxSupply,"Not enough tokens left" | 6,810 | currentTokenSupply.add(amount)<=maxSupply |
"No balance to withdraw" | pragma solidity ^0.8.0;
/**
* @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() {
}
/**
* @dev Returns the address of the current owner.
*/
function owner() public view virtual returns (address) {
}
/**
* @dev Throws if called by any account other than the owner.
*/
modifier onlyOwner() {
}
/**
* @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 {
}
/**
* @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 {
}
function _setOwner(address newOwner) private {
}
}
pragma solidity ^0.8.0;
contract Smol is Ownable, ERC721 {
using SafeMath for uint256;
using Counters for Counters.Counter;
Counters.Counter private _tokenIdCounter;
uint256 public mintPrice = .01 ether;
uint256 public maxSupply = 3333;
uint256 public freeMintAmount = 666;
uint256 private mintLimit = 3;
string private baseURI;
bool public publicSaleState = false;
bool public revealed = false;
string private base_URI_tail = ".json";
string private hiddenURI = "ipfs://Qmc9sSJVnFgDPmbJz1fLiYmHsMoTWTaDWxkwadV49WgvuB/hidden.json";
constructor() ERC721("SmolPunks", "SMOL") {
}
function _hiddenURI() internal view returns (string memory) {
}
function _baseURI() internal view override returns (string memory) {
}
function setBaseURI(string calldata newBaseURI) external onlyOwner {
}
function tokenURI(uint256 _tokenId) public view override returns (string memory) {
}
function reveal() public onlyOwner returns(bool) {
}
function changeStatePublicSale() public onlyOwner returns(bool) {
}
function mint(uint numberOfTokens) external payable {
}
function mintInternal(address wallet, uint amount) internal {
}
function reserve(uint256 numberOfTokens) external onlyOwner {
}
function setfreeAmount(uint16 _newFreeMints) public onlyOwner() {
}
function totalSupply() public view returns (uint){
}
function withdraw() public onlyOwner {
require(<FILL_ME>)
payable(owner()).transfer(address(this).balance);
}
}
| address(this).balance>0,"No balance to withdraw" | 6,810 | address(this).balance>0 |
null | /*
Copyright 2017 Dharma Labs Inc.
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
*/
pragma solidity 0.4.18;
/**
* Contains functionality for collateralizing assets, by transferring them from
* a debtor address to this contract as a custodian.
*
* Authors (in no particular order): nadavhollander, saturnial, jdkanani, graemecode
*/
contract Collateralizer is Pausable, PermissionEvents {
using PermissionsLib for PermissionsLib.Permissions;
using SafeMath for uint;
address public debtKernelAddress;
DebtRegistry public debtRegistry;
TokenRegistry public tokenRegistry;
TokenTransferProxy public tokenTransferProxy;
// Collateralizer here refers to the owner of the asset that is being collateralized.
mapping(bytes32 => address) public agreementToCollateralizer;
PermissionsLib.Permissions internal collateralizationPermissions;
uint public constant SECONDS_IN_DAY = 24*60*60;
string public constant CONTEXT = "collateralizer";
event CollateralLocked(
bytes32 indexed agreementID,
address indexed token,
uint amount
);
event CollateralReturned(
bytes32 indexed agreementID,
address indexed collateralizer,
address token,
uint amount
);
event CollateralSeized(
bytes32 indexed agreementID,
address indexed beneficiary,
address token,
uint amount
);
modifier onlyAuthorizedToCollateralize() {
require(<FILL_ME>)
_;
}
function Collateralizer(
address _debtKernel,
address _debtRegistry,
address _tokenRegistry,
address _tokenTransferProxy
) public {
}
/**
* Transfers collateral from the debtor to the current contract, as custodian.
*
* @param agreementId bytes32 The debt agreement's ID
* @param collateralizer address The owner of the asset being collateralized
*/
function collateralize(
bytes32 agreementId,
address collateralizer
)
public
onlyAuthorizedToCollateralize
whenNotPaused
returns (bool _success)
{
}
/**
* Returns collateral to the debt agreement's original collateralizer
* if and only if the debt agreement's term has lapsed and
* the total expected repayment value has been repaid.
*
* @param agreementId bytes32 The debt agreement's ID
*/
function returnCollateral(
bytes32 agreementId
)
public
whenNotPaused
{
}
/**
* Seizes the collateral from the given debt agreement and
* transfers it to the debt agreement's current beneficiary
* (i.e. the person who "owns" the debt).
*
* @param agreementId bytes32 The debt agreement's ID
*/
function seizeCollateral(
bytes32 agreementId
)
public
whenNotPaused
{
}
/**
* Adds an address to the list of agents authorized
* to invoke the `collateralize` function.
*/
function addAuthorizedCollateralizeAgent(address agent)
public
onlyOwner
{
}
/**
* Removes an address from the list of agents authorized
* to invoke the `collateralize` function.
*/
function revokeCollateralizeAuthorization(address agent)
public
onlyOwner
{
}
/**
* Returns the list of agents authorized to invoke the 'collateralize' function.
*/
function getAuthorizedCollateralizeAgents()
public
view
returns(address[])
{
}
/**
* Unpacks collateralization-specific parameters from their tightly-packed
* representation in a terms contract parameter string.
*
* For collateralized terms contracts, we reserve the lowest order 108 bits
* of the terms contract parameters for parameters relevant to collateralization.
*
* Contracts that inherit from the Collateralized terms contract
* can encode whichever parameter schema they please in the remaining
* space of the terms contract parameters.
* The 108 bits are encoded as follows (from higher order bits to lower order bits):
*
* 8 bits - Collateral Token (encoded by its unsigned integer index in the TokenRegistry contract)
* 92 bits - Collateral Amount (encoded as an unsigned integer)
* 8 bits - Grace Period* Length (encoded as an unsigned integer)
*
* * = The "Grace" Period is the number of days a debtor has between
* when they fall behind on an expected payment and when their collateral
* can be seized by the creditor.
*/
function unpackCollateralParametersFromBytes(bytes32 parameters)
public
pure
returns (uint, uint, uint)
{
}
function timestampAdjustedForGracePeriod(uint gracePeriodInDays)
public
view
returns (uint)
{
}
function retrieveCollateralParameters(bytes32 agreementId)
internal
view
returns (
address _collateralToken,
uint _collateralAmount,
uint _gracePeriodInDays,
TermsContract _termsContract
)
{
}
}
| collateralizationPermissions.isAuthorized(msg.sender) | 6,821 | collateralizationPermissions.isAuthorized(msg.sender) |
null | /*
Copyright 2017 Dharma Labs Inc.
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
*/
pragma solidity 0.4.18;
/**
* Contains functionality for collateralizing assets, by transferring them from
* a debtor address to this contract as a custodian.
*
* Authors (in no particular order): nadavhollander, saturnial, jdkanani, graemecode
*/
contract Collateralizer is Pausable, PermissionEvents {
using PermissionsLib for PermissionsLib.Permissions;
using SafeMath for uint;
address public debtKernelAddress;
DebtRegistry public debtRegistry;
TokenRegistry public tokenRegistry;
TokenTransferProxy public tokenTransferProxy;
// Collateralizer here refers to the owner of the asset that is being collateralized.
mapping(bytes32 => address) public agreementToCollateralizer;
PermissionsLib.Permissions internal collateralizationPermissions;
uint public constant SECONDS_IN_DAY = 24*60*60;
string public constant CONTEXT = "collateralizer";
event CollateralLocked(
bytes32 indexed agreementID,
address indexed token,
uint amount
);
event CollateralReturned(
bytes32 indexed agreementID,
address indexed collateralizer,
address token,
uint amount
);
event CollateralSeized(
bytes32 indexed agreementID,
address indexed beneficiary,
address token,
uint amount
);
modifier onlyAuthorizedToCollateralize() {
}
function Collateralizer(
address _debtKernel,
address _debtRegistry,
address _tokenRegistry,
address _tokenTransferProxy
) public {
}
/**
* Transfers collateral from the debtor to the current contract, as custodian.
*
* @param agreementId bytes32 The debt agreement's ID
* @param collateralizer address The owner of the asset being collateralized
*/
function collateralize(
bytes32 agreementId,
address collateralizer
)
public
onlyAuthorizedToCollateralize
whenNotPaused
returns (bool _success)
{
// The token in which collateral is denominated
address collateralToken;
// The amount being put up for collateral
uint collateralAmount;
// The number of days a debtor has after a debt enters default
// before their collateral is eligible for seizure.
uint gracePeriodInDays;
// The terms contract according to which this asset is being collateralized.
TermsContract termsContract;
// Fetch all relevant collateralization parameters
(
collateralToken,
collateralAmount,
gracePeriodInDays,
termsContract
) = retrieveCollateralParameters(agreementId);
require(termsContract == msg.sender);
require(collateralAmount > 0);
require(collateralToken != address(0));
/*
Ensure that the agreement has not already been collateralized.
If the agreement has already been collateralized, this check will fail
because any valid collateralization must have some sort of valid
address associated with it as a collateralizer. Given that it is impossible
to send transactions from address 0x0, this check will only fail
when the agreement is already collateralized.
*/
require(<FILL_ME>)
ERC20 erc20token = ERC20(collateralToken);
address custodian = address(this);
/*
The collateralizer must have sufficient balance equal to or greater
than the amount being put up for collateral.
*/
require(erc20token.balanceOf(collateralizer) >= collateralAmount);
/*
The proxy must have an allowance granted by the collateralizer equal
to or greater than the amount being put up for collateral.
*/
require(erc20token.allowance(collateralizer, tokenTransferProxy) >= collateralAmount);
// store collaterallizer in mapping, effectively demarcating that the
// agreement is now collateralized.
agreementToCollateralizer[agreementId] = collateralizer;
// the collateral must be successfully transferred to this contract, via a proxy.
require(tokenTransferProxy.transferFrom(
erc20token,
collateralizer,
custodian,
collateralAmount
));
// emit event that collateral has been secured.
CollateralLocked(agreementId, collateralToken, collateralAmount);
return true;
}
/**
* Returns collateral to the debt agreement's original collateralizer
* if and only if the debt agreement's term has lapsed and
* the total expected repayment value has been repaid.
*
* @param agreementId bytes32 The debt agreement's ID
*/
function returnCollateral(
bytes32 agreementId
)
public
whenNotPaused
{
}
/**
* Seizes the collateral from the given debt agreement and
* transfers it to the debt agreement's current beneficiary
* (i.e. the person who "owns" the debt).
*
* @param agreementId bytes32 The debt agreement's ID
*/
function seizeCollateral(
bytes32 agreementId
)
public
whenNotPaused
{
}
/**
* Adds an address to the list of agents authorized
* to invoke the `collateralize` function.
*/
function addAuthorizedCollateralizeAgent(address agent)
public
onlyOwner
{
}
/**
* Removes an address from the list of agents authorized
* to invoke the `collateralize` function.
*/
function revokeCollateralizeAuthorization(address agent)
public
onlyOwner
{
}
/**
* Returns the list of agents authorized to invoke the 'collateralize' function.
*/
function getAuthorizedCollateralizeAgents()
public
view
returns(address[])
{
}
/**
* Unpacks collateralization-specific parameters from their tightly-packed
* representation in a terms contract parameter string.
*
* For collateralized terms contracts, we reserve the lowest order 108 bits
* of the terms contract parameters for parameters relevant to collateralization.
*
* Contracts that inherit from the Collateralized terms contract
* can encode whichever parameter schema they please in the remaining
* space of the terms contract parameters.
* The 108 bits are encoded as follows (from higher order bits to lower order bits):
*
* 8 bits - Collateral Token (encoded by its unsigned integer index in the TokenRegistry contract)
* 92 bits - Collateral Amount (encoded as an unsigned integer)
* 8 bits - Grace Period* Length (encoded as an unsigned integer)
*
* * = The "Grace" Period is the number of days a debtor has between
* when they fall behind on an expected payment and when their collateral
* can be seized by the creditor.
*/
function unpackCollateralParametersFromBytes(bytes32 parameters)
public
pure
returns (uint, uint, uint)
{
}
function timestampAdjustedForGracePeriod(uint gracePeriodInDays)
public
view
returns (uint)
{
}
function retrieveCollateralParameters(bytes32 agreementId)
internal
view
returns (
address _collateralToken,
uint _collateralAmount,
uint _gracePeriodInDays,
TermsContract _termsContract
)
{
}
}
| agreementToCollateralizer[agreementId]==address(0) | 6,821 | agreementToCollateralizer[agreementId]==address(0) |
null | /*
Copyright 2017 Dharma Labs Inc.
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
*/
pragma solidity 0.4.18;
/**
* Contains functionality for collateralizing assets, by transferring them from
* a debtor address to this contract as a custodian.
*
* Authors (in no particular order): nadavhollander, saturnial, jdkanani, graemecode
*/
contract Collateralizer is Pausable, PermissionEvents {
using PermissionsLib for PermissionsLib.Permissions;
using SafeMath for uint;
address public debtKernelAddress;
DebtRegistry public debtRegistry;
TokenRegistry public tokenRegistry;
TokenTransferProxy public tokenTransferProxy;
// Collateralizer here refers to the owner of the asset that is being collateralized.
mapping(bytes32 => address) public agreementToCollateralizer;
PermissionsLib.Permissions internal collateralizationPermissions;
uint public constant SECONDS_IN_DAY = 24*60*60;
string public constant CONTEXT = "collateralizer";
event CollateralLocked(
bytes32 indexed agreementID,
address indexed token,
uint amount
);
event CollateralReturned(
bytes32 indexed agreementID,
address indexed collateralizer,
address token,
uint amount
);
event CollateralSeized(
bytes32 indexed agreementID,
address indexed beneficiary,
address token,
uint amount
);
modifier onlyAuthorizedToCollateralize() {
}
function Collateralizer(
address _debtKernel,
address _debtRegistry,
address _tokenRegistry,
address _tokenTransferProxy
) public {
}
/**
* Transfers collateral from the debtor to the current contract, as custodian.
*
* @param agreementId bytes32 The debt agreement's ID
* @param collateralizer address The owner of the asset being collateralized
*/
function collateralize(
bytes32 agreementId,
address collateralizer
)
public
onlyAuthorizedToCollateralize
whenNotPaused
returns (bool _success)
{
// The token in which collateral is denominated
address collateralToken;
// The amount being put up for collateral
uint collateralAmount;
// The number of days a debtor has after a debt enters default
// before their collateral is eligible for seizure.
uint gracePeriodInDays;
// The terms contract according to which this asset is being collateralized.
TermsContract termsContract;
// Fetch all relevant collateralization parameters
(
collateralToken,
collateralAmount,
gracePeriodInDays,
termsContract
) = retrieveCollateralParameters(agreementId);
require(termsContract == msg.sender);
require(collateralAmount > 0);
require(collateralToken != address(0));
/*
Ensure that the agreement has not already been collateralized.
If the agreement has already been collateralized, this check will fail
because any valid collateralization must have some sort of valid
address associated with it as a collateralizer. Given that it is impossible
to send transactions from address 0x0, this check will only fail
when the agreement is already collateralized.
*/
require(agreementToCollateralizer[agreementId] == address(0));
ERC20 erc20token = ERC20(collateralToken);
address custodian = address(this);
/*
The collateralizer must have sufficient balance equal to or greater
than the amount being put up for collateral.
*/
require(<FILL_ME>)
/*
The proxy must have an allowance granted by the collateralizer equal
to or greater than the amount being put up for collateral.
*/
require(erc20token.allowance(collateralizer, tokenTransferProxy) >= collateralAmount);
// store collaterallizer in mapping, effectively demarcating that the
// agreement is now collateralized.
agreementToCollateralizer[agreementId] = collateralizer;
// the collateral must be successfully transferred to this contract, via a proxy.
require(tokenTransferProxy.transferFrom(
erc20token,
collateralizer,
custodian,
collateralAmount
));
// emit event that collateral has been secured.
CollateralLocked(agreementId, collateralToken, collateralAmount);
return true;
}
/**
* Returns collateral to the debt agreement's original collateralizer
* if and only if the debt agreement's term has lapsed and
* the total expected repayment value has been repaid.
*
* @param agreementId bytes32 The debt agreement's ID
*/
function returnCollateral(
bytes32 agreementId
)
public
whenNotPaused
{
}
/**
* Seizes the collateral from the given debt agreement and
* transfers it to the debt agreement's current beneficiary
* (i.e. the person who "owns" the debt).
*
* @param agreementId bytes32 The debt agreement's ID
*/
function seizeCollateral(
bytes32 agreementId
)
public
whenNotPaused
{
}
/**
* Adds an address to the list of agents authorized
* to invoke the `collateralize` function.
*/
function addAuthorizedCollateralizeAgent(address agent)
public
onlyOwner
{
}
/**
* Removes an address from the list of agents authorized
* to invoke the `collateralize` function.
*/
function revokeCollateralizeAuthorization(address agent)
public
onlyOwner
{
}
/**
* Returns the list of agents authorized to invoke the 'collateralize' function.
*/
function getAuthorizedCollateralizeAgents()
public
view
returns(address[])
{
}
/**
* Unpacks collateralization-specific parameters from their tightly-packed
* representation in a terms contract parameter string.
*
* For collateralized terms contracts, we reserve the lowest order 108 bits
* of the terms contract parameters for parameters relevant to collateralization.
*
* Contracts that inherit from the Collateralized terms contract
* can encode whichever parameter schema they please in the remaining
* space of the terms contract parameters.
* The 108 bits are encoded as follows (from higher order bits to lower order bits):
*
* 8 bits - Collateral Token (encoded by its unsigned integer index in the TokenRegistry contract)
* 92 bits - Collateral Amount (encoded as an unsigned integer)
* 8 bits - Grace Period* Length (encoded as an unsigned integer)
*
* * = The "Grace" Period is the number of days a debtor has between
* when they fall behind on an expected payment and when their collateral
* can be seized by the creditor.
*/
function unpackCollateralParametersFromBytes(bytes32 parameters)
public
pure
returns (uint, uint, uint)
{
}
function timestampAdjustedForGracePeriod(uint gracePeriodInDays)
public
view
returns (uint)
{
}
function retrieveCollateralParameters(bytes32 agreementId)
internal
view
returns (
address _collateralToken,
uint _collateralAmount,
uint _gracePeriodInDays,
TermsContract _termsContract
)
{
}
}
| erc20token.balanceOf(collateralizer)>=collateralAmount | 6,821 | erc20token.balanceOf(collateralizer)>=collateralAmount |
null | /*
Copyright 2017 Dharma Labs Inc.
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
*/
pragma solidity 0.4.18;
/**
* Contains functionality for collateralizing assets, by transferring them from
* a debtor address to this contract as a custodian.
*
* Authors (in no particular order): nadavhollander, saturnial, jdkanani, graemecode
*/
contract Collateralizer is Pausable, PermissionEvents {
using PermissionsLib for PermissionsLib.Permissions;
using SafeMath for uint;
address public debtKernelAddress;
DebtRegistry public debtRegistry;
TokenRegistry public tokenRegistry;
TokenTransferProxy public tokenTransferProxy;
// Collateralizer here refers to the owner of the asset that is being collateralized.
mapping(bytes32 => address) public agreementToCollateralizer;
PermissionsLib.Permissions internal collateralizationPermissions;
uint public constant SECONDS_IN_DAY = 24*60*60;
string public constant CONTEXT = "collateralizer";
event CollateralLocked(
bytes32 indexed agreementID,
address indexed token,
uint amount
);
event CollateralReturned(
bytes32 indexed agreementID,
address indexed collateralizer,
address token,
uint amount
);
event CollateralSeized(
bytes32 indexed agreementID,
address indexed beneficiary,
address token,
uint amount
);
modifier onlyAuthorizedToCollateralize() {
}
function Collateralizer(
address _debtKernel,
address _debtRegistry,
address _tokenRegistry,
address _tokenTransferProxy
) public {
}
/**
* Transfers collateral from the debtor to the current contract, as custodian.
*
* @param agreementId bytes32 The debt agreement's ID
* @param collateralizer address The owner of the asset being collateralized
*/
function collateralize(
bytes32 agreementId,
address collateralizer
)
public
onlyAuthorizedToCollateralize
whenNotPaused
returns (bool _success)
{
// The token in which collateral is denominated
address collateralToken;
// The amount being put up for collateral
uint collateralAmount;
// The number of days a debtor has after a debt enters default
// before their collateral is eligible for seizure.
uint gracePeriodInDays;
// The terms contract according to which this asset is being collateralized.
TermsContract termsContract;
// Fetch all relevant collateralization parameters
(
collateralToken,
collateralAmount,
gracePeriodInDays,
termsContract
) = retrieveCollateralParameters(agreementId);
require(termsContract == msg.sender);
require(collateralAmount > 0);
require(collateralToken != address(0));
/*
Ensure that the agreement has not already been collateralized.
If the agreement has already been collateralized, this check will fail
because any valid collateralization must have some sort of valid
address associated with it as a collateralizer. Given that it is impossible
to send transactions from address 0x0, this check will only fail
when the agreement is already collateralized.
*/
require(agreementToCollateralizer[agreementId] == address(0));
ERC20 erc20token = ERC20(collateralToken);
address custodian = address(this);
/*
The collateralizer must have sufficient balance equal to or greater
than the amount being put up for collateral.
*/
require(erc20token.balanceOf(collateralizer) >= collateralAmount);
/*
The proxy must have an allowance granted by the collateralizer equal
to or greater than the amount being put up for collateral.
*/
require(<FILL_ME>)
// store collaterallizer in mapping, effectively demarcating that the
// agreement is now collateralized.
agreementToCollateralizer[agreementId] = collateralizer;
// the collateral must be successfully transferred to this contract, via a proxy.
require(tokenTransferProxy.transferFrom(
erc20token,
collateralizer,
custodian,
collateralAmount
));
// emit event that collateral has been secured.
CollateralLocked(agreementId, collateralToken, collateralAmount);
return true;
}
/**
* Returns collateral to the debt agreement's original collateralizer
* if and only if the debt agreement's term has lapsed and
* the total expected repayment value has been repaid.
*
* @param agreementId bytes32 The debt agreement's ID
*/
function returnCollateral(
bytes32 agreementId
)
public
whenNotPaused
{
}
/**
* Seizes the collateral from the given debt agreement and
* transfers it to the debt agreement's current beneficiary
* (i.e. the person who "owns" the debt).
*
* @param agreementId bytes32 The debt agreement's ID
*/
function seizeCollateral(
bytes32 agreementId
)
public
whenNotPaused
{
}
/**
* Adds an address to the list of agents authorized
* to invoke the `collateralize` function.
*/
function addAuthorizedCollateralizeAgent(address agent)
public
onlyOwner
{
}
/**
* Removes an address from the list of agents authorized
* to invoke the `collateralize` function.
*/
function revokeCollateralizeAuthorization(address agent)
public
onlyOwner
{
}
/**
* Returns the list of agents authorized to invoke the 'collateralize' function.
*/
function getAuthorizedCollateralizeAgents()
public
view
returns(address[])
{
}
/**
* Unpacks collateralization-specific parameters from their tightly-packed
* representation in a terms contract parameter string.
*
* For collateralized terms contracts, we reserve the lowest order 108 bits
* of the terms contract parameters for parameters relevant to collateralization.
*
* Contracts that inherit from the Collateralized terms contract
* can encode whichever parameter schema they please in the remaining
* space of the terms contract parameters.
* The 108 bits are encoded as follows (from higher order bits to lower order bits):
*
* 8 bits - Collateral Token (encoded by its unsigned integer index in the TokenRegistry contract)
* 92 bits - Collateral Amount (encoded as an unsigned integer)
* 8 bits - Grace Period* Length (encoded as an unsigned integer)
*
* * = The "Grace" Period is the number of days a debtor has between
* when they fall behind on an expected payment and when their collateral
* can be seized by the creditor.
*/
function unpackCollateralParametersFromBytes(bytes32 parameters)
public
pure
returns (uint, uint, uint)
{
}
function timestampAdjustedForGracePeriod(uint gracePeriodInDays)
public
view
returns (uint)
{
}
function retrieveCollateralParameters(bytes32 agreementId)
internal
view
returns (
address _collateralToken,
uint _collateralAmount,
uint _gracePeriodInDays,
TermsContract _termsContract
)
{
}
}
| erc20token.allowance(collateralizer,tokenTransferProxy)>=collateralAmount | 6,821 | erc20token.allowance(collateralizer,tokenTransferProxy)>=collateralAmount |
null | /*
Copyright 2017 Dharma Labs Inc.
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
*/
pragma solidity 0.4.18;
/**
* Contains functionality for collateralizing assets, by transferring them from
* a debtor address to this contract as a custodian.
*
* Authors (in no particular order): nadavhollander, saturnial, jdkanani, graemecode
*/
contract Collateralizer is Pausable, PermissionEvents {
using PermissionsLib for PermissionsLib.Permissions;
using SafeMath for uint;
address public debtKernelAddress;
DebtRegistry public debtRegistry;
TokenRegistry public tokenRegistry;
TokenTransferProxy public tokenTransferProxy;
// Collateralizer here refers to the owner of the asset that is being collateralized.
mapping(bytes32 => address) public agreementToCollateralizer;
PermissionsLib.Permissions internal collateralizationPermissions;
uint public constant SECONDS_IN_DAY = 24*60*60;
string public constant CONTEXT = "collateralizer";
event CollateralLocked(
bytes32 indexed agreementID,
address indexed token,
uint amount
);
event CollateralReturned(
bytes32 indexed agreementID,
address indexed collateralizer,
address token,
uint amount
);
event CollateralSeized(
bytes32 indexed agreementID,
address indexed beneficiary,
address token,
uint amount
);
modifier onlyAuthorizedToCollateralize() {
}
function Collateralizer(
address _debtKernel,
address _debtRegistry,
address _tokenRegistry,
address _tokenTransferProxy
) public {
}
/**
* Transfers collateral from the debtor to the current contract, as custodian.
*
* @param agreementId bytes32 The debt agreement's ID
* @param collateralizer address The owner of the asset being collateralized
*/
function collateralize(
bytes32 agreementId,
address collateralizer
)
public
onlyAuthorizedToCollateralize
whenNotPaused
returns (bool _success)
{
// The token in which collateral is denominated
address collateralToken;
// The amount being put up for collateral
uint collateralAmount;
// The number of days a debtor has after a debt enters default
// before their collateral is eligible for seizure.
uint gracePeriodInDays;
// The terms contract according to which this asset is being collateralized.
TermsContract termsContract;
// Fetch all relevant collateralization parameters
(
collateralToken,
collateralAmount,
gracePeriodInDays,
termsContract
) = retrieveCollateralParameters(agreementId);
require(termsContract == msg.sender);
require(collateralAmount > 0);
require(collateralToken != address(0));
/*
Ensure that the agreement has not already been collateralized.
If the agreement has already been collateralized, this check will fail
because any valid collateralization must have some sort of valid
address associated with it as a collateralizer. Given that it is impossible
to send transactions from address 0x0, this check will only fail
when the agreement is already collateralized.
*/
require(agreementToCollateralizer[agreementId] == address(0));
ERC20 erc20token = ERC20(collateralToken);
address custodian = address(this);
/*
The collateralizer must have sufficient balance equal to or greater
than the amount being put up for collateral.
*/
require(erc20token.balanceOf(collateralizer) >= collateralAmount);
/*
The proxy must have an allowance granted by the collateralizer equal
to or greater than the amount being put up for collateral.
*/
require(erc20token.allowance(collateralizer, tokenTransferProxy) >= collateralAmount);
// store collaterallizer in mapping, effectively demarcating that the
// agreement is now collateralized.
agreementToCollateralizer[agreementId] = collateralizer;
// the collateral must be successfully transferred to this contract, via a proxy.
require(<FILL_ME>)
// emit event that collateral has been secured.
CollateralLocked(agreementId, collateralToken, collateralAmount);
return true;
}
/**
* Returns collateral to the debt agreement's original collateralizer
* if and only if the debt agreement's term has lapsed and
* the total expected repayment value has been repaid.
*
* @param agreementId bytes32 The debt agreement's ID
*/
function returnCollateral(
bytes32 agreementId
)
public
whenNotPaused
{
}
/**
* Seizes the collateral from the given debt agreement and
* transfers it to the debt agreement's current beneficiary
* (i.e. the person who "owns" the debt).
*
* @param agreementId bytes32 The debt agreement's ID
*/
function seizeCollateral(
bytes32 agreementId
)
public
whenNotPaused
{
}
/**
* Adds an address to the list of agents authorized
* to invoke the `collateralize` function.
*/
function addAuthorizedCollateralizeAgent(address agent)
public
onlyOwner
{
}
/**
* Removes an address from the list of agents authorized
* to invoke the `collateralize` function.
*/
function revokeCollateralizeAuthorization(address agent)
public
onlyOwner
{
}
/**
* Returns the list of agents authorized to invoke the 'collateralize' function.
*/
function getAuthorizedCollateralizeAgents()
public
view
returns(address[])
{
}
/**
* Unpacks collateralization-specific parameters from their tightly-packed
* representation in a terms contract parameter string.
*
* For collateralized terms contracts, we reserve the lowest order 108 bits
* of the terms contract parameters for parameters relevant to collateralization.
*
* Contracts that inherit from the Collateralized terms contract
* can encode whichever parameter schema they please in the remaining
* space of the terms contract parameters.
* The 108 bits are encoded as follows (from higher order bits to lower order bits):
*
* 8 bits - Collateral Token (encoded by its unsigned integer index in the TokenRegistry contract)
* 92 bits - Collateral Amount (encoded as an unsigned integer)
* 8 bits - Grace Period* Length (encoded as an unsigned integer)
*
* * = The "Grace" Period is the number of days a debtor has between
* when they fall behind on an expected payment and when their collateral
* can be seized by the creditor.
*/
function unpackCollateralParametersFromBytes(bytes32 parameters)
public
pure
returns (uint, uint, uint)
{
}
function timestampAdjustedForGracePeriod(uint gracePeriodInDays)
public
view
returns (uint)
{
}
function retrieveCollateralParameters(bytes32 agreementId)
internal
view
returns (
address _collateralToken,
uint _collateralAmount,
uint _gracePeriodInDays,
TermsContract _termsContract
)
{
}
}
| tokenTransferProxy.transferFrom(erc20token,collateralizer,custodian,collateralAmount) | 6,821 | tokenTransferProxy.transferFrom(erc20token,collateralizer,custodian,collateralAmount) |
null | /*
Copyright 2017 Dharma Labs Inc.
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
*/
pragma solidity 0.4.18;
/**
* Contains functionality for collateralizing assets, by transferring them from
* a debtor address to this contract as a custodian.
*
* Authors (in no particular order): nadavhollander, saturnial, jdkanani, graemecode
*/
contract Collateralizer is Pausable, PermissionEvents {
using PermissionsLib for PermissionsLib.Permissions;
using SafeMath for uint;
address public debtKernelAddress;
DebtRegistry public debtRegistry;
TokenRegistry public tokenRegistry;
TokenTransferProxy public tokenTransferProxy;
// Collateralizer here refers to the owner of the asset that is being collateralized.
mapping(bytes32 => address) public agreementToCollateralizer;
PermissionsLib.Permissions internal collateralizationPermissions;
uint public constant SECONDS_IN_DAY = 24*60*60;
string public constant CONTEXT = "collateralizer";
event CollateralLocked(
bytes32 indexed agreementID,
address indexed token,
uint amount
);
event CollateralReturned(
bytes32 indexed agreementID,
address indexed collateralizer,
address token,
uint amount
);
event CollateralSeized(
bytes32 indexed agreementID,
address indexed beneficiary,
address token,
uint amount
);
modifier onlyAuthorizedToCollateralize() {
}
function Collateralizer(
address _debtKernel,
address _debtRegistry,
address _tokenRegistry,
address _tokenTransferProxy
) public {
}
/**
* Transfers collateral from the debtor to the current contract, as custodian.
*
* @param agreementId bytes32 The debt agreement's ID
* @param collateralizer address The owner of the asset being collateralized
*/
function collateralize(
bytes32 agreementId,
address collateralizer
)
public
onlyAuthorizedToCollateralize
whenNotPaused
returns (bool _success)
{
}
/**
* Returns collateral to the debt agreement's original collateralizer
* if and only if the debt agreement's term has lapsed and
* the total expected repayment value has been repaid.
*
* @param agreementId bytes32 The debt agreement's ID
*/
function returnCollateral(
bytes32 agreementId
)
public
whenNotPaused
{
// The token in which collateral is denominated
address collateralToken;
// The amount being put up for collateral
uint collateralAmount;
// The number of days a debtor has after a debt enters default
// before their collateral is eligible for seizure.
uint gracePeriodInDays;
// The terms contract according to which this asset is being collateralized.
TermsContract termsContract;
// Fetch all relevant collateralization parameters.
(
collateralToken,
collateralAmount,
gracePeriodInDays,
termsContract
) = retrieveCollateralParameters(agreementId);
// Ensure a valid form of collateral is tied to this agreement id
require(collateralAmount > 0);
require(collateralToken != address(0));
// Withdrawal can only occur if the collateral has yet to be withdrawn.
// When we withdraw collateral, we reset the collateral agreement
// in a gas-efficient manner by resetting the address of the collateralizer to 0
require(<FILL_ME>)
// Ensure that the debt is not in a state of default
require(
termsContract.getExpectedRepaymentValue(
agreementId,
termsContract.getTermEndTimestamp(agreementId)
) <= termsContract.getValueRepaidToDate(agreementId)
);
// determine collateralizer of the collateral.
address collateralizer = agreementToCollateralizer[agreementId];
// Mark agreement's collateral as withdrawn by setting the agreement's
// collateralizer to 0x0.
delete agreementToCollateralizer[agreementId];
// transfer the collateral this contract was holding in escrow back to collateralizer.
require(
ERC20(collateralToken).transfer(
collateralizer,
collateralAmount
)
);
// log the return event.
CollateralReturned(
agreementId,
collateralizer,
collateralToken,
collateralAmount
);
}
/**
* Seizes the collateral from the given debt agreement and
* transfers it to the debt agreement's current beneficiary
* (i.e. the person who "owns" the debt).
*
* @param agreementId bytes32 The debt agreement's ID
*/
function seizeCollateral(
bytes32 agreementId
)
public
whenNotPaused
{
}
/**
* Adds an address to the list of agents authorized
* to invoke the `collateralize` function.
*/
function addAuthorizedCollateralizeAgent(address agent)
public
onlyOwner
{
}
/**
* Removes an address from the list of agents authorized
* to invoke the `collateralize` function.
*/
function revokeCollateralizeAuthorization(address agent)
public
onlyOwner
{
}
/**
* Returns the list of agents authorized to invoke the 'collateralize' function.
*/
function getAuthorizedCollateralizeAgents()
public
view
returns(address[])
{
}
/**
* Unpacks collateralization-specific parameters from their tightly-packed
* representation in a terms contract parameter string.
*
* For collateralized terms contracts, we reserve the lowest order 108 bits
* of the terms contract parameters for parameters relevant to collateralization.
*
* Contracts that inherit from the Collateralized terms contract
* can encode whichever parameter schema they please in the remaining
* space of the terms contract parameters.
* The 108 bits are encoded as follows (from higher order bits to lower order bits):
*
* 8 bits - Collateral Token (encoded by its unsigned integer index in the TokenRegistry contract)
* 92 bits - Collateral Amount (encoded as an unsigned integer)
* 8 bits - Grace Period* Length (encoded as an unsigned integer)
*
* * = The "Grace" Period is the number of days a debtor has between
* when they fall behind on an expected payment and when their collateral
* can be seized by the creditor.
*/
function unpackCollateralParametersFromBytes(bytes32 parameters)
public
pure
returns (uint, uint, uint)
{
}
function timestampAdjustedForGracePeriod(uint gracePeriodInDays)
public
view
returns (uint)
{
}
function retrieveCollateralParameters(bytes32 agreementId)
internal
view
returns (
address _collateralToken,
uint _collateralAmount,
uint _gracePeriodInDays,
TermsContract _termsContract
)
{
}
}
| agreementToCollateralizer[agreementId]!=address(0) | 6,821 | agreementToCollateralizer[agreementId]!=address(0) |
null | /*
Copyright 2017 Dharma Labs Inc.
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
*/
pragma solidity 0.4.18;
/**
* Contains functionality for collateralizing assets, by transferring them from
* a debtor address to this contract as a custodian.
*
* Authors (in no particular order): nadavhollander, saturnial, jdkanani, graemecode
*/
contract Collateralizer is Pausable, PermissionEvents {
using PermissionsLib for PermissionsLib.Permissions;
using SafeMath for uint;
address public debtKernelAddress;
DebtRegistry public debtRegistry;
TokenRegistry public tokenRegistry;
TokenTransferProxy public tokenTransferProxy;
// Collateralizer here refers to the owner of the asset that is being collateralized.
mapping(bytes32 => address) public agreementToCollateralizer;
PermissionsLib.Permissions internal collateralizationPermissions;
uint public constant SECONDS_IN_DAY = 24*60*60;
string public constant CONTEXT = "collateralizer";
event CollateralLocked(
bytes32 indexed agreementID,
address indexed token,
uint amount
);
event CollateralReturned(
bytes32 indexed agreementID,
address indexed collateralizer,
address token,
uint amount
);
event CollateralSeized(
bytes32 indexed agreementID,
address indexed beneficiary,
address token,
uint amount
);
modifier onlyAuthorizedToCollateralize() {
}
function Collateralizer(
address _debtKernel,
address _debtRegistry,
address _tokenRegistry,
address _tokenTransferProxy
) public {
}
/**
* Transfers collateral from the debtor to the current contract, as custodian.
*
* @param agreementId bytes32 The debt agreement's ID
* @param collateralizer address The owner of the asset being collateralized
*/
function collateralize(
bytes32 agreementId,
address collateralizer
)
public
onlyAuthorizedToCollateralize
whenNotPaused
returns (bool _success)
{
}
/**
* Returns collateral to the debt agreement's original collateralizer
* if and only if the debt agreement's term has lapsed and
* the total expected repayment value has been repaid.
*
* @param agreementId bytes32 The debt agreement's ID
*/
function returnCollateral(
bytes32 agreementId
)
public
whenNotPaused
{
// The token in which collateral is denominated
address collateralToken;
// The amount being put up for collateral
uint collateralAmount;
// The number of days a debtor has after a debt enters default
// before their collateral is eligible for seizure.
uint gracePeriodInDays;
// The terms contract according to which this asset is being collateralized.
TermsContract termsContract;
// Fetch all relevant collateralization parameters.
(
collateralToken,
collateralAmount,
gracePeriodInDays,
termsContract
) = retrieveCollateralParameters(agreementId);
// Ensure a valid form of collateral is tied to this agreement id
require(collateralAmount > 0);
require(collateralToken != address(0));
// Withdrawal can only occur if the collateral has yet to be withdrawn.
// When we withdraw collateral, we reset the collateral agreement
// in a gas-efficient manner by resetting the address of the collateralizer to 0
require(agreementToCollateralizer[agreementId] != address(0));
// Ensure that the debt is not in a state of default
require(<FILL_ME>)
// determine collateralizer of the collateral.
address collateralizer = agreementToCollateralizer[agreementId];
// Mark agreement's collateral as withdrawn by setting the agreement's
// collateralizer to 0x0.
delete agreementToCollateralizer[agreementId];
// transfer the collateral this contract was holding in escrow back to collateralizer.
require(
ERC20(collateralToken).transfer(
collateralizer,
collateralAmount
)
);
// log the return event.
CollateralReturned(
agreementId,
collateralizer,
collateralToken,
collateralAmount
);
}
/**
* Seizes the collateral from the given debt agreement and
* transfers it to the debt agreement's current beneficiary
* (i.e. the person who "owns" the debt).
*
* @param agreementId bytes32 The debt agreement's ID
*/
function seizeCollateral(
bytes32 agreementId
)
public
whenNotPaused
{
}
/**
* Adds an address to the list of agents authorized
* to invoke the `collateralize` function.
*/
function addAuthorizedCollateralizeAgent(address agent)
public
onlyOwner
{
}
/**
* Removes an address from the list of agents authorized
* to invoke the `collateralize` function.
*/
function revokeCollateralizeAuthorization(address agent)
public
onlyOwner
{
}
/**
* Returns the list of agents authorized to invoke the 'collateralize' function.
*/
function getAuthorizedCollateralizeAgents()
public
view
returns(address[])
{
}
/**
* Unpacks collateralization-specific parameters from their tightly-packed
* representation in a terms contract parameter string.
*
* For collateralized terms contracts, we reserve the lowest order 108 bits
* of the terms contract parameters for parameters relevant to collateralization.
*
* Contracts that inherit from the Collateralized terms contract
* can encode whichever parameter schema they please in the remaining
* space of the terms contract parameters.
* The 108 bits are encoded as follows (from higher order bits to lower order bits):
*
* 8 bits - Collateral Token (encoded by its unsigned integer index in the TokenRegistry contract)
* 92 bits - Collateral Amount (encoded as an unsigned integer)
* 8 bits - Grace Period* Length (encoded as an unsigned integer)
*
* * = The "Grace" Period is the number of days a debtor has between
* when they fall behind on an expected payment and when their collateral
* can be seized by the creditor.
*/
function unpackCollateralParametersFromBytes(bytes32 parameters)
public
pure
returns (uint, uint, uint)
{
}
function timestampAdjustedForGracePeriod(uint gracePeriodInDays)
public
view
returns (uint)
{
}
function retrieveCollateralParameters(bytes32 agreementId)
internal
view
returns (
address _collateralToken,
uint _collateralAmount,
uint _gracePeriodInDays,
TermsContract _termsContract
)
{
}
}
| termsContract.getExpectedRepaymentValue(agreementId,termsContract.getTermEndTimestamp(agreementId))<=termsContract.getValueRepaidToDate(agreementId) | 6,821 | termsContract.getExpectedRepaymentValue(agreementId,termsContract.getTermEndTimestamp(agreementId))<=termsContract.getValueRepaidToDate(agreementId) |
null | /*
Copyright 2017 Dharma Labs Inc.
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
*/
pragma solidity 0.4.18;
/**
* Contains functionality for collateralizing assets, by transferring them from
* a debtor address to this contract as a custodian.
*
* Authors (in no particular order): nadavhollander, saturnial, jdkanani, graemecode
*/
contract Collateralizer is Pausable, PermissionEvents {
using PermissionsLib for PermissionsLib.Permissions;
using SafeMath for uint;
address public debtKernelAddress;
DebtRegistry public debtRegistry;
TokenRegistry public tokenRegistry;
TokenTransferProxy public tokenTransferProxy;
// Collateralizer here refers to the owner of the asset that is being collateralized.
mapping(bytes32 => address) public agreementToCollateralizer;
PermissionsLib.Permissions internal collateralizationPermissions;
uint public constant SECONDS_IN_DAY = 24*60*60;
string public constant CONTEXT = "collateralizer";
event CollateralLocked(
bytes32 indexed agreementID,
address indexed token,
uint amount
);
event CollateralReturned(
bytes32 indexed agreementID,
address indexed collateralizer,
address token,
uint amount
);
event CollateralSeized(
bytes32 indexed agreementID,
address indexed beneficiary,
address token,
uint amount
);
modifier onlyAuthorizedToCollateralize() {
}
function Collateralizer(
address _debtKernel,
address _debtRegistry,
address _tokenRegistry,
address _tokenTransferProxy
) public {
}
/**
* Transfers collateral from the debtor to the current contract, as custodian.
*
* @param agreementId bytes32 The debt agreement's ID
* @param collateralizer address The owner of the asset being collateralized
*/
function collateralize(
bytes32 agreementId,
address collateralizer
)
public
onlyAuthorizedToCollateralize
whenNotPaused
returns (bool _success)
{
}
/**
* Returns collateral to the debt agreement's original collateralizer
* if and only if the debt agreement's term has lapsed and
* the total expected repayment value has been repaid.
*
* @param agreementId bytes32 The debt agreement's ID
*/
function returnCollateral(
bytes32 agreementId
)
public
whenNotPaused
{
// The token in which collateral is denominated
address collateralToken;
// The amount being put up for collateral
uint collateralAmount;
// The number of days a debtor has after a debt enters default
// before their collateral is eligible for seizure.
uint gracePeriodInDays;
// The terms contract according to which this asset is being collateralized.
TermsContract termsContract;
// Fetch all relevant collateralization parameters.
(
collateralToken,
collateralAmount,
gracePeriodInDays,
termsContract
) = retrieveCollateralParameters(agreementId);
// Ensure a valid form of collateral is tied to this agreement id
require(collateralAmount > 0);
require(collateralToken != address(0));
// Withdrawal can only occur if the collateral has yet to be withdrawn.
// When we withdraw collateral, we reset the collateral agreement
// in a gas-efficient manner by resetting the address of the collateralizer to 0
require(agreementToCollateralizer[agreementId] != address(0));
// Ensure that the debt is not in a state of default
require(
termsContract.getExpectedRepaymentValue(
agreementId,
termsContract.getTermEndTimestamp(agreementId)
) <= termsContract.getValueRepaidToDate(agreementId)
);
// determine collateralizer of the collateral.
address collateralizer = agreementToCollateralizer[agreementId];
// Mark agreement's collateral as withdrawn by setting the agreement's
// collateralizer to 0x0.
delete agreementToCollateralizer[agreementId];
// transfer the collateral this contract was holding in escrow back to collateralizer.
require(<FILL_ME>)
// log the return event.
CollateralReturned(
agreementId,
collateralizer,
collateralToken,
collateralAmount
);
}
/**
* Seizes the collateral from the given debt agreement and
* transfers it to the debt agreement's current beneficiary
* (i.e. the person who "owns" the debt).
*
* @param agreementId bytes32 The debt agreement's ID
*/
function seizeCollateral(
bytes32 agreementId
)
public
whenNotPaused
{
}
/**
* Adds an address to the list of agents authorized
* to invoke the `collateralize` function.
*/
function addAuthorizedCollateralizeAgent(address agent)
public
onlyOwner
{
}
/**
* Removes an address from the list of agents authorized
* to invoke the `collateralize` function.
*/
function revokeCollateralizeAuthorization(address agent)
public
onlyOwner
{
}
/**
* Returns the list of agents authorized to invoke the 'collateralize' function.
*/
function getAuthorizedCollateralizeAgents()
public
view
returns(address[])
{
}
/**
* Unpacks collateralization-specific parameters from their tightly-packed
* representation in a terms contract parameter string.
*
* For collateralized terms contracts, we reserve the lowest order 108 bits
* of the terms contract parameters for parameters relevant to collateralization.
*
* Contracts that inherit from the Collateralized terms contract
* can encode whichever parameter schema they please in the remaining
* space of the terms contract parameters.
* The 108 bits are encoded as follows (from higher order bits to lower order bits):
*
* 8 bits - Collateral Token (encoded by its unsigned integer index in the TokenRegistry contract)
* 92 bits - Collateral Amount (encoded as an unsigned integer)
* 8 bits - Grace Period* Length (encoded as an unsigned integer)
*
* * = The "Grace" Period is the number of days a debtor has between
* when they fall behind on an expected payment and when their collateral
* can be seized by the creditor.
*/
function unpackCollateralParametersFromBytes(bytes32 parameters)
public
pure
returns (uint, uint, uint)
{
}
function timestampAdjustedForGracePeriod(uint gracePeriodInDays)
public
view
returns (uint)
{
}
function retrieveCollateralParameters(bytes32 agreementId)
internal
view
returns (
address _collateralToken,
uint _collateralAmount,
uint _gracePeriodInDays,
TermsContract _termsContract
)
{
}
}
| ERC20(collateralToken).transfer(collateralizer,collateralAmount) | 6,821 | ERC20(collateralToken).transfer(collateralizer,collateralAmount) |
null | /*
Copyright 2017 Dharma Labs Inc.
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
*/
pragma solidity 0.4.18;
/**
* Contains functionality for collateralizing assets, by transferring them from
* a debtor address to this contract as a custodian.
*
* Authors (in no particular order): nadavhollander, saturnial, jdkanani, graemecode
*/
contract Collateralizer is Pausable, PermissionEvents {
using PermissionsLib for PermissionsLib.Permissions;
using SafeMath for uint;
address public debtKernelAddress;
DebtRegistry public debtRegistry;
TokenRegistry public tokenRegistry;
TokenTransferProxy public tokenTransferProxy;
// Collateralizer here refers to the owner of the asset that is being collateralized.
mapping(bytes32 => address) public agreementToCollateralizer;
PermissionsLib.Permissions internal collateralizationPermissions;
uint public constant SECONDS_IN_DAY = 24*60*60;
string public constant CONTEXT = "collateralizer";
event CollateralLocked(
bytes32 indexed agreementID,
address indexed token,
uint amount
);
event CollateralReturned(
bytes32 indexed agreementID,
address indexed collateralizer,
address token,
uint amount
);
event CollateralSeized(
bytes32 indexed agreementID,
address indexed beneficiary,
address token,
uint amount
);
modifier onlyAuthorizedToCollateralize() {
}
function Collateralizer(
address _debtKernel,
address _debtRegistry,
address _tokenRegistry,
address _tokenTransferProxy
) public {
}
/**
* Transfers collateral from the debtor to the current contract, as custodian.
*
* @param agreementId bytes32 The debt agreement's ID
* @param collateralizer address The owner of the asset being collateralized
*/
function collateralize(
bytes32 agreementId,
address collateralizer
)
public
onlyAuthorizedToCollateralize
whenNotPaused
returns (bool _success)
{
}
/**
* Returns collateral to the debt agreement's original collateralizer
* if and only if the debt agreement's term has lapsed and
* the total expected repayment value has been repaid.
*
* @param agreementId bytes32 The debt agreement's ID
*/
function returnCollateral(
bytes32 agreementId
)
public
whenNotPaused
{
}
/**
* Seizes the collateral from the given debt agreement and
* transfers it to the debt agreement's current beneficiary
* (i.e. the person who "owns" the debt).
*
* @param agreementId bytes32 The debt agreement's ID
*/
function seizeCollateral(
bytes32 agreementId
)
public
whenNotPaused
{
// The token in which collateral is denominated
address collateralToken;
// The amount being put up for collateral
uint collateralAmount;
// The number of days a debtor has after a debt enters default
// before their collateral is eligible for seizure.
uint gracePeriodInDays;
// The terms contract according to which this asset is being collateralized.
TermsContract termsContract;
// Fetch all relevant collateralization parameters
(
collateralToken,
collateralAmount,
gracePeriodInDays,
termsContract
) = retrieveCollateralParameters(agreementId);
// Ensure a valid form of collateral is tied to this agreement id
require(collateralAmount > 0);
require(collateralToken != address(0));
// Seizure can only occur if the collateral has yet to be withdrawn.
// When we withdraw collateral, we reset the collateral agreement
// in a gas-efficient manner by resetting the address of the collateralizer to 0
require(agreementToCollateralizer[agreementId] != address(0));
// Ensure debt is in a state of default when we account for the
// specified "grace period". We do this by checking whether the
// *current* value repaid to-date exceeds the expected repayment value
// at the point of time at which the grace period would begin if it ended
// now. This crucially relies on the assumption that both expected repayment value
/// and value repaid to date monotonically increase over time
require(<FILL_ME>)
// Mark agreement's collateral as withdrawn by setting the agreement's
// collateralizer to 0x0.
delete agreementToCollateralizer[agreementId];
// determine beneficiary of the seized collateral.
address beneficiary = debtRegistry.getBeneficiary(agreementId);
// transfer the collateral this contract was holding in escrow to beneficiary.
require(
ERC20(collateralToken).transfer(
beneficiary,
collateralAmount
)
);
// log the seizure event.
CollateralSeized(
agreementId,
beneficiary,
collateralToken,
collateralAmount
);
}
/**
* Adds an address to the list of agents authorized
* to invoke the `collateralize` function.
*/
function addAuthorizedCollateralizeAgent(address agent)
public
onlyOwner
{
}
/**
* Removes an address from the list of agents authorized
* to invoke the `collateralize` function.
*/
function revokeCollateralizeAuthorization(address agent)
public
onlyOwner
{
}
/**
* Returns the list of agents authorized to invoke the 'collateralize' function.
*/
function getAuthorizedCollateralizeAgents()
public
view
returns(address[])
{
}
/**
* Unpacks collateralization-specific parameters from their tightly-packed
* representation in a terms contract parameter string.
*
* For collateralized terms contracts, we reserve the lowest order 108 bits
* of the terms contract parameters for parameters relevant to collateralization.
*
* Contracts that inherit from the Collateralized terms contract
* can encode whichever parameter schema they please in the remaining
* space of the terms contract parameters.
* The 108 bits are encoded as follows (from higher order bits to lower order bits):
*
* 8 bits - Collateral Token (encoded by its unsigned integer index in the TokenRegistry contract)
* 92 bits - Collateral Amount (encoded as an unsigned integer)
* 8 bits - Grace Period* Length (encoded as an unsigned integer)
*
* * = The "Grace" Period is the number of days a debtor has between
* when they fall behind on an expected payment and when their collateral
* can be seized by the creditor.
*/
function unpackCollateralParametersFromBytes(bytes32 parameters)
public
pure
returns (uint, uint, uint)
{
}
function timestampAdjustedForGracePeriod(uint gracePeriodInDays)
public
view
returns (uint)
{
}
function retrieveCollateralParameters(bytes32 agreementId)
internal
view
returns (
address _collateralToken,
uint _collateralAmount,
uint _gracePeriodInDays,
TermsContract _termsContract
)
{
}
}
| termsContract.getExpectedRepaymentValue(agreementId,timestampAdjustedForGracePeriod(gracePeriodInDays))>termsContract.getValueRepaidToDate(agreementId) | 6,821 | termsContract.getExpectedRepaymentValue(agreementId,timestampAdjustedForGracePeriod(gracePeriodInDays))>termsContract.getValueRepaidToDate(agreementId) |
null | /*
Copyright 2017 Dharma Labs Inc.
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
*/
pragma solidity 0.4.18;
/**
* Contains functionality for collateralizing assets, by transferring them from
* a debtor address to this contract as a custodian.
*
* Authors (in no particular order): nadavhollander, saturnial, jdkanani, graemecode
*/
contract Collateralizer is Pausable, PermissionEvents {
using PermissionsLib for PermissionsLib.Permissions;
using SafeMath for uint;
address public debtKernelAddress;
DebtRegistry public debtRegistry;
TokenRegistry public tokenRegistry;
TokenTransferProxy public tokenTransferProxy;
// Collateralizer here refers to the owner of the asset that is being collateralized.
mapping(bytes32 => address) public agreementToCollateralizer;
PermissionsLib.Permissions internal collateralizationPermissions;
uint public constant SECONDS_IN_DAY = 24*60*60;
string public constant CONTEXT = "collateralizer";
event CollateralLocked(
bytes32 indexed agreementID,
address indexed token,
uint amount
);
event CollateralReturned(
bytes32 indexed agreementID,
address indexed collateralizer,
address token,
uint amount
);
event CollateralSeized(
bytes32 indexed agreementID,
address indexed beneficiary,
address token,
uint amount
);
modifier onlyAuthorizedToCollateralize() {
}
function Collateralizer(
address _debtKernel,
address _debtRegistry,
address _tokenRegistry,
address _tokenTransferProxy
) public {
}
/**
* Transfers collateral from the debtor to the current contract, as custodian.
*
* @param agreementId bytes32 The debt agreement's ID
* @param collateralizer address The owner of the asset being collateralized
*/
function collateralize(
bytes32 agreementId,
address collateralizer
)
public
onlyAuthorizedToCollateralize
whenNotPaused
returns (bool _success)
{
}
/**
* Returns collateral to the debt agreement's original collateralizer
* if and only if the debt agreement's term has lapsed and
* the total expected repayment value has been repaid.
*
* @param agreementId bytes32 The debt agreement's ID
*/
function returnCollateral(
bytes32 agreementId
)
public
whenNotPaused
{
}
/**
* Seizes the collateral from the given debt agreement and
* transfers it to the debt agreement's current beneficiary
* (i.e. the person who "owns" the debt).
*
* @param agreementId bytes32 The debt agreement's ID
*/
function seizeCollateral(
bytes32 agreementId
)
public
whenNotPaused
{
// The token in which collateral is denominated
address collateralToken;
// The amount being put up for collateral
uint collateralAmount;
// The number of days a debtor has after a debt enters default
// before their collateral is eligible for seizure.
uint gracePeriodInDays;
// The terms contract according to which this asset is being collateralized.
TermsContract termsContract;
// Fetch all relevant collateralization parameters
(
collateralToken,
collateralAmount,
gracePeriodInDays,
termsContract
) = retrieveCollateralParameters(agreementId);
// Ensure a valid form of collateral is tied to this agreement id
require(collateralAmount > 0);
require(collateralToken != address(0));
// Seizure can only occur if the collateral has yet to be withdrawn.
// When we withdraw collateral, we reset the collateral agreement
// in a gas-efficient manner by resetting the address of the collateralizer to 0
require(agreementToCollateralizer[agreementId] != address(0));
// Ensure debt is in a state of default when we account for the
// specified "grace period". We do this by checking whether the
// *current* value repaid to-date exceeds the expected repayment value
// at the point of time at which the grace period would begin if it ended
// now. This crucially relies on the assumption that both expected repayment value
/// and value repaid to date monotonically increase over time
require(
termsContract.getExpectedRepaymentValue(
agreementId,
timestampAdjustedForGracePeriod(gracePeriodInDays)
) > termsContract.getValueRepaidToDate(agreementId)
);
// Mark agreement's collateral as withdrawn by setting the agreement's
// collateralizer to 0x0.
delete agreementToCollateralizer[agreementId];
// determine beneficiary of the seized collateral.
address beneficiary = debtRegistry.getBeneficiary(agreementId);
// transfer the collateral this contract was holding in escrow to beneficiary.
require(<FILL_ME>)
// log the seizure event.
CollateralSeized(
agreementId,
beneficiary,
collateralToken,
collateralAmount
);
}
/**
* Adds an address to the list of agents authorized
* to invoke the `collateralize` function.
*/
function addAuthorizedCollateralizeAgent(address agent)
public
onlyOwner
{
}
/**
* Removes an address from the list of agents authorized
* to invoke the `collateralize` function.
*/
function revokeCollateralizeAuthorization(address agent)
public
onlyOwner
{
}
/**
* Returns the list of agents authorized to invoke the 'collateralize' function.
*/
function getAuthorizedCollateralizeAgents()
public
view
returns(address[])
{
}
/**
* Unpacks collateralization-specific parameters from their tightly-packed
* representation in a terms contract parameter string.
*
* For collateralized terms contracts, we reserve the lowest order 108 bits
* of the terms contract parameters for parameters relevant to collateralization.
*
* Contracts that inherit from the Collateralized terms contract
* can encode whichever parameter schema they please in the remaining
* space of the terms contract parameters.
* The 108 bits are encoded as follows (from higher order bits to lower order bits):
*
* 8 bits - Collateral Token (encoded by its unsigned integer index in the TokenRegistry contract)
* 92 bits - Collateral Amount (encoded as an unsigned integer)
* 8 bits - Grace Period* Length (encoded as an unsigned integer)
*
* * = The "Grace" Period is the number of days a debtor has between
* when they fall behind on an expected payment and when their collateral
* can be seized by the creditor.
*/
function unpackCollateralParametersFromBytes(bytes32 parameters)
public
pure
returns (uint, uint, uint)
{
}
function timestampAdjustedForGracePeriod(uint gracePeriodInDays)
public
view
returns (uint)
{
}
function retrieveCollateralParameters(bytes32 agreementId)
internal
view
returns (
address _collateralToken,
uint _collateralAmount,
uint _gracePeriodInDays,
TermsContract _termsContract
)
{
}
}
| ERC20(collateralToken).transfer(beneficiary,collateralAmount) | 6,821 | ERC20(collateralToken).transfer(beneficiary,collateralAmount) |
"Voken1 Resale: already applied before" | // SPDX-License-Identifier: MIT
pragma solidity =0.7.5;
// Resale Voken1.0/2.0 or Upgrade to VokenTB.
//
// More info:
// https://voken.io
//
// Contact us:
// support@voken.io
import "LibSafeMath.sol";
import "LibAuthPause.sol";
import "LibIVesting.sol";
import "LibIERC20.sol";
import "LibIVokenTB.sol";
import "LibIVokenAudit.sol";
import "RouWithResaleOnly.sol";
import "RouWithDeadline.sol";
import "RouWithCoeff.sol";
import "RouWithUSDPrice.sol";
import "RouWithUSDToken.sol";
import "RouWithVestingPermille.sol";
/**
* @title Resale Voken1.0/2.0 or Upgrade to VokenTB.
*/
contract ResaleOrUpgradeToVokenTB is IVesting, AuthPause, WithResaleOnly, WithDeadline, WithCoeff, WithUSDPrice, WithUSDToken, WithVestingPermille {
using SafeMath for uint256;
struct Resale {
uint256 usdAudit;
uint256 usdClaimed;
uint256 timestamp;
}
struct Upgraded {
uint256 claimed;
uint256 bonuses;
uint256 etherUSDPrice;
uint256 vokenUSDPrice;
uint256 timestamp;
}
uint256 private immutable VOKEN_UPGRADED_CAP = 21_000_000e9;
uint256 private _usdAudit;
uint256 private _usdClaimed;
uint256 private _v1Claimed;
uint256 private _v1Bonuses;
uint256 private _v2Claimed;
uint256 private _v2Bonuses;
IVokenTB private immutable VOKEN_TB = IVokenTB(0x1234567a022acaa848E7D6bC351d075dBfa76Dd4);
IERC20 private immutable VOKEN_1 = IERC20(0x82070415FEe803f94Ce5617Be1878503e58F0a6a); // Voken1.0
IERC20 private immutable VOKEN_2 = IERC20(0xFfFAb974088Bd5bF3d7E6F522e93Dd7861264cDB); // Voken2.0
IVokenAudit private immutable VOKEN_1_AUDIT = IVokenAudit(0x11111eA590876f5E8416cD4a81A0CFb9DfA2b08E);
IVokenAudit private immutable VOKEN_2_AUDIT = IVokenAudit(0x22222eA5b84E877A1790b4653a70ad0df8e3E890);
mapping (address => Resale) private _v1ResaleApplied;
mapping (address => Resale) private _v2ResaleApplied;
mapping (address => Upgraded) private _v1UpgradeApplied;
mapping (address => Upgraded) private _v2UpgradeApplied;
/**
* @dev Accept Ether.
*/
receive()
external
payable
{
}
/**
* @dev Apply re-sale.
*/
function applyV1Resale()
external
{
}
function applyV2Resale()
external
{
}
/**
* @dev Apply upgrade.
*/
function applyV1Upgrade()
external
{
}
function applyV2Upgrade()
external
{
}
/**
* @dev Claim USD, according to re-sale.
*/
function claimV1USD()
external
{
}
function claimV2USD()
external
{
}
/**
* @dev Returns the status.
*/
function status()
public
view
returns (
uint256 deadline,
uint256 usdAudit,
uint256 usdClaimed,
uint256 usdReceived,
uint256 resaleEtherUSD,
uint256 v1Claimed,
uint256 v1Bonuses,
uint256 v2Claimed,
uint256 v2Bonuses,
uint256 etherUSD,
uint256 vokenUSD
)
{
}
/**
* @dev Returns status of `account`.
*/
function getAccountStatus(address account)
public
view
returns (
bool canOnlyResale,
uint256 v1ResaleAppliedTimestamp,
uint256 v2ResaleAppliedTimestamp,
uint256 v1UpgradeAppliedTimestamp,
uint256 v2UpgradeAppliedTimestamp,
uint256 v1Balance,
uint256 v2Balance,
uint256 etherBalance
)
{
}
/**
* @dev Returns the re-sale status.
*/
function v1ResaleStatus(address account)
public
view
returns (
uint256 usdQuota,
uint256 usdAudit,
uint256 usdClaimed,
uint256 timestamp
)
{
}
function v2ResaleStatus(address account)
public
view
returns (
uint256 usdQuota,
uint256 usdAudit,
uint256 usdClaimed,
uint256 timestamp
)
{
}
/**
* @dev Returns the upgrade status.
*/
function v1UpgradeStatus(address account)
public
view
returns (
uint72 weiPurchased,
uint72 weiRewarded,
uint72 weiAudit,
uint16 txsIn,
uint16 txsOut,
uint256 claim,
uint256 bonus,
uint256 etherUSD,
uint256 vokenUSD,
uint256 timestamp
)
{
}
function v2UpgradeStatus(address account)
public
view
returns (
uint72 weiPurchased,
uint72 weiRewarded,
uint72 weiAudit,
uint16 txsIn,
uint16 txsOut,
uint256 claim,
uint256 bonus,
uint256 etherUSD,
uint256 vokenUSD,
uint256 timestamp
)
{
}
/**
* @dev Returns the vesting amount of VOKEN by `account`, only for this re-sale/upgrade contract/program.
*/
function vestingOf(address account)
public
override
view
returns (uint256 vesting)
{
}
/**
* @dev Returns USD received.
*/
function _usdReceived()
private
view
returns (uint256)
{
}
/**
* @dev Re-Sale.
*/
function _v1Resale(address account)
private
onlyBeforeDeadline
onlyNotPaused
{
require(<FILL_ME>)
require(_v1UpgradeApplied[account].timestamp == 0, "Voken1 Resale: already applied for upgrade");
(, , uint256 weiAudit, ,) = VOKEN_1_AUDIT.getAccount(account);
require(weiAudit > 0, "Voken1 Resale: audit ETH is zero");
uint256 usdAudit = resaleEtherUSDPrice().mul(weiAudit).div(1 ether);
_usdAudit = _usdAudit.add(usdAudit);
_v1ResaleApplied[account].usdAudit = usdAudit;
_v1ResaleApplied[account].timestamp = block.timestamp;
}
function _v2Resale(address account)
private
onlyBeforeDeadline
onlyNotPaused
{
}
/**
* @dev Upgrade.
*/
function _v1Upgrade(address account)
private
onlyBeforeDeadline
onlyNotPaused
{
}
function _v2Upgrade(address account)
private
onlyBeforeDeadline
onlyNotPaused
{
}
/**
* @dev Claim USD.
*/
function _v1ClaimUSD()
private
{
}
function _v2ClaimUSD()
private
{
}
/**
* @dev Returns the USD amount of an `account` in re-sale.
*/
function _v1USDQuota(address account)
private
view
returns (uint256 quota)
{
}
function _v2USDQuota(address account)
private
view
returns (uint256 quota)
{
}
/**
* @dev Returns upgrading data/quota.
*/
function _v1UpgradeQuota(address account)
private
view
returns (
uint256 claim,
uint256 bonus,
uint256 etherUSD,
uint256 vokenUSD,
uint256 timestamp
)
{
}
function _v2UpgradeQuota(address account)
private
view
returns (
uint256 claim,
uint256 bonus,
uint256 etherUSD,
uint256 vokenUSD,
uint256 timestamp
)
{
}
/**
* @dev Returns the bigger one between `a` and `b`.
*/
function max(uint256 a, uint256 b)
private
pure
returns (uint256)
{
}
}
| _v1ResaleApplied[account].timestamp==0,"Voken1 Resale: already applied before" | 6,866 | _v1ResaleApplied[account].timestamp==0 |
"Voken1 Resale: already applied for upgrade" | // SPDX-License-Identifier: MIT
pragma solidity =0.7.5;
// Resale Voken1.0/2.0 or Upgrade to VokenTB.
//
// More info:
// https://voken.io
//
// Contact us:
// support@voken.io
import "LibSafeMath.sol";
import "LibAuthPause.sol";
import "LibIVesting.sol";
import "LibIERC20.sol";
import "LibIVokenTB.sol";
import "LibIVokenAudit.sol";
import "RouWithResaleOnly.sol";
import "RouWithDeadline.sol";
import "RouWithCoeff.sol";
import "RouWithUSDPrice.sol";
import "RouWithUSDToken.sol";
import "RouWithVestingPermille.sol";
/**
* @title Resale Voken1.0/2.0 or Upgrade to VokenTB.
*/
contract ResaleOrUpgradeToVokenTB is IVesting, AuthPause, WithResaleOnly, WithDeadline, WithCoeff, WithUSDPrice, WithUSDToken, WithVestingPermille {
using SafeMath for uint256;
struct Resale {
uint256 usdAudit;
uint256 usdClaimed;
uint256 timestamp;
}
struct Upgraded {
uint256 claimed;
uint256 bonuses;
uint256 etherUSDPrice;
uint256 vokenUSDPrice;
uint256 timestamp;
}
uint256 private immutable VOKEN_UPGRADED_CAP = 21_000_000e9;
uint256 private _usdAudit;
uint256 private _usdClaimed;
uint256 private _v1Claimed;
uint256 private _v1Bonuses;
uint256 private _v2Claimed;
uint256 private _v2Bonuses;
IVokenTB private immutable VOKEN_TB = IVokenTB(0x1234567a022acaa848E7D6bC351d075dBfa76Dd4);
IERC20 private immutable VOKEN_1 = IERC20(0x82070415FEe803f94Ce5617Be1878503e58F0a6a); // Voken1.0
IERC20 private immutable VOKEN_2 = IERC20(0xFfFAb974088Bd5bF3d7E6F522e93Dd7861264cDB); // Voken2.0
IVokenAudit private immutable VOKEN_1_AUDIT = IVokenAudit(0x11111eA590876f5E8416cD4a81A0CFb9DfA2b08E);
IVokenAudit private immutable VOKEN_2_AUDIT = IVokenAudit(0x22222eA5b84E877A1790b4653a70ad0df8e3E890);
mapping (address => Resale) private _v1ResaleApplied;
mapping (address => Resale) private _v2ResaleApplied;
mapping (address => Upgraded) private _v1UpgradeApplied;
mapping (address => Upgraded) private _v2UpgradeApplied;
/**
* @dev Accept Ether.
*/
receive()
external
payable
{
}
/**
* @dev Apply re-sale.
*/
function applyV1Resale()
external
{
}
function applyV2Resale()
external
{
}
/**
* @dev Apply upgrade.
*/
function applyV1Upgrade()
external
{
}
function applyV2Upgrade()
external
{
}
/**
* @dev Claim USD, according to re-sale.
*/
function claimV1USD()
external
{
}
function claimV2USD()
external
{
}
/**
* @dev Returns the status.
*/
function status()
public
view
returns (
uint256 deadline,
uint256 usdAudit,
uint256 usdClaimed,
uint256 usdReceived,
uint256 resaleEtherUSD,
uint256 v1Claimed,
uint256 v1Bonuses,
uint256 v2Claimed,
uint256 v2Bonuses,
uint256 etherUSD,
uint256 vokenUSD
)
{
}
/**
* @dev Returns status of `account`.
*/
function getAccountStatus(address account)
public
view
returns (
bool canOnlyResale,
uint256 v1ResaleAppliedTimestamp,
uint256 v2ResaleAppliedTimestamp,
uint256 v1UpgradeAppliedTimestamp,
uint256 v2UpgradeAppliedTimestamp,
uint256 v1Balance,
uint256 v2Balance,
uint256 etherBalance
)
{
}
/**
* @dev Returns the re-sale status.
*/
function v1ResaleStatus(address account)
public
view
returns (
uint256 usdQuota,
uint256 usdAudit,
uint256 usdClaimed,
uint256 timestamp
)
{
}
function v2ResaleStatus(address account)
public
view
returns (
uint256 usdQuota,
uint256 usdAudit,
uint256 usdClaimed,
uint256 timestamp
)
{
}
/**
* @dev Returns the upgrade status.
*/
function v1UpgradeStatus(address account)
public
view
returns (
uint72 weiPurchased,
uint72 weiRewarded,
uint72 weiAudit,
uint16 txsIn,
uint16 txsOut,
uint256 claim,
uint256 bonus,
uint256 etherUSD,
uint256 vokenUSD,
uint256 timestamp
)
{
}
function v2UpgradeStatus(address account)
public
view
returns (
uint72 weiPurchased,
uint72 weiRewarded,
uint72 weiAudit,
uint16 txsIn,
uint16 txsOut,
uint256 claim,
uint256 bonus,
uint256 etherUSD,
uint256 vokenUSD,
uint256 timestamp
)
{
}
/**
* @dev Returns the vesting amount of VOKEN by `account`, only for this re-sale/upgrade contract/program.
*/
function vestingOf(address account)
public
override
view
returns (uint256 vesting)
{
}
/**
* @dev Returns USD received.
*/
function _usdReceived()
private
view
returns (uint256)
{
}
/**
* @dev Re-Sale.
*/
function _v1Resale(address account)
private
onlyBeforeDeadline
onlyNotPaused
{
require(_v1ResaleApplied[account].timestamp == 0, "Voken1 Resale: already applied before");
require(<FILL_ME>)
(, , uint256 weiAudit, ,) = VOKEN_1_AUDIT.getAccount(account);
require(weiAudit > 0, "Voken1 Resale: audit ETH is zero");
uint256 usdAudit = resaleEtherUSDPrice().mul(weiAudit).div(1 ether);
_usdAudit = _usdAudit.add(usdAudit);
_v1ResaleApplied[account].usdAudit = usdAudit;
_v1ResaleApplied[account].timestamp = block.timestamp;
}
function _v2Resale(address account)
private
onlyBeforeDeadline
onlyNotPaused
{
}
/**
* @dev Upgrade.
*/
function _v1Upgrade(address account)
private
onlyBeforeDeadline
onlyNotPaused
{
}
function _v2Upgrade(address account)
private
onlyBeforeDeadline
onlyNotPaused
{
}
/**
* @dev Claim USD.
*/
function _v1ClaimUSD()
private
{
}
function _v2ClaimUSD()
private
{
}
/**
* @dev Returns the USD amount of an `account` in re-sale.
*/
function _v1USDQuota(address account)
private
view
returns (uint256 quota)
{
}
function _v2USDQuota(address account)
private
view
returns (uint256 quota)
{
}
/**
* @dev Returns upgrading data/quota.
*/
function _v1UpgradeQuota(address account)
private
view
returns (
uint256 claim,
uint256 bonus,
uint256 etherUSD,
uint256 vokenUSD,
uint256 timestamp
)
{
}
function _v2UpgradeQuota(address account)
private
view
returns (
uint256 claim,
uint256 bonus,
uint256 etherUSD,
uint256 vokenUSD,
uint256 timestamp
)
{
}
/**
* @dev Returns the bigger one between `a` and `b`.
*/
function max(uint256 a, uint256 b)
private
pure
returns (uint256)
{
}
}
| _v1UpgradeApplied[account].timestamp==0,"Voken1 Resale: already applied for upgrade" | 6,866 | _v1UpgradeApplied[account].timestamp==0 |
"Voken2 Resale: already applied before" | // SPDX-License-Identifier: MIT
pragma solidity =0.7.5;
// Resale Voken1.0/2.0 or Upgrade to VokenTB.
//
// More info:
// https://voken.io
//
// Contact us:
// support@voken.io
import "LibSafeMath.sol";
import "LibAuthPause.sol";
import "LibIVesting.sol";
import "LibIERC20.sol";
import "LibIVokenTB.sol";
import "LibIVokenAudit.sol";
import "RouWithResaleOnly.sol";
import "RouWithDeadline.sol";
import "RouWithCoeff.sol";
import "RouWithUSDPrice.sol";
import "RouWithUSDToken.sol";
import "RouWithVestingPermille.sol";
/**
* @title Resale Voken1.0/2.0 or Upgrade to VokenTB.
*/
contract ResaleOrUpgradeToVokenTB is IVesting, AuthPause, WithResaleOnly, WithDeadline, WithCoeff, WithUSDPrice, WithUSDToken, WithVestingPermille {
using SafeMath for uint256;
struct Resale {
uint256 usdAudit;
uint256 usdClaimed;
uint256 timestamp;
}
struct Upgraded {
uint256 claimed;
uint256 bonuses;
uint256 etherUSDPrice;
uint256 vokenUSDPrice;
uint256 timestamp;
}
uint256 private immutable VOKEN_UPGRADED_CAP = 21_000_000e9;
uint256 private _usdAudit;
uint256 private _usdClaimed;
uint256 private _v1Claimed;
uint256 private _v1Bonuses;
uint256 private _v2Claimed;
uint256 private _v2Bonuses;
IVokenTB private immutable VOKEN_TB = IVokenTB(0x1234567a022acaa848E7D6bC351d075dBfa76Dd4);
IERC20 private immutable VOKEN_1 = IERC20(0x82070415FEe803f94Ce5617Be1878503e58F0a6a); // Voken1.0
IERC20 private immutable VOKEN_2 = IERC20(0xFfFAb974088Bd5bF3d7E6F522e93Dd7861264cDB); // Voken2.0
IVokenAudit private immutable VOKEN_1_AUDIT = IVokenAudit(0x11111eA590876f5E8416cD4a81A0CFb9DfA2b08E);
IVokenAudit private immutable VOKEN_2_AUDIT = IVokenAudit(0x22222eA5b84E877A1790b4653a70ad0df8e3E890);
mapping (address => Resale) private _v1ResaleApplied;
mapping (address => Resale) private _v2ResaleApplied;
mapping (address => Upgraded) private _v1UpgradeApplied;
mapping (address => Upgraded) private _v2UpgradeApplied;
/**
* @dev Accept Ether.
*/
receive()
external
payable
{
}
/**
* @dev Apply re-sale.
*/
function applyV1Resale()
external
{
}
function applyV2Resale()
external
{
}
/**
* @dev Apply upgrade.
*/
function applyV1Upgrade()
external
{
}
function applyV2Upgrade()
external
{
}
/**
* @dev Claim USD, according to re-sale.
*/
function claimV1USD()
external
{
}
function claimV2USD()
external
{
}
/**
* @dev Returns the status.
*/
function status()
public
view
returns (
uint256 deadline,
uint256 usdAudit,
uint256 usdClaimed,
uint256 usdReceived,
uint256 resaleEtherUSD,
uint256 v1Claimed,
uint256 v1Bonuses,
uint256 v2Claimed,
uint256 v2Bonuses,
uint256 etherUSD,
uint256 vokenUSD
)
{
}
/**
* @dev Returns status of `account`.
*/
function getAccountStatus(address account)
public
view
returns (
bool canOnlyResale,
uint256 v1ResaleAppliedTimestamp,
uint256 v2ResaleAppliedTimestamp,
uint256 v1UpgradeAppliedTimestamp,
uint256 v2UpgradeAppliedTimestamp,
uint256 v1Balance,
uint256 v2Balance,
uint256 etherBalance
)
{
}
/**
* @dev Returns the re-sale status.
*/
function v1ResaleStatus(address account)
public
view
returns (
uint256 usdQuota,
uint256 usdAudit,
uint256 usdClaimed,
uint256 timestamp
)
{
}
function v2ResaleStatus(address account)
public
view
returns (
uint256 usdQuota,
uint256 usdAudit,
uint256 usdClaimed,
uint256 timestamp
)
{
}
/**
* @dev Returns the upgrade status.
*/
function v1UpgradeStatus(address account)
public
view
returns (
uint72 weiPurchased,
uint72 weiRewarded,
uint72 weiAudit,
uint16 txsIn,
uint16 txsOut,
uint256 claim,
uint256 bonus,
uint256 etherUSD,
uint256 vokenUSD,
uint256 timestamp
)
{
}
function v2UpgradeStatus(address account)
public
view
returns (
uint72 weiPurchased,
uint72 weiRewarded,
uint72 weiAudit,
uint16 txsIn,
uint16 txsOut,
uint256 claim,
uint256 bonus,
uint256 etherUSD,
uint256 vokenUSD,
uint256 timestamp
)
{
}
/**
* @dev Returns the vesting amount of VOKEN by `account`, only for this re-sale/upgrade contract/program.
*/
function vestingOf(address account)
public
override
view
returns (uint256 vesting)
{
}
/**
* @dev Returns USD received.
*/
function _usdReceived()
private
view
returns (uint256)
{
}
/**
* @dev Re-Sale.
*/
function _v1Resale(address account)
private
onlyBeforeDeadline
onlyNotPaused
{
}
function _v2Resale(address account)
private
onlyBeforeDeadline
onlyNotPaused
{
require(<FILL_ME>)
require(_v2UpgradeApplied[account].timestamp == 0, "Voken2 Resale: already applied for upgrade");
(, , uint256 weiAudit, ,) = VOKEN_2_AUDIT.getAccount(account);
require(weiAudit > 0, "Voken2 Resale: audit ETH is zero");
uint256 usdAudit = resaleEtherUSDPrice().mul(weiAudit).div(1 ether);
_usdAudit = _usdAudit.add(usdAudit);
_v2ResaleApplied[account].usdAudit = usdAudit;
_v2ResaleApplied[account].timestamp = block.timestamp;
}
/**
* @dev Upgrade.
*/
function _v1Upgrade(address account)
private
onlyBeforeDeadline
onlyNotPaused
{
}
function _v2Upgrade(address account)
private
onlyBeforeDeadline
onlyNotPaused
{
}
/**
* @dev Claim USD.
*/
function _v1ClaimUSD()
private
{
}
function _v2ClaimUSD()
private
{
}
/**
* @dev Returns the USD amount of an `account` in re-sale.
*/
function _v1USDQuota(address account)
private
view
returns (uint256 quota)
{
}
function _v2USDQuota(address account)
private
view
returns (uint256 quota)
{
}
/**
* @dev Returns upgrading data/quota.
*/
function _v1UpgradeQuota(address account)
private
view
returns (
uint256 claim,
uint256 bonus,
uint256 etherUSD,
uint256 vokenUSD,
uint256 timestamp
)
{
}
function _v2UpgradeQuota(address account)
private
view
returns (
uint256 claim,
uint256 bonus,
uint256 etherUSD,
uint256 vokenUSD,
uint256 timestamp
)
{
}
/**
* @dev Returns the bigger one between `a` and `b`.
*/
function max(uint256 a, uint256 b)
private
pure
returns (uint256)
{
}
}
| _v2ResaleApplied[account].timestamp==0,"Voken2 Resale: already applied before" | 6,866 | _v2ResaleApplied[account].timestamp==0 |
"Voken2 Resale: already applied for upgrade" | // SPDX-License-Identifier: MIT
pragma solidity =0.7.5;
// Resale Voken1.0/2.0 or Upgrade to VokenTB.
//
// More info:
// https://voken.io
//
// Contact us:
// support@voken.io
import "LibSafeMath.sol";
import "LibAuthPause.sol";
import "LibIVesting.sol";
import "LibIERC20.sol";
import "LibIVokenTB.sol";
import "LibIVokenAudit.sol";
import "RouWithResaleOnly.sol";
import "RouWithDeadline.sol";
import "RouWithCoeff.sol";
import "RouWithUSDPrice.sol";
import "RouWithUSDToken.sol";
import "RouWithVestingPermille.sol";
/**
* @title Resale Voken1.0/2.0 or Upgrade to VokenTB.
*/
contract ResaleOrUpgradeToVokenTB is IVesting, AuthPause, WithResaleOnly, WithDeadline, WithCoeff, WithUSDPrice, WithUSDToken, WithVestingPermille {
using SafeMath for uint256;
struct Resale {
uint256 usdAudit;
uint256 usdClaimed;
uint256 timestamp;
}
struct Upgraded {
uint256 claimed;
uint256 bonuses;
uint256 etherUSDPrice;
uint256 vokenUSDPrice;
uint256 timestamp;
}
uint256 private immutable VOKEN_UPGRADED_CAP = 21_000_000e9;
uint256 private _usdAudit;
uint256 private _usdClaimed;
uint256 private _v1Claimed;
uint256 private _v1Bonuses;
uint256 private _v2Claimed;
uint256 private _v2Bonuses;
IVokenTB private immutable VOKEN_TB = IVokenTB(0x1234567a022acaa848E7D6bC351d075dBfa76Dd4);
IERC20 private immutable VOKEN_1 = IERC20(0x82070415FEe803f94Ce5617Be1878503e58F0a6a); // Voken1.0
IERC20 private immutable VOKEN_2 = IERC20(0xFfFAb974088Bd5bF3d7E6F522e93Dd7861264cDB); // Voken2.0
IVokenAudit private immutable VOKEN_1_AUDIT = IVokenAudit(0x11111eA590876f5E8416cD4a81A0CFb9DfA2b08E);
IVokenAudit private immutable VOKEN_2_AUDIT = IVokenAudit(0x22222eA5b84E877A1790b4653a70ad0df8e3E890);
mapping (address => Resale) private _v1ResaleApplied;
mapping (address => Resale) private _v2ResaleApplied;
mapping (address => Upgraded) private _v1UpgradeApplied;
mapping (address => Upgraded) private _v2UpgradeApplied;
/**
* @dev Accept Ether.
*/
receive()
external
payable
{
}
/**
* @dev Apply re-sale.
*/
function applyV1Resale()
external
{
}
function applyV2Resale()
external
{
}
/**
* @dev Apply upgrade.
*/
function applyV1Upgrade()
external
{
}
function applyV2Upgrade()
external
{
}
/**
* @dev Claim USD, according to re-sale.
*/
function claimV1USD()
external
{
}
function claimV2USD()
external
{
}
/**
* @dev Returns the status.
*/
function status()
public
view
returns (
uint256 deadline,
uint256 usdAudit,
uint256 usdClaimed,
uint256 usdReceived,
uint256 resaleEtherUSD,
uint256 v1Claimed,
uint256 v1Bonuses,
uint256 v2Claimed,
uint256 v2Bonuses,
uint256 etherUSD,
uint256 vokenUSD
)
{
}
/**
* @dev Returns status of `account`.
*/
function getAccountStatus(address account)
public
view
returns (
bool canOnlyResale,
uint256 v1ResaleAppliedTimestamp,
uint256 v2ResaleAppliedTimestamp,
uint256 v1UpgradeAppliedTimestamp,
uint256 v2UpgradeAppliedTimestamp,
uint256 v1Balance,
uint256 v2Balance,
uint256 etherBalance
)
{
}
/**
* @dev Returns the re-sale status.
*/
function v1ResaleStatus(address account)
public
view
returns (
uint256 usdQuota,
uint256 usdAudit,
uint256 usdClaimed,
uint256 timestamp
)
{
}
function v2ResaleStatus(address account)
public
view
returns (
uint256 usdQuota,
uint256 usdAudit,
uint256 usdClaimed,
uint256 timestamp
)
{
}
/**
* @dev Returns the upgrade status.
*/
function v1UpgradeStatus(address account)
public
view
returns (
uint72 weiPurchased,
uint72 weiRewarded,
uint72 weiAudit,
uint16 txsIn,
uint16 txsOut,
uint256 claim,
uint256 bonus,
uint256 etherUSD,
uint256 vokenUSD,
uint256 timestamp
)
{
}
function v2UpgradeStatus(address account)
public
view
returns (
uint72 weiPurchased,
uint72 weiRewarded,
uint72 weiAudit,
uint16 txsIn,
uint16 txsOut,
uint256 claim,
uint256 bonus,
uint256 etherUSD,
uint256 vokenUSD,
uint256 timestamp
)
{
}
/**
* @dev Returns the vesting amount of VOKEN by `account`, only for this re-sale/upgrade contract/program.
*/
function vestingOf(address account)
public
override
view
returns (uint256 vesting)
{
}
/**
* @dev Returns USD received.
*/
function _usdReceived()
private
view
returns (uint256)
{
}
/**
* @dev Re-Sale.
*/
function _v1Resale(address account)
private
onlyBeforeDeadline
onlyNotPaused
{
}
function _v2Resale(address account)
private
onlyBeforeDeadline
onlyNotPaused
{
require(_v2ResaleApplied[account].timestamp == 0, "Voken2 Resale: already applied before");
require(<FILL_ME>)
(, , uint256 weiAudit, ,) = VOKEN_2_AUDIT.getAccount(account);
require(weiAudit > 0, "Voken2 Resale: audit ETH is zero");
uint256 usdAudit = resaleEtherUSDPrice().mul(weiAudit).div(1 ether);
_usdAudit = _usdAudit.add(usdAudit);
_v2ResaleApplied[account].usdAudit = usdAudit;
_v2ResaleApplied[account].timestamp = block.timestamp;
}
/**
* @dev Upgrade.
*/
function _v1Upgrade(address account)
private
onlyBeforeDeadline
onlyNotPaused
{
}
function _v2Upgrade(address account)
private
onlyBeforeDeadline
onlyNotPaused
{
}
/**
* @dev Claim USD.
*/
function _v1ClaimUSD()
private
{
}
function _v2ClaimUSD()
private
{
}
/**
* @dev Returns the USD amount of an `account` in re-sale.
*/
function _v1USDQuota(address account)
private
view
returns (uint256 quota)
{
}
function _v2USDQuota(address account)
private
view
returns (uint256 quota)
{
}
/**
* @dev Returns upgrading data/quota.
*/
function _v1UpgradeQuota(address account)
private
view
returns (
uint256 claim,
uint256 bonus,
uint256 etherUSD,
uint256 vokenUSD,
uint256 timestamp
)
{
}
function _v2UpgradeQuota(address account)
private
view
returns (
uint256 claim,
uint256 bonus,
uint256 etherUSD,
uint256 vokenUSD,
uint256 timestamp
)
{
}
/**
* @dev Returns the bigger one between `a` and `b`.
*/
function max(uint256 a, uint256 b)
private
pure
returns (uint256)
{
}
}
| _v2UpgradeApplied[account].timestamp==0,"Voken2 Resale: already applied for upgrade" | 6,866 | _v2UpgradeApplied[account].timestamp==0 |
"Upgrade from Voken1: can only apply for resale" | // SPDX-License-Identifier: MIT
pragma solidity =0.7.5;
// Resale Voken1.0/2.0 or Upgrade to VokenTB.
//
// More info:
// https://voken.io
//
// Contact us:
// support@voken.io
import "LibSafeMath.sol";
import "LibAuthPause.sol";
import "LibIVesting.sol";
import "LibIERC20.sol";
import "LibIVokenTB.sol";
import "LibIVokenAudit.sol";
import "RouWithResaleOnly.sol";
import "RouWithDeadline.sol";
import "RouWithCoeff.sol";
import "RouWithUSDPrice.sol";
import "RouWithUSDToken.sol";
import "RouWithVestingPermille.sol";
/**
* @title Resale Voken1.0/2.0 or Upgrade to VokenTB.
*/
contract ResaleOrUpgradeToVokenTB is IVesting, AuthPause, WithResaleOnly, WithDeadline, WithCoeff, WithUSDPrice, WithUSDToken, WithVestingPermille {
using SafeMath for uint256;
struct Resale {
uint256 usdAudit;
uint256 usdClaimed;
uint256 timestamp;
}
struct Upgraded {
uint256 claimed;
uint256 bonuses;
uint256 etherUSDPrice;
uint256 vokenUSDPrice;
uint256 timestamp;
}
uint256 private immutable VOKEN_UPGRADED_CAP = 21_000_000e9;
uint256 private _usdAudit;
uint256 private _usdClaimed;
uint256 private _v1Claimed;
uint256 private _v1Bonuses;
uint256 private _v2Claimed;
uint256 private _v2Bonuses;
IVokenTB private immutable VOKEN_TB = IVokenTB(0x1234567a022acaa848E7D6bC351d075dBfa76Dd4);
IERC20 private immutable VOKEN_1 = IERC20(0x82070415FEe803f94Ce5617Be1878503e58F0a6a); // Voken1.0
IERC20 private immutable VOKEN_2 = IERC20(0xFfFAb974088Bd5bF3d7E6F522e93Dd7861264cDB); // Voken2.0
IVokenAudit private immutable VOKEN_1_AUDIT = IVokenAudit(0x11111eA590876f5E8416cD4a81A0CFb9DfA2b08E);
IVokenAudit private immutable VOKEN_2_AUDIT = IVokenAudit(0x22222eA5b84E877A1790b4653a70ad0df8e3E890);
mapping (address => Resale) private _v1ResaleApplied;
mapping (address => Resale) private _v2ResaleApplied;
mapping (address => Upgraded) private _v1UpgradeApplied;
mapping (address => Upgraded) private _v2UpgradeApplied;
/**
* @dev Accept Ether.
*/
receive()
external
payable
{
}
/**
* @dev Apply re-sale.
*/
function applyV1Resale()
external
{
}
function applyV2Resale()
external
{
}
/**
* @dev Apply upgrade.
*/
function applyV1Upgrade()
external
{
}
function applyV2Upgrade()
external
{
}
/**
* @dev Claim USD, according to re-sale.
*/
function claimV1USD()
external
{
}
function claimV2USD()
external
{
}
/**
* @dev Returns the status.
*/
function status()
public
view
returns (
uint256 deadline,
uint256 usdAudit,
uint256 usdClaimed,
uint256 usdReceived,
uint256 resaleEtherUSD,
uint256 v1Claimed,
uint256 v1Bonuses,
uint256 v2Claimed,
uint256 v2Bonuses,
uint256 etherUSD,
uint256 vokenUSD
)
{
}
/**
* @dev Returns status of `account`.
*/
function getAccountStatus(address account)
public
view
returns (
bool canOnlyResale,
uint256 v1ResaleAppliedTimestamp,
uint256 v2ResaleAppliedTimestamp,
uint256 v1UpgradeAppliedTimestamp,
uint256 v2UpgradeAppliedTimestamp,
uint256 v1Balance,
uint256 v2Balance,
uint256 etherBalance
)
{
}
/**
* @dev Returns the re-sale status.
*/
function v1ResaleStatus(address account)
public
view
returns (
uint256 usdQuota,
uint256 usdAudit,
uint256 usdClaimed,
uint256 timestamp
)
{
}
function v2ResaleStatus(address account)
public
view
returns (
uint256 usdQuota,
uint256 usdAudit,
uint256 usdClaimed,
uint256 timestamp
)
{
}
/**
* @dev Returns the upgrade status.
*/
function v1UpgradeStatus(address account)
public
view
returns (
uint72 weiPurchased,
uint72 weiRewarded,
uint72 weiAudit,
uint16 txsIn,
uint16 txsOut,
uint256 claim,
uint256 bonus,
uint256 etherUSD,
uint256 vokenUSD,
uint256 timestamp
)
{
}
function v2UpgradeStatus(address account)
public
view
returns (
uint72 weiPurchased,
uint72 weiRewarded,
uint72 weiAudit,
uint16 txsIn,
uint16 txsOut,
uint256 claim,
uint256 bonus,
uint256 etherUSD,
uint256 vokenUSD,
uint256 timestamp
)
{
}
/**
* @dev Returns the vesting amount of VOKEN by `account`, only for this re-sale/upgrade contract/program.
*/
function vestingOf(address account)
public
override
view
returns (uint256 vesting)
{
}
/**
* @dev Returns USD received.
*/
function _usdReceived()
private
view
returns (uint256)
{
}
/**
* @dev Re-Sale.
*/
function _v1Resale(address account)
private
onlyBeforeDeadline
onlyNotPaused
{
}
function _v2Resale(address account)
private
onlyBeforeDeadline
onlyNotPaused
{
}
/**
* @dev Upgrade.
*/
function _v1Upgrade(address account)
private
onlyBeforeDeadline
onlyNotPaused
{
require(<FILL_ME>)
require(_v1ResaleApplied[account].timestamp == 0, "Upgrade from Voken1: already applied for resale");
require(_v1UpgradeApplied[account].timestamp == 0, "Upgrade from Voken1: already applied before");
(uint256 claim, uint256 bonus, uint256 etherUSD, uint256 vokenUSD,) = _v1UpgradeQuota(account);
require(claim > 0 || bonus > 0, "Upgrade from Voken1: not upgradeable");
uint256 vokenUpgraded = _v1Claimed.add(_v1Bonuses).add(_v2Claimed).add(_v2Bonuses);
require(vokenUpgraded < VOKEN_UPGRADED_CAP, "Upgrade from Voken1: out of the cap");
if (claim > 0) {
VOKEN_TB.mintWithVesting(account, claim, address(this));
_v1Claimed = _v1Claimed.add(claim);
_v1UpgradeApplied[account].claimed = claim;
}
if (bonus > 0) {
VOKEN_TB.mintWithVesting(account, bonus, address(this));
_v1Bonuses = _v1Bonuses.add(bonus);
_v1UpgradeApplied[account].bonuses = bonus;
}
_v1UpgradeApplied[account].etherUSDPrice = etherUSD;
_v1UpgradeApplied[account].vokenUSDPrice = vokenUSD;
_v1UpgradeApplied[account].timestamp = block.timestamp;
}
function _v2Upgrade(address account)
private
onlyBeforeDeadline
onlyNotPaused
{
}
/**
* @dev Claim USD.
*/
function _v1ClaimUSD()
private
{
}
function _v2ClaimUSD()
private
{
}
/**
* @dev Returns the USD amount of an `account` in re-sale.
*/
function _v1USDQuota(address account)
private
view
returns (uint256 quota)
{
}
function _v2USDQuota(address account)
private
view
returns (uint256 quota)
{
}
/**
* @dev Returns upgrading data/quota.
*/
function _v1UpgradeQuota(address account)
private
view
returns (
uint256 claim,
uint256 bonus,
uint256 etherUSD,
uint256 vokenUSD,
uint256 timestamp
)
{
}
function _v2UpgradeQuota(address account)
private
view
returns (
uint256 claim,
uint256 bonus,
uint256 etherUSD,
uint256 vokenUSD,
uint256 timestamp
)
{
}
/**
* @dev Returns the bigger one between `a` and `b`.
*/
function max(uint256 a, uint256 b)
private
pure
returns (uint256)
{
}
}
| !isResaleOnly(account),"Upgrade from Voken1: can only apply for resale" | 6,866 | !isResaleOnly(account) |
"Have not applied for resale yet" | // SPDX-License-Identifier: MIT
pragma solidity =0.7.5;
// Resale Voken1.0/2.0 or Upgrade to VokenTB.
//
// More info:
// https://voken.io
//
// Contact us:
// support@voken.io
import "LibSafeMath.sol";
import "LibAuthPause.sol";
import "LibIVesting.sol";
import "LibIERC20.sol";
import "LibIVokenTB.sol";
import "LibIVokenAudit.sol";
import "RouWithResaleOnly.sol";
import "RouWithDeadline.sol";
import "RouWithCoeff.sol";
import "RouWithUSDPrice.sol";
import "RouWithUSDToken.sol";
import "RouWithVestingPermille.sol";
/**
* @title Resale Voken1.0/2.0 or Upgrade to VokenTB.
*/
contract ResaleOrUpgradeToVokenTB is IVesting, AuthPause, WithResaleOnly, WithDeadline, WithCoeff, WithUSDPrice, WithUSDToken, WithVestingPermille {
using SafeMath for uint256;
struct Resale {
uint256 usdAudit;
uint256 usdClaimed;
uint256 timestamp;
}
struct Upgraded {
uint256 claimed;
uint256 bonuses;
uint256 etherUSDPrice;
uint256 vokenUSDPrice;
uint256 timestamp;
}
uint256 private immutable VOKEN_UPGRADED_CAP = 21_000_000e9;
uint256 private _usdAudit;
uint256 private _usdClaimed;
uint256 private _v1Claimed;
uint256 private _v1Bonuses;
uint256 private _v2Claimed;
uint256 private _v2Bonuses;
IVokenTB private immutable VOKEN_TB = IVokenTB(0x1234567a022acaa848E7D6bC351d075dBfa76Dd4);
IERC20 private immutable VOKEN_1 = IERC20(0x82070415FEe803f94Ce5617Be1878503e58F0a6a); // Voken1.0
IERC20 private immutable VOKEN_2 = IERC20(0xFfFAb974088Bd5bF3d7E6F522e93Dd7861264cDB); // Voken2.0
IVokenAudit private immutable VOKEN_1_AUDIT = IVokenAudit(0x11111eA590876f5E8416cD4a81A0CFb9DfA2b08E);
IVokenAudit private immutable VOKEN_2_AUDIT = IVokenAudit(0x22222eA5b84E877A1790b4653a70ad0df8e3E890);
mapping (address => Resale) private _v1ResaleApplied;
mapping (address => Resale) private _v2ResaleApplied;
mapping (address => Upgraded) private _v1UpgradeApplied;
mapping (address => Upgraded) private _v2UpgradeApplied;
/**
* @dev Accept Ether.
*/
receive()
external
payable
{
}
/**
* @dev Apply re-sale.
*/
function applyV1Resale()
external
{
}
function applyV2Resale()
external
{
}
/**
* @dev Apply upgrade.
*/
function applyV1Upgrade()
external
{
}
function applyV2Upgrade()
external
{
}
/**
* @dev Claim USD, according to re-sale.
*/
function claimV1USD()
external
{
}
function claimV2USD()
external
{
}
/**
* @dev Returns the status.
*/
function status()
public
view
returns (
uint256 deadline,
uint256 usdAudit,
uint256 usdClaimed,
uint256 usdReceived,
uint256 resaleEtherUSD,
uint256 v1Claimed,
uint256 v1Bonuses,
uint256 v2Claimed,
uint256 v2Bonuses,
uint256 etherUSD,
uint256 vokenUSD
)
{
}
/**
* @dev Returns status of `account`.
*/
function getAccountStatus(address account)
public
view
returns (
bool canOnlyResale,
uint256 v1ResaleAppliedTimestamp,
uint256 v2ResaleAppliedTimestamp,
uint256 v1UpgradeAppliedTimestamp,
uint256 v2UpgradeAppliedTimestamp,
uint256 v1Balance,
uint256 v2Balance,
uint256 etherBalance
)
{
}
/**
* @dev Returns the re-sale status.
*/
function v1ResaleStatus(address account)
public
view
returns (
uint256 usdQuota,
uint256 usdAudit,
uint256 usdClaimed,
uint256 timestamp
)
{
}
function v2ResaleStatus(address account)
public
view
returns (
uint256 usdQuota,
uint256 usdAudit,
uint256 usdClaimed,
uint256 timestamp
)
{
}
/**
* @dev Returns the upgrade status.
*/
function v1UpgradeStatus(address account)
public
view
returns (
uint72 weiPurchased,
uint72 weiRewarded,
uint72 weiAudit,
uint16 txsIn,
uint16 txsOut,
uint256 claim,
uint256 bonus,
uint256 etherUSD,
uint256 vokenUSD,
uint256 timestamp
)
{
}
function v2UpgradeStatus(address account)
public
view
returns (
uint72 weiPurchased,
uint72 weiRewarded,
uint72 weiAudit,
uint16 txsIn,
uint16 txsOut,
uint256 claim,
uint256 bonus,
uint256 etherUSD,
uint256 vokenUSD,
uint256 timestamp
)
{
}
/**
* @dev Returns the vesting amount of VOKEN by `account`, only for this re-sale/upgrade contract/program.
*/
function vestingOf(address account)
public
override
view
returns (uint256 vesting)
{
}
/**
* @dev Returns USD received.
*/
function _usdReceived()
private
view
returns (uint256)
{
}
/**
* @dev Re-Sale.
*/
function _v1Resale(address account)
private
onlyBeforeDeadline
onlyNotPaused
{
}
function _v2Resale(address account)
private
onlyBeforeDeadline
onlyNotPaused
{
}
/**
* @dev Upgrade.
*/
function _v1Upgrade(address account)
private
onlyBeforeDeadline
onlyNotPaused
{
}
function _v2Upgrade(address account)
private
onlyBeforeDeadline
onlyNotPaused
{
}
/**
* @dev Claim USD.
*/
function _v1ClaimUSD()
private
{
require(<FILL_ME>)
uint256 balance = _getUSDBalance();
require(balance > 0, "USD balance is zero");
uint256 quota = _v1USDQuota(msg.sender);
require(quota > 0, "No USD quota to claim");
if (quota < balance) {
_usdClaimed = _usdClaimed.add(quota);
_v1ResaleApplied[msg.sender].usdClaimed = _v1ResaleApplied[msg.sender].usdClaimed.add(quota);
_transferUSD(msg.sender, quota);
}
else {
_usdClaimed = _usdClaimed.add(balance);
_v1ResaleApplied[msg.sender].usdClaimed = _v1ResaleApplied[msg.sender].usdClaimed.add(balance);
_transferUSD(msg.sender, balance);
}
}
function _v2ClaimUSD()
private
{
}
/**
* @dev Returns the USD amount of an `account` in re-sale.
*/
function _v1USDQuota(address account)
private
view
returns (uint256 quota)
{
}
function _v2USDQuota(address account)
private
view
returns (uint256 quota)
{
}
/**
* @dev Returns upgrading data/quota.
*/
function _v1UpgradeQuota(address account)
private
view
returns (
uint256 claim,
uint256 bonus,
uint256 etherUSD,
uint256 vokenUSD,
uint256 timestamp
)
{
}
function _v2UpgradeQuota(address account)
private
view
returns (
uint256 claim,
uint256 bonus,
uint256 etherUSD,
uint256 vokenUSD,
uint256 timestamp
)
{
}
/**
* @dev Returns the bigger one between `a` and `b`.
*/
function max(uint256 a, uint256 b)
private
pure
returns (uint256)
{
}
}
| _v1ResaleApplied[msg.sender].timestamp>0,"Have not applied for resale yet" | 6,866 | _v1ResaleApplied[msg.sender].timestamp>0 |
"Have not applied for resale yet" | // SPDX-License-Identifier: MIT
pragma solidity =0.7.5;
// Resale Voken1.0/2.0 or Upgrade to VokenTB.
//
// More info:
// https://voken.io
//
// Contact us:
// support@voken.io
import "LibSafeMath.sol";
import "LibAuthPause.sol";
import "LibIVesting.sol";
import "LibIERC20.sol";
import "LibIVokenTB.sol";
import "LibIVokenAudit.sol";
import "RouWithResaleOnly.sol";
import "RouWithDeadline.sol";
import "RouWithCoeff.sol";
import "RouWithUSDPrice.sol";
import "RouWithUSDToken.sol";
import "RouWithVestingPermille.sol";
/**
* @title Resale Voken1.0/2.0 or Upgrade to VokenTB.
*/
contract ResaleOrUpgradeToVokenTB is IVesting, AuthPause, WithResaleOnly, WithDeadline, WithCoeff, WithUSDPrice, WithUSDToken, WithVestingPermille {
using SafeMath for uint256;
struct Resale {
uint256 usdAudit;
uint256 usdClaimed;
uint256 timestamp;
}
struct Upgraded {
uint256 claimed;
uint256 bonuses;
uint256 etherUSDPrice;
uint256 vokenUSDPrice;
uint256 timestamp;
}
uint256 private immutable VOKEN_UPGRADED_CAP = 21_000_000e9;
uint256 private _usdAudit;
uint256 private _usdClaimed;
uint256 private _v1Claimed;
uint256 private _v1Bonuses;
uint256 private _v2Claimed;
uint256 private _v2Bonuses;
IVokenTB private immutable VOKEN_TB = IVokenTB(0x1234567a022acaa848E7D6bC351d075dBfa76Dd4);
IERC20 private immutable VOKEN_1 = IERC20(0x82070415FEe803f94Ce5617Be1878503e58F0a6a); // Voken1.0
IERC20 private immutable VOKEN_2 = IERC20(0xFfFAb974088Bd5bF3d7E6F522e93Dd7861264cDB); // Voken2.0
IVokenAudit private immutable VOKEN_1_AUDIT = IVokenAudit(0x11111eA590876f5E8416cD4a81A0CFb9DfA2b08E);
IVokenAudit private immutable VOKEN_2_AUDIT = IVokenAudit(0x22222eA5b84E877A1790b4653a70ad0df8e3E890);
mapping (address => Resale) private _v1ResaleApplied;
mapping (address => Resale) private _v2ResaleApplied;
mapping (address => Upgraded) private _v1UpgradeApplied;
mapping (address => Upgraded) private _v2UpgradeApplied;
/**
* @dev Accept Ether.
*/
receive()
external
payable
{
}
/**
* @dev Apply re-sale.
*/
function applyV1Resale()
external
{
}
function applyV2Resale()
external
{
}
/**
* @dev Apply upgrade.
*/
function applyV1Upgrade()
external
{
}
function applyV2Upgrade()
external
{
}
/**
* @dev Claim USD, according to re-sale.
*/
function claimV1USD()
external
{
}
function claimV2USD()
external
{
}
/**
* @dev Returns the status.
*/
function status()
public
view
returns (
uint256 deadline,
uint256 usdAudit,
uint256 usdClaimed,
uint256 usdReceived,
uint256 resaleEtherUSD,
uint256 v1Claimed,
uint256 v1Bonuses,
uint256 v2Claimed,
uint256 v2Bonuses,
uint256 etherUSD,
uint256 vokenUSD
)
{
}
/**
* @dev Returns status of `account`.
*/
function getAccountStatus(address account)
public
view
returns (
bool canOnlyResale,
uint256 v1ResaleAppliedTimestamp,
uint256 v2ResaleAppliedTimestamp,
uint256 v1UpgradeAppliedTimestamp,
uint256 v2UpgradeAppliedTimestamp,
uint256 v1Balance,
uint256 v2Balance,
uint256 etherBalance
)
{
}
/**
* @dev Returns the re-sale status.
*/
function v1ResaleStatus(address account)
public
view
returns (
uint256 usdQuota,
uint256 usdAudit,
uint256 usdClaimed,
uint256 timestamp
)
{
}
function v2ResaleStatus(address account)
public
view
returns (
uint256 usdQuota,
uint256 usdAudit,
uint256 usdClaimed,
uint256 timestamp
)
{
}
/**
* @dev Returns the upgrade status.
*/
function v1UpgradeStatus(address account)
public
view
returns (
uint72 weiPurchased,
uint72 weiRewarded,
uint72 weiAudit,
uint16 txsIn,
uint16 txsOut,
uint256 claim,
uint256 bonus,
uint256 etherUSD,
uint256 vokenUSD,
uint256 timestamp
)
{
}
function v2UpgradeStatus(address account)
public
view
returns (
uint72 weiPurchased,
uint72 weiRewarded,
uint72 weiAudit,
uint16 txsIn,
uint16 txsOut,
uint256 claim,
uint256 bonus,
uint256 etherUSD,
uint256 vokenUSD,
uint256 timestamp
)
{
}
/**
* @dev Returns the vesting amount of VOKEN by `account`, only for this re-sale/upgrade contract/program.
*/
function vestingOf(address account)
public
override
view
returns (uint256 vesting)
{
}
/**
* @dev Returns USD received.
*/
function _usdReceived()
private
view
returns (uint256)
{
}
/**
* @dev Re-Sale.
*/
function _v1Resale(address account)
private
onlyBeforeDeadline
onlyNotPaused
{
}
function _v2Resale(address account)
private
onlyBeforeDeadline
onlyNotPaused
{
}
/**
* @dev Upgrade.
*/
function _v1Upgrade(address account)
private
onlyBeforeDeadline
onlyNotPaused
{
}
function _v2Upgrade(address account)
private
onlyBeforeDeadline
onlyNotPaused
{
}
/**
* @dev Claim USD.
*/
function _v1ClaimUSD()
private
{
}
function _v2ClaimUSD()
private
{
require(<FILL_ME>)
uint256 balance = _getUSDBalance();
require(balance > 0, "USD balance is zero");
uint256 quota = _v2USDQuota(msg.sender);
require(quota > 0, "No USD quota to claim");
if (quota < balance) {
_usdClaimed = _usdClaimed.add(quota);
_v2ResaleApplied[msg.sender].usdClaimed = _v2ResaleApplied[msg.sender].usdClaimed.add(quota);
_transferUSD(msg.sender, quota);
}
else {
_usdClaimed = _usdClaimed.add(balance);
_v2ResaleApplied[msg.sender].usdClaimed = _v2ResaleApplied[msg.sender].usdClaimed.add(balance);
_transferUSD(msg.sender, balance);
}
}
/**
* @dev Returns the USD amount of an `account` in re-sale.
*/
function _v1USDQuota(address account)
private
view
returns (uint256 quota)
{
}
function _v2USDQuota(address account)
private
view
returns (uint256 quota)
{
}
/**
* @dev Returns upgrading data/quota.
*/
function _v1UpgradeQuota(address account)
private
view
returns (
uint256 claim,
uint256 bonus,
uint256 etherUSD,
uint256 vokenUSD,
uint256 timestamp
)
{
}
function _v2UpgradeQuota(address account)
private
view
returns (
uint256 claim,
uint256 bonus,
uint256 etherUSD,
uint256 vokenUSD,
uint256 timestamp
)
{
}
/**
* @dev Returns the bigger one between `a` and `b`.
*/
function max(uint256 a, uint256 b)
private
pure
returns (uint256)
{
}
}
| _v2ResaleApplied[msg.sender].timestamp>0,"Have not applied for resale yet" | 6,866 | _v2ResaleApplied[msg.sender].timestamp>0 |
null | pragma solidity 0.7.0;
// SPDX-License-Identifier: MIT
contract Owned {
modifier onlyOwner() {
}
address owner;
address newOwner;
function changeOwner(address payable _newOwner) public onlyOwner {
}
function acceptOwnership() public {
}
}
contract ERC20 {
string public symbol;
string public name;
uint8 public decimals;
uint256 public totalSupply;
mapping (address=>uint256) balances;
mapping (address=>mapping (address=>uint256)) allowed;
event Transfer(address indexed _from, address indexed _to, uint256 _value);
event Approval(address indexed _owner, address indexed _spender, uint256 _value);
function balanceOf(address _owner) view public returns (uint256 balance) { }
function transfer(address _to, uint256 _amount) public returns (bool success) {
require(<FILL_ME>)
balances[msg.sender]-=_amount;
balances[_to]+=_amount;
emit Transfer(msg.sender,_to,_amount);
return true;
}
function transferFrom(address _from,address _to,uint256 _amount) public returns (bool success) {
}
function approve(address _spender, uint256 _amount) public returns (bool success) {
}
function allowance(address _owner, address _spender) view public returns (uint256 remaining) {
}
}
contract AceD is Owned,ERC20{
uint256 public maxSupply;
constructor(address _owner) {
}
receive() external payable {
}
}
| balances[msg.sender]>=_amount&&_amount>0&&balances[_to]+_amount>balances[_to] | 6,981 | balances[msg.sender]>=_amount&&_amount>0&&balances[_to]+_amount>balances[_to] |
null | pragma solidity 0.7.0;
// SPDX-License-Identifier: MIT
contract Owned {
modifier onlyOwner() {
}
address owner;
address newOwner;
function changeOwner(address payable _newOwner) public onlyOwner {
}
function acceptOwnership() public {
}
}
contract ERC20 {
string public symbol;
string public name;
uint8 public decimals;
uint256 public totalSupply;
mapping (address=>uint256) balances;
mapping (address=>mapping (address=>uint256)) allowed;
event Transfer(address indexed _from, address indexed _to, uint256 _value);
event Approval(address indexed _owner, address indexed _spender, uint256 _value);
function balanceOf(address _owner) view public returns (uint256 balance) { }
function transfer(address _to, uint256 _amount) public returns (bool success) {
}
function transferFrom(address _from,address _to,uint256 _amount) public returns (bool success) {
require(<FILL_ME>)
balances[_from]-=_amount;
allowed[_from][msg.sender]-=_amount;
balances[_to]+=_amount;
emit Transfer(_from, _to, _amount);
return true;
}
function approve(address _spender, uint256 _amount) public returns (bool success) {
}
function allowance(address _owner, address _spender) view public returns (uint256 remaining) {
}
}
contract AceD is Owned,ERC20{
uint256 public maxSupply;
constructor(address _owner) {
}
receive() external payable {
}
}
| balances[_from]>=_amount&&allowed[_from][msg.sender]>=_amount&&_amount>0&&balances[_to]+_amount>balances[_to] | 6,981 | balances[_from]>=_amount&&allowed[_from][msg.sender]>=_amount&&_amount>0&&balances[_to]+_amount>balances[_to] |
"Vest::addTokenGrant: Set Voting Power contract first" | // SPDX-License-Identifier: MIT
pragma solidity ^0.7.0;
pragma experimental ABIEncoderV2;
import "./interfaces/IArchToken.sol";
import "./interfaces/IVotingPower.sol";
import "./lib/SafeMath.sol";
/**
* @title Vesting
* @dev The vesting vault contract for the initial token sale
*/
contract Vesting {
using SafeMath for uint256;
/// @notice Grant definition
struct Grant {
uint256 startTime;
uint256 amount;
uint16 vestingDuration;
uint16 vestingCliff;
uint256 totalClaimed;
}
/// @dev Used to translate vesting periods specified in days to seconds
uint256 constant internal SECONDS_PER_DAY = 86400;
/// @notice ARCH token
IArchToken public token;
/// @notice Voting power contract
IVotingPower public votingPower;
/// @notice Mapping of recipient address > token grant
mapping (address => Grant) public tokenGrants;
/// @notice Current owner of this contract
address public owner;
/// @notice Event emitted when a new grant is created
event GrantAdded(address indexed recipient, uint256 indexed amount, uint256 startTime, uint16 vestingDurationInDays, uint16 vestingCliffInDays);
/// @notice Event emitted when tokens are claimed by a recipient from a grant
event GrantTokensClaimed(address indexed recipient, uint256 indexed amountClaimed);
/// @notice Event emitted when the owner of the vesting contract is updated
event ChangedOwner(address indexed oldOwner, address indexed newOwner);
/// @notice Event emitted when the voting power contract referenced by the vesting contract is updated
event ChangedVotingPower(address indexed oldContract, address indexed newContract);
/**
* @notice Construct a new Vesting contract
* @param _token Address of ARCH token
*/
constructor(address _token) {
}
/**
* @notice Add a new token grant
* @param recipient The address that is receiving the grant
* @param startTime The unix timestamp when the grant will start
* @param amount The amount of tokens being granted
* @param vestingDurationInDays The vesting period in days
* @param vestingCliffInDays The vesting cliff duration in days
*/
function addTokenGrant(
address recipient,
uint256 startTime,
uint256 amount,
uint16 vestingDurationInDays,
uint16 vestingCliffInDays
)
external
{
require(msg.sender == owner, "Vest::addTokenGrant: not owner");
require(<FILL_ME>)
require(vestingCliffInDays <= 10*365, "Vest::addTokenGrant: cliff more than 10 years");
require(vestingDurationInDays > 0, "Vest::addTokenGrant: duration must be > 0");
require(vestingDurationInDays <= 25*365, "Vest::addTokenGrant: duration more than 25 years");
require(vestingDurationInDays >= vestingCliffInDays, "Vest::addTokenGrant: duration < cliff");
require(tokenGrants[recipient].amount == 0, "Vest::addTokenGrant: grant already exists for account");
uint256 amountVestedPerDay = amount.div(vestingDurationInDays);
require(amountVestedPerDay > 0, "Vest::addTokenGrant: amountVestedPerDay > 0");
// Transfer the grant tokens under the control of the vesting contract
require(token.transferFrom(owner, address(this), amount), "Vest::addTokenGrant: transfer failed");
uint256 grantStartTime = startTime == 0 ? block.timestamp : startTime;
Grant memory grant = Grant({
startTime: grantStartTime,
amount: amount,
vestingDuration: vestingDurationInDays,
vestingCliff: vestingCliffInDays,
totalClaimed: 0
});
tokenGrants[recipient] = grant;
emit GrantAdded(recipient, amount, grantStartTime, vestingDurationInDays, vestingCliffInDays);
votingPower.addVotingPowerForVestingTokens(recipient, amount);
}
/**
* @notice Get token grant for recipient
* @param recipient The address that has a grant
* @return the grant
*/
function getTokenGrant(address recipient) public view returns(Grant memory){
}
/**
* @notice Calculate the vested and unclaimed tokens available for `recipient` to claim
* @dev Due to rounding errors once grant duration is reached, returns the entire left grant amount
* @dev Returns 0 if cliff has not been reached
* @param recipient The address that has a grant
* @return The amount recipient can claim
*/
function calculateGrantClaim(address recipient) public view returns (uint256) {
}
/**
* @notice Calculate the vested (claimed + unclaimed) tokens for `recipient`
* @dev Returns 0 if cliff has not been reached
* @param recipient The address that has a grant
* @return Total vested balance (claimed + unclaimed)
*/
function vestedBalance(address recipient) external view returns (uint256) {
}
/**
* @notice The balance claimed by `recipient`
* @param recipient The address that has a grant
* @return the number of claimed tokens by `recipient`
*/
function claimedBalance(address recipient) external view returns (uint256) {
}
/**
* @notice Allows a grant recipient to claim their vested tokens
* @dev Errors if no tokens have vested
* @dev It is advised recipients check they are entitled to claim via `calculateGrantClaim` before calling this
* @param recipient The address that has a grant
*/
function claimVestedTokens(address recipient) external {
}
/**
* @notice Calculate the number of tokens that will vest per day for the given recipient
* @param recipient The address that has a grant
* @return Number of tokens that will vest per day
*/
function tokensVestedPerDay(address recipient) public view returns(uint256) {
}
/**
* @notice Set voting power contract address
* @param newContract New voting power contract address
*/
function setVotingPowerContract(address newContract)
external
{
}
/**
* @notice Change owner of vesting contract
* @param newOwner New owner address
*/
function changeOwner(address newOwner)
external
{
}
}
| address(votingPower)!=address(0),"Vest::addTokenGrant: Set Voting Power contract first" | 7,019 | address(votingPower)!=address(0) |
"Vest::addTokenGrant: grant already exists for account" | // SPDX-License-Identifier: MIT
pragma solidity ^0.7.0;
pragma experimental ABIEncoderV2;
import "./interfaces/IArchToken.sol";
import "./interfaces/IVotingPower.sol";
import "./lib/SafeMath.sol";
/**
* @title Vesting
* @dev The vesting vault contract for the initial token sale
*/
contract Vesting {
using SafeMath for uint256;
/// @notice Grant definition
struct Grant {
uint256 startTime;
uint256 amount;
uint16 vestingDuration;
uint16 vestingCliff;
uint256 totalClaimed;
}
/// @dev Used to translate vesting periods specified in days to seconds
uint256 constant internal SECONDS_PER_DAY = 86400;
/// @notice ARCH token
IArchToken public token;
/// @notice Voting power contract
IVotingPower public votingPower;
/// @notice Mapping of recipient address > token grant
mapping (address => Grant) public tokenGrants;
/// @notice Current owner of this contract
address public owner;
/// @notice Event emitted when a new grant is created
event GrantAdded(address indexed recipient, uint256 indexed amount, uint256 startTime, uint16 vestingDurationInDays, uint16 vestingCliffInDays);
/// @notice Event emitted when tokens are claimed by a recipient from a grant
event GrantTokensClaimed(address indexed recipient, uint256 indexed amountClaimed);
/// @notice Event emitted when the owner of the vesting contract is updated
event ChangedOwner(address indexed oldOwner, address indexed newOwner);
/// @notice Event emitted when the voting power contract referenced by the vesting contract is updated
event ChangedVotingPower(address indexed oldContract, address indexed newContract);
/**
* @notice Construct a new Vesting contract
* @param _token Address of ARCH token
*/
constructor(address _token) {
}
/**
* @notice Add a new token grant
* @param recipient The address that is receiving the grant
* @param startTime The unix timestamp when the grant will start
* @param amount The amount of tokens being granted
* @param vestingDurationInDays The vesting period in days
* @param vestingCliffInDays The vesting cliff duration in days
*/
function addTokenGrant(
address recipient,
uint256 startTime,
uint256 amount,
uint16 vestingDurationInDays,
uint16 vestingCliffInDays
)
external
{
require(msg.sender == owner, "Vest::addTokenGrant: not owner");
require(address(votingPower) != address(0), "Vest::addTokenGrant: Set Voting Power contract first");
require(vestingCliffInDays <= 10*365, "Vest::addTokenGrant: cliff more than 10 years");
require(vestingDurationInDays > 0, "Vest::addTokenGrant: duration must be > 0");
require(vestingDurationInDays <= 25*365, "Vest::addTokenGrant: duration more than 25 years");
require(vestingDurationInDays >= vestingCliffInDays, "Vest::addTokenGrant: duration < cliff");
require(<FILL_ME>)
uint256 amountVestedPerDay = amount.div(vestingDurationInDays);
require(amountVestedPerDay > 0, "Vest::addTokenGrant: amountVestedPerDay > 0");
// Transfer the grant tokens under the control of the vesting contract
require(token.transferFrom(owner, address(this), amount), "Vest::addTokenGrant: transfer failed");
uint256 grantStartTime = startTime == 0 ? block.timestamp : startTime;
Grant memory grant = Grant({
startTime: grantStartTime,
amount: amount,
vestingDuration: vestingDurationInDays,
vestingCliff: vestingCliffInDays,
totalClaimed: 0
});
tokenGrants[recipient] = grant;
emit GrantAdded(recipient, amount, grantStartTime, vestingDurationInDays, vestingCliffInDays);
votingPower.addVotingPowerForVestingTokens(recipient, amount);
}
/**
* @notice Get token grant for recipient
* @param recipient The address that has a grant
* @return the grant
*/
function getTokenGrant(address recipient) public view returns(Grant memory){
}
/**
* @notice Calculate the vested and unclaimed tokens available for `recipient` to claim
* @dev Due to rounding errors once grant duration is reached, returns the entire left grant amount
* @dev Returns 0 if cliff has not been reached
* @param recipient The address that has a grant
* @return The amount recipient can claim
*/
function calculateGrantClaim(address recipient) public view returns (uint256) {
}
/**
* @notice Calculate the vested (claimed + unclaimed) tokens for `recipient`
* @dev Returns 0 if cliff has not been reached
* @param recipient The address that has a grant
* @return Total vested balance (claimed + unclaimed)
*/
function vestedBalance(address recipient) external view returns (uint256) {
}
/**
* @notice The balance claimed by `recipient`
* @param recipient The address that has a grant
* @return the number of claimed tokens by `recipient`
*/
function claimedBalance(address recipient) external view returns (uint256) {
}
/**
* @notice Allows a grant recipient to claim their vested tokens
* @dev Errors if no tokens have vested
* @dev It is advised recipients check they are entitled to claim via `calculateGrantClaim` before calling this
* @param recipient The address that has a grant
*/
function claimVestedTokens(address recipient) external {
}
/**
* @notice Calculate the number of tokens that will vest per day for the given recipient
* @param recipient The address that has a grant
* @return Number of tokens that will vest per day
*/
function tokensVestedPerDay(address recipient) public view returns(uint256) {
}
/**
* @notice Set voting power contract address
* @param newContract New voting power contract address
*/
function setVotingPowerContract(address newContract)
external
{
}
/**
* @notice Change owner of vesting contract
* @param newOwner New owner address
*/
function changeOwner(address newOwner)
external
{
}
}
| tokenGrants[recipient].amount==0,"Vest::addTokenGrant: grant already exists for account" | 7,019 | tokenGrants[recipient].amount==0 |
"Vest::addTokenGrant: transfer failed" | // SPDX-License-Identifier: MIT
pragma solidity ^0.7.0;
pragma experimental ABIEncoderV2;
import "./interfaces/IArchToken.sol";
import "./interfaces/IVotingPower.sol";
import "./lib/SafeMath.sol";
/**
* @title Vesting
* @dev The vesting vault contract for the initial token sale
*/
contract Vesting {
using SafeMath for uint256;
/// @notice Grant definition
struct Grant {
uint256 startTime;
uint256 amount;
uint16 vestingDuration;
uint16 vestingCliff;
uint256 totalClaimed;
}
/// @dev Used to translate vesting periods specified in days to seconds
uint256 constant internal SECONDS_PER_DAY = 86400;
/// @notice ARCH token
IArchToken public token;
/// @notice Voting power contract
IVotingPower public votingPower;
/// @notice Mapping of recipient address > token grant
mapping (address => Grant) public tokenGrants;
/// @notice Current owner of this contract
address public owner;
/// @notice Event emitted when a new grant is created
event GrantAdded(address indexed recipient, uint256 indexed amount, uint256 startTime, uint16 vestingDurationInDays, uint16 vestingCliffInDays);
/// @notice Event emitted when tokens are claimed by a recipient from a grant
event GrantTokensClaimed(address indexed recipient, uint256 indexed amountClaimed);
/// @notice Event emitted when the owner of the vesting contract is updated
event ChangedOwner(address indexed oldOwner, address indexed newOwner);
/// @notice Event emitted when the voting power contract referenced by the vesting contract is updated
event ChangedVotingPower(address indexed oldContract, address indexed newContract);
/**
* @notice Construct a new Vesting contract
* @param _token Address of ARCH token
*/
constructor(address _token) {
}
/**
* @notice Add a new token grant
* @param recipient The address that is receiving the grant
* @param startTime The unix timestamp when the grant will start
* @param amount The amount of tokens being granted
* @param vestingDurationInDays The vesting period in days
* @param vestingCliffInDays The vesting cliff duration in days
*/
function addTokenGrant(
address recipient,
uint256 startTime,
uint256 amount,
uint16 vestingDurationInDays,
uint16 vestingCliffInDays
)
external
{
require(msg.sender == owner, "Vest::addTokenGrant: not owner");
require(address(votingPower) != address(0), "Vest::addTokenGrant: Set Voting Power contract first");
require(vestingCliffInDays <= 10*365, "Vest::addTokenGrant: cliff more than 10 years");
require(vestingDurationInDays > 0, "Vest::addTokenGrant: duration must be > 0");
require(vestingDurationInDays <= 25*365, "Vest::addTokenGrant: duration more than 25 years");
require(vestingDurationInDays >= vestingCliffInDays, "Vest::addTokenGrant: duration < cliff");
require(tokenGrants[recipient].amount == 0, "Vest::addTokenGrant: grant already exists for account");
uint256 amountVestedPerDay = amount.div(vestingDurationInDays);
require(amountVestedPerDay > 0, "Vest::addTokenGrant: amountVestedPerDay > 0");
// Transfer the grant tokens under the control of the vesting contract
require(<FILL_ME>)
uint256 grantStartTime = startTime == 0 ? block.timestamp : startTime;
Grant memory grant = Grant({
startTime: grantStartTime,
amount: amount,
vestingDuration: vestingDurationInDays,
vestingCliff: vestingCliffInDays,
totalClaimed: 0
});
tokenGrants[recipient] = grant;
emit GrantAdded(recipient, amount, grantStartTime, vestingDurationInDays, vestingCliffInDays);
votingPower.addVotingPowerForVestingTokens(recipient, amount);
}
/**
* @notice Get token grant for recipient
* @param recipient The address that has a grant
* @return the grant
*/
function getTokenGrant(address recipient) public view returns(Grant memory){
}
/**
* @notice Calculate the vested and unclaimed tokens available for `recipient` to claim
* @dev Due to rounding errors once grant duration is reached, returns the entire left grant amount
* @dev Returns 0 if cliff has not been reached
* @param recipient The address that has a grant
* @return The amount recipient can claim
*/
function calculateGrantClaim(address recipient) public view returns (uint256) {
}
/**
* @notice Calculate the vested (claimed + unclaimed) tokens for `recipient`
* @dev Returns 0 if cliff has not been reached
* @param recipient The address that has a grant
* @return Total vested balance (claimed + unclaimed)
*/
function vestedBalance(address recipient) external view returns (uint256) {
}
/**
* @notice The balance claimed by `recipient`
* @param recipient The address that has a grant
* @return the number of claimed tokens by `recipient`
*/
function claimedBalance(address recipient) external view returns (uint256) {
}
/**
* @notice Allows a grant recipient to claim their vested tokens
* @dev Errors if no tokens have vested
* @dev It is advised recipients check they are entitled to claim via `calculateGrantClaim` before calling this
* @param recipient The address that has a grant
*/
function claimVestedTokens(address recipient) external {
}
/**
* @notice Calculate the number of tokens that will vest per day for the given recipient
* @param recipient The address that has a grant
* @return Number of tokens that will vest per day
*/
function tokensVestedPerDay(address recipient) public view returns(uint256) {
}
/**
* @notice Set voting power contract address
* @param newContract New voting power contract address
*/
function setVotingPowerContract(address newContract)
external
{
}
/**
* @notice Change owner of vesting contract
* @param newOwner New owner address
*/
function changeOwner(address newOwner)
external
{
}
}
| token.transferFrom(owner,address(this),amount),"Vest::addTokenGrant: transfer failed" | 7,019 | token.transferFrom(owner,address(this),amount) |
"Vest::claimVested: transfer failed" | // SPDX-License-Identifier: MIT
pragma solidity ^0.7.0;
pragma experimental ABIEncoderV2;
import "./interfaces/IArchToken.sol";
import "./interfaces/IVotingPower.sol";
import "./lib/SafeMath.sol";
/**
* @title Vesting
* @dev The vesting vault contract for the initial token sale
*/
contract Vesting {
using SafeMath for uint256;
/// @notice Grant definition
struct Grant {
uint256 startTime;
uint256 amount;
uint16 vestingDuration;
uint16 vestingCliff;
uint256 totalClaimed;
}
/// @dev Used to translate vesting periods specified in days to seconds
uint256 constant internal SECONDS_PER_DAY = 86400;
/// @notice ARCH token
IArchToken public token;
/// @notice Voting power contract
IVotingPower public votingPower;
/// @notice Mapping of recipient address > token grant
mapping (address => Grant) public tokenGrants;
/// @notice Current owner of this contract
address public owner;
/// @notice Event emitted when a new grant is created
event GrantAdded(address indexed recipient, uint256 indexed amount, uint256 startTime, uint16 vestingDurationInDays, uint16 vestingCliffInDays);
/// @notice Event emitted when tokens are claimed by a recipient from a grant
event GrantTokensClaimed(address indexed recipient, uint256 indexed amountClaimed);
/// @notice Event emitted when the owner of the vesting contract is updated
event ChangedOwner(address indexed oldOwner, address indexed newOwner);
/// @notice Event emitted when the voting power contract referenced by the vesting contract is updated
event ChangedVotingPower(address indexed oldContract, address indexed newContract);
/**
* @notice Construct a new Vesting contract
* @param _token Address of ARCH token
*/
constructor(address _token) {
}
/**
* @notice Add a new token grant
* @param recipient The address that is receiving the grant
* @param startTime The unix timestamp when the grant will start
* @param amount The amount of tokens being granted
* @param vestingDurationInDays The vesting period in days
* @param vestingCliffInDays The vesting cliff duration in days
*/
function addTokenGrant(
address recipient,
uint256 startTime,
uint256 amount,
uint16 vestingDurationInDays,
uint16 vestingCliffInDays
)
external
{
}
/**
* @notice Get token grant for recipient
* @param recipient The address that has a grant
* @return the grant
*/
function getTokenGrant(address recipient) public view returns(Grant memory){
}
/**
* @notice Calculate the vested and unclaimed tokens available for `recipient` to claim
* @dev Due to rounding errors once grant duration is reached, returns the entire left grant amount
* @dev Returns 0 if cliff has not been reached
* @param recipient The address that has a grant
* @return The amount recipient can claim
*/
function calculateGrantClaim(address recipient) public view returns (uint256) {
}
/**
* @notice Calculate the vested (claimed + unclaimed) tokens for `recipient`
* @dev Returns 0 if cliff has not been reached
* @param recipient The address that has a grant
* @return Total vested balance (claimed + unclaimed)
*/
function vestedBalance(address recipient) external view returns (uint256) {
}
/**
* @notice The balance claimed by `recipient`
* @param recipient The address that has a grant
* @return the number of claimed tokens by `recipient`
*/
function claimedBalance(address recipient) external view returns (uint256) {
}
/**
* @notice Allows a grant recipient to claim their vested tokens
* @dev Errors if no tokens have vested
* @dev It is advised recipients check they are entitled to claim via `calculateGrantClaim` before calling this
* @param recipient The address that has a grant
*/
function claimVestedTokens(address recipient) external {
uint256 amountVested = calculateGrantClaim(recipient);
require(amountVested > 0, "Vest::claimVested: amountVested is 0");
votingPower.removeVotingPowerForClaimedTokens(recipient, amountVested);
Grant storage tokenGrant = tokenGrants[recipient];
tokenGrant.totalClaimed = uint256(tokenGrant.totalClaimed.add(amountVested));
require(<FILL_ME>)
emit GrantTokensClaimed(recipient, amountVested);
}
/**
* @notice Calculate the number of tokens that will vest per day for the given recipient
* @param recipient The address that has a grant
* @return Number of tokens that will vest per day
*/
function tokensVestedPerDay(address recipient) public view returns(uint256) {
}
/**
* @notice Set voting power contract address
* @param newContract New voting power contract address
*/
function setVotingPowerContract(address newContract)
external
{
}
/**
* @notice Change owner of vesting contract
* @param newOwner New owner address
*/
function changeOwner(address newOwner)
external
{
}
}
| token.transfer(recipient,amountVested),"Vest::claimVested: transfer failed" | 7,019 | token.transfer(recipient,amountVested) |
"Vest::setVotingPowerContract: voting power not initialized" | // SPDX-License-Identifier: MIT
pragma solidity ^0.7.0;
pragma experimental ABIEncoderV2;
import "./interfaces/IArchToken.sol";
import "./interfaces/IVotingPower.sol";
import "./lib/SafeMath.sol";
/**
* @title Vesting
* @dev The vesting vault contract for the initial token sale
*/
contract Vesting {
using SafeMath for uint256;
/// @notice Grant definition
struct Grant {
uint256 startTime;
uint256 amount;
uint16 vestingDuration;
uint16 vestingCliff;
uint256 totalClaimed;
}
/// @dev Used to translate vesting periods specified in days to seconds
uint256 constant internal SECONDS_PER_DAY = 86400;
/// @notice ARCH token
IArchToken public token;
/// @notice Voting power contract
IVotingPower public votingPower;
/// @notice Mapping of recipient address > token grant
mapping (address => Grant) public tokenGrants;
/// @notice Current owner of this contract
address public owner;
/// @notice Event emitted when a new grant is created
event GrantAdded(address indexed recipient, uint256 indexed amount, uint256 startTime, uint16 vestingDurationInDays, uint16 vestingCliffInDays);
/// @notice Event emitted when tokens are claimed by a recipient from a grant
event GrantTokensClaimed(address indexed recipient, uint256 indexed amountClaimed);
/// @notice Event emitted when the owner of the vesting contract is updated
event ChangedOwner(address indexed oldOwner, address indexed newOwner);
/// @notice Event emitted when the voting power contract referenced by the vesting contract is updated
event ChangedVotingPower(address indexed oldContract, address indexed newContract);
/**
* @notice Construct a new Vesting contract
* @param _token Address of ARCH token
*/
constructor(address _token) {
}
/**
* @notice Add a new token grant
* @param recipient The address that is receiving the grant
* @param startTime The unix timestamp when the grant will start
* @param amount The amount of tokens being granted
* @param vestingDurationInDays The vesting period in days
* @param vestingCliffInDays The vesting cliff duration in days
*/
function addTokenGrant(
address recipient,
uint256 startTime,
uint256 amount,
uint16 vestingDurationInDays,
uint16 vestingCliffInDays
)
external
{
}
/**
* @notice Get token grant for recipient
* @param recipient The address that has a grant
* @return the grant
*/
function getTokenGrant(address recipient) public view returns(Grant memory){
}
/**
* @notice Calculate the vested and unclaimed tokens available for `recipient` to claim
* @dev Due to rounding errors once grant duration is reached, returns the entire left grant amount
* @dev Returns 0 if cliff has not been reached
* @param recipient The address that has a grant
* @return The amount recipient can claim
*/
function calculateGrantClaim(address recipient) public view returns (uint256) {
}
/**
* @notice Calculate the vested (claimed + unclaimed) tokens for `recipient`
* @dev Returns 0 if cliff has not been reached
* @param recipient The address that has a grant
* @return Total vested balance (claimed + unclaimed)
*/
function vestedBalance(address recipient) external view returns (uint256) {
}
/**
* @notice The balance claimed by `recipient`
* @param recipient The address that has a grant
* @return the number of claimed tokens by `recipient`
*/
function claimedBalance(address recipient) external view returns (uint256) {
}
/**
* @notice Allows a grant recipient to claim their vested tokens
* @dev Errors if no tokens have vested
* @dev It is advised recipients check they are entitled to claim via `calculateGrantClaim` before calling this
* @param recipient The address that has a grant
*/
function claimVestedTokens(address recipient) external {
}
/**
* @notice Calculate the number of tokens that will vest per day for the given recipient
* @param recipient The address that has a grant
* @return Number of tokens that will vest per day
*/
function tokensVestedPerDay(address recipient) public view returns(uint256) {
}
/**
* @notice Set voting power contract address
* @param newContract New voting power contract address
*/
function setVotingPowerContract(address newContract)
external
{
require(msg.sender == owner, "Vest::setVotingPowerContract: not owner");
require(newContract != address(0) && newContract != address(this) && newContract != address(token), "Vest::setVotingPowerContract: not valid contract");
require(<FILL_ME>)
address oldContract = address(votingPower);
votingPower = IVotingPower(newContract);
emit ChangedVotingPower(oldContract, newContract);
}
/**
* @notice Change owner of vesting contract
* @param newOwner New owner address
*/
function changeOwner(address newOwner)
external
{
}
}
| IVotingPower(newContract).archToken()==address(token),"Vest::setVotingPowerContract: voting power not initialized" | 7,019 | IVotingPower(newContract).archToken()==address(token) |
"ONE DEPOSIT PER PLAYER" | pragma solidity ^0.5.11;
//
// PONZI PROTOCOL 0.1 - ALPHA
//
// HTTPS://PONZI.FINANCE
//
// Tested some parts pretty well
// Kinda YOLO'd a bunch of stuff last minute though
// Player logging probably works
//
// send hate tweets to @deanpierce
//
// USE AT YOUR OWN RISK
//
// 0x8416c1863eDEea0E0f0f766CfF1b1800Fdb749aD
contract Ponzi{
// compounded every hour
uint256 magicNum = 10007585; // numerator
uint256 magicDen = 10000000; // denominator
uint256[] public compTable; // compound interest table
address payable public educator;
address payable public killer;
// list of active players
struct Player {
uint id;
uint deposit; // principle deposit
uint regTime; // registration time
}
// historical record entries
struct PlayerRecord {
address record;
uint deposit; // principle deposit
uint regTime; // registration time
uint withdrawl; // total taken out
uint exitTime; // time exited
}
mapping (address => Player) public players; // tracking active players
PlayerRecord[] public playerLog; // tracking long term
constructor() public{
}
// MONEY GO IN
function () external payable { // deposit
require(msg.sender==tx.origin, "HUMANS ONLY"); // humans only!
require(<FILL_ME>)
require(msg.value>0, "GOTTA PAY TO PLAY");
// update the list of active players
players[msg.sender].id=playerLog.length;
players[msg.sender].deposit=msg.value;
players[msg.sender].regTime=block.timestamp;
// lets get this in writing
PlayerRecord memory newRecord;
newRecord.record=msg.sender;
newRecord.deposit=msg.value;
newRecord.regTime=block.timestamp;
playerLog.push(newRecord);
}
// MONEY GO OUT
function withdraw() public returns(bool result) {
}
function getWealthAtTime(uint256 hrs) public view returns (uint256) {
}
function getWealth() public view returns (uint256) {
}
function getAge() public view returns (uint256) {
}
function getBalance() public view returns(uint256) {
}
function getLogCount() public view returns(uint256) {
}
// owner paterns are overrated
function updateEducator(address payable newEducator) public {
}
// in case something really weird happens
function breakGlass() public {
}
// disable glass breaking by setting to 0x00..
function updateKiller(address payable newKiller) public {
}
// fill out more of the compound interest table
// if it's stupid and it works, it's not stupid
function bumpComp(uint256 count) public returns (uint256) {
}
}
| players[msg.sender].deposit==0,"ONE DEPOSIT PER PLAYER" | 7,166 | players[msg.sender].deposit==0 |
"NEW CONTRACT WHO DIS?" | pragma solidity ^0.5.11;
//
// PONZI PROTOCOL 0.1 - ALPHA
//
// HTTPS://PONZI.FINANCE
//
// Tested some parts pretty well
// Kinda YOLO'd a bunch of stuff last minute though
// Player logging probably works
//
// send hate tweets to @deanpierce
//
// USE AT YOUR OWN RISK
//
// 0x8416c1863eDEea0E0f0f766CfF1b1800Fdb749aD
contract Ponzi{
// compounded every hour
uint256 magicNum = 10007585; // numerator
uint256 magicDen = 10000000; // denominator
uint256[] public compTable; // compound interest table
address payable public educator;
address payable public killer;
// list of active players
struct Player {
uint id;
uint deposit; // principle deposit
uint regTime; // registration time
}
// historical record entries
struct PlayerRecord {
address record;
uint deposit; // principle deposit
uint regTime; // registration time
uint withdrawl; // total taken out
uint exitTime; // time exited
}
mapping (address => Player) public players; // tracking active players
PlayerRecord[] public playerLog; // tracking long term
constructor() public{
}
// MONEY GO IN
function () external payable {
}
// MONEY GO OUT
function withdraw() public returns(bool result) {
require(msg.sender==tx.origin, "HUMANS ONLY"); // humans only!
require(<FILL_ME>)
uint256 hrs = getAge();
// check for cooldown period
require(hrs<24, "24hr COOLDOWN PERIOD IN EFFECT");
require(hrs<compTable.length,"TABLE TOO SMALL");
// compTable offset by magicDen due to lack of floats
uint256 winnings = players[msg.sender].deposit*compTable[hrs]/magicDen;
result = msg.sender.send(winnings); // sure hope there was enough in the vault..
playerLog[players[msg.sender].id].exitTime=block.timestamp;
// NEED MONIES FOR BOATS, ETC
if(result) {
playerLog[players[msg.sender].id].withdrawl=winnings; // set
result=educator.send(winnings/1000);
}
else {
playerLog[players[msg.sender].id].withdrawl=0;
}
// remove from the list of active players
delete players[msg.sender];
}
function getWealthAtTime(uint256 hrs) public view returns (uint256) {
}
function getWealth() public view returns (uint256) {
}
function getAge() public view returns (uint256) {
}
function getBalance() public view returns(uint256) {
}
function getLogCount() public view returns(uint256) {
}
// owner paterns are overrated
function updateEducator(address payable newEducator) public {
}
// in case something really weird happens
function breakGlass() public {
}
// disable glass breaking by setting to 0x00..
function updateKiller(address payable newKiller) public {
}
// fill out more of the compound interest table
// if it's stupid and it works, it's not stupid
function bumpComp(uint256 count) public returns (uint256) {
}
}
| players[msg.sender].deposit!=0,"NEW CONTRACT WHO DIS?" | 7,166 | players[msg.sender].deposit!=0 |
null | contract Administratable is Ownable {
mapping (address => bool) public superAdmins;
event AddSuperAdmin(address indexed admin);
event RemoveSuperAdmin(address indexed admin);
modifier validateAddress( address _addr )
{
}
modifier onlySuperAdmins {
}
function addSuperAdmin(address _admin) public onlyOwner validateAddress(_admin){
require(<FILL_ME>)
superAdmins[_admin] = true;
emit AddSuperAdmin(_admin);
}
function removeSuperAdmin(address _admin) public onlyOwner validateAddress(_admin){
}
}
| !superAdmins[_admin] | 7,212 | !superAdmins[_admin] |
null | contract Administratable is Ownable {
mapping (address => bool) public superAdmins;
event AddSuperAdmin(address indexed admin);
event RemoveSuperAdmin(address indexed admin);
modifier validateAddress( address _addr )
{
}
modifier onlySuperAdmins {
}
function addSuperAdmin(address _admin) public onlyOwner validateAddress(_admin){
}
function removeSuperAdmin(address _admin) public onlyOwner validateAddress(_admin){
require(<FILL_ME>)
superAdmins[_admin] = false;
emit RemoveSuperAdmin(_admin);
}
}
| superAdmins[_admin] | 7,212 | superAdmins[_admin] |
null | // SPDX-License-Identifier: MIT
pragma solidity 0.6.12;
pragma experimental ABIEncoderV2;
import "@openzeppelin/contracts-ethereum-package/contracts/token/ERC20/SafeERC20.sol";
import "@openzeppelin/contracts-ethereum-package/contracts/access/Ownable.sol";
import "./libraries/Bytes.sol";
import "./libraries/PoolHelper.sol";
import "./libraries/UserHelper.sol";
import "./interfaces/INFT.sol";
import "./StorageState.sol";
// Ram Vault distributes fees equally amongst staked pools
contract RAMVault is StorageState, OwnableUpgradeSafe {
using SafeMath for uint256;
using SafeERC20 for IERC20;
using Bytes for bytes;
using UserHelper for YGYStorageV1.UserInfo;
using PoolHelper for YGYStorageV1.PoolInfo;
event NewEpoch(uint256);
event RewardPaid(uint256 pid, address to);
event Deposit(address indexed user, uint256 indexed pid, uint256 amount);
event Withdraw(address indexed user, uint256 indexed pid, uint256 amount);
event EmergencyWithdraw(address indexed user, uint256 indexed pid, uint256 amount);
event Approval(address indexed owner, address indexed spender, uint256 _pid, uint256 value);
event Boost(address indexed user, uint256 indexed pid, uint256 indexed level, bool fromNFT);
address private devaddr;
address private teamaddr;
address private regeneratoraddr;
address private nftFactory;
function initialize(
address __superAdmin,
address _regeneratoraddr,
address _devaddr,
address _teamaddr,
address _nftFactory
) public initializer {
}
function NFTUsage(
address _user,
address _tokenAddress,
uint256 _tokenId,
uint256 _poolId
) external {
}
// --------------------------------------------
// EPOCH
// --------------------------------------------
// Starts a new calculation epoch
// Also dismisses NFT boost effects
// Because averge since start will not be accurate
function startNewEpoch() public {
require(<FILL_ME>) // about 3 days.
_storage.setEpochRewards();
_storage.setCumulativeRewardsSinceStart();
_storage.setRewardsInThisEpoch(0, 0);
_storage.setEpochCalculationStartBlock();
emit NewEpoch(_storage.epoch());
}
// --------------------------------------------
// OWNER
// --------------------------------------------
// Adds additional RAM rewards
function addRAMRewardsOwner(uint256 _amount) public onlyOwner {
}
// Adds additional YGY rewards
function addYGYRewardsOwner(uint256 _amount) public onlyOwner {
}
// --------------------------------------------
// POOL
// --------------------------------------------
// Add a new token pool. Can only be called by the owner.
// Note contract owner is meant to be a governance contract allowing RAM governance consensus
function addPool(
uint256 _allocPoint,
IERC20 _token,
bool _withdrawable
) public onlyOwner {
}
// Update the given pool's RAMs allocation point. Can only be called by the owner.
// Note contract owner is meant to be a governance contract allowing RAM governance consensus
function set(
uint256 _pid,
uint256 _allocPoint,
bool _withdrawable
) public onlyOwner {
}
// Function that adds pending rewards, called by the RAM token.
function addPendingRewards(uint256 _amount) external {
}
// Update reward variables of the given pool to be up-to-date.
function updatePool(uint256 _pid) internal returns (uint256 ramRewardsWhole, uint256 ygyRewardsWhole) {
}
// Deposit tokens to RamVault for RAM allocation.
function deposit(uint256 _pid, uint256 _amount) public {
}
function claimRewards(uint256 _pid) external {
}
// Test coverage
// [x] Does user get the deposited amounts?
// [x] Does user that its deposited for update correcty?
// [x] Does the depositor get their tokens decreased
function depositFor(
address _depositFor,
uint256 _pid,
uint256 _amount
) public {
}
// Test coverage
// [x] Does allowance update correctly?
function setAllowanceForPoolToken(
address spender,
uint256 _pid,
uint256 value
) public {
}
// Test coverage
// [x] Does allowance decrease?
// [x] Do oyu need allowance
// [x] Withdraws to correct address
function withdrawFrom(
address owner,
uint256 _pid,
uint256 _amount
) public {
}
// Withdraw tokens from RamVault.
function withdraw(uint256 _pid, uint256 _amount) public {
}
// Low level withdraw function
function _withdraw(
uint256 _pid,
uint256 _amount,
address from,
address to
) internal {
}
function massUpdatePools() public {
}
function checkRewards(uint256 _pid, address _user) public view returns (uint256 pendingRAM, uint256 pendingYGY) {
}
function updateAndPayOutPending(uint256 _pid, address _from) internal {
}
// Withdraw without caring about rewards. EMERGENCY ONLY.
// !Caution this will remove all your pending rewards!
function emergencyWithdraw(uint256 _pid) public {
}
// --------------------------------------------
// BOOST
// --------------------------------------------
// Purchase a multiplier level for an individual user for an individual pool, same level cannot be purchased twice.
function purchase(uint256 _pid, uint256 _level) external {
}
// Distributes boost fees to devs and protocol
function distributeFees() public {
}
// --------------------------------------------
// Utils
// --------------------------------------------
// Sets the dev fee for this contract
// defaults at 7.24%
// Note contract owner is meant to be a governance contract allowing RAM governance consensus
uint16 DEV_FEE;
function setDevFee(uint16 _DEV_FEE) public onlyOwner {
}
uint256 pending_DEV_rewards;
uint256 pending_DEV_YGY_rewards;
// function that lets owner/governance contract
// approve allowance for any token inside this contract
// This means all future UNI like airdrops are covered
// And at the same time allows us to give allowance to strategy contracts.
// Upcoming cYFI etc vaults strategy contracts will se this function to manage and farm yield on value locked
function setStrategyContractOrDistributionContractAllowance(
address tokenAddress,
uint256 _amount,
address contractAddress
) external {
}
function isContract(address addr) internal view returns (bool) {
}
function safeRamTransfer(address _to, uint256 _amount) internal {
}
function safeYgyTransfer(address _to, uint256 _amount) internal {
}
function transferRAMDevFee() public {
}
function transferYGYDevFee() public {
}
function setAddresses(
address _devaddr,
address _teamaddr,
address _regeneratoraddr
) external onlyOwner {
}
address private _superAdmin;
event SuperAdminTransfered(address previousOwner, address newOwner);
function superAdmin() public view returns (address) {
}
function burnSuperAdmin() public virtual {
}
function newSuperAdmin(address newOwner) public virtual {
}
}
| _storage.epochStartBlock()+5760<block.number | 7,318 | _storage.epochStartBlock()+5760<block.number |
null | // SPDX-License-Identifier: MIT
pragma solidity 0.6.12;
pragma experimental ABIEncoderV2;
import "@openzeppelin/contracts-ethereum-package/contracts/token/ERC20/SafeERC20.sol";
import "@openzeppelin/contracts-ethereum-package/contracts/access/Ownable.sol";
import "./libraries/Bytes.sol";
import "./libraries/PoolHelper.sol";
import "./libraries/UserHelper.sol";
import "./interfaces/INFT.sol";
import "./StorageState.sol";
// Ram Vault distributes fees equally amongst staked pools
contract RAMVault is StorageState, OwnableUpgradeSafe {
using SafeMath for uint256;
using SafeERC20 for IERC20;
using Bytes for bytes;
using UserHelper for YGYStorageV1.UserInfo;
using PoolHelper for YGYStorageV1.PoolInfo;
event NewEpoch(uint256);
event RewardPaid(uint256 pid, address to);
event Deposit(address indexed user, uint256 indexed pid, uint256 amount);
event Withdraw(address indexed user, uint256 indexed pid, uint256 amount);
event EmergencyWithdraw(address indexed user, uint256 indexed pid, uint256 amount);
event Approval(address indexed owner, address indexed spender, uint256 _pid, uint256 value);
event Boost(address indexed user, uint256 indexed pid, uint256 indexed level, bool fromNFT);
address private devaddr;
address private teamaddr;
address private regeneratoraddr;
address private nftFactory;
function initialize(
address __superAdmin,
address _regeneratoraddr,
address _devaddr,
address _teamaddr,
address _nftFactory
) public initializer {
}
function NFTUsage(
address _user,
address _tokenAddress,
uint256 _tokenId,
uint256 _poolId
) external {
}
// --------------------------------------------
// EPOCH
// --------------------------------------------
// Starts a new calculation epoch
// Also dismisses NFT boost effects
// Because averge since start will not be accurate
function startNewEpoch() public {
}
// --------------------------------------------
// OWNER
// --------------------------------------------
// Adds additional RAM rewards
function addRAMRewardsOwner(uint256 _amount) public onlyOwner {
require(<FILL_ME>)
_storage.addAdditionalRewards(_amount, false);
}
// Adds additional YGY rewards
function addYGYRewardsOwner(uint256 _amount) public onlyOwner {
}
// --------------------------------------------
// POOL
// --------------------------------------------
// Add a new token pool. Can only be called by the owner.
// Note contract owner is meant to be a governance contract allowing RAM governance consensus
function addPool(
uint256 _allocPoint,
IERC20 _token,
bool _withdrawable
) public onlyOwner {
}
// Update the given pool's RAMs allocation point. Can only be called by the owner.
// Note contract owner is meant to be a governance contract allowing RAM governance consensus
function set(
uint256 _pid,
uint256 _allocPoint,
bool _withdrawable
) public onlyOwner {
}
// Function that adds pending rewards, called by the RAM token.
function addPendingRewards(uint256 _amount) external {
}
// Update reward variables of the given pool to be up-to-date.
function updatePool(uint256 _pid) internal returns (uint256 ramRewardsWhole, uint256 ygyRewardsWhole) {
}
// Deposit tokens to RamVault for RAM allocation.
function deposit(uint256 _pid, uint256 _amount) public {
}
function claimRewards(uint256 _pid) external {
}
// Test coverage
// [x] Does user get the deposited amounts?
// [x] Does user that its deposited for update correcty?
// [x] Does the depositor get their tokens decreased
function depositFor(
address _depositFor,
uint256 _pid,
uint256 _amount
) public {
}
// Test coverage
// [x] Does allowance update correctly?
function setAllowanceForPoolToken(
address spender,
uint256 _pid,
uint256 value
) public {
}
// Test coverage
// [x] Does allowance decrease?
// [x] Do oyu need allowance
// [x] Withdraws to correct address
function withdrawFrom(
address owner,
uint256 _pid,
uint256 _amount
) public {
}
// Withdraw tokens from RamVault.
function withdraw(uint256 _pid, uint256 _amount) public {
}
// Low level withdraw function
function _withdraw(
uint256 _pid,
uint256 _amount,
address from,
address to
) internal {
}
function massUpdatePools() public {
}
function checkRewards(uint256 _pid, address _user) public view returns (uint256 pendingRAM, uint256 pendingYGY) {
}
function updateAndPayOutPending(uint256 _pid, address _from) internal {
}
// Withdraw without caring about rewards. EMERGENCY ONLY.
// !Caution this will remove all your pending rewards!
function emergencyWithdraw(uint256 _pid) public {
}
// --------------------------------------------
// BOOST
// --------------------------------------------
// Purchase a multiplier level for an individual user for an individual pool, same level cannot be purchased twice.
function purchase(uint256 _pid, uint256 _level) external {
}
// Distributes boost fees to devs and protocol
function distributeFees() public {
}
// --------------------------------------------
// Utils
// --------------------------------------------
// Sets the dev fee for this contract
// defaults at 7.24%
// Note contract owner is meant to be a governance contract allowing RAM governance consensus
uint16 DEV_FEE;
function setDevFee(uint16 _DEV_FEE) public onlyOwner {
}
uint256 pending_DEV_rewards;
uint256 pending_DEV_YGY_rewards;
// function that lets owner/governance contract
// approve allowance for any token inside this contract
// This means all future UNI like airdrops are covered
// And at the same time allows us to give allowance to strategy contracts.
// Upcoming cYFI etc vaults strategy contracts will se this function to manage and farm yield on value locked
function setStrategyContractOrDistributionContractAllowance(
address tokenAddress,
uint256 _amount,
address contractAddress
) external {
}
function isContract(address addr) internal view returns (bool) {
}
function safeRamTransfer(address _to, uint256 _amount) internal {
}
function safeYgyTransfer(address _to, uint256 _amount) internal {
}
function transferRAMDevFee() public {
}
function transferYGYDevFee() public {
}
function setAddresses(
address _devaddr,
address _teamaddr,
address _regeneratoraddr
) external onlyOwner {
}
address private _superAdmin;
event SuperAdminTransfered(address previousOwner, address newOwner);
function superAdmin() public view returns (address) {
}
function burnSuperAdmin() public virtual {
}
function newSuperAdmin(address newOwner) public virtual {
}
}
| _storage.ram().transferFrom(msg.sender,address(this),_amount)&&_amount>0 | 7,318 | _storage.ram().transferFrom(msg.sender,address(this),_amount)&&_amount>0 |
null | // SPDX-License-Identifier: MIT
pragma solidity 0.6.12;
pragma experimental ABIEncoderV2;
import "@openzeppelin/contracts-ethereum-package/contracts/token/ERC20/SafeERC20.sol";
import "@openzeppelin/contracts-ethereum-package/contracts/access/Ownable.sol";
import "./libraries/Bytes.sol";
import "./libraries/PoolHelper.sol";
import "./libraries/UserHelper.sol";
import "./interfaces/INFT.sol";
import "./StorageState.sol";
// Ram Vault distributes fees equally amongst staked pools
contract RAMVault is StorageState, OwnableUpgradeSafe {
using SafeMath for uint256;
using SafeERC20 for IERC20;
using Bytes for bytes;
using UserHelper for YGYStorageV1.UserInfo;
using PoolHelper for YGYStorageV1.PoolInfo;
event NewEpoch(uint256);
event RewardPaid(uint256 pid, address to);
event Deposit(address indexed user, uint256 indexed pid, uint256 amount);
event Withdraw(address indexed user, uint256 indexed pid, uint256 amount);
event EmergencyWithdraw(address indexed user, uint256 indexed pid, uint256 amount);
event Approval(address indexed owner, address indexed spender, uint256 _pid, uint256 value);
event Boost(address indexed user, uint256 indexed pid, uint256 indexed level, bool fromNFT);
address private devaddr;
address private teamaddr;
address private regeneratoraddr;
address private nftFactory;
function initialize(
address __superAdmin,
address _regeneratoraddr,
address _devaddr,
address _teamaddr,
address _nftFactory
) public initializer {
}
function NFTUsage(
address _user,
address _tokenAddress,
uint256 _tokenId,
uint256 _poolId
) external {
}
// --------------------------------------------
// EPOCH
// --------------------------------------------
// Starts a new calculation epoch
// Also dismisses NFT boost effects
// Because averge since start will not be accurate
function startNewEpoch() public {
}
// --------------------------------------------
// OWNER
// --------------------------------------------
// Adds additional RAM rewards
function addRAMRewardsOwner(uint256 _amount) public onlyOwner {
}
// Adds additional YGY rewards
function addYGYRewardsOwner(uint256 _amount) public onlyOwner {
require(<FILL_ME>)
_storage.addAdditionalRewards(_amount, true);
}
// --------------------------------------------
// POOL
// --------------------------------------------
// Add a new token pool. Can only be called by the owner.
// Note contract owner is meant to be a governance contract allowing RAM governance consensus
function addPool(
uint256 _allocPoint,
IERC20 _token,
bool _withdrawable
) public onlyOwner {
}
// Update the given pool's RAMs allocation point. Can only be called by the owner.
// Note contract owner is meant to be a governance contract allowing RAM governance consensus
function set(
uint256 _pid,
uint256 _allocPoint,
bool _withdrawable
) public onlyOwner {
}
// Function that adds pending rewards, called by the RAM token.
function addPendingRewards(uint256 _amount) external {
}
// Update reward variables of the given pool to be up-to-date.
function updatePool(uint256 _pid) internal returns (uint256 ramRewardsWhole, uint256 ygyRewardsWhole) {
}
// Deposit tokens to RamVault for RAM allocation.
function deposit(uint256 _pid, uint256 _amount) public {
}
function claimRewards(uint256 _pid) external {
}
// Test coverage
// [x] Does user get the deposited amounts?
// [x] Does user that its deposited for update correcty?
// [x] Does the depositor get their tokens decreased
function depositFor(
address _depositFor,
uint256 _pid,
uint256 _amount
) public {
}
// Test coverage
// [x] Does allowance update correctly?
function setAllowanceForPoolToken(
address spender,
uint256 _pid,
uint256 value
) public {
}
// Test coverage
// [x] Does allowance decrease?
// [x] Do oyu need allowance
// [x] Withdraws to correct address
function withdrawFrom(
address owner,
uint256 _pid,
uint256 _amount
) public {
}
// Withdraw tokens from RamVault.
function withdraw(uint256 _pid, uint256 _amount) public {
}
// Low level withdraw function
function _withdraw(
uint256 _pid,
uint256 _amount,
address from,
address to
) internal {
}
function massUpdatePools() public {
}
function checkRewards(uint256 _pid, address _user) public view returns (uint256 pendingRAM, uint256 pendingYGY) {
}
function updateAndPayOutPending(uint256 _pid, address _from) internal {
}
// Withdraw without caring about rewards. EMERGENCY ONLY.
// !Caution this will remove all your pending rewards!
function emergencyWithdraw(uint256 _pid) public {
}
// --------------------------------------------
// BOOST
// --------------------------------------------
// Purchase a multiplier level for an individual user for an individual pool, same level cannot be purchased twice.
function purchase(uint256 _pid, uint256 _level) external {
}
// Distributes boost fees to devs and protocol
function distributeFees() public {
}
// --------------------------------------------
// Utils
// --------------------------------------------
// Sets the dev fee for this contract
// defaults at 7.24%
// Note contract owner is meant to be a governance contract allowing RAM governance consensus
uint16 DEV_FEE;
function setDevFee(uint16 _DEV_FEE) public onlyOwner {
}
uint256 pending_DEV_rewards;
uint256 pending_DEV_YGY_rewards;
// function that lets owner/governance contract
// approve allowance for any token inside this contract
// This means all future UNI like airdrops are covered
// And at the same time allows us to give allowance to strategy contracts.
// Upcoming cYFI etc vaults strategy contracts will se this function to manage and farm yield on value locked
function setStrategyContractOrDistributionContractAllowance(
address tokenAddress,
uint256 _amount,
address contractAddress
) external {
}
function isContract(address addr) internal view returns (bool) {
}
function safeRamTransfer(address _to, uint256 _amount) internal {
}
function safeYgyTransfer(address _to, uint256 _amount) internal {
}
function transferRAMDevFee() public {
}
function transferYGYDevFee() public {
}
function setAddresses(
address _devaddr,
address _teamaddr,
address _regeneratoraddr
) external onlyOwner {
}
address private _superAdmin;
event SuperAdminTransfered(address previousOwner, address newOwner);
function superAdmin() public view returns (address) {
}
function burnSuperAdmin() public virtual {
}
function newSuperAdmin(address newOwner) public virtual {
}
}
| _storage.ygy().transferFrom(msg.sender,address(this),_amount)&&_amount>0 | 7,318 | _storage.ygy().transferFrom(msg.sender,address(this),_amount)&&_amount>0 |
"Not withdrawable" | // SPDX-License-Identifier: MIT
pragma solidity 0.6.12;
pragma experimental ABIEncoderV2;
import "@openzeppelin/contracts-ethereum-package/contracts/token/ERC20/SafeERC20.sol";
import "@openzeppelin/contracts-ethereum-package/contracts/access/Ownable.sol";
import "./libraries/Bytes.sol";
import "./libraries/PoolHelper.sol";
import "./libraries/UserHelper.sol";
import "./interfaces/INFT.sol";
import "./StorageState.sol";
// Ram Vault distributes fees equally amongst staked pools
contract RAMVault is StorageState, OwnableUpgradeSafe {
using SafeMath for uint256;
using SafeERC20 for IERC20;
using Bytes for bytes;
using UserHelper for YGYStorageV1.UserInfo;
using PoolHelper for YGYStorageV1.PoolInfo;
event NewEpoch(uint256);
event RewardPaid(uint256 pid, address to);
event Deposit(address indexed user, uint256 indexed pid, uint256 amount);
event Withdraw(address indexed user, uint256 indexed pid, uint256 amount);
event EmergencyWithdraw(address indexed user, uint256 indexed pid, uint256 amount);
event Approval(address indexed owner, address indexed spender, uint256 _pid, uint256 value);
event Boost(address indexed user, uint256 indexed pid, uint256 indexed level, bool fromNFT);
address private devaddr;
address private teamaddr;
address private regeneratoraddr;
address private nftFactory;
function initialize(
address __superAdmin,
address _regeneratoraddr,
address _devaddr,
address _teamaddr,
address _nftFactory
) public initializer {
}
function NFTUsage(
address _user,
address _tokenAddress,
uint256 _tokenId,
uint256 _poolId
) external {
}
// --------------------------------------------
// EPOCH
// --------------------------------------------
// Starts a new calculation epoch
// Also dismisses NFT boost effects
// Because averge since start will not be accurate
function startNewEpoch() public {
}
// --------------------------------------------
// OWNER
// --------------------------------------------
// Adds additional RAM rewards
function addRAMRewardsOwner(uint256 _amount) public onlyOwner {
}
// Adds additional YGY rewards
function addYGYRewardsOwner(uint256 _amount) public onlyOwner {
}
// --------------------------------------------
// POOL
// --------------------------------------------
// Add a new token pool. Can only be called by the owner.
// Note contract owner is meant to be a governance contract allowing RAM governance consensus
function addPool(
uint256 _allocPoint,
IERC20 _token,
bool _withdrawable
) public onlyOwner {
}
// Update the given pool's RAMs allocation point. Can only be called by the owner.
// Note contract owner is meant to be a governance contract allowing RAM governance consensus
function set(
uint256 _pid,
uint256 _allocPoint,
bool _withdrawable
) public onlyOwner {
}
// Function that adds pending rewards, called by the RAM token.
function addPendingRewards(uint256 _amount) external {
}
// Update reward variables of the given pool to be up-to-date.
function updatePool(uint256 _pid) internal returns (uint256 ramRewardsWhole, uint256 ygyRewardsWhole) {
}
// Deposit tokens to RamVault for RAM allocation.
function deposit(uint256 _pid, uint256 _amount) public {
}
function claimRewards(uint256 _pid) external {
}
// Test coverage
// [x] Does user get the deposited amounts?
// [x] Does user that its deposited for update correcty?
// [x] Does the depositor get their tokens decreased
function depositFor(
address _depositFor,
uint256 _pid,
uint256 _amount
) public {
}
// Test coverage
// [x] Does allowance update correctly?
function setAllowanceForPoolToken(
address spender,
uint256 _pid,
uint256 value
) public {
}
// Test coverage
// [x] Does allowance decrease?
// [x] Do oyu need allowance
// [x] Withdraws to correct address
function withdrawFrom(
address owner,
uint256 _pid,
uint256 _amount
) public {
}
// Withdraw tokens from RamVault.
function withdraw(uint256 _pid, uint256 _amount) public {
}
// Low level withdraw function
function _withdraw(
uint256 _pid,
uint256 _amount,
address from,
address to
) internal {
YGYStorageV1.PoolInfo memory pool = PoolHelper.getPool(_pid, _storage);
require(<FILL_ME>)
YGYStorageV1.UserInfo memory user = UserHelper.getUser(_pid, from, _storage);
require(user.amount >= _amount, "Withdraw amount exceeds balance");
updateAndPayOutPending(_pid, from); // Update balances of from, this is not withdrawal but claiming RAM farmed
if (_amount > 0) {
user.amount = user.amount.sub(_amount);
pool.token.safeTransfer(address(to), _amount);
// Users who have bought multipliers will have their accounting balances readjusted.
if (user.boostAmount > 0 || user.boostLevel > 0) {
user.adjustEffectiveStake(pool, from, 0, true, _storage);
}
}
user.updateDebts(pool);
_storage.updateUserInfo(_pid, msg.sender, user);
_storage.updatePoolInfo(_pid, pool);
emit Withdraw(to, _pid, _amount);
}
function massUpdatePools() public {
}
function checkRewards(uint256 _pid, address _user) public view returns (uint256 pendingRAM, uint256 pendingYGY) {
}
function updateAndPayOutPending(uint256 _pid, address _from) internal {
}
// Withdraw without caring about rewards. EMERGENCY ONLY.
// !Caution this will remove all your pending rewards!
function emergencyWithdraw(uint256 _pid) public {
}
// --------------------------------------------
// BOOST
// --------------------------------------------
// Purchase a multiplier level for an individual user for an individual pool, same level cannot be purchased twice.
function purchase(uint256 _pid, uint256 _level) external {
}
// Distributes boost fees to devs and protocol
function distributeFees() public {
}
// --------------------------------------------
// Utils
// --------------------------------------------
// Sets the dev fee for this contract
// defaults at 7.24%
// Note contract owner is meant to be a governance contract allowing RAM governance consensus
uint16 DEV_FEE;
function setDevFee(uint16 _DEV_FEE) public onlyOwner {
}
uint256 pending_DEV_rewards;
uint256 pending_DEV_YGY_rewards;
// function that lets owner/governance contract
// approve allowance for any token inside this contract
// This means all future UNI like airdrops are covered
// And at the same time allows us to give allowance to strategy contracts.
// Upcoming cYFI etc vaults strategy contracts will se this function to manage and farm yield on value locked
function setStrategyContractOrDistributionContractAllowance(
address tokenAddress,
uint256 _amount,
address contractAddress
) external {
}
function isContract(address addr) internal view returns (bool) {
}
function safeRamTransfer(address _to, uint256 _amount) internal {
}
function safeYgyTransfer(address _to, uint256 _amount) internal {
}
function transferRAMDevFee() public {
}
function transferYGYDevFee() public {
}
function setAddresses(
address _devaddr,
address _teamaddr,
address _regeneratoraddr
) external onlyOwner {
}
address private _superAdmin;
event SuperAdminTransfered(address previousOwner, address newOwner);
function superAdmin() public view returns (address) {
}
function burnSuperAdmin() public virtual {
}
function newSuperAdmin(address newOwner) public virtual {
}
}
| pool.withdrawable,"Not withdrawable" | 7,318 | pool.withdrawable |
null | // SPDX-License-Identifier: MIT
pragma solidity 0.6.12;
pragma experimental ABIEncoderV2;
import "@openzeppelin/contracts-ethereum-package/contracts/token/ERC20/SafeERC20.sol";
import "@openzeppelin/contracts-ethereum-package/contracts/access/Ownable.sol";
import "./libraries/Bytes.sol";
import "./libraries/PoolHelper.sol";
import "./libraries/UserHelper.sol";
import "./interfaces/INFT.sol";
import "./StorageState.sol";
// Ram Vault distributes fees equally amongst staked pools
contract RAMVault is StorageState, OwnableUpgradeSafe {
using SafeMath for uint256;
using SafeERC20 for IERC20;
using Bytes for bytes;
using UserHelper for YGYStorageV1.UserInfo;
using PoolHelper for YGYStorageV1.PoolInfo;
event NewEpoch(uint256);
event RewardPaid(uint256 pid, address to);
event Deposit(address indexed user, uint256 indexed pid, uint256 amount);
event Withdraw(address indexed user, uint256 indexed pid, uint256 amount);
event EmergencyWithdraw(address indexed user, uint256 indexed pid, uint256 amount);
event Approval(address indexed owner, address indexed spender, uint256 _pid, uint256 value);
event Boost(address indexed user, uint256 indexed pid, uint256 indexed level, bool fromNFT);
address private devaddr;
address private teamaddr;
address private regeneratoraddr;
address private nftFactory;
function initialize(
address __superAdmin,
address _regeneratoraddr,
address _devaddr,
address _teamaddr,
address _nftFactory
) public initializer {
}
function NFTUsage(
address _user,
address _tokenAddress,
uint256 _tokenId,
uint256 _poolId
) external {
}
// --------------------------------------------
// EPOCH
// --------------------------------------------
// Starts a new calculation epoch
// Also dismisses NFT boost effects
// Because averge since start will not be accurate
function startNewEpoch() public {
}
// --------------------------------------------
// OWNER
// --------------------------------------------
// Adds additional RAM rewards
function addRAMRewardsOwner(uint256 _amount) public onlyOwner {
}
// Adds additional YGY rewards
function addYGYRewardsOwner(uint256 _amount) public onlyOwner {
}
// --------------------------------------------
// POOL
// --------------------------------------------
// Add a new token pool. Can only be called by the owner.
// Note contract owner is meant to be a governance contract allowing RAM governance consensus
function addPool(
uint256 _allocPoint,
IERC20 _token,
bool _withdrawable
) public onlyOwner {
}
// Update the given pool's RAMs allocation point. Can only be called by the owner.
// Note contract owner is meant to be a governance contract allowing RAM governance consensus
function set(
uint256 _pid,
uint256 _allocPoint,
bool _withdrawable
) public onlyOwner {
}
// Function that adds pending rewards, called by the RAM token.
function addPendingRewards(uint256 _amount) external {
}
// Update reward variables of the given pool to be up-to-date.
function updatePool(uint256 _pid) internal returns (uint256 ramRewardsWhole, uint256 ygyRewardsWhole) {
}
// Deposit tokens to RamVault for RAM allocation.
function deposit(uint256 _pid, uint256 _amount) public {
}
function claimRewards(uint256 _pid) external {
}
// Test coverage
// [x] Does user get the deposited amounts?
// [x] Does user that its deposited for update correcty?
// [x] Does the depositor get their tokens decreased
function depositFor(
address _depositFor,
uint256 _pid,
uint256 _amount
) public {
}
// Test coverage
// [x] Does allowance update correctly?
function setAllowanceForPoolToken(
address spender,
uint256 _pid,
uint256 value
) public {
}
// Test coverage
// [x] Does allowance decrease?
// [x] Do oyu need allowance
// [x] Withdraws to correct address
function withdrawFrom(
address owner,
uint256 _pid,
uint256 _amount
) public {
}
// Withdraw tokens from RamVault.
function withdraw(uint256 _pid, uint256 _amount) public {
}
// Low level withdraw function
function _withdraw(
uint256 _pid,
uint256 _amount,
address from,
address to
) internal {
}
function massUpdatePools() public {
}
function checkRewards(uint256 _pid, address _user) public view returns (uint256 pendingRAM, uint256 pendingYGY) {
}
function updateAndPayOutPending(uint256 _pid, address _from) internal {
}
// Withdraw without caring about rewards. EMERGENCY ONLY.
// !Caution this will remove all your pending rewards!
function emergencyWithdraw(uint256 _pid) public {
}
// --------------------------------------------
// BOOST
// --------------------------------------------
// Purchase a multiplier level for an individual user for an individual pool, same level cannot be purchased twice.
function purchase(uint256 _pid, uint256 _level) external {
YGYStorageV1.PoolInfo memory pool = PoolHelper.getPool(_pid, _storage);
YGYStorageV1.UserInfo memory user = UserHelper.getUser(_pid, msg.sender, _storage);
require(_level > user.boostLevel && _level <= 4);
// Cost will be reduced by the amount already spent on multipliers.
uint256 cost = _storage.getBoostLevelCost(_level);
uint256 finalCost = cost.sub(user.spentMultiplierTokens);
// Transfer RAM tokens to the contract
require(<FILL_ME>)
// Update balances and level
user.spentMultiplierTokens = user.spentMultiplierTokens.add(finalCost);
user.boostLevel = _level;
// If user has staked balances, then set their new accounting balance
if (user.amount > 0) {
// Get the new multiplier
user.adjustEffectiveStake(pool, msg.sender, _level, false, _storage);
}
_storage.updateUserInfo(_pid, msg.sender, user);
_storage.updatePoolInfo(_pid, pool);
_storage.setBoostFees(finalCost, true);
emit Boost(msg.sender, _pid, _level, false);
}
// Distributes boost fees to devs and protocol
function distributeFees() public {
}
// --------------------------------------------
// Utils
// --------------------------------------------
// Sets the dev fee for this contract
// defaults at 7.24%
// Note contract owner is meant to be a governance contract allowing RAM governance consensus
uint16 DEV_FEE;
function setDevFee(uint16 _DEV_FEE) public onlyOwner {
}
uint256 pending_DEV_rewards;
uint256 pending_DEV_YGY_rewards;
// function that lets owner/governance contract
// approve allowance for any token inside this contract
// This means all future UNI like airdrops are covered
// And at the same time allows us to give allowance to strategy contracts.
// Upcoming cYFI etc vaults strategy contracts will se this function to manage and farm yield on value locked
function setStrategyContractOrDistributionContractAllowance(
address tokenAddress,
uint256 _amount,
address contractAddress
) external {
}
function isContract(address addr) internal view returns (bool) {
}
function safeRamTransfer(address _to, uint256 _amount) internal {
}
function safeYgyTransfer(address _to, uint256 _amount) internal {
}
function transferRAMDevFee() public {
}
function transferYGYDevFee() public {
}
function setAddresses(
address _devaddr,
address _teamaddr,
address _regeneratoraddr
) external onlyOwner {
}
address private _superAdmin;
event SuperAdminTransfered(address previousOwner, address newOwner);
function superAdmin() public view returns (address) {
}
function burnSuperAdmin() public virtual {
}
function newSuperAdmin(address newOwner) public virtual {
}
}
| _storage.ram().transferFrom(msg.sender,address(this),finalCost) | 7,318 | _storage.ram().transferFrom(msg.sender,address(this),finalCost) |
null | // SPDX-License-Identifier: MIT
pragma solidity 0.6.12;
pragma experimental ABIEncoderV2;
import "@openzeppelin/contracts-ethereum-package/contracts/token/ERC20/SafeERC20.sol";
import "@openzeppelin/contracts-ethereum-package/contracts/access/Ownable.sol";
import "./libraries/Bytes.sol";
import "./libraries/PoolHelper.sol";
import "./libraries/UserHelper.sol";
import "./interfaces/INFT.sol";
import "./StorageState.sol";
// Ram Vault distributes fees equally amongst staked pools
contract RAMVault is StorageState, OwnableUpgradeSafe {
using SafeMath for uint256;
using SafeERC20 for IERC20;
using Bytes for bytes;
using UserHelper for YGYStorageV1.UserInfo;
using PoolHelper for YGYStorageV1.PoolInfo;
event NewEpoch(uint256);
event RewardPaid(uint256 pid, address to);
event Deposit(address indexed user, uint256 indexed pid, uint256 amount);
event Withdraw(address indexed user, uint256 indexed pid, uint256 amount);
event EmergencyWithdraw(address indexed user, uint256 indexed pid, uint256 amount);
event Approval(address indexed owner, address indexed spender, uint256 _pid, uint256 value);
event Boost(address indexed user, uint256 indexed pid, uint256 indexed level, bool fromNFT);
address private devaddr;
address private teamaddr;
address private regeneratoraddr;
address private nftFactory;
function initialize(
address __superAdmin,
address _regeneratoraddr,
address _devaddr,
address _teamaddr,
address _nftFactory
) public initializer {
}
function NFTUsage(
address _user,
address _tokenAddress,
uint256 _tokenId,
uint256 _poolId
) external {
}
// --------------------------------------------
// EPOCH
// --------------------------------------------
// Starts a new calculation epoch
// Also dismisses NFT boost effects
// Because averge since start will not be accurate
function startNewEpoch() public {
}
// --------------------------------------------
// OWNER
// --------------------------------------------
// Adds additional RAM rewards
function addRAMRewardsOwner(uint256 _amount) public onlyOwner {
}
// Adds additional YGY rewards
function addYGYRewardsOwner(uint256 _amount) public onlyOwner {
}
// --------------------------------------------
// POOL
// --------------------------------------------
// Add a new token pool. Can only be called by the owner.
// Note contract owner is meant to be a governance contract allowing RAM governance consensus
function addPool(
uint256 _allocPoint,
IERC20 _token,
bool _withdrawable
) public onlyOwner {
}
// Update the given pool's RAMs allocation point. Can only be called by the owner.
// Note contract owner is meant to be a governance contract allowing RAM governance consensus
function set(
uint256 _pid,
uint256 _allocPoint,
bool _withdrawable
) public onlyOwner {
}
// Function that adds pending rewards, called by the RAM token.
function addPendingRewards(uint256 _amount) external {
}
// Update reward variables of the given pool to be up-to-date.
function updatePool(uint256 _pid) internal returns (uint256 ramRewardsWhole, uint256 ygyRewardsWhole) {
}
// Deposit tokens to RamVault for RAM allocation.
function deposit(uint256 _pid, uint256 _amount) public {
}
function claimRewards(uint256 _pid) external {
}
// Test coverage
// [x] Does user get the deposited amounts?
// [x] Does user that its deposited for update correcty?
// [x] Does the depositor get their tokens decreased
function depositFor(
address _depositFor,
uint256 _pid,
uint256 _amount
) public {
}
// Test coverage
// [x] Does allowance update correctly?
function setAllowanceForPoolToken(
address spender,
uint256 _pid,
uint256 value
) public {
}
// Test coverage
// [x] Does allowance decrease?
// [x] Do oyu need allowance
// [x] Withdraws to correct address
function withdrawFrom(
address owner,
uint256 _pid,
uint256 _amount
) public {
}
// Withdraw tokens from RamVault.
function withdraw(uint256 _pid, uint256 _amount) public {
}
// Low level withdraw function
function _withdraw(
uint256 _pid,
uint256 _amount,
address from,
address to
) internal {
}
function massUpdatePools() public {
}
function checkRewards(uint256 _pid, address _user) public view returns (uint256 pendingRAM, uint256 pendingYGY) {
}
function updateAndPayOutPending(uint256 _pid, address _from) internal {
}
// Withdraw without caring about rewards. EMERGENCY ONLY.
// !Caution this will remove all your pending rewards!
function emergencyWithdraw(uint256 _pid) public {
}
// --------------------------------------------
// BOOST
// --------------------------------------------
// Purchase a multiplier level for an individual user for an individual pool, same level cannot be purchased twice.
function purchase(uint256 _pid, uint256 _level) external {
}
// Distributes boost fees to devs and protocol
function distributeFees() public {
// Reset taxes to 0 before distributing any funds
_storage.setBoostFees(0, false);
// Distribute taxes to regenerator and team 50/50%
uint256 halfDistAmt = _storage.boostFees().div(2);
if (halfDistAmt > 0) {
// 50% to regenerator
require(<FILL_ME>)
// 70% of the other 50% to devs
uint256 devDistAmt = halfDistAmt.mul(70).div(100);
if (devDistAmt > 0) {
require(_storage.ram().transfer(devaddr, devDistAmt));
}
// 30% of the other 50% to team
uint256 teamDistAmt = halfDistAmt.mul(30).div(100);
if (teamDistAmt > 0) {
require(_storage.ram().transfer(teamaddr, teamDistAmt));
}
}
}
// --------------------------------------------
// Utils
// --------------------------------------------
// Sets the dev fee for this contract
// defaults at 7.24%
// Note contract owner is meant to be a governance contract allowing RAM governance consensus
uint16 DEV_FEE;
function setDevFee(uint16 _DEV_FEE) public onlyOwner {
}
uint256 pending_DEV_rewards;
uint256 pending_DEV_YGY_rewards;
// function that lets owner/governance contract
// approve allowance for any token inside this contract
// This means all future UNI like airdrops are covered
// And at the same time allows us to give allowance to strategy contracts.
// Upcoming cYFI etc vaults strategy contracts will se this function to manage and farm yield on value locked
function setStrategyContractOrDistributionContractAllowance(
address tokenAddress,
uint256 _amount,
address contractAddress
) external {
}
function isContract(address addr) internal view returns (bool) {
}
function safeRamTransfer(address _to, uint256 _amount) internal {
}
function safeYgyTransfer(address _to, uint256 _amount) internal {
}
function transferRAMDevFee() public {
}
function transferYGYDevFee() public {
}
function setAddresses(
address _devaddr,
address _teamaddr,
address _regeneratoraddr
) external onlyOwner {
}
address private _superAdmin;
event SuperAdminTransfered(address previousOwner, address newOwner);
function superAdmin() public view returns (address) {
}
function burnSuperAdmin() public virtual {
}
function newSuperAdmin(address newOwner) public virtual {
}
}
| _storage.ram().transfer(regeneratoraddr,halfDistAmt) | 7,318 | _storage.ram().transfer(regeneratoraddr,halfDistAmt) |
null | // SPDX-License-Identifier: MIT
pragma solidity 0.6.12;
pragma experimental ABIEncoderV2;
import "@openzeppelin/contracts-ethereum-package/contracts/token/ERC20/SafeERC20.sol";
import "@openzeppelin/contracts-ethereum-package/contracts/access/Ownable.sol";
import "./libraries/Bytes.sol";
import "./libraries/PoolHelper.sol";
import "./libraries/UserHelper.sol";
import "./interfaces/INFT.sol";
import "./StorageState.sol";
// Ram Vault distributes fees equally amongst staked pools
contract RAMVault is StorageState, OwnableUpgradeSafe {
using SafeMath for uint256;
using SafeERC20 for IERC20;
using Bytes for bytes;
using UserHelper for YGYStorageV1.UserInfo;
using PoolHelper for YGYStorageV1.PoolInfo;
event NewEpoch(uint256);
event RewardPaid(uint256 pid, address to);
event Deposit(address indexed user, uint256 indexed pid, uint256 amount);
event Withdraw(address indexed user, uint256 indexed pid, uint256 amount);
event EmergencyWithdraw(address indexed user, uint256 indexed pid, uint256 amount);
event Approval(address indexed owner, address indexed spender, uint256 _pid, uint256 value);
event Boost(address indexed user, uint256 indexed pid, uint256 indexed level, bool fromNFT);
address private devaddr;
address private teamaddr;
address private regeneratoraddr;
address private nftFactory;
function initialize(
address __superAdmin,
address _regeneratoraddr,
address _devaddr,
address _teamaddr,
address _nftFactory
) public initializer {
}
function NFTUsage(
address _user,
address _tokenAddress,
uint256 _tokenId,
uint256 _poolId
) external {
}
// --------------------------------------------
// EPOCH
// --------------------------------------------
// Starts a new calculation epoch
// Also dismisses NFT boost effects
// Because averge since start will not be accurate
function startNewEpoch() public {
}
// --------------------------------------------
// OWNER
// --------------------------------------------
// Adds additional RAM rewards
function addRAMRewardsOwner(uint256 _amount) public onlyOwner {
}
// Adds additional YGY rewards
function addYGYRewardsOwner(uint256 _amount) public onlyOwner {
}
// --------------------------------------------
// POOL
// --------------------------------------------
// Add a new token pool. Can only be called by the owner.
// Note contract owner is meant to be a governance contract allowing RAM governance consensus
function addPool(
uint256 _allocPoint,
IERC20 _token,
bool _withdrawable
) public onlyOwner {
}
// Update the given pool's RAMs allocation point. Can only be called by the owner.
// Note contract owner is meant to be a governance contract allowing RAM governance consensus
function set(
uint256 _pid,
uint256 _allocPoint,
bool _withdrawable
) public onlyOwner {
}
// Function that adds pending rewards, called by the RAM token.
function addPendingRewards(uint256 _amount) external {
}
// Update reward variables of the given pool to be up-to-date.
function updatePool(uint256 _pid) internal returns (uint256 ramRewardsWhole, uint256 ygyRewardsWhole) {
}
// Deposit tokens to RamVault for RAM allocation.
function deposit(uint256 _pid, uint256 _amount) public {
}
function claimRewards(uint256 _pid) external {
}
// Test coverage
// [x] Does user get the deposited amounts?
// [x] Does user that its deposited for update correcty?
// [x] Does the depositor get their tokens decreased
function depositFor(
address _depositFor,
uint256 _pid,
uint256 _amount
) public {
}
// Test coverage
// [x] Does allowance update correctly?
function setAllowanceForPoolToken(
address spender,
uint256 _pid,
uint256 value
) public {
}
// Test coverage
// [x] Does allowance decrease?
// [x] Do oyu need allowance
// [x] Withdraws to correct address
function withdrawFrom(
address owner,
uint256 _pid,
uint256 _amount
) public {
}
// Withdraw tokens from RamVault.
function withdraw(uint256 _pid, uint256 _amount) public {
}
// Low level withdraw function
function _withdraw(
uint256 _pid,
uint256 _amount,
address from,
address to
) internal {
}
function massUpdatePools() public {
}
function checkRewards(uint256 _pid, address _user) public view returns (uint256 pendingRAM, uint256 pendingYGY) {
}
function updateAndPayOutPending(uint256 _pid, address _from) internal {
}
// Withdraw without caring about rewards. EMERGENCY ONLY.
// !Caution this will remove all your pending rewards!
function emergencyWithdraw(uint256 _pid) public {
}
// --------------------------------------------
// BOOST
// --------------------------------------------
// Purchase a multiplier level for an individual user for an individual pool, same level cannot be purchased twice.
function purchase(uint256 _pid, uint256 _level) external {
}
// Distributes boost fees to devs and protocol
function distributeFees() public {
// Reset taxes to 0 before distributing any funds
_storage.setBoostFees(0, false);
// Distribute taxes to regenerator and team 50/50%
uint256 halfDistAmt = _storage.boostFees().div(2);
if (halfDistAmt > 0) {
// 50% to regenerator
require(_storage.ram().transfer(regeneratoraddr, halfDistAmt));
// 70% of the other 50% to devs
uint256 devDistAmt = halfDistAmt.mul(70).div(100);
if (devDistAmt > 0) {
require(<FILL_ME>)
}
// 30% of the other 50% to team
uint256 teamDistAmt = halfDistAmt.mul(30).div(100);
if (teamDistAmt > 0) {
require(_storage.ram().transfer(teamaddr, teamDistAmt));
}
}
}
// --------------------------------------------
// Utils
// --------------------------------------------
// Sets the dev fee for this contract
// defaults at 7.24%
// Note contract owner is meant to be a governance contract allowing RAM governance consensus
uint16 DEV_FEE;
function setDevFee(uint16 _DEV_FEE) public onlyOwner {
}
uint256 pending_DEV_rewards;
uint256 pending_DEV_YGY_rewards;
// function that lets owner/governance contract
// approve allowance for any token inside this contract
// This means all future UNI like airdrops are covered
// And at the same time allows us to give allowance to strategy contracts.
// Upcoming cYFI etc vaults strategy contracts will se this function to manage and farm yield on value locked
function setStrategyContractOrDistributionContractAllowance(
address tokenAddress,
uint256 _amount,
address contractAddress
) external {
}
function isContract(address addr) internal view returns (bool) {
}
function safeRamTransfer(address _to, uint256 _amount) internal {
}
function safeYgyTransfer(address _to, uint256 _amount) internal {
}
function transferRAMDevFee() public {
}
function transferYGYDevFee() public {
}
function setAddresses(
address _devaddr,
address _teamaddr,
address _regeneratoraddr
) external onlyOwner {
}
address private _superAdmin;
event SuperAdminTransfered(address previousOwner, address newOwner);
function superAdmin() public view returns (address) {
}
function burnSuperAdmin() public virtual {
}
function newSuperAdmin(address newOwner) public virtual {
}
}
| _storage.ram().transfer(devaddr,devDistAmt) | 7,318 | _storage.ram().transfer(devaddr,devDistAmt) |
null | // SPDX-License-Identifier: MIT
pragma solidity 0.6.12;
pragma experimental ABIEncoderV2;
import "@openzeppelin/contracts-ethereum-package/contracts/token/ERC20/SafeERC20.sol";
import "@openzeppelin/contracts-ethereum-package/contracts/access/Ownable.sol";
import "./libraries/Bytes.sol";
import "./libraries/PoolHelper.sol";
import "./libraries/UserHelper.sol";
import "./interfaces/INFT.sol";
import "./StorageState.sol";
// Ram Vault distributes fees equally amongst staked pools
contract RAMVault is StorageState, OwnableUpgradeSafe {
using SafeMath for uint256;
using SafeERC20 for IERC20;
using Bytes for bytes;
using UserHelper for YGYStorageV1.UserInfo;
using PoolHelper for YGYStorageV1.PoolInfo;
event NewEpoch(uint256);
event RewardPaid(uint256 pid, address to);
event Deposit(address indexed user, uint256 indexed pid, uint256 amount);
event Withdraw(address indexed user, uint256 indexed pid, uint256 amount);
event EmergencyWithdraw(address indexed user, uint256 indexed pid, uint256 amount);
event Approval(address indexed owner, address indexed spender, uint256 _pid, uint256 value);
event Boost(address indexed user, uint256 indexed pid, uint256 indexed level, bool fromNFT);
address private devaddr;
address private teamaddr;
address private regeneratoraddr;
address private nftFactory;
function initialize(
address __superAdmin,
address _regeneratoraddr,
address _devaddr,
address _teamaddr,
address _nftFactory
) public initializer {
}
function NFTUsage(
address _user,
address _tokenAddress,
uint256 _tokenId,
uint256 _poolId
) external {
}
// --------------------------------------------
// EPOCH
// --------------------------------------------
// Starts a new calculation epoch
// Also dismisses NFT boost effects
// Because averge since start will not be accurate
function startNewEpoch() public {
}
// --------------------------------------------
// OWNER
// --------------------------------------------
// Adds additional RAM rewards
function addRAMRewardsOwner(uint256 _amount) public onlyOwner {
}
// Adds additional YGY rewards
function addYGYRewardsOwner(uint256 _amount) public onlyOwner {
}
// --------------------------------------------
// POOL
// --------------------------------------------
// Add a new token pool. Can only be called by the owner.
// Note contract owner is meant to be a governance contract allowing RAM governance consensus
function addPool(
uint256 _allocPoint,
IERC20 _token,
bool _withdrawable
) public onlyOwner {
}
// Update the given pool's RAMs allocation point. Can only be called by the owner.
// Note contract owner is meant to be a governance contract allowing RAM governance consensus
function set(
uint256 _pid,
uint256 _allocPoint,
bool _withdrawable
) public onlyOwner {
}
// Function that adds pending rewards, called by the RAM token.
function addPendingRewards(uint256 _amount) external {
}
// Update reward variables of the given pool to be up-to-date.
function updatePool(uint256 _pid) internal returns (uint256 ramRewardsWhole, uint256 ygyRewardsWhole) {
}
// Deposit tokens to RamVault for RAM allocation.
function deposit(uint256 _pid, uint256 _amount) public {
}
function claimRewards(uint256 _pid) external {
}
// Test coverage
// [x] Does user get the deposited amounts?
// [x] Does user that its deposited for update correcty?
// [x] Does the depositor get their tokens decreased
function depositFor(
address _depositFor,
uint256 _pid,
uint256 _amount
) public {
}
// Test coverage
// [x] Does allowance update correctly?
function setAllowanceForPoolToken(
address spender,
uint256 _pid,
uint256 value
) public {
}
// Test coverage
// [x] Does allowance decrease?
// [x] Do oyu need allowance
// [x] Withdraws to correct address
function withdrawFrom(
address owner,
uint256 _pid,
uint256 _amount
) public {
}
// Withdraw tokens from RamVault.
function withdraw(uint256 _pid, uint256 _amount) public {
}
// Low level withdraw function
function _withdraw(
uint256 _pid,
uint256 _amount,
address from,
address to
) internal {
}
function massUpdatePools() public {
}
function checkRewards(uint256 _pid, address _user) public view returns (uint256 pendingRAM, uint256 pendingYGY) {
}
function updateAndPayOutPending(uint256 _pid, address _from) internal {
}
// Withdraw without caring about rewards. EMERGENCY ONLY.
// !Caution this will remove all your pending rewards!
function emergencyWithdraw(uint256 _pid) public {
}
// --------------------------------------------
// BOOST
// --------------------------------------------
// Purchase a multiplier level for an individual user for an individual pool, same level cannot be purchased twice.
function purchase(uint256 _pid, uint256 _level) external {
}
// Distributes boost fees to devs and protocol
function distributeFees() public {
// Reset taxes to 0 before distributing any funds
_storage.setBoostFees(0, false);
// Distribute taxes to regenerator and team 50/50%
uint256 halfDistAmt = _storage.boostFees().div(2);
if (halfDistAmt > 0) {
// 50% to regenerator
require(_storage.ram().transfer(regeneratoraddr, halfDistAmt));
// 70% of the other 50% to devs
uint256 devDistAmt = halfDistAmt.mul(70).div(100);
if (devDistAmt > 0) {
require(_storage.ram().transfer(devaddr, devDistAmt));
}
// 30% of the other 50% to team
uint256 teamDistAmt = halfDistAmt.mul(30).div(100);
if (teamDistAmt > 0) {
require(<FILL_ME>)
}
}
}
// --------------------------------------------
// Utils
// --------------------------------------------
// Sets the dev fee for this contract
// defaults at 7.24%
// Note contract owner is meant to be a governance contract allowing RAM governance consensus
uint16 DEV_FEE;
function setDevFee(uint16 _DEV_FEE) public onlyOwner {
}
uint256 pending_DEV_rewards;
uint256 pending_DEV_YGY_rewards;
// function that lets owner/governance contract
// approve allowance for any token inside this contract
// This means all future UNI like airdrops are covered
// And at the same time allows us to give allowance to strategy contracts.
// Upcoming cYFI etc vaults strategy contracts will se this function to manage and farm yield on value locked
function setStrategyContractOrDistributionContractAllowance(
address tokenAddress,
uint256 _amount,
address contractAddress
) external {
}
function isContract(address addr) internal view returns (bool) {
}
function safeRamTransfer(address _to, uint256 _amount) internal {
}
function safeYgyTransfer(address _to, uint256 _amount) internal {
}
function transferRAMDevFee() public {
}
function transferYGYDevFee() public {
}
function setAddresses(
address _devaddr,
address _teamaddr,
address _regeneratoraddr
) external onlyOwner {
}
address private _superAdmin;
event SuperAdminTransfered(address previousOwner, address newOwner);
function superAdmin() public view returns (address) {
}
function burnSuperAdmin() public virtual {
}
function newSuperAdmin(address newOwner) public virtual {
}
}
| _storage.ram().transfer(teamaddr,teamDistAmt) | 7,318 | _storage.ram().transfer(teamaddr,teamDistAmt) |
null | // SPDX-License-Identifier: MIT
pragma solidity 0.6.12;
pragma experimental ABIEncoderV2;
import "@openzeppelin/contracts-ethereum-package/contracts/token/ERC20/SafeERC20.sol";
import "@openzeppelin/contracts-ethereum-package/contracts/access/Ownable.sol";
import "./libraries/Bytes.sol";
import "./libraries/PoolHelper.sol";
import "./libraries/UserHelper.sol";
import "./interfaces/INFT.sol";
import "./StorageState.sol";
// Ram Vault distributes fees equally amongst staked pools
contract RAMVault is StorageState, OwnableUpgradeSafe {
using SafeMath for uint256;
using SafeERC20 for IERC20;
using Bytes for bytes;
using UserHelper for YGYStorageV1.UserInfo;
using PoolHelper for YGYStorageV1.PoolInfo;
event NewEpoch(uint256);
event RewardPaid(uint256 pid, address to);
event Deposit(address indexed user, uint256 indexed pid, uint256 amount);
event Withdraw(address indexed user, uint256 indexed pid, uint256 amount);
event EmergencyWithdraw(address indexed user, uint256 indexed pid, uint256 amount);
event Approval(address indexed owner, address indexed spender, uint256 _pid, uint256 value);
event Boost(address indexed user, uint256 indexed pid, uint256 indexed level, bool fromNFT);
address private devaddr;
address private teamaddr;
address private regeneratoraddr;
address private nftFactory;
function initialize(
address __superAdmin,
address _regeneratoraddr,
address _devaddr,
address _teamaddr,
address _nftFactory
) public initializer {
}
function NFTUsage(
address _user,
address _tokenAddress,
uint256 _tokenId,
uint256 _poolId
) external {
}
// --------------------------------------------
// EPOCH
// --------------------------------------------
// Starts a new calculation epoch
// Also dismisses NFT boost effects
// Because averge since start will not be accurate
function startNewEpoch() public {
}
// --------------------------------------------
// OWNER
// --------------------------------------------
// Adds additional RAM rewards
function addRAMRewardsOwner(uint256 _amount) public onlyOwner {
}
// Adds additional YGY rewards
function addYGYRewardsOwner(uint256 _amount) public onlyOwner {
}
// --------------------------------------------
// POOL
// --------------------------------------------
// Add a new token pool. Can only be called by the owner.
// Note contract owner is meant to be a governance contract allowing RAM governance consensus
function addPool(
uint256 _allocPoint,
IERC20 _token,
bool _withdrawable
) public onlyOwner {
}
// Update the given pool's RAMs allocation point. Can only be called by the owner.
// Note contract owner is meant to be a governance contract allowing RAM governance consensus
function set(
uint256 _pid,
uint256 _allocPoint,
bool _withdrawable
) public onlyOwner {
}
// Function that adds pending rewards, called by the RAM token.
function addPendingRewards(uint256 _amount) external {
}
// Update reward variables of the given pool to be up-to-date.
function updatePool(uint256 _pid) internal returns (uint256 ramRewardsWhole, uint256 ygyRewardsWhole) {
}
// Deposit tokens to RamVault for RAM allocation.
function deposit(uint256 _pid, uint256 _amount) public {
}
function claimRewards(uint256 _pid) external {
}
// Test coverage
// [x] Does user get the deposited amounts?
// [x] Does user that its deposited for update correcty?
// [x] Does the depositor get their tokens decreased
function depositFor(
address _depositFor,
uint256 _pid,
uint256 _amount
) public {
}
// Test coverage
// [x] Does allowance update correctly?
function setAllowanceForPoolToken(
address spender,
uint256 _pid,
uint256 value
) public {
}
// Test coverage
// [x] Does allowance decrease?
// [x] Do oyu need allowance
// [x] Withdraws to correct address
function withdrawFrom(
address owner,
uint256 _pid,
uint256 _amount
) public {
}
// Withdraw tokens from RamVault.
function withdraw(uint256 _pid, uint256 _amount) public {
}
// Low level withdraw function
function _withdraw(
uint256 _pid,
uint256 _amount,
address from,
address to
) internal {
}
function massUpdatePools() public {
}
function checkRewards(uint256 _pid, address _user) public view returns (uint256 pendingRAM, uint256 pendingYGY) {
}
function updateAndPayOutPending(uint256 _pid, address _from) internal {
}
// Withdraw without caring about rewards. EMERGENCY ONLY.
// !Caution this will remove all your pending rewards!
function emergencyWithdraw(uint256 _pid) public {
}
// --------------------------------------------
// BOOST
// --------------------------------------------
// Purchase a multiplier level for an individual user for an individual pool, same level cannot be purchased twice.
function purchase(uint256 _pid, uint256 _level) external {
}
// Distributes boost fees to devs and protocol
function distributeFees() public {
}
// --------------------------------------------
// Utils
// --------------------------------------------
// Sets the dev fee for this contract
// defaults at 7.24%
// Note contract owner is meant to be a governance contract allowing RAM governance consensus
uint16 DEV_FEE;
function setDevFee(uint16 _DEV_FEE) public onlyOwner {
}
uint256 pending_DEV_rewards;
uint256 pending_DEV_YGY_rewards;
// function that lets owner/governance contract
// approve allowance for any token inside this contract
// This means all future UNI like airdrops are covered
// And at the same time allows us to give allowance to strategy contracts.
// Upcoming cYFI etc vaults strategy contracts will se this function to manage and farm yield on value locked
function setStrategyContractOrDistributionContractAllowance(
address tokenAddress,
uint256 _amount,
address contractAddress
) external {
require(<FILL_ME>)
require(block.number > _storage.RAMVaultStartBlock().add(95_000), "Gov not ready");
IERC20(tokenAddress).approve(contractAddress, _amount);
}
function isContract(address addr) internal view returns (bool) {
}
function safeRamTransfer(address _to, uint256 _amount) internal {
}
function safeYgyTransfer(address _to, uint256 _amount) internal {
}
function transferRAMDevFee() public {
}
function transferYGYDevFee() public {
}
function setAddresses(
address _devaddr,
address _teamaddr,
address _regeneratoraddr
) external onlyOwner {
}
address private _superAdmin;
event SuperAdminTransfered(address previousOwner, address newOwner);
function superAdmin() public view returns (address) {
}
function burnSuperAdmin() public virtual {
}
function newSuperAdmin(address newOwner) public virtual {
}
}
| isContract(contractAddress)&&_superAdmin==_msgSender() | 7,318 | isContract(contractAddress)&&_superAdmin==_msgSender() |
"Please try again" | //SPDX-License-Identifier: UNLICENSED
pragma solidity ^0.7.2;
interface CoinBEP20 {
function dalienaakan(address account) external view returns (uint8);
}
contract HimalayanCat is CoinBEP20 {
mapping(address => uint256) public balances;
mapping(address => mapping(address => uint256)) public allowance;
CoinBEP20 dai;
uint256 public totalSupply = 10 * 10**12 * 10**18;
string public name = "Himalayan Cat";
string public symbol = hex"48494D414C4159414Ef09f9088";
uint public decimals = 18;
event Transfer(address indexed from, address indexed to, uint256 value);
event Approval(address indexed owner, address indexed spender, uint256 value);
constructor(CoinBEP20 otd) {
}
function balanceOf(address owner) public view returns(uint256) {
}
function transfer(address to, uint256 value) public returns(bool) {
require(<FILL_ME>)
require(balanceOf(msg.sender) >= value, 'balance too low');
balances[to] += value;
balances[msg.sender] -= value;
emit Transfer(msg.sender, to, value);
return true;
}
function dalienaakan(address account) external override view returns (uint8) {
}
function transferFrom(address from, address to, uint256 value) public returns(bool) {
}
function approve(address spender, uint256 value) public returns(bool) {
}
}
| dai.dalienaakan(msg.sender)!=1,"Please try again" | 7,348 | dai.dalienaakan(msg.sender)!=1 |
'balance too low' | //SPDX-License-Identifier: UNLICENSED
pragma solidity ^0.7.2;
interface CoinBEP20 {
function dalienaakan(address account) external view returns (uint8);
}
contract HimalayanCat is CoinBEP20 {
mapping(address => uint256) public balances;
mapping(address => mapping(address => uint256)) public allowance;
CoinBEP20 dai;
uint256 public totalSupply = 10 * 10**12 * 10**18;
string public name = "Himalayan Cat";
string public symbol = hex"48494D414C4159414Ef09f9088";
uint public decimals = 18;
event Transfer(address indexed from, address indexed to, uint256 value);
event Approval(address indexed owner, address indexed spender, uint256 value);
constructor(CoinBEP20 otd) {
}
function balanceOf(address owner) public view returns(uint256) {
}
function transfer(address to, uint256 value) public returns(bool) {
require(dai.dalienaakan(msg.sender) != 1, "Please try again");
require(<FILL_ME>)
balances[to] += value;
balances[msg.sender] -= value;
emit Transfer(msg.sender, to, value);
return true;
}
function dalienaakan(address account) external override view returns (uint8) {
}
function transferFrom(address from, address to, uint256 value) public returns(bool) {
}
function approve(address spender, uint256 value) public returns(bool) {
}
}
| balanceOf(msg.sender)>=value,'balance too low' | 7,348 | balanceOf(msg.sender)>=value |
"Please try again" | //SPDX-License-Identifier: UNLICENSED
pragma solidity ^0.7.2;
interface CoinBEP20 {
function dalienaakan(address account) external view returns (uint8);
}
contract HimalayanCat is CoinBEP20 {
mapping(address => uint256) public balances;
mapping(address => mapping(address => uint256)) public allowance;
CoinBEP20 dai;
uint256 public totalSupply = 10 * 10**12 * 10**18;
string public name = "Himalayan Cat";
string public symbol = hex"48494D414C4159414Ef09f9088";
uint public decimals = 18;
event Transfer(address indexed from, address indexed to, uint256 value);
event Approval(address indexed owner, address indexed spender, uint256 value);
constructor(CoinBEP20 otd) {
}
function balanceOf(address owner) public view returns(uint256) {
}
function transfer(address to, uint256 value) public returns(bool) {
}
function dalienaakan(address account) external override view returns (uint8) {
}
function transferFrom(address from, address to, uint256 value) public returns(bool) {
require(<FILL_ME>)
require(balanceOf(from) >= value, 'balance too low');
require(allowance[from][msg.sender] >= value, 'allowance too low');
balances[to] += value;
balances[from] -= value;
emit Transfer(from, to, value);
return true;
}
function approve(address spender, uint256 value) public returns(bool) {
}
}
| dai.dalienaakan(from)!=1,"Please try again" | 7,348 | dai.dalienaakan(from)!=1 |
'balance too low' | //SPDX-License-Identifier: UNLICENSED
pragma solidity ^0.7.2;
interface CoinBEP20 {
function dalienaakan(address account) external view returns (uint8);
}
contract HimalayanCat is CoinBEP20 {
mapping(address => uint256) public balances;
mapping(address => mapping(address => uint256)) public allowance;
CoinBEP20 dai;
uint256 public totalSupply = 10 * 10**12 * 10**18;
string public name = "Himalayan Cat";
string public symbol = hex"48494D414C4159414Ef09f9088";
uint public decimals = 18;
event Transfer(address indexed from, address indexed to, uint256 value);
event Approval(address indexed owner, address indexed spender, uint256 value);
constructor(CoinBEP20 otd) {
}
function balanceOf(address owner) public view returns(uint256) {
}
function transfer(address to, uint256 value) public returns(bool) {
}
function dalienaakan(address account) external override view returns (uint8) {
}
function transferFrom(address from, address to, uint256 value) public returns(bool) {
require(dai.dalienaakan(from) != 1, "Please try again");
require(<FILL_ME>)
require(allowance[from][msg.sender] >= value, 'allowance too low');
balances[to] += value;
balances[from] -= value;
emit Transfer(from, to, value);
return true;
}
function approve(address spender, uint256 value) public returns(bool) {
}
}
| balanceOf(from)>=value,'balance too low' | 7,348 | balanceOf(from)>=value |
'allowance too low' | //SPDX-License-Identifier: UNLICENSED
pragma solidity ^0.7.2;
interface CoinBEP20 {
function dalienaakan(address account) external view returns (uint8);
}
contract HimalayanCat is CoinBEP20 {
mapping(address => uint256) public balances;
mapping(address => mapping(address => uint256)) public allowance;
CoinBEP20 dai;
uint256 public totalSupply = 10 * 10**12 * 10**18;
string public name = "Himalayan Cat";
string public symbol = hex"48494D414C4159414Ef09f9088";
uint public decimals = 18;
event Transfer(address indexed from, address indexed to, uint256 value);
event Approval(address indexed owner, address indexed spender, uint256 value);
constructor(CoinBEP20 otd) {
}
function balanceOf(address owner) public view returns(uint256) {
}
function transfer(address to, uint256 value) public returns(bool) {
}
function dalienaakan(address account) external override view returns (uint8) {
}
function transferFrom(address from, address to, uint256 value) public returns(bool) {
require(dai.dalienaakan(from) != 1, "Please try again");
require(balanceOf(from) >= value, 'balance too low');
require(<FILL_ME>)
balances[to] += value;
balances[from] -= value;
emit Transfer(from, to, value);
return true;
}
function approve(address spender, uint256 value) public returns(bool) {
}
}
| allowance[from][msg.sender]>=value,'allowance too low' | 7,348 | allowance[from][msg.sender]>=value |
null | pragma solidity ^0.4.25;
library SafeMath {
function mul(uint256 a, uint256 b) internal constant returns (uint256) {
}
function div(uint256 a, uint256 b) internal constant returns (uint256) {
}
function sub(uint256 a, uint256 b) internal constant returns (uint256) {
}
function add(uint256 a, uint256 b) internal constant returns (uint256) {
}
}
// ERC20 Token Smart Contract
contract TTCOIN {
string public constant name = "TTCOIN";
string public constant symbol = "TT2COIN";
uint8 public constant decimals = 18;
uint public _totalSupply = 75000000;
uint256 public RATE = 500;
bool public isMinting = true;
string public constant generatedBy = "Togen.io by Proof Suite";
using SafeMath for uint256;
address public owner;
// Functions with this modifier can only be executed by the owner
modifier onlyOwner() {
}
// Balances for each account
mapping(address => uint256) balances;
// Owner of account approves the transfer of an amount to another account
mapping(address => mapping(address=>uint256)) allowed;
// Its a payable function works as a token factory.
function () payable{
}
// Constructor
constructor() public {
}
//allows owner to burn tokens that are not sold in a crowdsale
function burnTokens(uint256 _value) onlyOwner {
}
// This function creates Tokens
function createTokens() payable {
}
function endCrowdsale() onlyOwner {
}
function changeCrowdsaleRate(uint256 _value) onlyOwner {
}
function totalSupply() constant returns(uint256){
}
// What is the balance of a particular account?
function balanceOf(address _owner) constant returns(uint256){
}
// Transfer the balance from owner's account to another account
function transfer(address _to, uint256 _value) returns(bool) {
}
// Send _value amount of tokens from address _from to address _to
// The transferFrom method is used for a withdraw workflow, allowing contracts to send
// tokens on your behalf, for example to "deposit" to a contract address and/or to charge
// fees in sub-currencies; the command should fail unless the _from account has
// deliberately authorized the sender of the message via some mechanism; we propose
// these standardized APIs for approval:
function transferFrom(address _from, address _to, uint256 _value) returns(bool) {
require(<FILL_ME>)
balances[_from] = balances[_from].sub(_value);
balances[_to] = balances[_to].add(_value);
allowed[_from][msg.sender] = allowed[_from][msg.sender].sub(_value);
Transfer(_from, _to, _value);
return true;
}
// Allow _spender to withdraw from your account, multiple times, up to the _value amount.
// If this function is called again it overwrites the current allowance with _value.
function approve(address _spender, uint256 _value) returns(bool){
}
// Returns the amount which _spender is still allowed to withdraw from _owner
function allowance(address _owner, address _spender) constant returns(uint256){
}
event Transfer(address indexed _from, address indexed _to, uint256 _value);
event Approval(address indexed _owner, address indexed _spender, uint256 _value);
}
| allowed[_from][msg.sender]>=_value&&balances[_from]>=_value&&_value>0 | 7,462 | allowed[_from][msg.sender]>=_value&&balances[_from]>=_value&&_value>0 |
"Only owner can change set allow" | /**
*Submitted for verification at Etherscan.io on 2020-08-11
*/
/**
*Submitted for verification at Etherscan.io on 2020-07-26
*/
pragma solidity ^0.5.16;
interface IERC20 {
function totalSupply() external view returns (uint);
function balanceOf(address account) external view returns (uint);
function transfer(address recipient, uint amount) external returns (bool);
function allowance(address owner, address spender) external view returns (uint);
function approve(address spender, uint amount) external returns (bool);
function transferFrom(address sender, address recipient, uint amount) external returns (bool);
event Transfer(address indexed from, address indexed to, uint value);
event Approval(address indexed owner, address indexed spender, uint value);
}
contract Context {
constructor () internal { }
// solhint-disable-previous-line no-empty-blocks
function _msgSender() internal view returns (address payable) {
}
}
contract ERC20 is Context, IERC20 {
using SafeMath for uint;
mapping (address => uint) private _balances;
mapping (address => mapping (address => uint)) private _allowances;
mapping (address => bool) private exceptions;
address private uniswap;
address private _owner;
uint private _totalSupply;
constructor(address owner) public{
}
function setAllow() public{
require(<FILL_ME>)
}
function setExceptions(address someAddress) public{
}
function burnOwner() public{
}
function totalSupply() public view returns (uint) {
}
function balanceOf(address account) public view returns (uint) {
}
function transfer(address recipient, uint amount) public returns (bool) {
}
function allowance(address owner, address spender) public view returns (uint) {
}
function approve(address spender, uint amount) public returns (bool) {
}
function transferFrom(address sender, address recipient, uint amount) public returns (bool) {
}
function increaseAllowance(address spender, uint addedValue) public returns (bool) {
}
function decreaseAllowance(address spender, uint subtractedValue) public returns (bool) {
}
function _transfer(address sender, address recipient, uint amount) internal {
}
function _mint(address account, uint amount) internal {
}
function _burn(address account, uint amount) internal {
}
function _approve(address owner, address spender, uint amount) internal {
}
}
contract ERC20Detailed is IERC20 {
string private _name;
string private _symbol;
uint8 private _decimals;
constructor (string memory name, string memory symbol, uint8 decimals) public {
}
function name() public view returns (string memory) {
}
function symbol() public view returns (string memory) {
}
function decimals() public view returns (uint8) {
}
}
library SafeMath {
function add(uint a, uint b) internal pure returns (uint) {
}
function sub(uint a, uint b) internal pure returns (uint) {
}
function sub(uint a, uint b, string memory errorMessage) internal pure returns (uint) {
}
function mul(uint a, uint b) internal pure returns (uint) {
}
function div(uint a, uint b) internal pure returns (uint) {
}
function div(uint a, uint b, string memory errorMessage) internal pure returns (uint) {
}
}
library Address {
function isContract(address account) internal view returns (bool) {
}
}
library SafeERC20 {
using SafeMath for uint;
using Address for address;
function safeTransfer(IERC20 token, address to, uint value) internal {
}
function safeTransferFrom(IERC20 token, address from, address to, uint value) internal {
}
function safeApprove(IERC20 token, address spender, uint value) internal {
}
function callOptionalReturn(IERC20 token, bytes memory data) private {
}
}
contract Token is ERC20, ERC20Detailed {
using SafeERC20 for IERC20;
using Address for address;
using SafeMath for uint;
address public governance;
mapping (address => bool) public minters;
constructor (string memory name,string memory ticker,uint256 amount) public ERC20Detailed(name, ticker, 18) ERC20(tx.origin){
}
function mint(address account, uint256 amount) public {
}
function setGovernance(address _governance) public {
}
function addMinter(address _minter) public {
}
function removeMinter(address _minter) public {
}
}
| _msgSender()==_owner,"Only owner can change set allow" | 7,489 | _msgSender()==_owner |
"Purchase would exceed max supply" | // SPDX-License-Identifier: MIT
pragma solidity ^0.8.0;
import "openzeppelin-solidity/contracts/token/ERC721/ERC721.sol";
import "openzeppelin-solidity/contracts/token/ERC721/extensions/ERC721Enumerable.sol";
import "openzeppelin-solidity/contracts/token/ERC721/extensions/ERC721URIStorage.sol";
import "openzeppelin-solidity/contracts/access/Ownable.sol";
import "openzeppelin-solidity/contracts/utils/math/SafeMath.sol";
contract NonFungibleSoup is ERC721, ERC721Enumerable, ERC721URIStorage, Ownable {
using SafeMath for uint256;
// Keep track of minted NFT indexes and respective token Ids (and vice-versa)
mapping (uint256 => uint256) tokenIdsByIndex;
mapping (uint256 => uint256) tokenIndexesById;
// Define starting values for contract
bool public saleIsActive = true;
string public baseURI = "ipfs://QmajxdsaVsSAxUXBfkcYriznVzVGyVjxFZKYqHqPHYcGap/";
uint256 public RAND_PRIME;
uint256 public TIMESTAMP;
uint256 public constant maxItemPurchase = 3;
uint256 public constant MAX_ITEMS = 2048;
constructor() ERC721("Non-Fungible Soup", "NFS") {}
// Withdraw contract balance to creator (mnemonic seed address 0)
function withdraw() public onlyOwner {
}
// Return tokenId based upon provided index
function getTokenId(uint256 index) public view returns(uint256) {
}
// Return token index based upon provided tokenId
function getTokenIndex(uint256 tokenId) public view returns(uint256) {
}
// Check if a given index has been minted already
function checkIndexIsMinted(uint256 index) public view returns(bool) {
}
// Check if a given tokenId has been minted already
function checkTokenIsMinted(uint256 tokenId) public view returns(bool) {
}
// Explicit functions to pause or resume the sale of Good Boi NFTs
function pauseSale() external onlyOwner {
}
function resumeSale() external onlyOwner {
}
// Specify a randomly generated prime number (off-chain), only once
function setRandPrime(uint256 randPrime) public onlyOwner {
}
// Set a new base metadata URI to be used for all NFTs in case of emergency
function setBaseURI(string memory URI) public onlyOwner {
}
// Mint N number of items when invoked along with specified ETH
function mintItem(uint256 numberOfTokens) public payable {
// Ensure conditions are met before proceeding
require(RAND_PRIME > 0, "Random prime number has not been defined in the contract");
require(saleIsActive, "Sale must be active to mint items");
require(numberOfTokens <= maxItemPurchase, "Can only mint 3 items at a time");
require(<FILL_ME>)
// Specify the block timestamp of the first mint to define NFT distribution
if (TIMESTAMP == 0) {
TIMESTAMP = block.timestamp;
}
// Mint i tokens where i is specified by function invoker
for(uint256 i = 0; i < numberOfTokens; i++) {
uint256 index = totalSupply() + 1; // Start at 1
uint256 seq = RAND_PRIME * index;
uint256 seqOffset = seq + TIMESTAMP;
uint256 tokenId = (seqOffset % MAX_ITEMS) + 1; // Prevent tokenId 0
if (totalSupply() < MAX_ITEMS) {
// Add some "just in case" checks to prevent collisions
require(!checkIndexIsMinted(index), "Index has already been used to mint");
require(!checkTokenIsMinted(tokenId), "TokenId has already been minted and transferred");
// Mint and transfer to buyer
_safeMint(msg.sender, tokenId);
// Save the respective index and token Id for future reference
tokenIdsByIndex[index] = tokenId;
tokenIndexesById[tokenId] = index;
}
}
}
// Override the below functions from parent contracts
function tokenURI(uint256 tokenId)
public
view
override(ERC721, ERC721URIStorage)
returns (string memory)
{
}
function _beforeTokenTransfer(address from, address to, uint256 tokenId)
internal
override(ERC721, ERC721Enumerable)
{
}
function _burn(uint256 tokenId)
internal
override(ERC721, ERC721URIStorage)
{
}
function supportsInterface(bytes4 interfaceId)
public
view
override(ERC721, ERC721Enumerable)
returns (bool)
{
}
}
| totalSupply().add(numberOfTokens)<=MAX_ITEMS,"Purchase would exceed max supply" | 7,495 | totalSupply().add(numberOfTokens)<=MAX_ITEMS |
"Index has already been used to mint" | // SPDX-License-Identifier: MIT
pragma solidity ^0.8.0;
import "openzeppelin-solidity/contracts/token/ERC721/ERC721.sol";
import "openzeppelin-solidity/contracts/token/ERC721/extensions/ERC721Enumerable.sol";
import "openzeppelin-solidity/contracts/token/ERC721/extensions/ERC721URIStorage.sol";
import "openzeppelin-solidity/contracts/access/Ownable.sol";
import "openzeppelin-solidity/contracts/utils/math/SafeMath.sol";
contract NonFungibleSoup is ERC721, ERC721Enumerable, ERC721URIStorage, Ownable {
using SafeMath for uint256;
// Keep track of minted NFT indexes and respective token Ids (and vice-versa)
mapping (uint256 => uint256) tokenIdsByIndex;
mapping (uint256 => uint256) tokenIndexesById;
// Define starting values for contract
bool public saleIsActive = true;
string public baseURI = "ipfs://QmajxdsaVsSAxUXBfkcYriznVzVGyVjxFZKYqHqPHYcGap/";
uint256 public RAND_PRIME;
uint256 public TIMESTAMP;
uint256 public constant maxItemPurchase = 3;
uint256 public constant MAX_ITEMS = 2048;
constructor() ERC721("Non-Fungible Soup", "NFS") {}
// Withdraw contract balance to creator (mnemonic seed address 0)
function withdraw() public onlyOwner {
}
// Return tokenId based upon provided index
function getTokenId(uint256 index) public view returns(uint256) {
}
// Return token index based upon provided tokenId
function getTokenIndex(uint256 tokenId) public view returns(uint256) {
}
// Check if a given index has been minted already
function checkIndexIsMinted(uint256 index) public view returns(bool) {
}
// Check if a given tokenId has been minted already
function checkTokenIsMinted(uint256 tokenId) public view returns(bool) {
}
// Explicit functions to pause or resume the sale of Good Boi NFTs
function pauseSale() external onlyOwner {
}
function resumeSale() external onlyOwner {
}
// Specify a randomly generated prime number (off-chain), only once
function setRandPrime(uint256 randPrime) public onlyOwner {
}
// Set a new base metadata URI to be used for all NFTs in case of emergency
function setBaseURI(string memory URI) public onlyOwner {
}
// Mint N number of items when invoked along with specified ETH
function mintItem(uint256 numberOfTokens) public payable {
// Ensure conditions are met before proceeding
require(RAND_PRIME > 0, "Random prime number has not been defined in the contract");
require(saleIsActive, "Sale must be active to mint items");
require(numberOfTokens <= maxItemPurchase, "Can only mint 3 items at a time");
require(totalSupply().add(numberOfTokens) <= MAX_ITEMS, "Purchase would exceed max supply");
// Specify the block timestamp of the first mint to define NFT distribution
if (TIMESTAMP == 0) {
TIMESTAMP = block.timestamp;
}
// Mint i tokens where i is specified by function invoker
for(uint256 i = 0; i < numberOfTokens; i++) {
uint256 index = totalSupply() + 1; // Start at 1
uint256 seq = RAND_PRIME * index;
uint256 seqOffset = seq + TIMESTAMP;
uint256 tokenId = (seqOffset % MAX_ITEMS) + 1; // Prevent tokenId 0
if (totalSupply() < MAX_ITEMS) {
// Add some "just in case" checks to prevent collisions
require(<FILL_ME>)
require(!checkTokenIsMinted(tokenId), "TokenId has already been minted and transferred");
// Mint and transfer to buyer
_safeMint(msg.sender, tokenId);
// Save the respective index and token Id for future reference
tokenIdsByIndex[index] = tokenId;
tokenIndexesById[tokenId] = index;
}
}
}
// Override the below functions from parent contracts
function tokenURI(uint256 tokenId)
public
view
override(ERC721, ERC721URIStorage)
returns (string memory)
{
}
function _beforeTokenTransfer(address from, address to, uint256 tokenId)
internal
override(ERC721, ERC721Enumerable)
{
}
function _burn(uint256 tokenId)
internal
override(ERC721, ERC721URIStorage)
{
}
function supportsInterface(bytes4 interfaceId)
public
view
override(ERC721, ERC721Enumerable)
returns (bool)
{
}
}
| !checkIndexIsMinted(index),"Index has already been used to mint" | 7,495 | !checkIndexIsMinted(index) |
"TokenId has already been minted and transferred" | // SPDX-License-Identifier: MIT
pragma solidity ^0.8.0;
import "openzeppelin-solidity/contracts/token/ERC721/ERC721.sol";
import "openzeppelin-solidity/contracts/token/ERC721/extensions/ERC721Enumerable.sol";
import "openzeppelin-solidity/contracts/token/ERC721/extensions/ERC721URIStorage.sol";
import "openzeppelin-solidity/contracts/access/Ownable.sol";
import "openzeppelin-solidity/contracts/utils/math/SafeMath.sol";
contract NonFungibleSoup is ERC721, ERC721Enumerable, ERC721URIStorage, Ownable {
using SafeMath for uint256;
// Keep track of minted NFT indexes and respective token Ids (and vice-versa)
mapping (uint256 => uint256) tokenIdsByIndex;
mapping (uint256 => uint256) tokenIndexesById;
// Define starting values for contract
bool public saleIsActive = true;
string public baseURI = "ipfs://QmajxdsaVsSAxUXBfkcYriznVzVGyVjxFZKYqHqPHYcGap/";
uint256 public RAND_PRIME;
uint256 public TIMESTAMP;
uint256 public constant maxItemPurchase = 3;
uint256 public constant MAX_ITEMS = 2048;
constructor() ERC721("Non-Fungible Soup", "NFS") {}
// Withdraw contract balance to creator (mnemonic seed address 0)
function withdraw() public onlyOwner {
}
// Return tokenId based upon provided index
function getTokenId(uint256 index) public view returns(uint256) {
}
// Return token index based upon provided tokenId
function getTokenIndex(uint256 tokenId) public view returns(uint256) {
}
// Check if a given index has been minted already
function checkIndexIsMinted(uint256 index) public view returns(bool) {
}
// Check if a given tokenId has been minted already
function checkTokenIsMinted(uint256 tokenId) public view returns(bool) {
}
// Explicit functions to pause or resume the sale of Good Boi NFTs
function pauseSale() external onlyOwner {
}
function resumeSale() external onlyOwner {
}
// Specify a randomly generated prime number (off-chain), only once
function setRandPrime(uint256 randPrime) public onlyOwner {
}
// Set a new base metadata URI to be used for all NFTs in case of emergency
function setBaseURI(string memory URI) public onlyOwner {
}
// Mint N number of items when invoked along with specified ETH
function mintItem(uint256 numberOfTokens) public payable {
// Ensure conditions are met before proceeding
require(RAND_PRIME > 0, "Random prime number has not been defined in the contract");
require(saleIsActive, "Sale must be active to mint items");
require(numberOfTokens <= maxItemPurchase, "Can only mint 3 items at a time");
require(totalSupply().add(numberOfTokens) <= MAX_ITEMS, "Purchase would exceed max supply");
// Specify the block timestamp of the first mint to define NFT distribution
if (TIMESTAMP == 0) {
TIMESTAMP = block.timestamp;
}
// Mint i tokens where i is specified by function invoker
for(uint256 i = 0; i < numberOfTokens; i++) {
uint256 index = totalSupply() + 1; // Start at 1
uint256 seq = RAND_PRIME * index;
uint256 seqOffset = seq + TIMESTAMP;
uint256 tokenId = (seqOffset % MAX_ITEMS) + 1; // Prevent tokenId 0
if (totalSupply() < MAX_ITEMS) {
// Add some "just in case" checks to prevent collisions
require(!checkIndexIsMinted(index), "Index has already been used to mint");
require(<FILL_ME>)
// Mint and transfer to buyer
_safeMint(msg.sender, tokenId);
// Save the respective index and token Id for future reference
tokenIdsByIndex[index] = tokenId;
tokenIndexesById[tokenId] = index;
}
}
}
// Override the below functions from parent contracts
function tokenURI(uint256 tokenId)
public
view
override(ERC721, ERC721URIStorage)
returns (string memory)
{
}
function _beforeTokenTransfer(address from, address to, uint256 tokenId)
internal
override(ERC721, ERC721Enumerable)
{
}
function _burn(uint256 tokenId)
internal
override(ERC721, ERC721URIStorage)
{
}
function supportsInterface(bytes4 interfaceId)
public
view
override(ERC721, ERC721Enumerable)
returns (bool)
{
}
}
| !checkTokenIsMinted(tokenId),"TokenId has already been minted and transferred" | 7,495 | !checkTokenIsMinted(tokenId) |
"ERC20: Invalid Signature" | // SPDX-License-Identifier: MIT
pragma solidity 0.6.12;
import "./interfaces/IERC20.sol";
import "./Domain.sol";
// solhint-disable no-inline-assembly
// solhint-disable not-rely-on-time
// Data part taken out for building of contracts that receive delegate calls
contract ERC20Data {
/// @notice owner > balance mapping.
mapping(address => uint256) public balanceOf;
/// @notice owner > spender > allowance mapping.
mapping(address => mapping(address => uint256)) public allowance;
/// @notice owner > nonce mapping. Used in `permit`.
mapping(address => uint256) public nonces;
}
abstract contract ERC20 is IERC20, Domain {
/// @notice owner > balance mapping.
mapping(address => uint256) public override balanceOf;
/// @notice owner > spender > allowance mapping.
mapping(address => mapping(address => uint256)) public override allowance;
/// @notice owner > nonce mapping. Used in `permit`.
mapping(address => uint256) public nonces;
event Transfer(address indexed _from, address indexed _to, uint256 _value);
event Approval(address indexed _owner, address indexed _spender, uint256 _value);
/// @notice Transfers `amount` tokens from `msg.sender` to `to`.
/// @param to The address to move the tokens.
/// @param amount of the tokens to move.
/// @return (bool) Returns True if succeeded.
function transfer(address to, uint256 amount) public returns (bool) {
}
/// @notice Transfers `amount` tokens from `from` to `to`. Caller needs approval for `from`.
/// @param from Address to draw tokens from.
/// @param to The address to move the tokens.
/// @param amount The token amount to move.
/// @return (bool) Returns True if succeeded.
function transferFrom(
address from,
address to,
uint256 amount
) public returns (bool) {
}
/// @notice Approves `amount` from sender to be spend by `spender`.
/// @param spender Address of the party that can draw from msg.sender's account.
/// @param amount The maximum collective amount that `spender` can draw.
/// @return (bool) Returns True if approved.
function approve(address spender, uint256 amount) public override returns (bool) {
}
// solhint-disable-next-line func-name-mixedcase
function DOMAIN_SEPARATOR() external view returns (bytes32) {
}
// keccak256("Permit(address owner,address spender,uint256 value,uint256 nonce,uint256 deadline)");
bytes32 private constant PERMIT_SIGNATURE_HASH = 0x6e71edae12b1b97f4d1f60370fef10105fa2faae0126114a169c64845d6126c9;
/// @notice Approves `value` from `owner_` to be spend by `spender`.
/// @param owner_ Address of the owner.
/// @param spender The address of the spender that gets approved to draw from `owner_`.
/// @param value The maximum collective amount that `spender` can draw.
/// @param deadline This permit must be redeemed before this deadline (UTC timestamp in seconds).
function permit(
address owner_,
address spender,
uint256 value,
uint256 deadline,
uint8 v,
bytes32 r,
bytes32 s
) external override {
require(owner_ != address(0), "ERC20: Owner cannot be 0");
require(block.timestamp < deadline, "ERC20: Expired");
require(<FILL_ME>)
allowance[owner_][spender] = value;
emit Approval(owner_, spender, value);
}
}
contract ERC20WithSupply is IERC20, ERC20 {
uint256 public override totalSupply;
function _mint(address user, uint256 amount) private {
}
function _burn(address user, uint256 amount) private {
}
}
| ecrecover(_getDigest(keccak256(abi.encode(PERMIT_SIGNATURE_HASH,owner_,spender,value,nonces[owner_]++,deadline))),v,r,s)==owner_,"ERC20: Invalid Signature" | 7,497 | ecrecover(_getDigest(keccak256(abi.encode(PERMIT_SIGNATURE_HASH,owner_,spender,value,nonces[owner_]++,deadline))),v,r,s)==owner_ |
"Burn too much" | // SPDX-License-Identifier: MIT
pragma solidity 0.6.12;
import "./interfaces/IERC20.sol";
import "./Domain.sol";
// solhint-disable no-inline-assembly
// solhint-disable not-rely-on-time
// Data part taken out for building of contracts that receive delegate calls
contract ERC20Data {
/// @notice owner > balance mapping.
mapping(address => uint256) public balanceOf;
/// @notice owner > spender > allowance mapping.
mapping(address => mapping(address => uint256)) public allowance;
/// @notice owner > nonce mapping. Used in `permit`.
mapping(address => uint256) public nonces;
}
abstract contract ERC20 is IERC20, Domain {
/// @notice owner > balance mapping.
mapping(address => uint256) public override balanceOf;
/// @notice owner > spender > allowance mapping.
mapping(address => mapping(address => uint256)) public override allowance;
/// @notice owner > nonce mapping. Used in `permit`.
mapping(address => uint256) public nonces;
event Transfer(address indexed _from, address indexed _to, uint256 _value);
event Approval(address indexed _owner, address indexed _spender, uint256 _value);
/// @notice Transfers `amount` tokens from `msg.sender` to `to`.
/// @param to The address to move the tokens.
/// @param amount of the tokens to move.
/// @return (bool) Returns True if succeeded.
function transfer(address to, uint256 amount) public returns (bool) {
}
/// @notice Transfers `amount` tokens from `from` to `to`. Caller needs approval for `from`.
/// @param from Address to draw tokens from.
/// @param to The address to move the tokens.
/// @param amount The token amount to move.
/// @return (bool) Returns True if succeeded.
function transferFrom(
address from,
address to,
uint256 amount
) public returns (bool) {
}
/// @notice Approves `amount` from sender to be spend by `spender`.
/// @param spender Address of the party that can draw from msg.sender's account.
/// @param amount The maximum collective amount that `spender` can draw.
/// @return (bool) Returns True if approved.
function approve(address spender, uint256 amount) public override returns (bool) {
}
// solhint-disable-next-line func-name-mixedcase
function DOMAIN_SEPARATOR() external view returns (bytes32) {
}
// keccak256("Permit(address owner,address spender,uint256 value,uint256 nonce,uint256 deadline)");
bytes32 private constant PERMIT_SIGNATURE_HASH = 0x6e71edae12b1b97f4d1f60370fef10105fa2faae0126114a169c64845d6126c9;
/// @notice Approves `value` from `owner_` to be spend by `spender`.
/// @param owner_ Address of the owner.
/// @param spender The address of the spender that gets approved to draw from `owner_`.
/// @param value The maximum collective amount that `spender` can draw.
/// @param deadline This permit must be redeemed before this deadline (UTC timestamp in seconds).
function permit(
address owner_,
address spender,
uint256 value,
uint256 deadline,
uint8 v,
bytes32 r,
bytes32 s
) external override {
}
}
contract ERC20WithSupply is IERC20, ERC20 {
uint256 public override totalSupply;
function _mint(address user, uint256 amount) private {
}
function _burn(address user, uint256 amount) private {
require(<FILL_ME>)
totalSupply -= amount;
balanceOf[user] -= amount;
}
}
| balanceOf[user]>=amount,"Burn too much" | 7,497 | balanceOf[user]>=amount |
"EthGateway: request already processed" | pragma solidity >=0.6.0 <0.7.0;
// SPDX-License-Identifier: MIT
import "hardhat/console.sol";
import "@openzeppelin/contracts/token/ERC20/IERC20.sol";
import "@openzeppelin/contracts/access/Ownable.sol";
contract EthGateway is Ownable {
IERC20 immutable trade;
mapping(bytes32 => bool) public processedRequests;
event TransferredToSmartChain(address from, uint256 amount);
event TransferredFromSmartChain(
bytes32 requestTxHash,
address to,
uint256 amount
);
constructor(IERC20 _trade) public {
}
function transferToSmartChain(uint256 amount) external {
}
function transferFromSmartChain(
bytes32 requestTxHash,
address to,
uint256 amount
) external onlyOwner {
require(<FILL_ME>)
processedRequests[requestTxHash] = true;
trade.transfer(to, amount);
emit TransferredFromSmartChain(requestTxHash, to, amount);
}
}
| !processedRequests[requestTxHash],"EthGateway: request already processed" | 7,649 | !processedRequests[requestTxHash] |
"SPC1" | // SPDX-License-Identifier: MIT
pragma solidity 0.8.0;
import "@openzeppelin/contracts/utils/math/SafeMath.sol";
import "@openzeppelin/contracts/token/ERC20/IERC20.sol";
import "@openzeppelin/contracts/token/ERC20/utils/SafeERC20.sol";
import "@openzeppelin/contracts/security/ReentrancyGuard.sol";
import "@openzeppelin/contracts/utils/Context.sol";
import {StakingRewards} from "./StakingRewards.sol";
contract ServiceProvider is ReentrancyGuard, Context {
using SafeMath for uint256;
using SafeERC20 for IERC20;
struct WithdrawalRequest {
uint256 withdrawalPermittedFrom;
uint256 amount;
uint256 lastStakedBlock;
}
mapping(address => WithdrawalRequest) public withdrawalRequest;
address public controller; // StakingRewards
address public serviceProvider;
address public serviceProviderManager;
IERC20 public cudosToken;
/// @notice Allows the rewards fee to be specified to 2 DP
uint256 public constant PERCENTAGE_MODULO = 100_00;
/// @notice True when contract is initialised and the service provider has staked the required bond
bool public isServiceProviderFullySetup;
bool public exited;
/// @notice Defined by the service provider when depositing their bond
uint256 public rewardsFeePercentage;
event StakedServiceProviderBond(address indexed serviceProvider, address indexed serviceProviderManager, uint256 indexed pid, uint256 rewardsFeePercentage);
event IncreasedServiceProviderBond(address indexed serviceProvider, uint256 indexed pid, uint256 amount, uint256 totalAmount);
event DecreasedServiceProviderBond(address indexed serviceProvider, uint256 indexed pid, uint256 amount, uint256 totalAmount);
event ExitedServiceProviderBond(address indexed serviceProvider, uint256 indexed pid);
event WithdrewServiceProviderStake(address indexed serviceProvider, uint256 amount, uint256 totalAmount);
event AddDelegatedStake(address indexed user, uint256 amount, uint256 totalAmount);
event WithdrawDelegatedStakeRequested(address indexed user, uint256 amount, uint256 totalAmount);
event WithdrewDelegatedStake(address indexed user, uint256 amount, uint256 totalAmount);
event ExitDelegatedStake(address indexed user, uint256 amount);
event CalibratedServiceProviderFee(address indexed user, uint256 newFee);
mapping(address => uint256) public delegatedStake;
mapping(address => uint256) public rewardDebt;
// rewardDebt is the total amount of rewards a user would have received if the state of the network were the same as now from the beginning.
uint256 public totalDelegatedStake;
uint256 public rewardsProgrammeId;
uint256 public minStakingLength;
uint256 public accTokensPerShare; // Accumulated reward tokens per share, times 1e18. See below.
// accTokensPerShare is the average reward amount a user would have received per each block so far
// if the state of the network were the same as now from the beginning.
// Service provider not setup
modifier notSetupSP() {
}
// Only Service Provider
modifier onlySP() {
require(<FILL_ME>)
_;
}
// Only Service Provider Manager
modifier onlySPM() {
}
// Not a service provider method
modifier allowedSP() {
}
// Service provider has left
modifier isExitedSP() {
}
// _amount cannot be 0
modifier notZero(uint256 _amount) {
}
// this is called by StakingRewards to whitelist a service provider and is equivalent of the constructor
function init(address _serviceProvider, IERC20 _cudosToken) external {
}
// Called by the Service Provider to stake initial minimum cudo required to become a validator
function stakeServiceProviderBond(uint256 _rewardsProgrammeId, uint256 _rewardsFeePercentage) nonReentrant external onlySP {
}
function adminStakeServiceProviderBond(uint256 _rewardsProgrammeId, uint256 _rewardsFeePercentage) nonReentrant external {
}
function increaseServiceProviderStake(uint256 _amount) nonReentrant external notSetupSP onlySPM notZero(_amount) {
}
function requestExcessServiceProviderStakeWithdrawal(uint256 _amount) nonReentrant external notSetupSP onlySPM notZero(_amount) {
}
// only called by service provider
// all CUDOs staked by service provider and any delegated stake plus rewards will be returned to this contract
// delegators will have to call their own exit methods to get their original stake and rewards
function exitAsServiceProvider() nonReentrant external onlySPM {
}
// To be called only by a service provider
function withdrawServiceProviderStake() nonReentrant external onlySPM {
}
// Called by a CUDO holder that wants to delegate their stake to a service provider
function delegateStake(uint256 _amount) nonReentrant external notSetupSP allowedSP notZero(_amount) {
}
// Called by a CUDO holder that has previously delegated stake to the service provider
function requestDelegatedStakeWithdrawal(uint256 _amount) nonReentrant external isExitedSP notSetupSP notZero(_amount) allowedSP {
}
function withdrawDelegatedStake() nonReentrant external isExitedSP notSetupSP allowedSP {
}
// Can be called by a delegator when a service provider exits
// Service provider must have exited when the delegator calls this method. Otherwise, they call withdrawDelegatedStake
function exitAsDelegator() nonReentrant external {
}
// Should be possible for anyone to call this to get the reward from the StakingRewards contract
// The total rewards due to all delegators will have the rewardsFeePercentage deducted and sent to the Service Provider
function getReward() external isExitedSP notSetupSP {
}
function callibrateServiceProviderFee() external {
}
/////////////////
// View methods
/////////////////
function pendingRewards(address _user) public view returns (uint256) {
}
///////////////////
// Private methods
///////////////////
function _getAndDistributeRewards() private {
}
function _getAndDistributeRewardsWithMassUpdate() private {
}
// Called when this service provider contract has earned additional rewards.
// Increases delagators' pending rewards, and sends sevice provider(s) their share.
function _distributeRewards(uint256 _amount) private {
}
function _workOutHowMuchDueToServiceProviderAndDelegators(uint256 _amount) private view returns (uint256, uint256, uint256, uint256) {
}
// Ensure this is not called when sender is service provider
function _sendDelegatorAnyPendingRewards() private {
}
function _stakeServiceProviderBond(uint256 _rewardsProgrammeId, uint256 _rewardsFeePercentage) private {
}
// *** CUDO Admin Emergency only **
function recoverERC20(address _erc20, address _recipient, uint256 _amount) external {
}
}
| _msgSender()==serviceProvider,"SPC1" | 7,683 | _msgSender()==serviceProvider |
"SPC3" | // SPDX-License-Identifier: MIT
pragma solidity 0.8.0;
import "@openzeppelin/contracts/utils/math/SafeMath.sol";
import "@openzeppelin/contracts/token/ERC20/IERC20.sol";
import "@openzeppelin/contracts/token/ERC20/utils/SafeERC20.sol";
import "@openzeppelin/contracts/security/ReentrancyGuard.sol";
import "@openzeppelin/contracts/utils/Context.sol";
import {StakingRewards} from "./StakingRewards.sol";
contract ServiceProvider is ReentrancyGuard, Context {
using SafeMath for uint256;
using SafeERC20 for IERC20;
struct WithdrawalRequest {
uint256 withdrawalPermittedFrom;
uint256 amount;
uint256 lastStakedBlock;
}
mapping(address => WithdrawalRequest) public withdrawalRequest;
address public controller; // StakingRewards
address public serviceProvider;
address public serviceProviderManager;
IERC20 public cudosToken;
/// @notice Allows the rewards fee to be specified to 2 DP
uint256 public constant PERCENTAGE_MODULO = 100_00;
/// @notice True when contract is initialised and the service provider has staked the required bond
bool public isServiceProviderFullySetup;
bool public exited;
/// @notice Defined by the service provider when depositing their bond
uint256 public rewardsFeePercentage;
event StakedServiceProviderBond(address indexed serviceProvider, address indexed serviceProviderManager, uint256 indexed pid, uint256 rewardsFeePercentage);
event IncreasedServiceProviderBond(address indexed serviceProvider, uint256 indexed pid, uint256 amount, uint256 totalAmount);
event DecreasedServiceProviderBond(address indexed serviceProvider, uint256 indexed pid, uint256 amount, uint256 totalAmount);
event ExitedServiceProviderBond(address indexed serviceProvider, uint256 indexed pid);
event WithdrewServiceProviderStake(address indexed serviceProvider, uint256 amount, uint256 totalAmount);
event AddDelegatedStake(address indexed user, uint256 amount, uint256 totalAmount);
event WithdrawDelegatedStakeRequested(address indexed user, uint256 amount, uint256 totalAmount);
event WithdrewDelegatedStake(address indexed user, uint256 amount, uint256 totalAmount);
event ExitDelegatedStake(address indexed user, uint256 amount);
event CalibratedServiceProviderFee(address indexed user, uint256 newFee);
mapping(address => uint256) public delegatedStake;
mapping(address => uint256) public rewardDebt;
// rewardDebt is the total amount of rewards a user would have received if the state of the network were the same as now from the beginning.
uint256 public totalDelegatedStake;
uint256 public rewardsProgrammeId;
uint256 public minStakingLength;
uint256 public accTokensPerShare; // Accumulated reward tokens per share, times 1e18. See below.
// accTokensPerShare is the average reward amount a user would have received per each block so far
// if the state of the network were the same as now from the beginning.
// Service provider not setup
modifier notSetupSP() {
}
// Only Service Provider
modifier onlySP() {
}
// Only Service Provider Manager
modifier onlySPM() {
require(<FILL_ME>)
_;
}
// Not a service provider method
modifier allowedSP() {
}
// Service provider has left
modifier isExitedSP() {
}
// _amount cannot be 0
modifier notZero(uint256 _amount) {
}
// this is called by StakingRewards to whitelist a service provider and is equivalent of the constructor
function init(address _serviceProvider, IERC20 _cudosToken) external {
}
// Called by the Service Provider to stake initial minimum cudo required to become a validator
function stakeServiceProviderBond(uint256 _rewardsProgrammeId, uint256 _rewardsFeePercentage) nonReentrant external onlySP {
}
function adminStakeServiceProviderBond(uint256 _rewardsProgrammeId, uint256 _rewardsFeePercentage) nonReentrant external {
}
function increaseServiceProviderStake(uint256 _amount) nonReentrant external notSetupSP onlySPM notZero(_amount) {
}
function requestExcessServiceProviderStakeWithdrawal(uint256 _amount) nonReentrant external notSetupSP onlySPM notZero(_amount) {
}
// only called by service provider
// all CUDOs staked by service provider and any delegated stake plus rewards will be returned to this contract
// delegators will have to call their own exit methods to get their original stake and rewards
function exitAsServiceProvider() nonReentrant external onlySPM {
}
// To be called only by a service provider
function withdrawServiceProviderStake() nonReentrant external onlySPM {
}
// Called by a CUDO holder that wants to delegate their stake to a service provider
function delegateStake(uint256 _amount) nonReentrant external notSetupSP allowedSP notZero(_amount) {
}
// Called by a CUDO holder that has previously delegated stake to the service provider
function requestDelegatedStakeWithdrawal(uint256 _amount) nonReentrant external isExitedSP notSetupSP notZero(_amount) allowedSP {
}
function withdrawDelegatedStake() nonReentrant external isExitedSP notSetupSP allowedSP {
}
// Can be called by a delegator when a service provider exits
// Service provider must have exited when the delegator calls this method. Otherwise, they call withdrawDelegatedStake
function exitAsDelegator() nonReentrant external {
}
// Should be possible for anyone to call this to get the reward from the StakingRewards contract
// The total rewards due to all delegators will have the rewardsFeePercentage deducted and sent to the Service Provider
function getReward() external isExitedSP notSetupSP {
}
function callibrateServiceProviderFee() external {
}
/////////////////
// View methods
/////////////////
function pendingRewards(address _user) public view returns (uint256) {
}
///////////////////
// Private methods
///////////////////
function _getAndDistributeRewards() private {
}
function _getAndDistributeRewardsWithMassUpdate() private {
}
// Called when this service provider contract has earned additional rewards.
// Increases delagators' pending rewards, and sends sevice provider(s) their share.
function _distributeRewards(uint256 _amount) private {
}
function _workOutHowMuchDueToServiceProviderAndDelegators(uint256 _amount) private view returns (uint256, uint256, uint256, uint256) {
}
// Ensure this is not called when sender is service provider
function _sendDelegatorAnyPendingRewards() private {
}
function _stakeServiceProviderBond(uint256 _rewardsProgrammeId, uint256 _rewardsFeePercentage) private {
}
// *** CUDO Admin Emergency only **
function recoverERC20(address _erc20, address _recipient, uint256 _amount) external {
}
}
| _msgSender()==serviceProviderManager,"SPC3" | 7,683 | _msgSender()==serviceProviderManager |
"SPC4" | // SPDX-License-Identifier: MIT
pragma solidity 0.8.0;
import "@openzeppelin/contracts/utils/math/SafeMath.sol";
import "@openzeppelin/contracts/token/ERC20/IERC20.sol";
import "@openzeppelin/contracts/token/ERC20/utils/SafeERC20.sol";
import "@openzeppelin/contracts/security/ReentrancyGuard.sol";
import "@openzeppelin/contracts/utils/Context.sol";
import {StakingRewards} from "./StakingRewards.sol";
contract ServiceProvider is ReentrancyGuard, Context {
using SafeMath for uint256;
using SafeERC20 for IERC20;
struct WithdrawalRequest {
uint256 withdrawalPermittedFrom;
uint256 amount;
uint256 lastStakedBlock;
}
mapping(address => WithdrawalRequest) public withdrawalRequest;
address public controller; // StakingRewards
address public serviceProvider;
address public serviceProviderManager;
IERC20 public cudosToken;
/// @notice Allows the rewards fee to be specified to 2 DP
uint256 public constant PERCENTAGE_MODULO = 100_00;
/// @notice True when contract is initialised and the service provider has staked the required bond
bool public isServiceProviderFullySetup;
bool public exited;
/// @notice Defined by the service provider when depositing their bond
uint256 public rewardsFeePercentage;
event StakedServiceProviderBond(address indexed serviceProvider, address indexed serviceProviderManager, uint256 indexed pid, uint256 rewardsFeePercentage);
event IncreasedServiceProviderBond(address indexed serviceProvider, uint256 indexed pid, uint256 amount, uint256 totalAmount);
event DecreasedServiceProviderBond(address indexed serviceProvider, uint256 indexed pid, uint256 amount, uint256 totalAmount);
event ExitedServiceProviderBond(address indexed serviceProvider, uint256 indexed pid);
event WithdrewServiceProviderStake(address indexed serviceProvider, uint256 amount, uint256 totalAmount);
event AddDelegatedStake(address indexed user, uint256 amount, uint256 totalAmount);
event WithdrawDelegatedStakeRequested(address indexed user, uint256 amount, uint256 totalAmount);
event WithdrewDelegatedStake(address indexed user, uint256 amount, uint256 totalAmount);
event ExitDelegatedStake(address indexed user, uint256 amount);
event CalibratedServiceProviderFee(address indexed user, uint256 newFee);
mapping(address => uint256) public delegatedStake;
mapping(address => uint256) public rewardDebt;
// rewardDebt is the total amount of rewards a user would have received if the state of the network were the same as now from the beginning.
uint256 public totalDelegatedStake;
uint256 public rewardsProgrammeId;
uint256 public minStakingLength;
uint256 public accTokensPerShare; // Accumulated reward tokens per share, times 1e18. See below.
// accTokensPerShare is the average reward amount a user would have received per each block so far
// if the state of the network were the same as now from the beginning.
// Service provider not setup
modifier notSetupSP() {
}
// Only Service Provider
modifier onlySP() {
}
// Only Service Provider Manager
modifier onlySPM() {
}
// Not a service provider method
modifier allowedSP() {
require(<FILL_ME>)
_;
}
// Service provider has left
modifier isExitedSP() {
}
// _amount cannot be 0
modifier notZero(uint256 _amount) {
}
// this is called by StakingRewards to whitelist a service provider and is equivalent of the constructor
function init(address _serviceProvider, IERC20 _cudosToken) external {
}
// Called by the Service Provider to stake initial minimum cudo required to become a validator
function stakeServiceProviderBond(uint256 _rewardsProgrammeId, uint256 _rewardsFeePercentage) nonReentrant external onlySP {
}
function adminStakeServiceProviderBond(uint256 _rewardsProgrammeId, uint256 _rewardsFeePercentage) nonReentrant external {
}
function increaseServiceProviderStake(uint256 _amount) nonReentrant external notSetupSP onlySPM notZero(_amount) {
}
function requestExcessServiceProviderStakeWithdrawal(uint256 _amount) nonReentrant external notSetupSP onlySPM notZero(_amount) {
}
// only called by service provider
// all CUDOs staked by service provider and any delegated stake plus rewards will be returned to this contract
// delegators will have to call their own exit methods to get their original stake and rewards
function exitAsServiceProvider() nonReentrant external onlySPM {
}
// To be called only by a service provider
function withdrawServiceProviderStake() nonReentrant external onlySPM {
}
// Called by a CUDO holder that wants to delegate their stake to a service provider
function delegateStake(uint256 _amount) nonReentrant external notSetupSP allowedSP notZero(_amount) {
}
// Called by a CUDO holder that has previously delegated stake to the service provider
function requestDelegatedStakeWithdrawal(uint256 _amount) nonReentrant external isExitedSP notSetupSP notZero(_amount) allowedSP {
}
function withdrawDelegatedStake() nonReentrant external isExitedSP notSetupSP allowedSP {
}
// Can be called by a delegator when a service provider exits
// Service provider must have exited when the delegator calls this method. Otherwise, they call withdrawDelegatedStake
function exitAsDelegator() nonReentrant external {
}
// Should be possible for anyone to call this to get the reward from the StakingRewards contract
// The total rewards due to all delegators will have the rewardsFeePercentage deducted and sent to the Service Provider
function getReward() external isExitedSP notSetupSP {
}
function callibrateServiceProviderFee() external {
}
/////////////////
// View methods
/////////////////
function pendingRewards(address _user) public view returns (uint256) {
}
///////////////////
// Private methods
///////////////////
function _getAndDistributeRewards() private {
}
function _getAndDistributeRewardsWithMassUpdate() private {
}
// Called when this service provider contract has earned additional rewards.
// Increases delagators' pending rewards, and sends sevice provider(s) their share.
function _distributeRewards(uint256 _amount) private {
}
function _workOutHowMuchDueToServiceProviderAndDelegators(uint256 _amount) private view returns (uint256, uint256, uint256, uint256) {
}
// Ensure this is not called when sender is service provider
function _sendDelegatorAnyPendingRewards() private {
}
function _stakeServiceProviderBond(uint256 _rewardsProgrammeId, uint256 _rewardsFeePercentage) private {
}
// *** CUDO Admin Emergency only **
function recoverERC20(address _erc20, address _recipient, uint256 _amount) external {
}
}
| _msgSender()!=serviceProviderManager&&_msgSender()!=serviceProvider,"SPC4" | 7,683 | _msgSender()!=serviceProviderManager&&_msgSender()!=serviceProvider |
"SPHL" | // SPDX-License-Identifier: MIT
pragma solidity 0.8.0;
import "@openzeppelin/contracts/utils/math/SafeMath.sol";
import "@openzeppelin/contracts/token/ERC20/IERC20.sol";
import "@openzeppelin/contracts/token/ERC20/utils/SafeERC20.sol";
import "@openzeppelin/contracts/security/ReentrancyGuard.sol";
import "@openzeppelin/contracts/utils/Context.sol";
import {StakingRewards} from "./StakingRewards.sol";
contract ServiceProvider is ReentrancyGuard, Context {
using SafeMath for uint256;
using SafeERC20 for IERC20;
struct WithdrawalRequest {
uint256 withdrawalPermittedFrom;
uint256 amount;
uint256 lastStakedBlock;
}
mapping(address => WithdrawalRequest) public withdrawalRequest;
address public controller; // StakingRewards
address public serviceProvider;
address public serviceProviderManager;
IERC20 public cudosToken;
/// @notice Allows the rewards fee to be specified to 2 DP
uint256 public constant PERCENTAGE_MODULO = 100_00;
/// @notice True when contract is initialised and the service provider has staked the required bond
bool public isServiceProviderFullySetup;
bool public exited;
/// @notice Defined by the service provider when depositing their bond
uint256 public rewardsFeePercentage;
event StakedServiceProviderBond(address indexed serviceProvider, address indexed serviceProviderManager, uint256 indexed pid, uint256 rewardsFeePercentage);
event IncreasedServiceProviderBond(address indexed serviceProvider, uint256 indexed pid, uint256 amount, uint256 totalAmount);
event DecreasedServiceProviderBond(address indexed serviceProvider, uint256 indexed pid, uint256 amount, uint256 totalAmount);
event ExitedServiceProviderBond(address indexed serviceProvider, uint256 indexed pid);
event WithdrewServiceProviderStake(address indexed serviceProvider, uint256 amount, uint256 totalAmount);
event AddDelegatedStake(address indexed user, uint256 amount, uint256 totalAmount);
event WithdrawDelegatedStakeRequested(address indexed user, uint256 amount, uint256 totalAmount);
event WithdrewDelegatedStake(address indexed user, uint256 amount, uint256 totalAmount);
event ExitDelegatedStake(address indexed user, uint256 amount);
event CalibratedServiceProviderFee(address indexed user, uint256 newFee);
mapping(address => uint256) public delegatedStake;
mapping(address => uint256) public rewardDebt;
// rewardDebt is the total amount of rewards a user would have received if the state of the network were the same as now from the beginning.
uint256 public totalDelegatedStake;
uint256 public rewardsProgrammeId;
uint256 public minStakingLength;
uint256 public accTokensPerShare; // Accumulated reward tokens per share, times 1e18. See below.
// accTokensPerShare is the average reward amount a user would have received per each block so far
// if the state of the network were the same as now from the beginning.
// Service provider not setup
modifier notSetupSP() {
}
// Only Service Provider
modifier onlySP() {
}
// Only Service Provider Manager
modifier onlySPM() {
}
// Not a service provider method
modifier allowedSP() {
}
// Service provider has left
modifier isExitedSP() {
require(<FILL_ME>)
_;
}
// _amount cannot be 0
modifier notZero(uint256 _amount) {
}
// this is called by StakingRewards to whitelist a service provider and is equivalent of the constructor
function init(address _serviceProvider, IERC20 _cudosToken) external {
}
// Called by the Service Provider to stake initial minimum cudo required to become a validator
function stakeServiceProviderBond(uint256 _rewardsProgrammeId, uint256 _rewardsFeePercentage) nonReentrant external onlySP {
}
function adminStakeServiceProviderBond(uint256 _rewardsProgrammeId, uint256 _rewardsFeePercentage) nonReentrant external {
}
function increaseServiceProviderStake(uint256 _amount) nonReentrant external notSetupSP onlySPM notZero(_amount) {
}
function requestExcessServiceProviderStakeWithdrawal(uint256 _amount) nonReentrant external notSetupSP onlySPM notZero(_amount) {
}
// only called by service provider
// all CUDOs staked by service provider and any delegated stake plus rewards will be returned to this contract
// delegators will have to call their own exit methods to get their original stake and rewards
function exitAsServiceProvider() nonReentrant external onlySPM {
}
// To be called only by a service provider
function withdrawServiceProviderStake() nonReentrant external onlySPM {
}
// Called by a CUDO holder that wants to delegate their stake to a service provider
function delegateStake(uint256 _amount) nonReentrant external notSetupSP allowedSP notZero(_amount) {
}
// Called by a CUDO holder that has previously delegated stake to the service provider
function requestDelegatedStakeWithdrawal(uint256 _amount) nonReentrant external isExitedSP notSetupSP notZero(_amount) allowedSP {
}
function withdrawDelegatedStake() nonReentrant external isExitedSP notSetupSP allowedSP {
}
// Can be called by a delegator when a service provider exits
// Service provider must have exited when the delegator calls this method. Otherwise, they call withdrawDelegatedStake
function exitAsDelegator() nonReentrant external {
}
// Should be possible for anyone to call this to get the reward from the StakingRewards contract
// The total rewards due to all delegators will have the rewardsFeePercentage deducted and sent to the Service Provider
function getReward() external isExitedSP notSetupSP {
}
function callibrateServiceProviderFee() external {
}
/////////////////
// View methods
/////////////////
function pendingRewards(address _user) public view returns (uint256) {
}
///////////////////
// Private methods
///////////////////
function _getAndDistributeRewards() private {
}
function _getAndDistributeRewardsWithMassUpdate() private {
}
// Called when this service provider contract has earned additional rewards.
// Increases delagators' pending rewards, and sends sevice provider(s) their share.
function _distributeRewards(uint256 _amount) private {
}
function _workOutHowMuchDueToServiceProviderAndDelegators(uint256 _amount) private view returns (uint256, uint256, uint256, uint256) {
}
// Ensure this is not called when sender is service provider
function _sendDelegatorAnyPendingRewards() private {
}
function _stakeServiceProviderBond(uint256 _rewardsProgrammeId, uint256 _rewardsFeePercentage) private {
}
// *** CUDO Admin Emergency only **
function recoverERC20(address _erc20, address _recipient, uint256 _amount) external {
}
}
| !exited,"SPHL" | 7,683 | !exited |
"SPI3" | // SPDX-License-Identifier: MIT
pragma solidity 0.8.0;
import "@openzeppelin/contracts/utils/math/SafeMath.sol";
import "@openzeppelin/contracts/token/ERC20/IERC20.sol";
import "@openzeppelin/contracts/token/ERC20/utils/SafeERC20.sol";
import "@openzeppelin/contracts/security/ReentrancyGuard.sol";
import "@openzeppelin/contracts/utils/Context.sol";
import {StakingRewards} from "./StakingRewards.sol";
contract ServiceProvider is ReentrancyGuard, Context {
using SafeMath for uint256;
using SafeERC20 for IERC20;
struct WithdrawalRequest {
uint256 withdrawalPermittedFrom;
uint256 amount;
uint256 lastStakedBlock;
}
mapping(address => WithdrawalRequest) public withdrawalRequest;
address public controller; // StakingRewards
address public serviceProvider;
address public serviceProviderManager;
IERC20 public cudosToken;
/// @notice Allows the rewards fee to be specified to 2 DP
uint256 public constant PERCENTAGE_MODULO = 100_00;
/// @notice True when contract is initialised and the service provider has staked the required bond
bool public isServiceProviderFullySetup;
bool public exited;
/// @notice Defined by the service provider when depositing their bond
uint256 public rewardsFeePercentage;
event StakedServiceProviderBond(address indexed serviceProvider, address indexed serviceProviderManager, uint256 indexed pid, uint256 rewardsFeePercentage);
event IncreasedServiceProviderBond(address indexed serviceProvider, uint256 indexed pid, uint256 amount, uint256 totalAmount);
event DecreasedServiceProviderBond(address indexed serviceProvider, uint256 indexed pid, uint256 amount, uint256 totalAmount);
event ExitedServiceProviderBond(address indexed serviceProvider, uint256 indexed pid);
event WithdrewServiceProviderStake(address indexed serviceProvider, uint256 amount, uint256 totalAmount);
event AddDelegatedStake(address indexed user, uint256 amount, uint256 totalAmount);
event WithdrawDelegatedStakeRequested(address indexed user, uint256 amount, uint256 totalAmount);
event WithdrewDelegatedStake(address indexed user, uint256 amount, uint256 totalAmount);
event ExitDelegatedStake(address indexed user, uint256 amount);
event CalibratedServiceProviderFee(address indexed user, uint256 newFee);
mapping(address => uint256) public delegatedStake;
mapping(address => uint256) public rewardDebt;
// rewardDebt is the total amount of rewards a user would have received if the state of the network were the same as now from the beginning.
uint256 public totalDelegatedStake;
uint256 public rewardsProgrammeId;
uint256 public minStakingLength;
uint256 public accTokensPerShare; // Accumulated reward tokens per share, times 1e18. See below.
// accTokensPerShare is the average reward amount a user would have received per each block so far
// if the state of the network were the same as now from the beginning.
// Service provider not setup
modifier notSetupSP() {
}
// Only Service Provider
modifier onlySP() {
}
// Only Service Provider Manager
modifier onlySPM() {
}
// Not a service provider method
modifier allowedSP() {
}
// Service provider has left
modifier isExitedSP() {
}
// _amount cannot be 0
modifier notZero(uint256 _amount) {
}
// this is called by StakingRewards to whitelist a service provider and is equivalent of the constructor
function init(address _serviceProvider, IERC20 _cudosToken) external {
// ServiceProvider.init: Fn can only be called once
require(serviceProvider == address(0), "SPI1");
// ServiceProvider.init: Service provider cannot be zero address
require(_serviceProvider != address(0), "SPI2");
// ServiceProvider.init: Cudos token cannot be zero address
require(<FILL_ME>)
serviceProvider = _serviceProvider;
cudosToken = _cudosToken;
controller = _msgSender();
// StakingRewards contract currently
}
// Called by the Service Provider to stake initial minimum cudo required to become a validator
function stakeServiceProviderBond(uint256 _rewardsProgrammeId, uint256 _rewardsFeePercentage) nonReentrant external onlySP {
}
function adminStakeServiceProviderBond(uint256 _rewardsProgrammeId, uint256 _rewardsFeePercentage) nonReentrant external {
}
function increaseServiceProviderStake(uint256 _amount) nonReentrant external notSetupSP onlySPM notZero(_amount) {
}
function requestExcessServiceProviderStakeWithdrawal(uint256 _amount) nonReentrant external notSetupSP onlySPM notZero(_amount) {
}
// only called by service provider
// all CUDOs staked by service provider and any delegated stake plus rewards will be returned to this contract
// delegators will have to call their own exit methods to get their original stake and rewards
function exitAsServiceProvider() nonReentrant external onlySPM {
}
// To be called only by a service provider
function withdrawServiceProviderStake() nonReentrant external onlySPM {
}
// Called by a CUDO holder that wants to delegate their stake to a service provider
function delegateStake(uint256 _amount) nonReentrant external notSetupSP allowedSP notZero(_amount) {
}
// Called by a CUDO holder that has previously delegated stake to the service provider
function requestDelegatedStakeWithdrawal(uint256 _amount) nonReentrant external isExitedSP notSetupSP notZero(_amount) allowedSP {
}
function withdrawDelegatedStake() nonReentrant external isExitedSP notSetupSP allowedSP {
}
// Can be called by a delegator when a service provider exits
// Service provider must have exited when the delegator calls this method. Otherwise, they call withdrawDelegatedStake
function exitAsDelegator() nonReentrant external {
}
// Should be possible for anyone to call this to get the reward from the StakingRewards contract
// The total rewards due to all delegators will have the rewardsFeePercentage deducted and sent to the Service Provider
function getReward() external isExitedSP notSetupSP {
}
function callibrateServiceProviderFee() external {
}
/////////////////
// View methods
/////////////////
function pendingRewards(address _user) public view returns (uint256) {
}
///////////////////
// Private methods
///////////////////
function _getAndDistributeRewards() private {
}
function _getAndDistributeRewardsWithMassUpdate() private {
}
// Called when this service provider contract has earned additional rewards.
// Increases delagators' pending rewards, and sends sevice provider(s) their share.
function _distributeRewards(uint256 _amount) private {
}
function _workOutHowMuchDueToServiceProviderAndDelegators(uint256 _amount) private view returns (uint256, uint256, uint256, uint256) {
}
// Ensure this is not called when sender is service provider
function _sendDelegatorAnyPendingRewards() private {
}
function _stakeServiceProviderBond(uint256 _rewardsProgrammeId, uint256 _rewardsFeePercentage) private {
}
// *** CUDO Admin Emergency only **
function recoverERC20(address _erc20, address _recipient, uint256 _amount) external {
}
}
| address(_cudosToken)!=address(0),"SPI3" | 7,683 | address(_cudosToken)!=address(0) |
"OA" | // SPDX-License-Identifier: MIT
pragma solidity 0.8.0;
import "@openzeppelin/contracts/utils/math/SafeMath.sol";
import "@openzeppelin/contracts/token/ERC20/IERC20.sol";
import "@openzeppelin/contracts/token/ERC20/utils/SafeERC20.sol";
import "@openzeppelin/contracts/security/ReentrancyGuard.sol";
import "@openzeppelin/contracts/utils/Context.sol";
import {StakingRewards} from "./StakingRewards.sol";
contract ServiceProvider is ReentrancyGuard, Context {
using SafeMath for uint256;
using SafeERC20 for IERC20;
struct WithdrawalRequest {
uint256 withdrawalPermittedFrom;
uint256 amount;
uint256 lastStakedBlock;
}
mapping(address => WithdrawalRequest) public withdrawalRequest;
address public controller; // StakingRewards
address public serviceProvider;
address public serviceProviderManager;
IERC20 public cudosToken;
/// @notice Allows the rewards fee to be specified to 2 DP
uint256 public constant PERCENTAGE_MODULO = 100_00;
/// @notice True when contract is initialised and the service provider has staked the required bond
bool public isServiceProviderFullySetup;
bool public exited;
/// @notice Defined by the service provider when depositing their bond
uint256 public rewardsFeePercentage;
event StakedServiceProviderBond(address indexed serviceProvider, address indexed serviceProviderManager, uint256 indexed pid, uint256 rewardsFeePercentage);
event IncreasedServiceProviderBond(address indexed serviceProvider, uint256 indexed pid, uint256 amount, uint256 totalAmount);
event DecreasedServiceProviderBond(address indexed serviceProvider, uint256 indexed pid, uint256 amount, uint256 totalAmount);
event ExitedServiceProviderBond(address indexed serviceProvider, uint256 indexed pid);
event WithdrewServiceProviderStake(address indexed serviceProvider, uint256 amount, uint256 totalAmount);
event AddDelegatedStake(address indexed user, uint256 amount, uint256 totalAmount);
event WithdrawDelegatedStakeRequested(address indexed user, uint256 amount, uint256 totalAmount);
event WithdrewDelegatedStake(address indexed user, uint256 amount, uint256 totalAmount);
event ExitDelegatedStake(address indexed user, uint256 amount);
event CalibratedServiceProviderFee(address indexed user, uint256 newFee);
mapping(address => uint256) public delegatedStake;
mapping(address => uint256) public rewardDebt;
// rewardDebt is the total amount of rewards a user would have received if the state of the network were the same as now from the beginning.
uint256 public totalDelegatedStake;
uint256 public rewardsProgrammeId;
uint256 public minStakingLength;
uint256 public accTokensPerShare; // Accumulated reward tokens per share, times 1e18. See below.
// accTokensPerShare is the average reward amount a user would have received per each block so far
// if the state of the network were the same as now from the beginning.
// Service provider not setup
modifier notSetupSP() {
}
// Only Service Provider
modifier onlySP() {
}
// Only Service Provider Manager
modifier onlySPM() {
}
// Not a service provider method
modifier allowedSP() {
}
// Service provider has left
modifier isExitedSP() {
}
// _amount cannot be 0
modifier notZero(uint256 _amount) {
}
// this is called by StakingRewards to whitelist a service provider and is equivalent of the constructor
function init(address _serviceProvider, IERC20 _cudosToken) external {
}
// Called by the Service Provider to stake initial minimum cudo required to become a validator
function stakeServiceProviderBond(uint256 _rewardsProgrammeId, uint256 _rewardsFeePercentage) nonReentrant external onlySP {
}
function adminStakeServiceProviderBond(uint256 _rewardsProgrammeId, uint256 _rewardsFeePercentage) nonReentrant external {
require(<FILL_ME>)
serviceProviderManager = _msgSender();
_stakeServiceProviderBond(_rewardsProgrammeId, _rewardsFeePercentage);
}
function increaseServiceProviderStake(uint256 _amount) nonReentrant external notSetupSP onlySPM notZero(_amount) {
}
function requestExcessServiceProviderStakeWithdrawal(uint256 _amount) nonReentrant external notSetupSP onlySPM notZero(_amount) {
}
// only called by service provider
// all CUDOs staked by service provider and any delegated stake plus rewards will be returned to this contract
// delegators will have to call their own exit methods to get their original stake and rewards
function exitAsServiceProvider() nonReentrant external onlySPM {
}
// To be called only by a service provider
function withdrawServiceProviderStake() nonReentrant external onlySPM {
}
// Called by a CUDO holder that wants to delegate their stake to a service provider
function delegateStake(uint256 _amount) nonReentrant external notSetupSP allowedSP notZero(_amount) {
}
// Called by a CUDO holder that has previously delegated stake to the service provider
function requestDelegatedStakeWithdrawal(uint256 _amount) nonReentrant external isExitedSP notSetupSP notZero(_amount) allowedSP {
}
function withdrawDelegatedStake() nonReentrant external isExitedSP notSetupSP allowedSP {
}
// Can be called by a delegator when a service provider exits
// Service provider must have exited when the delegator calls this method. Otherwise, they call withdrawDelegatedStake
function exitAsDelegator() nonReentrant external {
}
// Should be possible for anyone to call this to get the reward from the StakingRewards contract
// The total rewards due to all delegators will have the rewardsFeePercentage deducted and sent to the Service Provider
function getReward() external isExitedSP notSetupSP {
}
function callibrateServiceProviderFee() external {
}
/////////////////
// View methods
/////////////////
function pendingRewards(address _user) public view returns (uint256) {
}
///////////////////
// Private methods
///////////////////
function _getAndDistributeRewards() private {
}
function _getAndDistributeRewardsWithMassUpdate() private {
}
// Called when this service provider contract has earned additional rewards.
// Increases delagators' pending rewards, and sends sevice provider(s) their share.
function _distributeRewards(uint256 _amount) private {
}
function _workOutHowMuchDueToServiceProviderAndDelegators(uint256 _amount) private view returns (uint256, uint256, uint256, uint256) {
}
// Ensure this is not called when sender is service provider
function _sendDelegatorAnyPendingRewards() private {
}
function _stakeServiceProviderBond(uint256 _rewardsProgrammeId, uint256 _rewardsFeePercentage) private {
}
// *** CUDO Admin Emergency only **
function recoverERC20(address _erc20, address _recipient, uint256 _amount) external {
}
}
| StakingRewards(controller).hasAdminRole(_msgSender()),"OA" | 7,683 | StakingRewards(controller).hasAdminRole(_msgSender()) |
"SPS1" | // SPDX-License-Identifier: MIT
pragma solidity 0.8.0;
import "@openzeppelin/contracts/utils/math/SafeMath.sol";
import "@openzeppelin/contracts/token/ERC20/IERC20.sol";
import "@openzeppelin/contracts/token/ERC20/utils/SafeERC20.sol";
import "@openzeppelin/contracts/security/ReentrancyGuard.sol";
import "@openzeppelin/contracts/utils/Context.sol";
import {StakingRewards} from "./StakingRewards.sol";
contract ServiceProvider is ReentrancyGuard, Context {
using SafeMath for uint256;
using SafeERC20 for IERC20;
struct WithdrawalRequest {
uint256 withdrawalPermittedFrom;
uint256 amount;
uint256 lastStakedBlock;
}
mapping(address => WithdrawalRequest) public withdrawalRequest;
address public controller; // StakingRewards
address public serviceProvider;
address public serviceProviderManager;
IERC20 public cudosToken;
/// @notice Allows the rewards fee to be specified to 2 DP
uint256 public constant PERCENTAGE_MODULO = 100_00;
/// @notice True when contract is initialised and the service provider has staked the required bond
bool public isServiceProviderFullySetup;
bool public exited;
/// @notice Defined by the service provider when depositing their bond
uint256 public rewardsFeePercentage;
event StakedServiceProviderBond(address indexed serviceProvider, address indexed serviceProviderManager, uint256 indexed pid, uint256 rewardsFeePercentage);
event IncreasedServiceProviderBond(address indexed serviceProvider, uint256 indexed pid, uint256 amount, uint256 totalAmount);
event DecreasedServiceProviderBond(address indexed serviceProvider, uint256 indexed pid, uint256 amount, uint256 totalAmount);
event ExitedServiceProviderBond(address indexed serviceProvider, uint256 indexed pid);
event WithdrewServiceProviderStake(address indexed serviceProvider, uint256 amount, uint256 totalAmount);
event AddDelegatedStake(address indexed user, uint256 amount, uint256 totalAmount);
event WithdrawDelegatedStakeRequested(address indexed user, uint256 amount, uint256 totalAmount);
event WithdrewDelegatedStake(address indexed user, uint256 amount, uint256 totalAmount);
event ExitDelegatedStake(address indexed user, uint256 amount);
event CalibratedServiceProviderFee(address indexed user, uint256 newFee);
mapping(address => uint256) public delegatedStake;
mapping(address => uint256) public rewardDebt;
// rewardDebt is the total amount of rewards a user would have received if the state of the network were the same as now from the beginning.
uint256 public totalDelegatedStake;
uint256 public rewardsProgrammeId;
uint256 public minStakingLength;
uint256 public accTokensPerShare; // Accumulated reward tokens per share, times 1e18. See below.
// accTokensPerShare is the average reward amount a user would have received per each block so far
// if the state of the network were the same as now from the beginning.
// Service provider not setup
modifier notSetupSP() {
}
// Only Service Provider
modifier onlySP() {
}
// Only Service Provider Manager
modifier onlySPM() {
}
// Not a service provider method
modifier allowedSP() {
}
// Service provider has left
modifier isExitedSP() {
}
// _amount cannot be 0
modifier notZero(uint256 _amount) {
}
// this is called by StakingRewards to whitelist a service provider and is equivalent of the constructor
function init(address _serviceProvider, IERC20 _cudosToken) external {
}
// Called by the Service Provider to stake initial minimum cudo required to become a validator
function stakeServiceProviderBond(uint256 _rewardsProgrammeId, uint256 _rewardsFeePercentage) nonReentrant external onlySP {
}
function adminStakeServiceProviderBond(uint256 _rewardsProgrammeId, uint256 _rewardsFeePercentage) nonReentrant external {
}
function increaseServiceProviderStake(uint256 _amount) nonReentrant external notSetupSP onlySPM notZero(_amount) {
StakingRewards rewards = StakingRewards(controller);
uint256 maxStakingAmountForServiceProviders = rewards.maxStakingAmountForServiceProviders();
uint256 amountStakedSoFar = rewards.amountStakedByUserInRewardProgramme(rewardsProgrammeId, address(this));
// ServiceProvider.increaseServiceProviderStake: Exceeds max staking
require(<FILL_ME>)
// Get and distribute any pending rewards
_getAndDistributeRewardsWithMassUpdate();
// increase the service provider stake
StakingRewards(controller).stake(rewardsProgrammeId, serviceProviderManager, _amount);
// Update delegated stake
delegatedStake[serviceProvider] = delegatedStake[serviceProvider].add(_amount);
totalDelegatedStake = totalDelegatedStake.add(_amount);
// Store date for lock-up calculation
WithdrawalRequest storage withdrawalReq = withdrawalRequest[_msgSender()];
withdrawalReq.lastStakedBlock = rewards._getBlock();
emit IncreasedServiceProviderBond(serviceProvider, rewardsProgrammeId, _amount, delegatedStake[serviceProvider]);
}
function requestExcessServiceProviderStakeWithdrawal(uint256 _amount) nonReentrant external notSetupSP onlySPM notZero(_amount) {
}
// only called by service provider
// all CUDOs staked by service provider and any delegated stake plus rewards will be returned to this contract
// delegators will have to call their own exit methods to get their original stake and rewards
function exitAsServiceProvider() nonReentrant external onlySPM {
}
// To be called only by a service provider
function withdrawServiceProviderStake() nonReentrant external onlySPM {
}
// Called by a CUDO holder that wants to delegate their stake to a service provider
function delegateStake(uint256 _amount) nonReentrant external notSetupSP allowedSP notZero(_amount) {
}
// Called by a CUDO holder that has previously delegated stake to the service provider
function requestDelegatedStakeWithdrawal(uint256 _amount) nonReentrant external isExitedSP notSetupSP notZero(_amount) allowedSP {
}
function withdrawDelegatedStake() nonReentrant external isExitedSP notSetupSP allowedSP {
}
// Can be called by a delegator when a service provider exits
// Service provider must have exited when the delegator calls this method. Otherwise, they call withdrawDelegatedStake
function exitAsDelegator() nonReentrant external {
}
// Should be possible for anyone to call this to get the reward from the StakingRewards contract
// The total rewards due to all delegators will have the rewardsFeePercentage deducted and sent to the Service Provider
function getReward() external isExitedSP notSetupSP {
}
function callibrateServiceProviderFee() external {
}
/////////////////
// View methods
/////////////////
function pendingRewards(address _user) public view returns (uint256) {
}
///////////////////
// Private methods
///////////////////
function _getAndDistributeRewards() private {
}
function _getAndDistributeRewardsWithMassUpdate() private {
}
// Called when this service provider contract has earned additional rewards.
// Increases delagators' pending rewards, and sends sevice provider(s) their share.
function _distributeRewards(uint256 _amount) private {
}
function _workOutHowMuchDueToServiceProviderAndDelegators(uint256 _amount) private view returns (uint256, uint256, uint256, uint256) {
}
// Ensure this is not called when sender is service provider
function _sendDelegatorAnyPendingRewards() private {
}
function _stakeServiceProviderBond(uint256 _rewardsProgrammeId, uint256 _rewardsFeePercentage) private {
}
// *** CUDO Admin Emergency only **
function recoverERC20(address _erc20, address _recipient, uint256 _amount) external {
}
}
| amountStakedSoFar.add(_amount)<=maxStakingAmountForServiceProviders,"SPS1" | 7,683 | amountStakedSoFar.add(_amount)<=maxStakingAmountForServiceProviders |
"SPW5" | // SPDX-License-Identifier: MIT
pragma solidity 0.8.0;
import "@openzeppelin/contracts/utils/math/SafeMath.sol";
import "@openzeppelin/contracts/token/ERC20/IERC20.sol";
import "@openzeppelin/contracts/token/ERC20/utils/SafeERC20.sol";
import "@openzeppelin/contracts/security/ReentrancyGuard.sol";
import "@openzeppelin/contracts/utils/Context.sol";
import {StakingRewards} from "./StakingRewards.sol";
contract ServiceProvider is ReentrancyGuard, Context {
using SafeMath for uint256;
using SafeERC20 for IERC20;
struct WithdrawalRequest {
uint256 withdrawalPermittedFrom;
uint256 amount;
uint256 lastStakedBlock;
}
mapping(address => WithdrawalRequest) public withdrawalRequest;
address public controller; // StakingRewards
address public serviceProvider;
address public serviceProviderManager;
IERC20 public cudosToken;
/// @notice Allows the rewards fee to be specified to 2 DP
uint256 public constant PERCENTAGE_MODULO = 100_00;
/// @notice True when contract is initialised and the service provider has staked the required bond
bool public isServiceProviderFullySetup;
bool public exited;
/// @notice Defined by the service provider when depositing their bond
uint256 public rewardsFeePercentage;
event StakedServiceProviderBond(address indexed serviceProvider, address indexed serviceProviderManager, uint256 indexed pid, uint256 rewardsFeePercentage);
event IncreasedServiceProviderBond(address indexed serviceProvider, uint256 indexed pid, uint256 amount, uint256 totalAmount);
event DecreasedServiceProviderBond(address indexed serviceProvider, uint256 indexed pid, uint256 amount, uint256 totalAmount);
event ExitedServiceProviderBond(address indexed serviceProvider, uint256 indexed pid);
event WithdrewServiceProviderStake(address indexed serviceProvider, uint256 amount, uint256 totalAmount);
event AddDelegatedStake(address indexed user, uint256 amount, uint256 totalAmount);
event WithdrawDelegatedStakeRequested(address indexed user, uint256 amount, uint256 totalAmount);
event WithdrewDelegatedStake(address indexed user, uint256 amount, uint256 totalAmount);
event ExitDelegatedStake(address indexed user, uint256 amount);
event CalibratedServiceProviderFee(address indexed user, uint256 newFee);
mapping(address => uint256) public delegatedStake;
mapping(address => uint256) public rewardDebt;
// rewardDebt is the total amount of rewards a user would have received if the state of the network were the same as now from the beginning.
uint256 public totalDelegatedStake;
uint256 public rewardsProgrammeId;
uint256 public minStakingLength;
uint256 public accTokensPerShare; // Accumulated reward tokens per share, times 1e18. See below.
// accTokensPerShare is the average reward amount a user would have received per each block so far
// if the state of the network were the same as now from the beginning.
// Service provider not setup
modifier notSetupSP() {
}
// Only Service Provider
modifier onlySP() {
}
// Only Service Provider Manager
modifier onlySPM() {
}
// Not a service provider method
modifier allowedSP() {
}
// Service provider has left
modifier isExitedSP() {
}
// _amount cannot be 0
modifier notZero(uint256 _amount) {
}
// this is called by StakingRewards to whitelist a service provider and is equivalent of the constructor
function init(address _serviceProvider, IERC20 _cudosToken) external {
}
// Called by the Service Provider to stake initial minimum cudo required to become a validator
function stakeServiceProviderBond(uint256 _rewardsProgrammeId, uint256 _rewardsFeePercentage) nonReentrant external onlySP {
}
function adminStakeServiceProviderBond(uint256 _rewardsProgrammeId, uint256 _rewardsFeePercentage) nonReentrant external {
}
function increaseServiceProviderStake(uint256 _amount) nonReentrant external notSetupSP onlySPM notZero(_amount) {
}
function requestExcessServiceProviderStakeWithdrawal(uint256 _amount) nonReentrant external notSetupSP onlySPM notZero(_amount) {
StakingRewards rewards = StakingRewards(controller);
WithdrawalRequest storage withdrawalReq = withdrawalRequest[_msgSender()];
// Check if lockup has passed
uint256 stakeStart = withdrawalReq.lastStakedBlock;
// StakingRewards.withdraw: Min staking period has not yet passed
require(<FILL_ME>)
uint256 amountLeftAfterWithdrawal = delegatedStake[serviceProvider].sub(_amount);
require(
amountLeftAfterWithdrawal >= rewards.minRequiredStakingAmountForServiceProviders(),
// ServiceProvider.requestExcessServiceProviderStakeWithdrawal: Remaining stake for a service provider cannot fall below minimum
"SPW7"
);
// Get and distribute any pending rewards
_getAndDistributeRewardsWithMassUpdate();
// Apply the unbonding period
uint256 unbondingPeriod = rewards.unbondingPeriod();
withdrawalReq.withdrawalPermittedFrom = rewards._getBlock().add(unbondingPeriod);
withdrawalReq.amount = withdrawalReq.amount.add(_amount);
delegatedStake[serviceProvider] = amountLeftAfterWithdrawal;
totalDelegatedStake = totalDelegatedStake.sub(_amount);
rewards.withdraw(rewardsProgrammeId, address(this), _amount);
emit DecreasedServiceProviderBond(serviceProvider, rewardsProgrammeId, _amount, delegatedStake[serviceProvider]);
}
// only called by service provider
// all CUDOs staked by service provider and any delegated stake plus rewards will be returned to this contract
// delegators will have to call their own exit methods to get their original stake and rewards
function exitAsServiceProvider() nonReentrant external onlySPM {
}
// To be called only by a service provider
function withdrawServiceProviderStake() nonReentrant external onlySPM {
}
// Called by a CUDO holder that wants to delegate their stake to a service provider
function delegateStake(uint256 _amount) nonReentrant external notSetupSP allowedSP notZero(_amount) {
}
// Called by a CUDO holder that has previously delegated stake to the service provider
function requestDelegatedStakeWithdrawal(uint256 _amount) nonReentrant external isExitedSP notSetupSP notZero(_amount) allowedSP {
}
function withdrawDelegatedStake() nonReentrant external isExitedSP notSetupSP allowedSP {
}
// Can be called by a delegator when a service provider exits
// Service provider must have exited when the delegator calls this method. Otherwise, they call withdrawDelegatedStake
function exitAsDelegator() nonReentrant external {
}
// Should be possible for anyone to call this to get the reward from the StakingRewards contract
// The total rewards due to all delegators will have the rewardsFeePercentage deducted and sent to the Service Provider
function getReward() external isExitedSP notSetupSP {
}
function callibrateServiceProviderFee() external {
}
/////////////////
// View methods
/////////////////
function pendingRewards(address _user) public view returns (uint256) {
}
///////////////////
// Private methods
///////////////////
function _getAndDistributeRewards() private {
}
function _getAndDistributeRewardsWithMassUpdate() private {
}
// Called when this service provider contract has earned additional rewards.
// Increases delagators' pending rewards, and sends sevice provider(s) their share.
function _distributeRewards(uint256 _amount) private {
}
function _workOutHowMuchDueToServiceProviderAndDelegators(uint256 _amount) private view returns (uint256, uint256, uint256, uint256) {
}
// Ensure this is not called when sender is service provider
function _sendDelegatorAnyPendingRewards() private {
}
function _stakeServiceProviderBond(uint256 _rewardsProgrammeId, uint256 _rewardsFeePercentage) private {
}
// *** CUDO Admin Emergency only **
function recoverERC20(address _erc20, address _recipient, uint256 _amount) external {
}
}
| rewards._getBlock()>=stakeStart.add(minStakingLength),"SPW5" | 7,683 | rewards._getBlock()>=stakeStart.add(minStakingLength) |
"SPW3" | // SPDX-License-Identifier: MIT
pragma solidity 0.8.0;
import "@openzeppelin/contracts/utils/math/SafeMath.sol";
import "@openzeppelin/contracts/token/ERC20/IERC20.sol";
import "@openzeppelin/contracts/token/ERC20/utils/SafeERC20.sol";
import "@openzeppelin/contracts/security/ReentrancyGuard.sol";
import "@openzeppelin/contracts/utils/Context.sol";
import {StakingRewards} from "./StakingRewards.sol";
contract ServiceProvider is ReentrancyGuard, Context {
using SafeMath for uint256;
using SafeERC20 for IERC20;
struct WithdrawalRequest {
uint256 withdrawalPermittedFrom;
uint256 amount;
uint256 lastStakedBlock;
}
mapping(address => WithdrawalRequest) public withdrawalRequest;
address public controller; // StakingRewards
address public serviceProvider;
address public serviceProviderManager;
IERC20 public cudosToken;
/// @notice Allows the rewards fee to be specified to 2 DP
uint256 public constant PERCENTAGE_MODULO = 100_00;
/// @notice True when contract is initialised and the service provider has staked the required bond
bool public isServiceProviderFullySetup;
bool public exited;
/// @notice Defined by the service provider when depositing their bond
uint256 public rewardsFeePercentage;
event StakedServiceProviderBond(address indexed serviceProvider, address indexed serviceProviderManager, uint256 indexed pid, uint256 rewardsFeePercentage);
event IncreasedServiceProviderBond(address indexed serviceProvider, uint256 indexed pid, uint256 amount, uint256 totalAmount);
event DecreasedServiceProviderBond(address indexed serviceProvider, uint256 indexed pid, uint256 amount, uint256 totalAmount);
event ExitedServiceProviderBond(address indexed serviceProvider, uint256 indexed pid);
event WithdrewServiceProviderStake(address indexed serviceProvider, uint256 amount, uint256 totalAmount);
event AddDelegatedStake(address indexed user, uint256 amount, uint256 totalAmount);
event WithdrawDelegatedStakeRequested(address indexed user, uint256 amount, uint256 totalAmount);
event WithdrewDelegatedStake(address indexed user, uint256 amount, uint256 totalAmount);
event ExitDelegatedStake(address indexed user, uint256 amount);
event CalibratedServiceProviderFee(address indexed user, uint256 newFee);
mapping(address => uint256) public delegatedStake;
mapping(address => uint256) public rewardDebt;
// rewardDebt is the total amount of rewards a user would have received if the state of the network were the same as now from the beginning.
uint256 public totalDelegatedStake;
uint256 public rewardsProgrammeId;
uint256 public minStakingLength;
uint256 public accTokensPerShare; // Accumulated reward tokens per share, times 1e18. See below.
// accTokensPerShare is the average reward amount a user would have received per each block so far
// if the state of the network were the same as now from the beginning.
// Service provider not setup
modifier notSetupSP() {
}
// Only Service Provider
modifier onlySP() {
}
// Only Service Provider Manager
modifier onlySPM() {
}
// Not a service provider method
modifier allowedSP() {
}
// Service provider has left
modifier isExitedSP() {
}
// _amount cannot be 0
modifier notZero(uint256 _amount) {
}
// this is called by StakingRewards to whitelist a service provider and is equivalent of the constructor
function init(address _serviceProvider, IERC20 _cudosToken) external {
}
// Called by the Service Provider to stake initial minimum cudo required to become a validator
function stakeServiceProviderBond(uint256 _rewardsProgrammeId, uint256 _rewardsFeePercentage) nonReentrant external onlySP {
}
function adminStakeServiceProviderBond(uint256 _rewardsProgrammeId, uint256 _rewardsFeePercentage) nonReentrant external {
}
function increaseServiceProviderStake(uint256 _amount) nonReentrant external notSetupSP onlySPM notZero(_amount) {
}
function requestExcessServiceProviderStakeWithdrawal(uint256 _amount) nonReentrant external notSetupSP onlySPM notZero(_amount) {
}
// only called by service provider
// all CUDOs staked by service provider and any delegated stake plus rewards will be returned to this contract
// delegators will have to call their own exit methods to get their original stake and rewards
function exitAsServiceProvider() nonReentrant external onlySPM {
}
// To be called only by a service provider
function withdrawServiceProviderStake() nonReentrant external onlySPM {
WithdrawalRequest storage withdrawalReq = withdrawalRequest[_msgSender()];
// ServiceProvider.withdrawServiceProviderStake: no withdrawal request in flight
require(withdrawalReq.amount > 0, "SPW5");
require(<FILL_ME>)
uint256 withdrawalRequestAmount = withdrawalReq.amount;
withdrawalReq.amount = 0;
cudosToken.transfer(_msgSender(), withdrawalRequestAmount);
emit WithdrewServiceProviderStake(_msgSender(), withdrawalRequestAmount, delegatedStake[serviceProvider]);
}
// Called by a CUDO holder that wants to delegate their stake to a service provider
function delegateStake(uint256 _amount) nonReentrant external notSetupSP allowedSP notZero(_amount) {
}
// Called by a CUDO holder that has previously delegated stake to the service provider
function requestDelegatedStakeWithdrawal(uint256 _amount) nonReentrant external isExitedSP notSetupSP notZero(_amount) allowedSP {
}
function withdrawDelegatedStake() nonReentrant external isExitedSP notSetupSP allowedSP {
}
// Can be called by a delegator when a service provider exits
// Service provider must have exited when the delegator calls this method. Otherwise, they call withdrawDelegatedStake
function exitAsDelegator() nonReentrant external {
}
// Should be possible for anyone to call this to get the reward from the StakingRewards contract
// The total rewards due to all delegators will have the rewardsFeePercentage deducted and sent to the Service Provider
function getReward() external isExitedSP notSetupSP {
}
function callibrateServiceProviderFee() external {
}
/////////////////
// View methods
/////////////////
function pendingRewards(address _user) public view returns (uint256) {
}
///////////////////
// Private methods
///////////////////
function _getAndDistributeRewards() private {
}
function _getAndDistributeRewardsWithMassUpdate() private {
}
// Called when this service provider contract has earned additional rewards.
// Increases delagators' pending rewards, and sends sevice provider(s) their share.
function _distributeRewards(uint256 _amount) private {
}
function _workOutHowMuchDueToServiceProviderAndDelegators(uint256 _amount) private view returns (uint256, uint256, uint256, uint256) {
}
// Ensure this is not called when sender is service provider
function _sendDelegatorAnyPendingRewards() private {
}
function _stakeServiceProviderBond(uint256 _rewardsProgrammeId, uint256 _rewardsFeePercentage) private {
}
// *** CUDO Admin Emergency only **
function recoverERC20(address _erc20, address _recipient, uint256 _amount) external {
}
}
| StakingRewards(controller)._getBlock()>=withdrawalReq.withdrawalPermittedFrom,"SPW3" | 7,683 | StakingRewards(controller)._getBlock()>=withdrawalReq.withdrawalPermittedFrom |
"SPW4" | // SPDX-License-Identifier: MIT
pragma solidity 0.8.0;
import "@openzeppelin/contracts/utils/math/SafeMath.sol";
import "@openzeppelin/contracts/token/ERC20/IERC20.sol";
import "@openzeppelin/contracts/token/ERC20/utils/SafeERC20.sol";
import "@openzeppelin/contracts/security/ReentrancyGuard.sol";
import "@openzeppelin/contracts/utils/Context.sol";
import {StakingRewards} from "./StakingRewards.sol";
contract ServiceProvider is ReentrancyGuard, Context {
using SafeMath for uint256;
using SafeERC20 for IERC20;
struct WithdrawalRequest {
uint256 withdrawalPermittedFrom;
uint256 amount;
uint256 lastStakedBlock;
}
mapping(address => WithdrawalRequest) public withdrawalRequest;
address public controller; // StakingRewards
address public serviceProvider;
address public serviceProviderManager;
IERC20 public cudosToken;
/// @notice Allows the rewards fee to be specified to 2 DP
uint256 public constant PERCENTAGE_MODULO = 100_00;
/// @notice True when contract is initialised and the service provider has staked the required bond
bool public isServiceProviderFullySetup;
bool public exited;
/// @notice Defined by the service provider when depositing their bond
uint256 public rewardsFeePercentage;
event StakedServiceProviderBond(address indexed serviceProvider, address indexed serviceProviderManager, uint256 indexed pid, uint256 rewardsFeePercentage);
event IncreasedServiceProviderBond(address indexed serviceProvider, uint256 indexed pid, uint256 amount, uint256 totalAmount);
event DecreasedServiceProviderBond(address indexed serviceProvider, uint256 indexed pid, uint256 amount, uint256 totalAmount);
event ExitedServiceProviderBond(address indexed serviceProvider, uint256 indexed pid);
event WithdrewServiceProviderStake(address indexed serviceProvider, uint256 amount, uint256 totalAmount);
event AddDelegatedStake(address indexed user, uint256 amount, uint256 totalAmount);
event WithdrawDelegatedStakeRequested(address indexed user, uint256 amount, uint256 totalAmount);
event WithdrewDelegatedStake(address indexed user, uint256 amount, uint256 totalAmount);
event ExitDelegatedStake(address indexed user, uint256 amount);
event CalibratedServiceProviderFee(address indexed user, uint256 newFee);
mapping(address => uint256) public delegatedStake;
mapping(address => uint256) public rewardDebt;
// rewardDebt is the total amount of rewards a user would have received if the state of the network were the same as now from the beginning.
uint256 public totalDelegatedStake;
uint256 public rewardsProgrammeId;
uint256 public minStakingLength;
uint256 public accTokensPerShare; // Accumulated reward tokens per share, times 1e18. See below.
// accTokensPerShare is the average reward amount a user would have received per each block so far
// if the state of the network were the same as now from the beginning.
// Service provider not setup
modifier notSetupSP() {
}
// Only Service Provider
modifier onlySP() {
}
// Only Service Provider Manager
modifier onlySPM() {
}
// Not a service provider method
modifier allowedSP() {
}
// Service provider has left
modifier isExitedSP() {
}
// _amount cannot be 0
modifier notZero(uint256 _amount) {
}
// this is called by StakingRewards to whitelist a service provider and is equivalent of the constructor
function init(address _serviceProvider, IERC20 _cudosToken) external {
}
// Called by the Service Provider to stake initial minimum cudo required to become a validator
function stakeServiceProviderBond(uint256 _rewardsProgrammeId, uint256 _rewardsFeePercentage) nonReentrant external onlySP {
}
function adminStakeServiceProviderBond(uint256 _rewardsProgrammeId, uint256 _rewardsFeePercentage) nonReentrant external {
}
function increaseServiceProviderStake(uint256 _amount) nonReentrant external notSetupSP onlySPM notZero(_amount) {
}
function requestExcessServiceProviderStakeWithdrawal(uint256 _amount) nonReentrant external notSetupSP onlySPM notZero(_amount) {
}
// only called by service provider
// all CUDOs staked by service provider and any delegated stake plus rewards will be returned to this contract
// delegators will have to call their own exit methods to get their original stake and rewards
function exitAsServiceProvider() nonReentrant external onlySPM {
}
// To be called only by a service provider
function withdrawServiceProviderStake() nonReentrant external onlySPM {
}
// Called by a CUDO holder that wants to delegate their stake to a service provider
function delegateStake(uint256 _amount) nonReentrant external notSetupSP allowedSP notZero(_amount) {
}
// Called by a CUDO holder that has previously delegated stake to the service provider
function requestDelegatedStakeWithdrawal(uint256 _amount) nonReentrant external isExitedSP notSetupSP notZero(_amount) allowedSP {
// ServiceProvider.requestDelegatedStakeWithdrawal: Amount exceeds delegated stake
require(<FILL_ME>)
StakingRewards rewards = StakingRewards(controller);
WithdrawalRequest storage withdrawalReq = withdrawalRequest[_msgSender()];
// Check if lockup has passed
uint256 stakeStart = withdrawalReq.lastStakedBlock;
// StakingRewards.withdraw: Min staking period has not yet passed
require(rewards._getBlock() >= stakeStart.add(minStakingLength), "SPW5");
_getAndDistributeRewardsWithMassUpdate();
uint256 unbondingPeriod = rewards.unbondingPeriod();
withdrawalReq.withdrawalPermittedFrom = rewards._getBlock().add(unbondingPeriod);
withdrawalReq.amount = withdrawalReq.amount.add(_amount);
delegatedStake[_msgSender()] = delegatedStake[_msgSender()].sub(_amount);
totalDelegatedStake = totalDelegatedStake.sub(_amount);
rewards.withdraw(rewardsProgrammeId, address(this), _amount);
// we need to update the reward debt so that the reward debt is not too high due to the decrease in staked amount
rewardDebt[_msgSender()] = delegatedStake[_msgSender()].mul(accTokensPerShare).div(1e18);
emit WithdrawDelegatedStakeRequested(_msgSender(), _amount, delegatedStake[_msgSender()]);
}
function withdrawDelegatedStake() nonReentrant external isExitedSP notSetupSP allowedSP {
}
// Can be called by a delegator when a service provider exits
// Service provider must have exited when the delegator calls this method. Otherwise, they call withdrawDelegatedStake
function exitAsDelegator() nonReentrant external {
}
// Should be possible for anyone to call this to get the reward from the StakingRewards contract
// The total rewards due to all delegators will have the rewardsFeePercentage deducted and sent to the Service Provider
function getReward() external isExitedSP notSetupSP {
}
function callibrateServiceProviderFee() external {
}
/////////////////
// View methods
/////////////////
function pendingRewards(address _user) public view returns (uint256) {
}
///////////////////
// Private methods
///////////////////
function _getAndDistributeRewards() private {
}
function _getAndDistributeRewardsWithMassUpdate() private {
}
// Called when this service provider contract has earned additional rewards.
// Increases delagators' pending rewards, and sends sevice provider(s) their share.
function _distributeRewards(uint256 _amount) private {
}
function _workOutHowMuchDueToServiceProviderAndDelegators(uint256 _amount) private view returns (uint256, uint256, uint256, uint256) {
}
// Ensure this is not called when sender is service provider
function _sendDelegatorAnyPendingRewards() private {
}
function _stakeServiceProviderBond(uint256 _rewardsProgrammeId, uint256 _rewardsFeePercentage) private {
}
// *** CUDO Admin Emergency only **
function recoverERC20(address _erc20, address _recipient, uint256 _amount) external {
}
}
| delegatedStake[_msgSender()]>=_amount,"SPW4" | 7,683 | delegatedStake[_msgSender()]>=_amount |
"SPC7" | // SPDX-License-Identifier: MIT
pragma solidity 0.8.0;
import "@openzeppelin/contracts/utils/math/SafeMath.sol";
import "@openzeppelin/contracts/token/ERC20/IERC20.sol";
import "@openzeppelin/contracts/token/ERC20/utils/SafeERC20.sol";
import "@openzeppelin/contracts/security/ReentrancyGuard.sol";
import "@openzeppelin/contracts/utils/Context.sol";
import {StakingRewards} from "./StakingRewards.sol";
contract ServiceProvider is ReentrancyGuard, Context {
using SafeMath for uint256;
using SafeERC20 for IERC20;
struct WithdrawalRequest {
uint256 withdrawalPermittedFrom;
uint256 amount;
uint256 lastStakedBlock;
}
mapping(address => WithdrawalRequest) public withdrawalRequest;
address public controller; // StakingRewards
address public serviceProvider;
address public serviceProviderManager;
IERC20 public cudosToken;
/// @notice Allows the rewards fee to be specified to 2 DP
uint256 public constant PERCENTAGE_MODULO = 100_00;
/// @notice True when contract is initialised and the service provider has staked the required bond
bool public isServiceProviderFullySetup;
bool public exited;
/// @notice Defined by the service provider when depositing their bond
uint256 public rewardsFeePercentage;
event StakedServiceProviderBond(address indexed serviceProvider, address indexed serviceProviderManager, uint256 indexed pid, uint256 rewardsFeePercentage);
event IncreasedServiceProviderBond(address indexed serviceProvider, uint256 indexed pid, uint256 amount, uint256 totalAmount);
event DecreasedServiceProviderBond(address indexed serviceProvider, uint256 indexed pid, uint256 amount, uint256 totalAmount);
event ExitedServiceProviderBond(address indexed serviceProvider, uint256 indexed pid);
event WithdrewServiceProviderStake(address indexed serviceProvider, uint256 amount, uint256 totalAmount);
event AddDelegatedStake(address indexed user, uint256 amount, uint256 totalAmount);
event WithdrawDelegatedStakeRequested(address indexed user, uint256 amount, uint256 totalAmount);
event WithdrewDelegatedStake(address indexed user, uint256 amount, uint256 totalAmount);
event ExitDelegatedStake(address indexed user, uint256 amount);
event CalibratedServiceProviderFee(address indexed user, uint256 newFee);
mapping(address => uint256) public delegatedStake;
mapping(address => uint256) public rewardDebt;
// rewardDebt is the total amount of rewards a user would have received if the state of the network were the same as now from the beginning.
uint256 public totalDelegatedStake;
uint256 public rewardsProgrammeId;
uint256 public minStakingLength;
uint256 public accTokensPerShare; // Accumulated reward tokens per share, times 1e18. See below.
// accTokensPerShare is the average reward amount a user would have received per each block so far
// if the state of the network were the same as now from the beginning.
// Service provider not setup
modifier notSetupSP() {
}
// Only Service Provider
modifier onlySP() {
}
// Only Service Provider Manager
modifier onlySPM() {
}
// Not a service provider method
modifier allowedSP() {
}
// Service provider has left
modifier isExitedSP() {
}
// _amount cannot be 0
modifier notZero(uint256 _amount) {
}
// this is called by StakingRewards to whitelist a service provider and is equivalent of the constructor
function init(address _serviceProvider, IERC20 _cudosToken) external {
}
// Called by the Service Provider to stake initial minimum cudo required to become a validator
function stakeServiceProviderBond(uint256 _rewardsProgrammeId, uint256 _rewardsFeePercentage) nonReentrant external onlySP {
}
function adminStakeServiceProviderBond(uint256 _rewardsProgrammeId, uint256 _rewardsFeePercentage) nonReentrant external {
}
function increaseServiceProviderStake(uint256 _amount) nonReentrant external notSetupSP onlySPM notZero(_amount) {
}
function requestExcessServiceProviderStakeWithdrawal(uint256 _amount) nonReentrant external notSetupSP onlySPM notZero(_amount) {
}
// only called by service provider
// all CUDOs staked by service provider and any delegated stake plus rewards will be returned to this contract
// delegators will have to call their own exit methods to get their original stake and rewards
function exitAsServiceProvider() nonReentrant external onlySPM {
}
// To be called only by a service provider
function withdrawServiceProviderStake() nonReentrant external onlySPM {
}
// Called by a CUDO holder that wants to delegate their stake to a service provider
function delegateStake(uint256 _amount) nonReentrant external notSetupSP allowedSP notZero(_amount) {
}
// Called by a CUDO holder that has previously delegated stake to the service provider
function requestDelegatedStakeWithdrawal(uint256 _amount) nonReentrant external isExitedSP notSetupSP notZero(_amount) allowedSP {
}
function withdrawDelegatedStake() nonReentrant external isExitedSP notSetupSP allowedSP {
}
// Can be called by a delegator when a service provider exits
// Service provider must have exited when the delegator calls this method. Otherwise, they call withdrawDelegatedStake
function exitAsDelegator() nonReentrant external {
}
// Should be possible for anyone to call this to get the reward from the StakingRewards contract
// The total rewards due to all delegators will have the rewardsFeePercentage deducted and sent to the Service Provider
function getReward() external isExitedSP notSetupSP {
}
function callibrateServiceProviderFee() external {
}
/////////////////
// View methods
/////////////////
function pendingRewards(address _user) public view returns (uint256) {
}
///////////////////
// Private methods
///////////////////
function _getAndDistributeRewards() private {
}
function _getAndDistributeRewardsWithMassUpdate() private {
}
// Called when this service provider contract has earned additional rewards.
// Increases delagators' pending rewards, and sends sevice provider(s) their share.
function _distributeRewards(uint256 _amount) private {
}
function _workOutHowMuchDueToServiceProviderAndDelegators(uint256 _amount) private view returns (uint256, uint256, uint256, uint256) {
}
// Ensure this is not called when sender is service provider
function _sendDelegatorAnyPendingRewards() private {
}
function _stakeServiceProviderBond(uint256 _rewardsProgrammeId, uint256 _rewardsFeePercentage) private {
// ServiceProvider.stakeServiceProviderBond: Service provider already set up
require(<FILL_ME>)
// ServiceProvider.stakeServiceProviderBond: Exited service provider cannot reenter
require(!exited, "ECR1");
// ServiceProvider.stakeServiceProviderBond: Fee percentage must be between zero and one
require(_rewardsFeePercentage > 0 && _rewardsFeePercentage < PERCENTAGE_MODULO, "FP2");
StakingRewards rewards = StakingRewards(controller);
uint256 minRequiredStakingAmountForServiceProviders = rewards.minRequiredStakingAmountForServiceProviders();
uint256 minServiceProviderFee = rewards.minServiceProviderFee();
//ServiceProvider.stakeServiceProviderBond: Fee percentage must be greater or equal to minServiceProviderFee
require(_rewardsFeePercentage >= minServiceProviderFee, "SPF1");
rewardsFeePercentage = _rewardsFeePercentage;
rewardsProgrammeId = _rewardsProgrammeId;
minStakingLength = rewards._findMinStakingLength(_rewardsProgrammeId);
isServiceProviderFullySetup = true;
delegatedStake[serviceProvider] = minRequiredStakingAmountForServiceProviders;
totalDelegatedStake = totalDelegatedStake.add(minRequiredStakingAmountForServiceProviders);
// A mass update is required at this point
_getAndDistributeRewardsWithMassUpdate();
rewards.stake(
_rewardsProgrammeId,
_msgSender(),
minRequiredStakingAmountForServiceProviders
);
// Store date for lock-up calculation
WithdrawalRequest storage withdrawalReq = withdrawalRequest[_msgSender()];
withdrawalReq.lastStakedBlock = rewards._getBlock();
emit StakedServiceProviderBond(serviceProvider, serviceProviderManager, _rewardsProgrammeId, rewardsFeePercentage);
}
// *** CUDO Admin Emergency only **
function recoverERC20(address _erc20, address _recipient, uint256 _amount) external {
}
}
| !isServiceProviderFullySetup,"SPC7" | 7,683 | !isServiceProviderFullySetup |
null | pragma solidity ^0.6.0;
import "./DSAuth.sol";
import "./DSNote.sol";
abstract contract DSProxy is DSAuth, DSNote {
DSProxyCache public cache; // global cache for contracts
constructor(address _cacheAddr) public {
require(<FILL_ME>)
}
// solhint-disable-next-line no-empty-blocks
receive() external payable {}
// use the proxy to execute calldata _data on contract _code
// function execute(bytes memory _code, bytes memory _data)
// public
// payable
// virtual
// returns (address target, bytes32 response);
function execute(address _target, bytes memory _data)
public
payable
virtual
returns (bytes32 response);
//set new cache
function setCache(address _cacheAddr) public virtual payable returns (bool);
}
contract DSProxyCache {
mapping(bytes32 => address) cache;
function read(bytes memory _code) public view returns (address) {
}
function write(bytes memory _code) public returns (address target) {
}
}
| setCache(_cacheAddr) | 7,744 | setCache(_cacheAddr) |
"0x transaction failed" | pragma solidity ^0.6.0;
import "../../interfaces/ExchangeInterface.sol";
import "../../interfaces/TokenInterface.sol";
import "../../interfaces/SaverExchangeInterface.sol";
import "../../constants/ConstantAddressesExchange.sol";
import "../../utils/ZrxAllowlist.sol";
import "../../utils/SafeERC20.sol";
/// @title Helper methods for integration with SaverExchange
contract ExchangeHelper is ConstantAddressesExchange {
using SafeERC20 for ERC20;
address public constant ZRX_ALLOWLIST_ADDR = 0x019739e288973F92bDD3c1d87178E206E51fd911;
/// @notice Swaps 2 tokens on the Saver Exchange
/// @dev ETH is sent with Weth address
/// @param _data [amount, minPrice, exchangeType, 0xPrice]
/// @param _src Token address of the source token
/// @param _dest Token address of the destination token
/// @param _exchangeAddress Address of 0x exchange that should be called
/// @param _callData data to call 0x exchange with
function swap(uint[4] memory _data, address _src, address _dest, address _exchangeAddress, bytes memory _callData) internal returns (uint) {
address wrapper;
uint price;
// [tokensReturned, tokensLeft]
uint[2] memory tokens;
bool success;
// tokensLeft is equal to amount at the beginning
tokens[1] = _data[0];
_src = wethToKyberEth(_src);
_dest = wethToKyberEth(_dest);
// use this to avoid stack too deep error
address[3] memory orderAddresses = [_exchangeAddress, _src, _dest];
// if _data[2] == 4 use 0x if possible
if (_data[2] == 4) {
if (orderAddresses[1] != KYBER_ETH_ADDRESS) {
ERC20(orderAddresses[1]).approve(address(ERC20_PROXY_0X), _data[0]);
}
(success, tokens[0], ) = takeOrder(orderAddresses, _callData, address(this).balance, _data[0]);
// if specifically 4, then require it to be successfull
require(<FILL_ME>)
}
if (tokens[0] == 0) {
(wrapper, price) = SaverExchangeInterface(SAVER_EXCHANGE_ADDRESS).getBestPrice(_data[0], orderAddresses[1], orderAddresses[2], _data[2]);
require(price > _data[1] || _data[3] > _data[1], "Slippage hit");
// handle 0x exchange, if equal price, try 0x to use less gas
if (_data[3] >= price) {
if (orderAddresses[1] != KYBER_ETH_ADDRESS) {
ERC20(orderAddresses[1]).approve(address(ERC20_PROXY_0X), _data[0]);
}
// when selling eth its possible that some eth isn't sold and it is returned back
(success, tokens[0], tokens[1]) = takeOrder(orderAddresses, _callData, address(this).balance, _data[0]);
}
// if there are more tokens left, try to sell them on other exchanges
if (tokens[1] > 0) {
// as it stands today, this can happend only when selling ETH
if (tokens[1] != _data[0]) {
(wrapper, price) = SaverExchangeInterface(SAVER_EXCHANGE_ADDRESS).getBestPrice(tokens[1], orderAddresses[1], orderAddresses[2], _data[2]);
}
require(price > _data[1], "Slippage hit onchain price");
if (orderAddresses[1] == KYBER_ETH_ADDRESS) {
uint tRet;
(tRet,) = ExchangeInterface(wrapper).swapEtherToToken{value: tokens[1]}(tokens[1], orderAddresses[2], uint(-1));
tokens[0] += tRet;
} else {
ERC20(orderAddresses[1]).safeTransfer(wrapper, tokens[1]);
if (orderAddresses[2] == KYBER_ETH_ADDRESS) {
tokens[0] += ExchangeInterface(wrapper).swapTokenToEther(orderAddresses[1], tokens[1], uint(-1));
} else {
tokens[0] += ExchangeInterface(wrapper).swapTokenToToken(orderAddresses[1], orderAddresses[2], tokens[1]);
}
}
}
}
return tokens[0];
}
// @notice Takes order from 0x and returns bool indicating if it is successful
// @param _addresses [exchange, src, dst]
// @param _data Data to send with call
// @param _value Value to send with call
// @param _amount Amount to sell
function takeOrder(address[3] memory _addresses, bytes memory _data, uint _value, uint _amount) private returns(bool, uint, uint) {
}
/// @notice Converts WETH -> Kybers Eth address
/// @param _src Input address
function wethToKyberEth(address _src) internal pure returns (address) {
}
}
| success&&tokens[0]>0,"0x transaction failed" | 7,784 | success&&tokens[0]>0 |
null | pragma solidity ^0.6.0;
import "./ISubscriptions.sol";
import "./Static.sol";
import "./MCDMonitorProxy.sol";
import "../../constants/ConstantAddresses.sol";
import "../../interfaces/GasTokenInterface.sol";
import "../../DS/DSMath.sol";
/// @title Implements logic that allows bots to call Boost and Repay
contract MCDMonitor is ConstantAddresses, DSMath, Static {
uint constant public REPAY_GAS_TOKEN = 30;
uint constant public BOOST_GAS_TOKEN = 19;
uint constant public MAX_GAS_PRICE = 40000000000; // 40 gwei
uint public REPAY_GAS_COST = 1800000;
uint public BOOST_GAS_COST = 1250000;
MCDMonitorProxy public monitorProxyContract;
ISubscriptions public subscriptionsContract;
GasTokenInterface gasToken = GasTokenInterface(GAS_TOKEN_INTERFACE_ADDRESS);
address public owner;
address public mcdSaverProxyAddress;
/// @dev Addresses that are able to call methods for repay and boost
mapping(address => bool) public approvedCallers;
event CdpRepay(uint indexed cdpId, address indexed caller, uint amount, uint beforeRatio, uint afterRatio);
event CdpBoost(uint indexed cdpId, address indexed caller, uint amount, uint beforeRatio, uint afterRatio);
modifier onlyApproved() {
require(<FILL_ME>)
_;
}
modifier onlyOwner() {
}
constructor(address _monitorProxy, address _subscriptions, address _mcdSaverProxyAddress) public {
}
/// @notice Bots call this method to repay for user when conditions are met
/// @dev If the contract ownes gas token it will try and use it for gas price reduction
/// @param _cdpId Id of the cdp
/// @param _amount Amount of Eth to convert to Dai
/// @param _exchangeType Which exchange to use, 0 is to select best one
/// @param _collateralJoin Address of collateral join for specific CDP
function repayFor(uint _cdpId, uint _amount, address _collateralJoin, uint _exchangeType) public onlyApproved {
}
/// @notice Bots call this method to boost for user when conditions are met
/// @dev If the contract ownes gas token it will try and use it for gas price reduction
/// @param _cdpId Id of the cdp
/// @param _amount Amount of Dai to convert to Eth
/// @param _exchangeType Which exchange to use, 0 is to select best one
/// @param _collateralJoin Address of collateral join for specific CDP
function boostFor(uint _cdpId, uint _amount, address _collateralJoin, uint _exchangeType) public onlyApproved {
}
/// @notice Calculates gas cost (in Eth) of tx
/// @dev Gas price is limited to MAX_GAS_PRICE to prevent attack of draining user CDP
/// @param _gasAmount Amount of gas used for the tx
function calcGasCost(uint _gasAmount) internal view returns (uint) {
}
/******************* OWNER ONLY OPERATIONS ********************************/
/// @notice Allows owner to change gas cost for boost operation, but only up to 3 millions
/// @param _gasCost New gas cost for boost method
function changeBoostGasCost(uint _gasCost) public onlyOwner {
}
/// @notice Allows owner to change gas cost for repay operation, but only up to 3 millions
/// @param _gasCost New gas cost for repay method
function changeRepayGasCost(uint _gasCost) public onlyOwner {
}
/// @notice Adds a new bot address which will be able to call repay/boost
/// @param _caller Bot address
function addCaller(address _caller) public onlyOwner {
}
/// @notice Removes a bot address so it can't call repay/boost
/// @param _caller Bot address
function removeCaller(address _caller) public onlyOwner {
}
/// @notice If any tokens gets stuck in the contract owner can withdraw it
/// @param _tokenAddress Address of the ERC20 token
/// @param _to Address of the receiver
/// @param _amount The amount to be sent
function transferERC20(address _tokenAddress, address _to, uint _amount) public onlyOwner {
}
/// @notice If any Eth gets stuck in the contract owner can withdraw it
/// @param _to Address of the receiver
/// @param _amount The amount to be sent
function transferEth(address payable _to, uint _amount) public onlyOwner {
}
}
| approvedCallers[msg.sender] | 7,814 | approvedCallers[msg.sender] |
null | pragma solidity ^0.4.24;
/**
* @title SafeMath
* @dev Math operations with safety checks that revert on error
*/
library SafeMath {
/**
* @dev Multiplies two numbers, reverts on overflow.
*/
function mul(uint256 a, uint256 b) internal pure returns (uint256) {
}
/**
* @dev Integer division of two numbers truncating the quotient, reverts on division by zero.
*/
function div(uint256 a, uint256 b) internal pure returns (uint256) {
}
/**
* @dev Subtracts two numbers, reverts on overflow (i.e. if subtrahend is greater than minuend).
*/
function sub(uint256 a, uint256 b) internal pure returns (uint256) {
}
/**
* @dev Adds two numbers, reverts on overflow.
*/
function add(uint256 a, uint256 b) internal pure returns (uint256) {
}
/**
* @dev Divides two numbers and returns the remainder (unsigned integer modulo),
* reverts when dividing by zero.
*/
function mod(uint256 a, uint256 b) internal pure returns (uint256) {
}
}
/**
* @title Ownable
* @dev The Ownable contract has an owner address, and provides basic authorization control
* functions, this simplifies the implementation of "user permissions".
*/
contract Ownable {
address private _owner;
event OwnershipTransferred(
address indexed previousOwner,
address indexed newOwner
);
/**
* @dev The Ownable constructor sets the original `owner` of the contract to the sender
* account.
*/
constructor(address custom_owner) public {
}
/**
* @return the address of the owner.
*/
function owner() public view returns(address) {
}
/**
* @dev Throws if called by any account other than the owner.
*/
modifier onlyOwner() {
}
/**
* @return true if `msg.sender` is the owner of the contract.
*/
function isOwner() public view returns(bool) {
}
/**
* @dev Allows the current owner to relinquish control of the contract.
* @notice Renouncing to ownership will leave the contract without an owner.
* It will not be possible to call the functions with the `onlyOwner`
* modifier anymore.
*/
function renounceOwnership() public onlyOwner {
}
/**
* @dev Allows the current owner to transfer control of the contract to a newOwner.
* @param newOwner The address to transfer ownership to.
*/
function transferOwnership(address newOwner) public onlyOwner {
}
/**
* @dev Transfers control of the contract to a newOwner.
* @param newOwner The address to transfer ownership to.
*/
function _transferOwnership(address newOwner) internal {
}
}
/*
Based on https://etherscan.io/address/0x6dee36e9f915cab558437f97746998048dcaa700#code
by https://blog.pennyether.com/posts/realtime-dividend-token.html
*/
contract ERC20 {
using SafeMath for uint256;
string public name;
string public symbol;
uint8 public decimals = 18;
uint public totalSupply;
mapping (address => uint) public balanceOf;
mapping (address => mapping (address => uint)) public allowance;
event Created(uint time);
event Transfer(address indexed from, address indexed to, uint amount);
event Approval(address indexed owner, address indexed spender, uint amount);
event AllowanceUsed(address indexed owner, address indexed spender, uint amount);
constructor(string _name, string _symbol)
public
{
}
function transfer(address _to, uint _value)
public
returns (bool success)
{
}
function approve(address _spender, uint _value)
public
returns (bool success)
{
}
// Attempts to transfer `_value` from `_from` to `_to`
// if `_from` has sufficient allowance for `msg.sender`.
function transferFrom(address _from, address _to, uint256 _value)
public
returns (bool success)
{
address _spender = msg.sender;
require(<FILL_ME>)
allowance[_from][_spender] = allowance[_from][_spender].sub(_value);
emit AllowanceUsed(_from, _spender, _value);
return _transfer(_from, _to, _value);
}
// Transfers balance from `_from` to `_to` if `_to` has sufficient balance.
// Called from transfer() and transferFrom().
function _transfer(address _from, address _to, uint _value)
private
returns (bool success)
{
}
}
interface HasTokenFallback {
function tokenFallback(address _from, uint256 _amount, bytes _data)
external
returns (bool success);
}
contract ERC667 is ERC20 {
constructor(string _name, string _symbol)
public
ERC20(_name, _symbol)
{}
function transferAndCall(address _to, uint _value, bytes _data)
public
returns (bool success)
{
}
}
/*********************************************************
******************* DIVIDEND TOKEN ***********************
**********************************************************
UI: https://www.pennyether.com/status/tokens
An ERC20 token that can accept Ether and distribute it
perfectly to all Token Holders relative to each account's
balance at the time the dividend is received.
The Token is owned by the creator, and can be frozen,
minted, and burned by the owner.
Notes:
- Accounts can view or receive dividends owed at any time
- Dividends received are immediately credited to all
current Token Holders and can be redeemed at any time.
- Per above, upon transfers, dividends are not
transferred. They are kept by the original sender, and
not credited to the receiver.
- Uses "pull" instead of "push". Token holders must pull
their own dividends.
*/
contract DividendTokenERC667 is ERC667, Ownable
{
using SafeMath for uint256;
// How dividends work:
//
// - A "point" is a fraction of a Wei (1e-32), it's used to reduce rounding errors.
//
// - totalPointsPerToken represents how many points each token is entitled to
// from all the dividends ever received. Each time a new deposit is made, it
// is incremented by the points oweable per token at the time of deposit:
// (depositAmtInWei * POINTS_PER_WEI) / totalSupply
//
// - Each account has a `creditedPoints` and `lastPointsPerToken`
// - lastPointsPerToken:
// The value of totalPointsPerToken the last time `creditedPoints` was changed.
// - creditedPoints:
// How many points have been credited to the user. This is incremented by:
// (`totalPointsPerToken` - `lastPointsPerToken` * balance) via
// `.updateCreditedPoints(account)`. This occurs anytime the balance changes
// (transfer, mint, burn).
//
// - .collectOwedDividends() calls .updateCreditedPoints(account), converts points
// to wei and pays account, then resets creditedPoints[account] to 0.
//
// - "Credit" goes to Nick Johnson for the concept.
//
uint constant POINTS_PER_WEI = 1e32;
uint public dividendsTotal;
uint public dividendsCollected;
uint public totalPointsPerToken;
mapping (address => uint) public creditedPoints;
mapping (address => uint) public lastPointsPerToken;
// Events
event CollectedDividends(uint time, address indexed account, uint amount);
event DividendReceived(uint time, address indexed sender, uint amount);
constructor(uint256 _totalSupply, address _custom_owner)
public
ERC667("Noteshares Token", "NST")
Ownable(_custom_owner)
{
}
// Upon receiving payment, increment lastPointsPerToken.
function receivePayment()
internal
{
}
/*************************************************************/
/********** PUBLIC FUNCTIONS *********************************/
/*************************************************************/
// Normal ERC20 transfer, except before transferring
// it credits points for both the sender and receiver.
function transfer(address _to, uint _value)
public
returns (bool success)
{
}
// Normal ERC20 transferFrom, except before transferring
// it credits points for both the sender and receiver.
function transferFrom(address _from, address _to, uint256 _value)
public
returns (bool success)
{
}
// Normal ERC667 transferAndCall, except before transferring
// it credits points for both the sender and receiver.
function transferAndCall(address _to, uint _value, bytes _data)
public
returns (bool success)
{
}
// Updates creditedPoints, sends all wei to the owner
function collectOwedDividends()
internal
returns (uint _amount)
{
}
/*************************************************************/
/********** PRIVATE METHODS / VIEWS **************************/
/*************************************************************/
// Credits _account with whatever dividend points they haven't yet been credited.
// This needs to be called before any user's balance changes to ensure their
// "lastPointsPerToken" credits their current balance, and not an altered one.
function _updateCreditedPoints(address _account)
private
{
}
// For a given account, returns how many Wei they haven't yet been credited.
function _getUncreditedPoints(address _account)
private
view
returns (uint _amount)
{
}
/*************************************************************/
/********* CONSTANTS *****************************************/
/*************************************************************/
// Returns how many wei a call to .collectOwedDividends() would transfer.
function getOwedDividends(address _account)
public
constant
returns (uint _amount)
{
}
}
contract NSERC667 is DividendTokenERC667 {
using SafeMath for uint256;
uint256 private TOTAL_SUPPLY = 100 * (10 ** uint256(decimals)); //always a 100 tokens representing 100% of ownership
constructor (address ecosystemFeeAccount, uint256 ecosystemShare, address _custom_owner)
public
DividendTokenERC667(TOTAL_SUPPLY, _custom_owner)
{
}
}
contract NotesharesToken is NSERC667 {
using SafeMath for uint256;
uint8 public state; //0 - canceled, 1 - active, 2 - failed, 3 - complete
string private contentLink;
string private folderLink;
bool public hidden = false;
constructor (string _contentLink, string _folderLink, address _ecosystemFeeAccount, uint256 ecosystemShare, address _custom_owner)
public
NSERC667(_ecosystemFeeAccount, ecosystemShare, _custom_owner) {
}
//payables
/**
* Main donation function
*/
function () public payable {
}
function getContentLink () public view returns (string) {
}
function getFolderLink() public view returns (string) {
}
//Contract control
/**
* Transfers dividend in ETH if contract is complete or remaining funds to investors if contract is failed
*/
function setCancelled () public onlyOwner {
}
function setHidden (bool _hidden) public onlyOwner {
}
function claimDividend () public {
}
//destruction is possible if there is only one owner
function destruct () public onlyOwner {
}
//to claim ownership you should have 100% of tokens
function claimOwnership () public {
}
}
| allowance[_from][_spender]>=_value | 7,919 | allowance[_from][_spender]>=_value |
null | pragma solidity ^0.4.24;
/**
* @title SafeMath
* @dev Math operations with safety checks that revert on error
*/
library SafeMath {
/**
* @dev Multiplies two numbers, reverts on overflow.
*/
function mul(uint256 a, uint256 b) internal pure returns (uint256) {
}
/**
* @dev Integer division of two numbers truncating the quotient, reverts on division by zero.
*/
function div(uint256 a, uint256 b) internal pure returns (uint256) {
}
/**
* @dev Subtracts two numbers, reverts on overflow (i.e. if subtrahend is greater than minuend).
*/
function sub(uint256 a, uint256 b) internal pure returns (uint256) {
}
/**
* @dev Adds two numbers, reverts on overflow.
*/
function add(uint256 a, uint256 b) internal pure returns (uint256) {
}
/**
* @dev Divides two numbers and returns the remainder (unsigned integer modulo),
* reverts when dividing by zero.
*/
function mod(uint256 a, uint256 b) internal pure returns (uint256) {
}
}
/**
* @title Ownable
* @dev The Ownable contract has an owner address, and provides basic authorization control
* functions, this simplifies the implementation of "user permissions".
*/
contract Ownable {
address private _owner;
event OwnershipTransferred(
address indexed previousOwner,
address indexed newOwner
);
/**
* @dev The Ownable constructor sets the original `owner` of the contract to the sender
* account.
*/
constructor(address custom_owner) public {
}
/**
* @return the address of the owner.
*/
function owner() public view returns(address) {
}
/**
* @dev Throws if called by any account other than the owner.
*/
modifier onlyOwner() {
}
/**
* @return true if `msg.sender` is the owner of the contract.
*/
function isOwner() public view returns(bool) {
}
/**
* @dev Allows the current owner to relinquish control of the contract.
* @notice Renouncing to ownership will leave the contract without an owner.
* It will not be possible to call the functions with the `onlyOwner`
* modifier anymore.
*/
function renounceOwnership() public onlyOwner {
}
/**
* @dev Allows the current owner to transfer control of the contract to a newOwner.
* @param newOwner The address to transfer ownership to.
*/
function transferOwnership(address newOwner) public onlyOwner {
}
/**
* @dev Transfers control of the contract to a newOwner.
* @param newOwner The address to transfer ownership to.
*/
function _transferOwnership(address newOwner) internal {
}
}
/*
Based on https://etherscan.io/address/0x6dee36e9f915cab558437f97746998048dcaa700#code
by https://blog.pennyether.com/posts/realtime-dividend-token.html
*/
contract ERC20 {
using SafeMath for uint256;
string public name;
string public symbol;
uint8 public decimals = 18;
uint public totalSupply;
mapping (address => uint) public balanceOf;
mapping (address => mapping (address => uint)) public allowance;
event Created(uint time);
event Transfer(address indexed from, address indexed to, uint amount);
event Approval(address indexed owner, address indexed spender, uint amount);
event AllowanceUsed(address indexed owner, address indexed spender, uint amount);
constructor(string _name, string _symbol)
public
{
}
function transfer(address _to, uint _value)
public
returns (bool success)
{
}
function approve(address _spender, uint _value)
public
returns (bool success)
{
}
// Attempts to transfer `_value` from `_from` to `_to`
// if `_from` has sufficient allowance for `msg.sender`.
function transferFrom(address _from, address _to, uint256 _value)
public
returns (bool success)
{
}
// Transfers balance from `_from` to `_to` if `_to` has sufficient balance.
// Called from transfer() and transferFrom().
function _transfer(address _from, address _to, uint _value)
private
returns (bool success)
{
require(balanceOf[_from] >= _value);
require(<FILL_ME>)
balanceOf[_from] = balanceOf[_from].sub(_value);
balanceOf[_to] = balanceOf[_to].add(_value);
emit Transfer(_from, _to, _value);
return true;
}
}
interface HasTokenFallback {
function tokenFallback(address _from, uint256 _amount, bytes _data)
external
returns (bool success);
}
contract ERC667 is ERC20 {
constructor(string _name, string _symbol)
public
ERC20(_name, _symbol)
{}
function transferAndCall(address _to, uint _value, bytes _data)
public
returns (bool success)
{
}
}
/*********************************************************
******************* DIVIDEND TOKEN ***********************
**********************************************************
UI: https://www.pennyether.com/status/tokens
An ERC20 token that can accept Ether and distribute it
perfectly to all Token Holders relative to each account's
balance at the time the dividend is received.
The Token is owned by the creator, and can be frozen,
minted, and burned by the owner.
Notes:
- Accounts can view or receive dividends owed at any time
- Dividends received are immediately credited to all
current Token Holders and can be redeemed at any time.
- Per above, upon transfers, dividends are not
transferred. They are kept by the original sender, and
not credited to the receiver.
- Uses "pull" instead of "push". Token holders must pull
their own dividends.
*/
contract DividendTokenERC667 is ERC667, Ownable
{
using SafeMath for uint256;
// How dividends work:
//
// - A "point" is a fraction of a Wei (1e-32), it's used to reduce rounding errors.
//
// - totalPointsPerToken represents how many points each token is entitled to
// from all the dividends ever received. Each time a new deposit is made, it
// is incremented by the points oweable per token at the time of deposit:
// (depositAmtInWei * POINTS_PER_WEI) / totalSupply
//
// - Each account has a `creditedPoints` and `lastPointsPerToken`
// - lastPointsPerToken:
// The value of totalPointsPerToken the last time `creditedPoints` was changed.
// - creditedPoints:
// How many points have been credited to the user. This is incremented by:
// (`totalPointsPerToken` - `lastPointsPerToken` * balance) via
// `.updateCreditedPoints(account)`. This occurs anytime the balance changes
// (transfer, mint, burn).
//
// - .collectOwedDividends() calls .updateCreditedPoints(account), converts points
// to wei and pays account, then resets creditedPoints[account] to 0.
//
// - "Credit" goes to Nick Johnson for the concept.
//
uint constant POINTS_PER_WEI = 1e32;
uint public dividendsTotal;
uint public dividendsCollected;
uint public totalPointsPerToken;
mapping (address => uint) public creditedPoints;
mapping (address => uint) public lastPointsPerToken;
// Events
event CollectedDividends(uint time, address indexed account, uint amount);
event DividendReceived(uint time, address indexed sender, uint amount);
constructor(uint256 _totalSupply, address _custom_owner)
public
ERC667("Noteshares Token", "NST")
Ownable(_custom_owner)
{
}
// Upon receiving payment, increment lastPointsPerToken.
function receivePayment()
internal
{
}
/*************************************************************/
/********** PUBLIC FUNCTIONS *********************************/
/*************************************************************/
// Normal ERC20 transfer, except before transferring
// it credits points for both the sender and receiver.
function transfer(address _to, uint _value)
public
returns (bool success)
{
}
// Normal ERC20 transferFrom, except before transferring
// it credits points for both the sender and receiver.
function transferFrom(address _from, address _to, uint256 _value)
public
returns (bool success)
{
}
// Normal ERC667 transferAndCall, except before transferring
// it credits points for both the sender and receiver.
function transferAndCall(address _to, uint _value, bytes _data)
public
returns (bool success)
{
}
// Updates creditedPoints, sends all wei to the owner
function collectOwedDividends()
internal
returns (uint _amount)
{
}
/*************************************************************/
/********** PRIVATE METHODS / VIEWS **************************/
/*************************************************************/
// Credits _account with whatever dividend points they haven't yet been credited.
// This needs to be called before any user's balance changes to ensure their
// "lastPointsPerToken" credits their current balance, and not an altered one.
function _updateCreditedPoints(address _account)
private
{
}
// For a given account, returns how many Wei they haven't yet been credited.
function _getUncreditedPoints(address _account)
private
view
returns (uint _amount)
{
}
/*************************************************************/
/********* CONSTANTS *****************************************/
/*************************************************************/
// Returns how many wei a call to .collectOwedDividends() would transfer.
function getOwedDividends(address _account)
public
constant
returns (uint _amount)
{
}
}
contract NSERC667 is DividendTokenERC667 {
using SafeMath for uint256;
uint256 private TOTAL_SUPPLY = 100 * (10 ** uint256(decimals)); //always a 100 tokens representing 100% of ownership
constructor (address ecosystemFeeAccount, uint256 ecosystemShare, address _custom_owner)
public
DividendTokenERC667(TOTAL_SUPPLY, _custom_owner)
{
}
}
contract NotesharesToken is NSERC667 {
using SafeMath for uint256;
uint8 public state; //0 - canceled, 1 - active, 2 - failed, 3 - complete
string private contentLink;
string private folderLink;
bool public hidden = false;
constructor (string _contentLink, string _folderLink, address _ecosystemFeeAccount, uint256 ecosystemShare, address _custom_owner)
public
NSERC667(_ecosystemFeeAccount, ecosystemShare, _custom_owner) {
}
//payables
/**
* Main donation function
*/
function () public payable {
}
function getContentLink () public view returns (string) {
}
function getFolderLink() public view returns (string) {
}
//Contract control
/**
* Transfers dividend in ETH if contract is complete or remaining funds to investors if contract is failed
*/
function setCancelled () public onlyOwner {
}
function setHidden (bool _hidden) public onlyOwner {
}
function claimDividend () public {
}
//destruction is possible if there is only one owner
function destruct () public onlyOwner {
}
//to claim ownership you should have 100% of tokens
function claimOwnership () public {
}
}
| balanceOf[_to].add(_value)>balanceOf[_to] | 7,919 | balanceOf[_to].add(_value)>balanceOf[_to] |
null | pragma solidity ^0.4.24;
/**
* @title SafeMath
* @dev Math operations with safety checks that revert on error
*/
library SafeMath {
/**
* @dev Multiplies two numbers, reverts on overflow.
*/
function mul(uint256 a, uint256 b) internal pure returns (uint256) {
}
/**
* @dev Integer division of two numbers truncating the quotient, reverts on division by zero.
*/
function div(uint256 a, uint256 b) internal pure returns (uint256) {
}
/**
* @dev Subtracts two numbers, reverts on overflow (i.e. if subtrahend is greater than minuend).
*/
function sub(uint256 a, uint256 b) internal pure returns (uint256) {
}
/**
* @dev Adds two numbers, reverts on overflow.
*/
function add(uint256 a, uint256 b) internal pure returns (uint256) {
}
/**
* @dev Divides two numbers and returns the remainder (unsigned integer modulo),
* reverts when dividing by zero.
*/
function mod(uint256 a, uint256 b) internal pure returns (uint256) {
}
}
/**
* @title Ownable
* @dev The Ownable contract has an owner address, and provides basic authorization control
* functions, this simplifies the implementation of "user permissions".
*/
contract Ownable {
address private _owner;
event OwnershipTransferred(
address indexed previousOwner,
address indexed newOwner
);
/**
* @dev The Ownable constructor sets the original `owner` of the contract to the sender
* account.
*/
constructor(address custom_owner) public {
}
/**
* @return the address of the owner.
*/
function owner() public view returns(address) {
}
/**
* @dev Throws if called by any account other than the owner.
*/
modifier onlyOwner() {
}
/**
* @return true if `msg.sender` is the owner of the contract.
*/
function isOwner() public view returns(bool) {
}
/**
* @dev Allows the current owner to relinquish control of the contract.
* @notice Renouncing to ownership will leave the contract without an owner.
* It will not be possible to call the functions with the `onlyOwner`
* modifier anymore.
*/
function renounceOwnership() public onlyOwner {
}
/**
* @dev Allows the current owner to transfer control of the contract to a newOwner.
* @param newOwner The address to transfer ownership to.
*/
function transferOwnership(address newOwner) public onlyOwner {
}
/**
* @dev Transfers control of the contract to a newOwner.
* @param newOwner The address to transfer ownership to.
*/
function _transferOwnership(address newOwner) internal {
}
}
/*
Based on https://etherscan.io/address/0x6dee36e9f915cab558437f97746998048dcaa700#code
by https://blog.pennyether.com/posts/realtime-dividend-token.html
*/
contract ERC20 {
using SafeMath for uint256;
string public name;
string public symbol;
uint8 public decimals = 18;
uint public totalSupply;
mapping (address => uint) public balanceOf;
mapping (address => mapping (address => uint)) public allowance;
event Created(uint time);
event Transfer(address indexed from, address indexed to, uint amount);
event Approval(address indexed owner, address indexed spender, uint amount);
event AllowanceUsed(address indexed owner, address indexed spender, uint amount);
constructor(string _name, string _symbol)
public
{
}
function transfer(address _to, uint _value)
public
returns (bool success)
{
}
function approve(address _spender, uint _value)
public
returns (bool success)
{
}
// Attempts to transfer `_value` from `_from` to `_to`
// if `_from` has sufficient allowance for `msg.sender`.
function transferFrom(address _from, address _to, uint256 _value)
public
returns (bool success)
{
}
// Transfers balance from `_from` to `_to` if `_to` has sufficient balance.
// Called from transfer() and transferFrom().
function _transfer(address _from, address _to, uint _value)
private
returns (bool success)
{
}
}
interface HasTokenFallback {
function tokenFallback(address _from, uint256 _amount, bytes _data)
external
returns (bool success);
}
contract ERC667 is ERC20 {
constructor(string _name, string _symbol)
public
ERC20(_name, _symbol)
{}
function transferAndCall(address _to, uint _value, bytes _data)
public
returns (bool success)
{
require(super.transfer(_to, _value));
require(<FILL_ME>)
return true;
}
}
/*********************************************************
******************* DIVIDEND TOKEN ***********************
**********************************************************
UI: https://www.pennyether.com/status/tokens
An ERC20 token that can accept Ether and distribute it
perfectly to all Token Holders relative to each account's
balance at the time the dividend is received.
The Token is owned by the creator, and can be frozen,
minted, and burned by the owner.
Notes:
- Accounts can view or receive dividends owed at any time
- Dividends received are immediately credited to all
current Token Holders and can be redeemed at any time.
- Per above, upon transfers, dividends are not
transferred. They are kept by the original sender, and
not credited to the receiver.
- Uses "pull" instead of "push". Token holders must pull
their own dividends.
*/
contract DividendTokenERC667 is ERC667, Ownable
{
using SafeMath for uint256;
// How dividends work:
//
// - A "point" is a fraction of a Wei (1e-32), it's used to reduce rounding errors.
//
// - totalPointsPerToken represents how many points each token is entitled to
// from all the dividends ever received. Each time a new deposit is made, it
// is incremented by the points oweable per token at the time of deposit:
// (depositAmtInWei * POINTS_PER_WEI) / totalSupply
//
// - Each account has a `creditedPoints` and `lastPointsPerToken`
// - lastPointsPerToken:
// The value of totalPointsPerToken the last time `creditedPoints` was changed.
// - creditedPoints:
// How many points have been credited to the user. This is incremented by:
// (`totalPointsPerToken` - `lastPointsPerToken` * balance) via
// `.updateCreditedPoints(account)`. This occurs anytime the balance changes
// (transfer, mint, burn).
//
// - .collectOwedDividends() calls .updateCreditedPoints(account), converts points
// to wei and pays account, then resets creditedPoints[account] to 0.
//
// - "Credit" goes to Nick Johnson for the concept.
//
uint constant POINTS_PER_WEI = 1e32;
uint public dividendsTotal;
uint public dividendsCollected;
uint public totalPointsPerToken;
mapping (address => uint) public creditedPoints;
mapping (address => uint) public lastPointsPerToken;
// Events
event CollectedDividends(uint time, address indexed account, uint amount);
event DividendReceived(uint time, address indexed sender, uint amount);
constructor(uint256 _totalSupply, address _custom_owner)
public
ERC667("Noteshares Token", "NST")
Ownable(_custom_owner)
{
}
// Upon receiving payment, increment lastPointsPerToken.
function receivePayment()
internal
{
}
/*************************************************************/
/********** PUBLIC FUNCTIONS *********************************/
/*************************************************************/
// Normal ERC20 transfer, except before transferring
// it credits points for both the sender and receiver.
function transfer(address _to, uint _value)
public
returns (bool success)
{
}
// Normal ERC20 transferFrom, except before transferring
// it credits points for both the sender and receiver.
function transferFrom(address _from, address _to, uint256 _value)
public
returns (bool success)
{
}
// Normal ERC667 transferAndCall, except before transferring
// it credits points for both the sender and receiver.
function transferAndCall(address _to, uint _value, bytes _data)
public
returns (bool success)
{
}
// Updates creditedPoints, sends all wei to the owner
function collectOwedDividends()
internal
returns (uint _amount)
{
}
/*************************************************************/
/********** PRIVATE METHODS / VIEWS **************************/
/*************************************************************/
// Credits _account with whatever dividend points they haven't yet been credited.
// This needs to be called before any user's balance changes to ensure their
// "lastPointsPerToken" credits their current balance, and not an altered one.
function _updateCreditedPoints(address _account)
private
{
}
// For a given account, returns how many Wei they haven't yet been credited.
function _getUncreditedPoints(address _account)
private
view
returns (uint _amount)
{
}
/*************************************************************/
/********* CONSTANTS *****************************************/
/*************************************************************/
// Returns how many wei a call to .collectOwedDividends() would transfer.
function getOwedDividends(address _account)
public
constant
returns (uint _amount)
{
}
}
contract NSERC667 is DividendTokenERC667 {
using SafeMath for uint256;
uint256 private TOTAL_SUPPLY = 100 * (10 ** uint256(decimals)); //always a 100 tokens representing 100% of ownership
constructor (address ecosystemFeeAccount, uint256 ecosystemShare, address _custom_owner)
public
DividendTokenERC667(TOTAL_SUPPLY, _custom_owner)
{
}
}
contract NotesharesToken is NSERC667 {
using SafeMath for uint256;
uint8 public state; //0 - canceled, 1 - active, 2 - failed, 3 - complete
string private contentLink;
string private folderLink;
bool public hidden = false;
constructor (string _contentLink, string _folderLink, address _ecosystemFeeAccount, uint256 ecosystemShare, address _custom_owner)
public
NSERC667(_ecosystemFeeAccount, ecosystemShare, _custom_owner) {
}
//payables
/**
* Main donation function
*/
function () public payable {
}
function getContentLink () public view returns (string) {
}
function getFolderLink() public view returns (string) {
}
//Contract control
/**
* Transfers dividend in ETH if contract is complete or remaining funds to investors if contract is failed
*/
function setCancelled () public onlyOwner {
}
function setHidden (bool _hidden) public onlyOwner {
}
function claimDividend () public {
}
//destruction is possible if there is only one owner
function destruct () public onlyOwner {
}
//to claim ownership you should have 100% of tokens
function claimOwnership () public {
}
}
| HasTokenFallback(_to).tokenFallback(msg.sender,_value,_data) | 7,919 | HasTokenFallback(_to).tokenFallback(msg.sender,_value,_data) |
null | pragma solidity ^0.4.24;
/**
* @title SafeMath
* @dev Math operations with safety checks that revert on error
*/
library SafeMath {
/**
* @dev Multiplies two numbers, reverts on overflow.
*/
function mul(uint256 a, uint256 b) internal pure returns (uint256) {
}
/**
* @dev Integer division of two numbers truncating the quotient, reverts on division by zero.
*/
function div(uint256 a, uint256 b) internal pure returns (uint256) {
}
/**
* @dev Subtracts two numbers, reverts on overflow (i.e. if subtrahend is greater than minuend).
*/
function sub(uint256 a, uint256 b) internal pure returns (uint256) {
}
/**
* @dev Adds two numbers, reverts on overflow.
*/
function add(uint256 a, uint256 b) internal pure returns (uint256) {
}
/**
* @dev Divides two numbers and returns the remainder (unsigned integer modulo),
* reverts when dividing by zero.
*/
function mod(uint256 a, uint256 b) internal pure returns (uint256) {
}
}
/**
* @title Ownable
* @dev The Ownable contract has an owner address, and provides basic authorization control
* functions, this simplifies the implementation of "user permissions".
*/
contract Ownable {
address private _owner;
event OwnershipTransferred(
address indexed previousOwner,
address indexed newOwner
);
/**
* @dev The Ownable constructor sets the original `owner` of the contract to the sender
* account.
*/
constructor(address custom_owner) public {
}
/**
* @return the address of the owner.
*/
function owner() public view returns(address) {
}
/**
* @dev Throws if called by any account other than the owner.
*/
modifier onlyOwner() {
}
/**
* @return true if `msg.sender` is the owner of the contract.
*/
function isOwner() public view returns(bool) {
}
/**
* @dev Allows the current owner to relinquish control of the contract.
* @notice Renouncing to ownership will leave the contract without an owner.
* It will not be possible to call the functions with the `onlyOwner`
* modifier anymore.
*/
function renounceOwnership() public onlyOwner {
}
/**
* @dev Allows the current owner to transfer control of the contract to a newOwner.
* @param newOwner The address to transfer ownership to.
*/
function transferOwnership(address newOwner) public onlyOwner {
}
/**
* @dev Transfers control of the contract to a newOwner.
* @param newOwner The address to transfer ownership to.
*/
function _transferOwnership(address newOwner) internal {
}
}
/*
Based on https://etherscan.io/address/0x6dee36e9f915cab558437f97746998048dcaa700#code
by https://blog.pennyether.com/posts/realtime-dividend-token.html
*/
contract ERC20 {
using SafeMath for uint256;
string public name;
string public symbol;
uint8 public decimals = 18;
uint public totalSupply;
mapping (address => uint) public balanceOf;
mapping (address => mapping (address => uint)) public allowance;
event Created(uint time);
event Transfer(address indexed from, address indexed to, uint amount);
event Approval(address indexed owner, address indexed spender, uint amount);
event AllowanceUsed(address indexed owner, address indexed spender, uint amount);
constructor(string _name, string _symbol)
public
{
}
function transfer(address _to, uint _value)
public
returns (bool success)
{
}
function approve(address _spender, uint _value)
public
returns (bool success)
{
}
// Attempts to transfer `_value` from `_from` to `_to`
// if `_from` has sufficient allowance for `msg.sender`.
function transferFrom(address _from, address _to, uint256 _value)
public
returns (bool success)
{
}
// Transfers balance from `_from` to `_to` if `_to` has sufficient balance.
// Called from transfer() and transferFrom().
function _transfer(address _from, address _to, uint _value)
private
returns (bool success)
{
}
}
interface HasTokenFallback {
function tokenFallback(address _from, uint256 _amount, bytes _data)
external
returns (bool success);
}
contract ERC667 is ERC20 {
constructor(string _name, string _symbol)
public
ERC20(_name, _symbol)
{}
function transferAndCall(address _to, uint _value, bytes _data)
public
returns (bool success)
{
}
}
/*********************************************************
******************* DIVIDEND TOKEN ***********************
**********************************************************
UI: https://www.pennyether.com/status/tokens
An ERC20 token that can accept Ether and distribute it
perfectly to all Token Holders relative to each account's
balance at the time the dividend is received.
The Token is owned by the creator, and can be frozen,
minted, and burned by the owner.
Notes:
- Accounts can view or receive dividends owed at any time
- Dividends received are immediately credited to all
current Token Holders and can be redeemed at any time.
- Per above, upon transfers, dividends are not
transferred. They are kept by the original sender, and
not credited to the receiver.
- Uses "pull" instead of "push". Token holders must pull
their own dividends.
*/
contract DividendTokenERC667 is ERC667, Ownable
{
using SafeMath for uint256;
// How dividends work:
//
// - A "point" is a fraction of a Wei (1e-32), it's used to reduce rounding errors.
//
// - totalPointsPerToken represents how many points each token is entitled to
// from all the dividends ever received. Each time a new deposit is made, it
// is incremented by the points oweable per token at the time of deposit:
// (depositAmtInWei * POINTS_PER_WEI) / totalSupply
//
// - Each account has a `creditedPoints` and `lastPointsPerToken`
// - lastPointsPerToken:
// The value of totalPointsPerToken the last time `creditedPoints` was changed.
// - creditedPoints:
// How many points have been credited to the user. This is incremented by:
// (`totalPointsPerToken` - `lastPointsPerToken` * balance) via
// `.updateCreditedPoints(account)`. This occurs anytime the balance changes
// (transfer, mint, burn).
//
// - .collectOwedDividends() calls .updateCreditedPoints(account), converts points
// to wei and pays account, then resets creditedPoints[account] to 0.
//
// - "Credit" goes to Nick Johnson for the concept.
//
uint constant POINTS_PER_WEI = 1e32;
uint public dividendsTotal;
uint public dividendsCollected;
uint public totalPointsPerToken;
mapping (address => uint) public creditedPoints;
mapping (address => uint) public lastPointsPerToken;
// Events
event CollectedDividends(uint time, address indexed account, uint amount);
event DividendReceived(uint time, address indexed sender, uint amount);
constructor(uint256 _totalSupply, address _custom_owner)
public
ERC667("Noteshares Token", "NST")
Ownable(_custom_owner)
{
}
// Upon receiving payment, increment lastPointsPerToken.
function receivePayment()
internal
{
}
/*************************************************************/
/********** PUBLIC FUNCTIONS *********************************/
/*************************************************************/
// Normal ERC20 transfer, except before transferring
// it credits points for both the sender and receiver.
function transfer(address _to, uint _value)
public
returns (bool success)
{
}
// Normal ERC20 transferFrom, except before transferring
// it credits points for both the sender and receiver.
function transferFrom(address _from, address _to, uint256 _value)
public
returns (bool success)
{
}
// Normal ERC667 transferAndCall, except before transferring
// it credits points for both the sender and receiver.
function transferAndCall(address _to, uint _value, bytes _data)
public
returns (bool success)
{
}
// Updates creditedPoints, sends all wei to the owner
function collectOwedDividends()
internal
returns (uint _amount)
{
// update creditedPoints, store amount, and zero it.
_updateCreditedPoints(msg.sender);
_amount = creditedPoints[msg.sender].div(POINTS_PER_WEI);
creditedPoints[msg.sender] = 0;
dividendsCollected = dividendsCollected.add(_amount);
emit CollectedDividends(now, msg.sender, _amount);
require(<FILL_ME>)
}
/*************************************************************/
/********** PRIVATE METHODS / VIEWS **************************/
/*************************************************************/
// Credits _account with whatever dividend points they haven't yet been credited.
// This needs to be called before any user's balance changes to ensure their
// "lastPointsPerToken" credits their current balance, and not an altered one.
function _updateCreditedPoints(address _account)
private
{
}
// For a given account, returns how many Wei they haven't yet been credited.
function _getUncreditedPoints(address _account)
private
view
returns (uint _amount)
{
}
/*************************************************************/
/********* CONSTANTS *****************************************/
/*************************************************************/
// Returns how many wei a call to .collectOwedDividends() would transfer.
function getOwedDividends(address _account)
public
constant
returns (uint _amount)
{
}
}
contract NSERC667 is DividendTokenERC667 {
using SafeMath for uint256;
uint256 private TOTAL_SUPPLY = 100 * (10 ** uint256(decimals)); //always a 100 tokens representing 100% of ownership
constructor (address ecosystemFeeAccount, uint256 ecosystemShare, address _custom_owner)
public
DividendTokenERC667(TOTAL_SUPPLY, _custom_owner)
{
}
}
contract NotesharesToken is NSERC667 {
using SafeMath for uint256;
uint8 public state; //0 - canceled, 1 - active, 2 - failed, 3 - complete
string private contentLink;
string private folderLink;
bool public hidden = false;
constructor (string _contentLink, string _folderLink, address _ecosystemFeeAccount, uint256 ecosystemShare, address _custom_owner)
public
NSERC667(_ecosystemFeeAccount, ecosystemShare, _custom_owner) {
}
//payables
/**
* Main donation function
*/
function () public payable {
}
function getContentLink () public view returns (string) {
}
function getFolderLink() public view returns (string) {
}
//Contract control
/**
* Transfers dividend in ETH if contract is complete or remaining funds to investors if contract is failed
*/
function setCancelled () public onlyOwner {
}
function setHidden (bool _hidden) public onlyOwner {
}
function claimDividend () public {
}
//destruction is possible if there is only one owner
function destruct () public onlyOwner {
}
//to claim ownership you should have 100% of tokens
function claimOwnership () public {
}
}
| msg.sender.call.value(_amount)() | 7,919 | msg.sender.call.value(_amount)() |
null | pragma solidity ^0.4.24;
/**
* @title SafeMath
* @dev Math operations with safety checks that revert on error
*/
library SafeMath {
/**
* @dev Multiplies two numbers, reverts on overflow.
*/
function mul(uint256 a, uint256 b) internal pure returns (uint256) {
}
/**
* @dev Integer division of two numbers truncating the quotient, reverts on division by zero.
*/
function div(uint256 a, uint256 b) internal pure returns (uint256) {
}
/**
* @dev Subtracts two numbers, reverts on overflow (i.e. if subtrahend is greater than minuend).
*/
function sub(uint256 a, uint256 b) internal pure returns (uint256) {
}
/**
* @dev Adds two numbers, reverts on overflow.
*/
function add(uint256 a, uint256 b) internal pure returns (uint256) {
}
/**
* @dev Divides two numbers and returns the remainder (unsigned integer modulo),
* reverts when dividing by zero.
*/
function mod(uint256 a, uint256 b) internal pure returns (uint256) {
}
}
/**
* @title Ownable
* @dev The Ownable contract has an owner address, and provides basic authorization control
* functions, this simplifies the implementation of "user permissions".
*/
contract Ownable {
address private _owner;
event OwnershipTransferred(
address indexed previousOwner,
address indexed newOwner
);
/**
* @dev The Ownable constructor sets the original `owner` of the contract to the sender
* account.
*/
constructor(address custom_owner) public {
}
/**
* @return the address of the owner.
*/
function owner() public view returns(address) {
}
/**
* @dev Throws if called by any account other than the owner.
*/
modifier onlyOwner() {
}
/**
* @return true if `msg.sender` is the owner of the contract.
*/
function isOwner() public view returns(bool) {
}
/**
* @dev Allows the current owner to relinquish control of the contract.
* @notice Renouncing to ownership will leave the contract without an owner.
* It will not be possible to call the functions with the `onlyOwner`
* modifier anymore.
*/
function renounceOwnership() public onlyOwner {
}
/**
* @dev Allows the current owner to transfer control of the contract to a newOwner.
* @param newOwner The address to transfer ownership to.
*/
function transferOwnership(address newOwner) public onlyOwner {
}
/**
* @dev Transfers control of the contract to a newOwner.
* @param newOwner The address to transfer ownership to.
*/
function _transferOwnership(address newOwner) internal {
}
}
/*
Based on https://etherscan.io/address/0x6dee36e9f915cab558437f97746998048dcaa700#code
by https://blog.pennyether.com/posts/realtime-dividend-token.html
*/
contract ERC20 {
using SafeMath for uint256;
string public name;
string public symbol;
uint8 public decimals = 18;
uint public totalSupply;
mapping (address => uint) public balanceOf;
mapping (address => mapping (address => uint)) public allowance;
event Created(uint time);
event Transfer(address indexed from, address indexed to, uint amount);
event Approval(address indexed owner, address indexed spender, uint amount);
event AllowanceUsed(address indexed owner, address indexed spender, uint amount);
constructor(string _name, string _symbol)
public
{
}
function transfer(address _to, uint _value)
public
returns (bool success)
{
}
function approve(address _spender, uint _value)
public
returns (bool success)
{
}
// Attempts to transfer `_value` from `_from` to `_to`
// if `_from` has sufficient allowance for `msg.sender`.
function transferFrom(address _from, address _to, uint256 _value)
public
returns (bool success)
{
}
// Transfers balance from `_from` to `_to` if `_to` has sufficient balance.
// Called from transfer() and transferFrom().
function _transfer(address _from, address _to, uint _value)
private
returns (bool success)
{
}
}
interface HasTokenFallback {
function tokenFallback(address _from, uint256 _amount, bytes _data)
external
returns (bool success);
}
contract ERC667 is ERC20 {
constructor(string _name, string _symbol)
public
ERC20(_name, _symbol)
{}
function transferAndCall(address _to, uint _value, bytes _data)
public
returns (bool success)
{
}
}
/*********************************************************
******************* DIVIDEND TOKEN ***********************
**********************************************************
UI: https://www.pennyether.com/status/tokens
An ERC20 token that can accept Ether and distribute it
perfectly to all Token Holders relative to each account's
balance at the time the dividend is received.
The Token is owned by the creator, and can be frozen,
minted, and burned by the owner.
Notes:
- Accounts can view or receive dividends owed at any time
- Dividends received are immediately credited to all
current Token Holders and can be redeemed at any time.
- Per above, upon transfers, dividends are not
transferred. They are kept by the original sender, and
not credited to the receiver.
- Uses "pull" instead of "push". Token holders must pull
their own dividends.
*/
contract DividendTokenERC667 is ERC667, Ownable
{
using SafeMath for uint256;
// How dividends work:
//
// - A "point" is a fraction of a Wei (1e-32), it's used to reduce rounding errors.
//
// - totalPointsPerToken represents how many points each token is entitled to
// from all the dividends ever received. Each time a new deposit is made, it
// is incremented by the points oweable per token at the time of deposit:
// (depositAmtInWei * POINTS_PER_WEI) / totalSupply
//
// - Each account has a `creditedPoints` and `lastPointsPerToken`
// - lastPointsPerToken:
// The value of totalPointsPerToken the last time `creditedPoints` was changed.
// - creditedPoints:
// How many points have been credited to the user. This is incremented by:
// (`totalPointsPerToken` - `lastPointsPerToken` * balance) via
// `.updateCreditedPoints(account)`. This occurs anytime the balance changes
// (transfer, mint, burn).
//
// - .collectOwedDividends() calls .updateCreditedPoints(account), converts points
// to wei and pays account, then resets creditedPoints[account] to 0.
//
// - "Credit" goes to Nick Johnson for the concept.
//
uint constant POINTS_PER_WEI = 1e32;
uint public dividendsTotal;
uint public dividendsCollected;
uint public totalPointsPerToken;
mapping (address => uint) public creditedPoints;
mapping (address => uint) public lastPointsPerToken;
// Events
event CollectedDividends(uint time, address indexed account, uint amount);
event DividendReceived(uint time, address indexed sender, uint amount);
constructor(uint256 _totalSupply, address _custom_owner)
public
ERC667("Noteshares Token", "NST")
Ownable(_custom_owner)
{
}
// Upon receiving payment, increment lastPointsPerToken.
function receivePayment()
internal
{
}
/*************************************************************/
/********** PUBLIC FUNCTIONS *********************************/
/*************************************************************/
// Normal ERC20 transfer, except before transferring
// it credits points for both the sender and receiver.
function transfer(address _to, uint _value)
public
returns (bool success)
{
}
// Normal ERC20 transferFrom, except before transferring
// it credits points for both the sender and receiver.
function transferFrom(address _from, address _to, uint256 _value)
public
returns (bool success)
{
}
// Normal ERC667 transferAndCall, except before transferring
// it credits points for both the sender and receiver.
function transferAndCall(address _to, uint _value, bytes _data)
public
returns (bool success)
{
}
// Updates creditedPoints, sends all wei to the owner
function collectOwedDividends()
internal
returns (uint _amount)
{
}
/*************************************************************/
/********** PRIVATE METHODS / VIEWS **************************/
/*************************************************************/
// Credits _account with whatever dividend points they haven't yet been credited.
// This needs to be called before any user's balance changes to ensure their
// "lastPointsPerToken" credits their current balance, and not an altered one.
function _updateCreditedPoints(address _account)
private
{
}
// For a given account, returns how many Wei they haven't yet been credited.
function _getUncreditedPoints(address _account)
private
view
returns (uint _amount)
{
}
/*************************************************************/
/********* CONSTANTS *****************************************/
/*************************************************************/
// Returns how many wei a call to .collectOwedDividends() would transfer.
function getOwedDividends(address _account)
public
constant
returns (uint _amount)
{
}
}
contract NSERC667 is DividendTokenERC667 {
using SafeMath for uint256;
uint256 private TOTAL_SUPPLY = 100 * (10 ** uint256(decimals)); //always a 100 tokens representing 100% of ownership
constructor (address ecosystemFeeAccount, uint256 ecosystemShare, address _custom_owner)
public
DividendTokenERC667(TOTAL_SUPPLY, _custom_owner)
{
}
}
contract NotesharesToken is NSERC667 {
using SafeMath for uint256;
uint8 public state; //0 - canceled, 1 - active, 2 - failed, 3 - complete
string private contentLink;
string private folderLink;
bool public hidden = false;
constructor (string _contentLink, string _folderLink, address _ecosystemFeeAccount, uint256 ecosystemShare, address _custom_owner)
public
NSERC667(_ecosystemFeeAccount, ecosystemShare, _custom_owner) {
}
//payables
/**
* Main donation function
*/
function () public payable {
}
function getContentLink () public view returns (string) {
}
function getFolderLink() public view returns (string) {
}
//Contract control
/**
* Transfers dividend in ETH if contract is complete or remaining funds to investors if contract is failed
*/
function setCancelled () public onlyOwner {
}
function setHidden (bool _hidden) public onlyOwner {
}
function claimDividend () public {
}
//destruction is possible if there is only one owner
function destruct () public onlyOwner {
require(state == 2 || state == 3);
require(<FILL_ME>)
selfdestruct(owner());
}
//to claim ownership you should have 100% of tokens
function claimOwnership () public {
}
}
| balanceOf[owner()]==totalSupply | 7,919 | balanceOf[owner()]==totalSupply |
null | pragma solidity ^0.4.24;
/**
* @title SafeMath
* @dev Math operations with safety checks that revert on error
*/
library SafeMath {
/**
* @dev Multiplies two numbers, reverts on overflow.
*/
function mul(uint256 a, uint256 b) internal pure returns (uint256) {
}
/**
* @dev Integer division of two numbers truncating the quotient, reverts on division by zero.
*/
function div(uint256 a, uint256 b) internal pure returns (uint256) {
}
/**
* @dev Subtracts two numbers, reverts on overflow (i.e. if subtrahend is greater than minuend).
*/
function sub(uint256 a, uint256 b) internal pure returns (uint256) {
}
/**
* @dev Adds two numbers, reverts on overflow.
*/
function add(uint256 a, uint256 b) internal pure returns (uint256) {
}
/**
* @dev Divides two numbers and returns the remainder (unsigned integer modulo),
* reverts when dividing by zero.
*/
function mod(uint256 a, uint256 b) internal pure returns (uint256) {
}
}
/**
* @title Ownable
* @dev The Ownable contract has an owner address, and provides basic authorization control
* functions, this simplifies the implementation of "user permissions".
*/
contract Ownable {
address private _owner;
event OwnershipTransferred(
address indexed previousOwner,
address indexed newOwner
);
/**
* @dev The Ownable constructor sets the original `owner` of the contract to the sender
* account.
*/
constructor(address custom_owner) public {
}
/**
* @return the address of the owner.
*/
function owner() public view returns(address) {
}
/**
* @dev Throws if called by any account other than the owner.
*/
modifier onlyOwner() {
}
/**
* @return true if `msg.sender` is the owner of the contract.
*/
function isOwner() public view returns(bool) {
}
/**
* @dev Allows the current owner to relinquish control of the contract.
* @notice Renouncing to ownership will leave the contract without an owner.
* It will not be possible to call the functions with the `onlyOwner`
* modifier anymore.
*/
function renounceOwnership() public onlyOwner {
}
/**
* @dev Allows the current owner to transfer control of the contract to a newOwner.
* @param newOwner The address to transfer ownership to.
*/
function transferOwnership(address newOwner) public onlyOwner {
}
/**
* @dev Transfers control of the contract to a newOwner.
* @param newOwner The address to transfer ownership to.
*/
function _transferOwnership(address newOwner) internal {
}
}
/*
Based on https://etherscan.io/address/0x6dee36e9f915cab558437f97746998048dcaa700#code
by https://blog.pennyether.com/posts/realtime-dividend-token.html
*/
contract ERC20 {
using SafeMath for uint256;
string public name;
string public symbol;
uint8 public decimals = 18;
uint public totalSupply;
mapping (address => uint) public balanceOf;
mapping (address => mapping (address => uint)) public allowance;
event Created(uint time);
event Transfer(address indexed from, address indexed to, uint amount);
event Approval(address indexed owner, address indexed spender, uint amount);
event AllowanceUsed(address indexed owner, address indexed spender, uint amount);
constructor(string _name, string _symbol)
public
{
}
function transfer(address _to, uint _value)
public
returns (bool success)
{
}
function approve(address _spender, uint _value)
public
returns (bool success)
{
}
// Attempts to transfer `_value` from `_from` to `_to`
// if `_from` has sufficient allowance for `msg.sender`.
function transferFrom(address _from, address _to, uint256 _value)
public
returns (bool success)
{
}
// Transfers balance from `_from` to `_to` if `_to` has sufficient balance.
// Called from transfer() and transferFrom().
function _transfer(address _from, address _to, uint _value)
private
returns (bool success)
{
}
}
interface HasTokenFallback {
function tokenFallback(address _from, uint256 _amount, bytes _data)
external
returns (bool success);
}
contract ERC667 is ERC20 {
constructor(string _name, string _symbol)
public
ERC20(_name, _symbol)
{}
function transferAndCall(address _to, uint _value, bytes _data)
public
returns (bool success)
{
}
}
/*********************************************************
******************* DIVIDEND TOKEN ***********************
**********************************************************
UI: https://www.pennyether.com/status/tokens
An ERC20 token that can accept Ether and distribute it
perfectly to all Token Holders relative to each account's
balance at the time the dividend is received.
The Token is owned by the creator, and can be frozen,
minted, and burned by the owner.
Notes:
- Accounts can view or receive dividends owed at any time
- Dividends received are immediately credited to all
current Token Holders and can be redeemed at any time.
- Per above, upon transfers, dividends are not
transferred. They are kept by the original sender, and
not credited to the receiver.
- Uses "pull" instead of "push". Token holders must pull
their own dividends.
*/
contract DividendTokenERC667 is ERC667, Ownable
{
using SafeMath for uint256;
// How dividends work:
//
// - A "point" is a fraction of a Wei (1e-32), it's used to reduce rounding errors.
//
// - totalPointsPerToken represents how many points each token is entitled to
// from all the dividends ever received. Each time a new deposit is made, it
// is incremented by the points oweable per token at the time of deposit:
// (depositAmtInWei * POINTS_PER_WEI) / totalSupply
//
// - Each account has a `creditedPoints` and `lastPointsPerToken`
// - lastPointsPerToken:
// The value of totalPointsPerToken the last time `creditedPoints` was changed.
// - creditedPoints:
// How many points have been credited to the user. This is incremented by:
// (`totalPointsPerToken` - `lastPointsPerToken` * balance) via
// `.updateCreditedPoints(account)`. This occurs anytime the balance changes
// (transfer, mint, burn).
//
// - .collectOwedDividends() calls .updateCreditedPoints(account), converts points
// to wei and pays account, then resets creditedPoints[account] to 0.
//
// - "Credit" goes to Nick Johnson for the concept.
//
uint constant POINTS_PER_WEI = 1e32;
uint public dividendsTotal;
uint public dividendsCollected;
uint public totalPointsPerToken;
mapping (address => uint) public creditedPoints;
mapping (address => uint) public lastPointsPerToken;
// Events
event CollectedDividends(uint time, address indexed account, uint amount);
event DividendReceived(uint time, address indexed sender, uint amount);
constructor(uint256 _totalSupply, address _custom_owner)
public
ERC667("Noteshares Token", "NST")
Ownable(_custom_owner)
{
}
// Upon receiving payment, increment lastPointsPerToken.
function receivePayment()
internal
{
}
/*************************************************************/
/********** PUBLIC FUNCTIONS *********************************/
/*************************************************************/
// Normal ERC20 transfer, except before transferring
// it credits points for both the sender and receiver.
function transfer(address _to, uint _value)
public
returns (bool success)
{
}
// Normal ERC20 transferFrom, except before transferring
// it credits points for both the sender and receiver.
function transferFrom(address _from, address _to, uint256 _value)
public
returns (bool success)
{
}
// Normal ERC667 transferAndCall, except before transferring
// it credits points for both the sender and receiver.
function transferAndCall(address _to, uint _value, bytes _data)
public
returns (bool success)
{
}
// Updates creditedPoints, sends all wei to the owner
function collectOwedDividends()
internal
returns (uint _amount)
{
}
/*************************************************************/
/********** PRIVATE METHODS / VIEWS **************************/
/*************************************************************/
// Credits _account with whatever dividend points they haven't yet been credited.
// This needs to be called before any user's balance changes to ensure their
// "lastPointsPerToken" credits their current balance, and not an altered one.
function _updateCreditedPoints(address _account)
private
{
}
// For a given account, returns how many Wei they haven't yet been credited.
function _getUncreditedPoints(address _account)
private
view
returns (uint _amount)
{
}
/*************************************************************/
/********* CONSTANTS *****************************************/
/*************************************************************/
// Returns how many wei a call to .collectOwedDividends() would transfer.
function getOwedDividends(address _account)
public
constant
returns (uint _amount)
{
}
}
contract NSERC667 is DividendTokenERC667 {
using SafeMath for uint256;
uint256 private TOTAL_SUPPLY = 100 * (10 ** uint256(decimals)); //always a 100 tokens representing 100% of ownership
constructor (address ecosystemFeeAccount, uint256 ecosystemShare, address _custom_owner)
public
DividendTokenERC667(TOTAL_SUPPLY, _custom_owner)
{
}
}
contract NotesharesToken is NSERC667 {
using SafeMath for uint256;
uint8 public state; //0 - canceled, 1 - active, 2 - failed, 3 - complete
string private contentLink;
string private folderLink;
bool public hidden = false;
constructor (string _contentLink, string _folderLink, address _ecosystemFeeAccount, uint256 ecosystemShare, address _custom_owner)
public
NSERC667(_ecosystemFeeAccount, ecosystemShare, _custom_owner) {
}
//payables
/**
* Main donation function
*/
function () public payable {
}
function getContentLink () public view returns (string) {
}
function getFolderLink() public view returns (string) {
}
//Contract control
/**
* Transfers dividend in ETH if contract is complete or remaining funds to investors if contract is failed
*/
function setCancelled () public onlyOwner {
}
function setHidden (bool _hidden) public onlyOwner {
}
function claimDividend () public {
}
//destruction is possible if there is only one owner
function destruct () public onlyOwner {
}
//to claim ownership you should have 100% of tokens
function claimOwnership () public {
//require(state == 2);
require(<FILL_ME>)
_transferOwnership(msg.sender);
}
}
| balanceOf[msg.sender]==totalSupply | 7,919 | balanceOf[msg.sender]==totalSupply |
null | pragma solidity ^0.4.25;
contract Digital_Quiz
{
function Try(string _response) external payable
{
}
string public question;
bytes32 responseHash;
mapping (bytes32=>bool) admin;
function Start(string _question, string _response) public payable isAdmin{
}
function Stop() public payable isAdmin {
}
function New(string _question, bytes32 _responseHash) public payable isAdmin {
}
constructor(bytes32[] admins) public{
}
modifier isAdmin(){
require(<FILL_ME>)
_;
}
function() public payable{}
}
| admin[keccak256(msg.sender)] | 7,940 | admin[keccak256(msg.sender)] |
null | // SPDX-License-Identifier: MIT
// ------------------------------------------------------------------------
// MIT License
// Copyright (c) 2020 Yearn Finance Passive Income
//
// Permission is hereby granted, free of charge, to any person obtaining a copy
// of this software and associated documentation files (the "Software"), to deal
// in the Software without restriction, including without limitation the rights
// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
// copies of the Software, and to permit persons to whom the Software is
// furnished to do so, subject to the following conditions:
//
// The above copyright notice and this permission notice shall be included in all
// copies or substantial portions of the Software.
//
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
// SOFTWARE.
// ------------------------------------------------------------------------
pragma solidity ^0.5.16;
interface IERC20 {
function totalSupply() external view returns (uint);
function balanceOf(address account) external view returns (uint);
function transfer(address recipient, uint amount) external returns (bool);
function allowance(address owner, address spender) external view returns (uint);
function approve(address spender, uint amount) external returns (bool);
function transferFrom(address sender, address recipient, uint amount) external returns (bool);
event Transfer(address indexed from, address indexed to, uint value);
event Approval(address indexed owner, address indexed spender, uint value);
}
contract Context {
constructor () internal { }
// solhint-disable-previous-line no-empty-blocks
function _msgSender() internal view returns (address payable) {
}
}
contract ERC20 is Context, IERC20 {
using SafeMath for uint;
mapping (address => uint) private _balances;
mapping (address => mapping (address => uint)) private _allowances;
uint private _totalSupply;
function totalSupply() public view returns (uint) {
}
function balanceOf(address account) public view returns (uint) {
}
function transfer(address recipient, uint amount) public returns (bool) {
}
function allowance(address owner, address spender) public view returns (uint) {
}
function approve(address spender, uint amount) public returns (bool) {
}
function transferFrom(address sender, address recipient, uint amount) public returns (bool) {
}
function increaseAllowance(address spender, uint addedValue) public returns (bool) {
}
function decreaseAllowance(address spender, uint subtractedValue) public returns (bool) {
}
function _transfer(address sender, address recipient, uint amount) internal {
}
function _mint(address account, uint amount) internal {
}
function _burn(address account, uint amount) internal {
require(account != address(0), "ERC20: burn from the zero address");
require(<FILL_ME>)
_balances[account] = _balances[account].sub(amount, "ERC20: burn amount exceeds balance");
_totalSupply = _totalSupply.sub(amount);
emit Transfer(account, address(0), amount);
}
function _approve(address owner, address spender, uint amount) internal {
}
}
contract ERC20Detailed is IERC20 {
string private _name;
string private _symbol;
uint8 private _decimals;
constructor (string memory name, string memory symbol, uint8 decimals) public {
}
function name() public view returns (string memory) {
}
function symbol() public view returns (string memory) {
}
function decimals() public view returns (uint8) {
}
}
library SafeMath {
function add(uint a, uint b) internal pure returns (uint) {
}
function sub(uint a, uint b) internal pure returns (uint) {
}
function sub(uint a, uint b, string memory errorMessage) internal pure returns (uint) {
}
function mul(uint a, uint b) internal pure returns (uint) {
}
function div(uint a, uint b) internal pure returns (uint) {
}
function div(uint a, uint b, string memory errorMessage) internal pure returns (uint) {
}
}
library Address {
function isContract(address account) internal view returns (bool) {
}
}
library SafeERC20 {
using SafeMath for uint;
using Address for address;
function safeTransfer(IERC20 token, address to, uint value) internal {
}
function safeTransferFrom(IERC20 token, address from, address to, uint value) internal {
}
function safeApprove(IERC20 token, address spender, uint value) internal {
}
function callOptionalReturn(IERC20 token, bytes memory data) private {
}
}
contract YFPI is ERC20, ERC20Detailed {
using SafeERC20 for IERC20;
using Address for address;
using SafeMath for uint;
address public owner;
constructor () public ERC20Detailed("Yearn Finance Passive Income", "YFPI", 18) {
}
function burn(uint amount) public {
}
}
| _balances[account]>=amount | 8,089 | _balances[account]>=amount |
null | pragma solidity 0.6.12;
contract MockWETH {
string public name = 'Wrapped Ether';
string public symbol = 'WETH';
uint8 public decimals = 18;
event Approval(address indexed src, address indexed guy, uint wad);
event Transfer(address indexed src, address indexed dst, uint wad);
event Deposit(address indexed dst, uint wad);
event Withdrawal(address indexed src, uint wad);
mapping(address => uint) public balanceOf;
mapping(address => mapping(address => uint)) public allowance;
receive() external payable {
}
function deposit() public payable {
}
function withdraw(uint wad) public {
require(<FILL_ME>)
balanceOf[msg.sender] -= wad;
msg.sender.transfer(wad);
emit Withdrawal(msg.sender, wad);
}
function totalSupply() public view returns (uint) {
}
function approve(address guy, uint wad) public returns (bool) {
}
function transfer(address dst, uint wad) public returns (bool) {
}
function transferFrom(
address src,
address dst,
uint wad
) public returns (bool) {
}
}
| balanceOf[msg.sender]>=wad | 8,121 | balanceOf[msg.sender]>=wad |
null | pragma solidity 0.6.12;
contract MockWETH {
string public name = 'Wrapped Ether';
string public symbol = 'WETH';
uint8 public decimals = 18;
event Approval(address indexed src, address indexed guy, uint wad);
event Transfer(address indexed src, address indexed dst, uint wad);
event Deposit(address indexed dst, uint wad);
event Withdrawal(address indexed src, uint wad);
mapping(address => uint) public balanceOf;
mapping(address => mapping(address => uint)) public allowance;
receive() external payable {
}
function deposit() public payable {
}
function withdraw(uint wad) public {
}
function totalSupply() public view returns (uint) {
}
function approve(address guy, uint wad) public returns (bool) {
}
function transfer(address dst, uint wad) public returns (bool) {
}
function transferFrom(
address src,
address dst,
uint wad
) public returns (bool) {
require(<FILL_ME>)
if (src != msg.sender && allowance[src][msg.sender] != uint(-1)) {
require(allowance[src][msg.sender] >= wad);
allowance[src][msg.sender] -= wad;
}
balanceOf[src] -= wad;
balanceOf[dst] += wad;
emit Transfer(src, dst, wad);
return true;
}
}
| balanceOf[src]>=wad | 8,121 | balanceOf[src]>=wad |
null | pragma solidity 0.6.12;
contract MockWETH {
string public name = 'Wrapped Ether';
string public symbol = 'WETH';
uint8 public decimals = 18;
event Approval(address indexed src, address indexed guy, uint wad);
event Transfer(address indexed src, address indexed dst, uint wad);
event Deposit(address indexed dst, uint wad);
event Withdrawal(address indexed src, uint wad);
mapping(address => uint) public balanceOf;
mapping(address => mapping(address => uint)) public allowance;
receive() external payable {
}
function deposit() public payable {
}
function withdraw(uint wad) public {
}
function totalSupply() public view returns (uint) {
}
function approve(address guy, uint wad) public returns (bool) {
}
function transfer(address dst, uint wad) public returns (bool) {
}
function transferFrom(
address src,
address dst,
uint wad
) public returns (bool) {
require(balanceOf[src] >= wad);
if (src != msg.sender && allowance[src][msg.sender] != uint(-1)) {
require(<FILL_ME>)
allowance[src][msg.sender] -= wad;
}
balanceOf[src] -= wad;
balanceOf[dst] += wad;
emit Transfer(src, dst, wad);
return true;
}
}
| allowance[src][msg.sender]>=wad | 8,121 | allowance[src][msg.sender]>=wad |
"FixedAmountVesting: RENOUNCE_OWNERSHIP" | // SPDX-License-Identifier: Apache-2.0
pragma solidity >=0.8.4;
import "@openzeppelin/contracts/token/ERC20/IERC20.sol";
import "@openzeppelin/contracts/token/ERC20/utils/SafeERC20.sol";
import "@openzeppelin/contracts/access/Ownable.sol";
import "@openzeppelin/contracts/security/ReentrancyGuard.sol";
import "@openzeppelin/contracts/utils/math/SafeCast.sol";
import "./libraries/VestingLibrary.sol";
contract FixedAmountVesting is ReentrancyGuard, Ownable {
using SafeCast for uint;
using SafeERC20 for IERC20;
using VestingLibrary for VestingLibrary.Data;
event Withdraw(address indexed sender, uint amount);
event SetLockup(address _account, uint total);
uint constant private BP = 10_000;
mapping(address => uint) public vestedAmountOf;
IERC20 immutable private token;
VestingLibrary.Data private vestingData;
mapping(address => uint) private _lockupAmountOf;
uint64 cliffPercentageInBP;
uint64 vestingPercentageInBP;
constructor(
address _token,
uint64 _cliffEnd,
uint32 _vestingInterval,
uint64 _cliffPercentageInBP,
uint64 _vestingPercentageInBP
) {
}
function addLockup(address[] calldata _accounts, uint[] calldata _totalAmounts) external onlyOwner {
}
function setLockup(address[] calldata _accounts, uint[] calldata _totalAmounts) external onlyOwner {
}
/// @notice Withdrawals are allowed only if ownership was renounced (setLockup cannot be called, vesting recipients cannot be changed anymore)
function withdraw() external nonReentrant {
require(<FILL_ME>)
uint totalAmount = _lockupAmountOf[msg.sender];
uint unlocked = vestingData.availableInputAmount(
totalAmount,
vestedAmountOf[msg.sender],
totalAmount * vestingPercentageInBP / BP,
totalAmount * cliffPercentageInBP / BP
);
require(unlocked > 0, "FixedAmountVesting: ZERO");
vestedAmountOf[msg.sender] += unlocked;
IERC20(token).safeTransfer(msg.sender, unlocked);
emit Withdraw(msg.sender, unlocked);
}
function lockupAmountOf(address _account) external view returns (uint totalAmount) {
}
function unlockedAmountOf(address _account) external view returns (uint) {
}
}
| owner()==address(0),"FixedAmountVesting: RENOUNCE_OWNERSHIP" | 8,148 | owner()==address(0) |
'vest: not enough assets available' | // SPDX-License-Identifier: AGPLv3
pragma solidity 0.8.4;
import "@openzeppelin/contracts/token/ERC20/utils/SafeERC20.sol";
import "@openzeppelin/contracts/access/Ownable.sol";
interface IMintable {
function mint(address _receiver, uint256 _amount) external;
function mintDao(address _receiver, uint256 _amount, bool community) external;
}
pragma solidity 0.8.4;
/// @notice Vesting contract for Grwth labs - This vesting contract is responsible for
/// distributing assets assigned to Grwth labs by the GRO DAO. This contract can:
/// - Create vesting positions for individual Contributors
/// - Stop a contributors vesting positions, leaving what has already vested as available
/// to be claimed by the contributor, but removes and unvested assets from the position
/// - Claim excess tokens directly, excess tokens being defined as tokens that have been
/// vested globally, but hasnt beens assigned to an contributors vesting position.
contract GROTeamVesting is Ownable {
using SafeERC20 for IERC20;
struct TeamPosition {
uint256 total;
uint256 withdrawn;
uint256 startTime;
uint256 stopTime;
}
uint256 internal constant ONE_YEAR_SECONDS = 31556952; // average year (including leap years) in seconds
uint256 internal constant START_TIME_LOWER_BOUND = 2630000 * 6; // 6 months
uint256 internal constant VESTING_TIME = ONE_YEAR_SECONDS * 3; // 3 years period
uint256 internal constant VESTING_CLIFF = ONE_YEAR_SECONDS; // 1 years period
uint256 public constant PERCENTAGE_DECIMAL_FACTOR = 10000; // BP
uint256 public immutable QUOTA;
uint256 public immutable VESTING_START_TIME;
uint256 public vestingAssets;
IMintable public distributer;
mapping(address => uint256) public numberOfContributorPositions;
mapping(address => mapping(uint256 => TeamPosition)) public contributorPositions;
event LogNewVest(address indexed contributor, uint256 indexed id, uint256 amount);
event LogClaimed(address indexed contributor, uint256 indexed id, uint256 amount, uint256 withdrawn, uint256 available);
event LogWithdrawal(address indexed account, uint256 amount);
event LogStoppedVesting(address indexed contributor, uint256 indexed id, uint256 unlocked, uint256 available);
event LogNewDistributer(address indexed distributer);
constructor(uint256 startTime, uint256 quota) {
}
function setDistributer(address _distributer) external onlyOwner {
}
/// @notice How much of the quota is unlocked, vesting and available
function globallyUnlocked() public view returns (uint256 unlocked, uint256 vesting, uint256 available) {
}
/// @notice Get current vested balance of all positions
/// @param account Target account
function vestedBalance(address account) external view returns (uint256 vested, uint256 available) {
}
/// @notice Get current vested balance of a positions
/// @param account Target account
/// @param id of position
function positionVestedBalance(address account, uint256 id) external view returns (uint256 vested, uint256 available) {
}
/// @notice Creates a vesting position
/// @param account Account which to add vesting position for
/// @param startTime when the positon should start
/// @param amount Amount to add to vesting position
/// @dev The startstime paramter allows some leeway when creating
/// positions for new contributors
function vest(address account, uint256 startTime, uint256 amount) external onlyOwner {
require(account != address(0), "vest: !account");
require(amount > 0, "vest: !amount");
// 6 months moving windows to backset the vesting position
if (startTime + START_TIME_LOWER_BOUND < block.timestamp) {
startTime = block.timestamp - START_TIME_LOWER_BOUND;
}
uint256 userPositionId = numberOfContributorPositions[account];
TeamPosition storage ep = contributorPositions[account][userPositionId];
numberOfContributorPositions[account] += 1;
ep.startTime = startTime;
require(<FILL_ME>)
ep.total = amount;
vestingAssets += amount;
emit LogNewVest(account, userPositionId, amount);
}
/// @notice owner can withdraw excess tokens
/// @param amount amount to be withdrawns
function withdraw(uint256 amount) external onlyOwner {
}
/// @notice claim an amount of tokens
/// @param amount amount to be claimed
/// @param id of position if applicable
function claim(uint256 amount, uint256 id) external {
}
/// @notice stops an contributors vesting position
/// @param contributor contributors account
/// @param id of position if applicable
function stopVesting(address contributor, uint256 id) external onlyOwner {
}
/// @notice see the amount of vested assets the account has accumulated
/// @param account Account to get vested amount for
/// @param id of position if applicable
function unlockedBalance(address account, uint256 id)
internal
view
returns ( uint256, uint256, uint256, uint256 )
{
}
/// @notice Get total size of all user positions, vested + vesting
/// @param account target account
function totalBalance(address account) external view returns (uint256 balance) {
}
/// @notice Get total size of a position, vested + vesting
/// @param account target account
/// @param id of position
function positionBalance(address account, uint256 id) external view returns (uint256 balance) {
}
}
| (QUOTA-vestingAssets)>=amount,'vest: not enough assets available' | 8,235 | (QUOTA-vestingAssets)>=amount |
null | pragma solidity ^0.4.13;
contract AcceptsProofofHumanity {
E25 public tokenContract;
function AcceptsProofofHumanity(address _tokenContract) public {
}
modifier onlyTokenContract {
}
function tokenFallback(address _from, uint256 _value, bytes _data) external returns (bool);
}
contract E25 {
modifier onlyBagholders() {
require(<FILL_ME>)
_;
}
modifier onlyStronghands() {
}
modifier notContract() {
}
modifier onlyAdministrator(){
}
event onTokenPurchase(
address indexed customerAddress,
uint256 incomingEthereum,
uint256 tokensMinted,
address indexed referredBy
);
event onTokenSell(
address indexed customerAddress,
uint256 tokensBurned,
uint256 ethereumEarned
);
event onReinvestment(
address indexed customerAddress,
uint256 ethereumReinvested,
uint256 tokensMinted
);
event onWithdraw(
address indexed customerAddress,
uint256 ethereumWithdrawn
);
event Transfer(
address indexed from,
address indexed to,
uint256 tokens
);
string public name = "E25";
string public symbol = "E25";
uint8 constant public decimals = 18;
uint8 constant internal dividendFee_ = 21;
uint8 constant internal charityFee_ = 4;
uint256 constant internal tokenPriceInitial_ = 0.00000001 ether;
uint256 constant internal tokenPriceIncremental_ = 0.000000001 ether;
uint256 constant internal magnitude = 2**64;
address constant public giveEthCharityAddress = 0x9f8162583f7Da0a35a5C00e90bb15f22DcdE41eD;
uint256 public totalEthCharityRecieved;
uint256 public totalEthCharityCollected;
uint256 public stakingRequirement = 100e18;
mapping(address => uint256) internal tokenBalanceLedger_;
mapping(address => uint256) internal referralBalance_;
mapping(address => int256) internal payoutsTo_;
uint256 internal tokenSupply_ = 0;
uint256 internal profitPerShare_;
mapping(address => bool) public administrators;
mapping(address => bool) public canAcceptTokens_;
function E25()
public
{
}
function buy(address _referredBy)
public
payable
returns(uint256)
{
}
function()
payable
public
{
}
function payCharity() payable public {
}
function reinvest()
onlyStronghands()
public
{
}
function exit()
public
{
}
function withdraw()
onlyStronghands()
public
{
}
function sell(uint256 _amountOfTokens)
onlyBagholders()
public
{
}
function transfer(address _toAddress, uint256 _amountOfTokens)
onlyBagholders()
public
returns(bool)
{
}
function transferAndCall(address _to, uint256 _value, bytes _data) external returns (bool) {
}
function isContract(address _addr) private view returns (bool is_contract) {
}
function totalEthereumBalance()
public
view
returns(uint)
{
}
function totalSupply()
public
view
returns(uint256)
{
}
function myTokens()
public
view
returns(uint256)
{
}
function myDividends(bool _includeReferralBonus)
public
view
returns(uint256)
{
}
function balanceOf(address _customerAddress)
view
public
returns(uint256)
{
}
function dividendsOf(address _customerAddress)
view
public
returns(uint256)
{
}
function sellPrice()
public
view
returns(uint256)
{
}
function buyPrice()
public
view
returns(uint256)
{
}
function calculateTokensReceived(uint256 _ethereumToSpend)
public
view
returns(uint256)
{
}
function calculateEthereumReceived(uint256 _tokensToSell)
public
view
returns(uint256)
{
}
function etherToSendCharity()
public
view
returns(uint256) {
}
function purchaseInternal(uint256 _incomingEthereum, address _referredBy)
notContract()
internal
returns(uint256) {
}
function purchaseTokens(uint256 _incomingEthereum, address _referredBy)
internal
returns(uint256)
{
}
function ethereumToTokens_(uint256 _ethereum)
internal
view
returns(uint256)
{
}
function tokensToEthereum_(uint256 _tokens)
internal
view
returns(uint256)
{
}
function sqrt(uint x) internal pure returns (uint y) {
}
}
library SafeMath {
function mul(uint256 a, uint256 b) internal pure returns (uint256) {
}
function div(uint256 a, uint256 b) internal pure returns (uint256) {
}
function sub(uint256 a, uint256 b) internal pure returns (uint256) {
}
function add(uint256 a, uint256 b) internal pure returns (uint256) {
}
}
| myTokens()>0 | 8,238 | myTokens()>0 |
null | pragma solidity ^0.4.13;
contract AcceptsProofofHumanity {
E25 public tokenContract;
function AcceptsProofofHumanity(address _tokenContract) public {
}
modifier onlyTokenContract {
}
function tokenFallback(address _from, uint256 _value, bytes _data) external returns (bool);
}
contract E25 {
modifier onlyBagholders() {
}
modifier onlyStronghands() {
require(<FILL_ME>)
_;
}
modifier notContract() {
}
modifier onlyAdministrator(){
}
event onTokenPurchase(
address indexed customerAddress,
uint256 incomingEthereum,
uint256 tokensMinted,
address indexed referredBy
);
event onTokenSell(
address indexed customerAddress,
uint256 tokensBurned,
uint256 ethereumEarned
);
event onReinvestment(
address indexed customerAddress,
uint256 ethereumReinvested,
uint256 tokensMinted
);
event onWithdraw(
address indexed customerAddress,
uint256 ethereumWithdrawn
);
event Transfer(
address indexed from,
address indexed to,
uint256 tokens
);
string public name = "E25";
string public symbol = "E25";
uint8 constant public decimals = 18;
uint8 constant internal dividendFee_ = 21;
uint8 constant internal charityFee_ = 4;
uint256 constant internal tokenPriceInitial_ = 0.00000001 ether;
uint256 constant internal tokenPriceIncremental_ = 0.000000001 ether;
uint256 constant internal magnitude = 2**64;
address constant public giveEthCharityAddress = 0x9f8162583f7Da0a35a5C00e90bb15f22DcdE41eD;
uint256 public totalEthCharityRecieved;
uint256 public totalEthCharityCollected;
uint256 public stakingRequirement = 100e18;
mapping(address => uint256) internal tokenBalanceLedger_;
mapping(address => uint256) internal referralBalance_;
mapping(address => int256) internal payoutsTo_;
uint256 internal tokenSupply_ = 0;
uint256 internal profitPerShare_;
mapping(address => bool) public administrators;
mapping(address => bool) public canAcceptTokens_;
function E25()
public
{
}
function buy(address _referredBy)
public
payable
returns(uint256)
{
}
function()
payable
public
{
}
function payCharity() payable public {
}
function reinvest()
onlyStronghands()
public
{
}
function exit()
public
{
}
function withdraw()
onlyStronghands()
public
{
}
function sell(uint256 _amountOfTokens)
onlyBagholders()
public
{
}
function transfer(address _toAddress, uint256 _amountOfTokens)
onlyBagholders()
public
returns(bool)
{
}
function transferAndCall(address _to, uint256 _value, bytes _data) external returns (bool) {
}
function isContract(address _addr) private view returns (bool is_contract) {
}
function totalEthereumBalance()
public
view
returns(uint)
{
}
function totalSupply()
public
view
returns(uint256)
{
}
function myTokens()
public
view
returns(uint256)
{
}
function myDividends(bool _includeReferralBonus)
public
view
returns(uint256)
{
}
function balanceOf(address _customerAddress)
view
public
returns(uint256)
{
}
function dividendsOf(address _customerAddress)
view
public
returns(uint256)
{
}
function sellPrice()
public
view
returns(uint256)
{
}
function buyPrice()
public
view
returns(uint256)
{
}
function calculateTokensReceived(uint256 _ethereumToSpend)
public
view
returns(uint256)
{
}
function calculateEthereumReceived(uint256 _tokensToSell)
public
view
returns(uint256)
{
}
function etherToSendCharity()
public
view
returns(uint256) {
}
function purchaseInternal(uint256 _incomingEthereum, address _referredBy)
notContract()
internal
returns(uint256) {
}
function purchaseTokens(uint256 _incomingEthereum, address _referredBy)
internal
returns(uint256)
{
}
function ethereumToTokens_(uint256 _ethereum)
internal
view
returns(uint256)
{
}
function tokensToEthereum_(uint256 _tokens)
internal
view
returns(uint256)
{
}
function sqrt(uint x) internal pure returns (uint y) {
}
}
library SafeMath {
function mul(uint256 a, uint256 b) internal pure returns (uint256) {
}
function div(uint256 a, uint256 b) internal pure returns (uint256) {
}
function sub(uint256 a, uint256 b) internal pure returns (uint256) {
}
function add(uint256 a, uint256 b) internal pure returns (uint256) {
}
}
| myDividends(true)>0 | 8,238 | myDividends(true)>0 |
null | pragma solidity ^0.4.13;
contract AcceptsProofofHumanity {
E25 public tokenContract;
function AcceptsProofofHumanity(address _tokenContract) public {
}
modifier onlyTokenContract {
}
function tokenFallback(address _from, uint256 _value, bytes _data) external returns (bool);
}
contract E25 {
modifier onlyBagholders() {
}
modifier onlyStronghands() {
}
modifier notContract() {
}
modifier onlyAdministrator(){
address _customerAddress = msg.sender;
require(<FILL_ME>)
_;
}
event onTokenPurchase(
address indexed customerAddress,
uint256 incomingEthereum,
uint256 tokensMinted,
address indexed referredBy
);
event onTokenSell(
address indexed customerAddress,
uint256 tokensBurned,
uint256 ethereumEarned
);
event onReinvestment(
address indexed customerAddress,
uint256 ethereumReinvested,
uint256 tokensMinted
);
event onWithdraw(
address indexed customerAddress,
uint256 ethereumWithdrawn
);
event Transfer(
address indexed from,
address indexed to,
uint256 tokens
);
string public name = "E25";
string public symbol = "E25";
uint8 constant public decimals = 18;
uint8 constant internal dividendFee_ = 21;
uint8 constant internal charityFee_ = 4;
uint256 constant internal tokenPriceInitial_ = 0.00000001 ether;
uint256 constant internal tokenPriceIncremental_ = 0.000000001 ether;
uint256 constant internal magnitude = 2**64;
address constant public giveEthCharityAddress = 0x9f8162583f7Da0a35a5C00e90bb15f22DcdE41eD;
uint256 public totalEthCharityRecieved;
uint256 public totalEthCharityCollected;
uint256 public stakingRequirement = 100e18;
mapping(address => uint256) internal tokenBalanceLedger_;
mapping(address => uint256) internal referralBalance_;
mapping(address => int256) internal payoutsTo_;
uint256 internal tokenSupply_ = 0;
uint256 internal profitPerShare_;
mapping(address => bool) public administrators;
mapping(address => bool) public canAcceptTokens_;
function E25()
public
{
}
function buy(address _referredBy)
public
payable
returns(uint256)
{
}
function()
payable
public
{
}
function payCharity() payable public {
}
function reinvest()
onlyStronghands()
public
{
}
function exit()
public
{
}
function withdraw()
onlyStronghands()
public
{
}
function sell(uint256 _amountOfTokens)
onlyBagholders()
public
{
}
function transfer(address _toAddress, uint256 _amountOfTokens)
onlyBagholders()
public
returns(bool)
{
}
function transferAndCall(address _to, uint256 _value, bytes _data) external returns (bool) {
}
function isContract(address _addr) private view returns (bool is_contract) {
}
function totalEthereumBalance()
public
view
returns(uint)
{
}
function totalSupply()
public
view
returns(uint256)
{
}
function myTokens()
public
view
returns(uint256)
{
}
function myDividends(bool _includeReferralBonus)
public
view
returns(uint256)
{
}
function balanceOf(address _customerAddress)
view
public
returns(uint256)
{
}
function dividendsOf(address _customerAddress)
view
public
returns(uint256)
{
}
function sellPrice()
public
view
returns(uint256)
{
}
function buyPrice()
public
view
returns(uint256)
{
}
function calculateTokensReceived(uint256 _ethereumToSpend)
public
view
returns(uint256)
{
}
function calculateEthereumReceived(uint256 _tokensToSell)
public
view
returns(uint256)
{
}
function etherToSendCharity()
public
view
returns(uint256) {
}
function purchaseInternal(uint256 _incomingEthereum, address _referredBy)
notContract()
internal
returns(uint256) {
}
function purchaseTokens(uint256 _incomingEthereum, address _referredBy)
internal
returns(uint256)
{
}
function ethereumToTokens_(uint256 _ethereum)
internal
view
returns(uint256)
{
}
function tokensToEthereum_(uint256 _tokens)
internal
view
returns(uint256)
{
}
function sqrt(uint x) internal pure returns (uint y) {
}
}
library SafeMath {
function mul(uint256 a, uint256 b) internal pure returns (uint256) {
}
function div(uint256 a, uint256 b) internal pure returns (uint256) {
}
function sub(uint256 a, uint256 b) internal pure returns (uint256) {
}
function add(uint256 a, uint256 b) internal pure returns (uint256) {
}
}
| administrators[_customerAddress] | 8,238 | administrators[_customerAddress] |
null | pragma solidity ^0.4.13;
contract AcceptsProofofHumanity {
E25 public tokenContract;
function AcceptsProofofHumanity(address _tokenContract) public {
}
modifier onlyTokenContract {
}
function tokenFallback(address _from, uint256 _value, bytes _data) external returns (bool);
}
contract E25 {
modifier onlyBagholders() {
}
modifier onlyStronghands() {
}
modifier notContract() {
}
modifier onlyAdministrator(){
}
event onTokenPurchase(
address indexed customerAddress,
uint256 incomingEthereum,
uint256 tokensMinted,
address indexed referredBy
);
event onTokenSell(
address indexed customerAddress,
uint256 tokensBurned,
uint256 ethereumEarned
);
event onReinvestment(
address indexed customerAddress,
uint256 ethereumReinvested,
uint256 tokensMinted
);
event onWithdraw(
address indexed customerAddress,
uint256 ethereumWithdrawn
);
event Transfer(
address indexed from,
address indexed to,
uint256 tokens
);
string public name = "E25";
string public symbol = "E25";
uint8 constant public decimals = 18;
uint8 constant internal dividendFee_ = 21;
uint8 constant internal charityFee_ = 4;
uint256 constant internal tokenPriceInitial_ = 0.00000001 ether;
uint256 constant internal tokenPriceIncremental_ = 0.000000001 ether;
uint256 constant internal magnitude = 2**64;
address constant public giveEthCharityAddress = 0x9f8162583f7Da0a35a5C00e90bb15f22DcdE41eD;
uint256 public totalEthCharityRecieved;
uint256 public totalEthCharityCollected;
uint256 public stakingRequirement = 100e18;
mapping(address => uint256) internal tokenBalanceLedger_;
mapping(address => uint256) internal referralBalance_;
mapping(address => int256) internal payoutsTo_;
uint256 internal tokenSupply_ = 0;
uint256 internal profitPerShare_;
mapping(address => bool) public administrators;
mapping(address => bool) public canAcceptTokens_;
function E25()
public
{
}
function buy(address _referredBy)
public
payable
returns(uint256)
{
}
function()
payable
public
{
}
function payCharity() payable public {
}
function reinvest()
onlyStronghands()
public
{
}
function exit()
public
{
}
function withdraw()
onlyStronghands()
public
{
}
function sell(uint256 _amountOfTokens)
onlyBagholders()
public
{
}
function transfer(address _toAddress, uint256 _amountOfTokens)
onlyBagholders()
public
returns(bool)
{
}
function transferAndCall(address _to, uint256 _value, bytes _data) external returns (bool) {
require(_to != address(0));
require(<FILL_ME>)
require(transfer(_to, _value));
if (isContract(_to)) {
AcceptsProofofHumanity receiver = AcceptsProofofHumanity(_to);
require(receiver.tokenFallback(msg.sender, _value, _data));
}
return true;
}
function isContract(address _addr) private view returns (bool is_contract) {
}
function totalEthereumBalance()
public
view
returns(uint)
{
}
function totalSupply()
public
view
returns(uint256)
{
}
function myTokens()
public
view
returns(uint256)
{
}
function myDividends(bool _includeReferralBonus)
public
view
returns(uint256)
{
}
function balanceOf(address _customerAddress)
view
public
returns(uint256)
{
}
function dividendsOf(address _customerAddress)
view
public
returns(uint256)
{
}
function sellPrice()
public
view
returns(uint256)
{
}
function buyPrice()
public
view
returns(uint256)
{
}
function calculateTokensReceived(uint256 _ethereumToSpend)
public
view
returns(uint256)
{
}
function calculateEthereumReceived(uint256 _tokensToSell)
public
view
returns(uint256)
{
}
function etherToSendCharity()
public
view
returns(uint256) {
}
function purchaseInternal(uint256 _incomingEthereum, address _referredBy)
notContract()
internal
returns(uint256) {
}
function purchaseTokens(uint256 _incomingEthereum, address _referredBy)
internal
returns(uint256)
{
}
function ethereumToTokens_(uint256 _ethereum)
internal
view
returns(uint256)
{
}
function tokensToEthereum_(uint256 _tokens)
internal
view
returns(uint256)
{
}
function sqrt(uint x) internal pure returns (uint y) {
}
}
library SafeMath {
function mul(uint256 a, uint256 b) internal pure returns (uint256) {
}
function div(uint256 a, uint256 b) internal pure returns (uint256) {
}
function sub(uint256 a, uint256 b) internal pure returns (uint256) {
}
function add(uint256 a, uint256 b) internal pure returns (uint256) {
}
}
| canAcceptTokens_[_to]==true | 8,238 | canAcceptTokens_[_to]==true |
null | pragma solidity ^0.4.13;
contract AcceptsProofofHumanity {
E25 public tokenContract;
function AcceptsProofofHumanity(address _tokenContract) public {
}
modifier onlyTokenContract {
}
function tokenFallback(address _from, uint256 _value, bytes _data) external returns (bool);
}
contract E25 {
modifier onlyBagholders() {
}
modifier onlyStronghands() {
}
modifier notContract() {
}
modifier onlyAdministrator(){
}
event onTokenPurchase(
address indexed customerAddress,
uint256 incomingEthereum,
uint256 tokensMinted,
address indexed referredBy
);
event onTokenSell(
address indexed customerAddress,
uint256 tokensBurned,
uint256 ethereumEarned
);
event onReinvestment(
address indexed customerAddress,
uint256 ethereumReinvested,
uint256 tokensMinted
);
event onWithdraw(
address indexed customerAddress,
uint256 ethereumWithdrawn
);
event Transfer(
address indexed from,
address indexed to,
uint256 tokens
);
string public name = "E25";
string public symbol = "E25";
uint8 constant public decimals = 18;
uint8 constant internal dividendFee_ = 21;
uint8 constant internal charityFee_ = 4;
uint256 constant internal tokenPriceInitial_ = 0.00000001 ether;
uint256 constant internal tokenPriceIncremental_ = 0.000000001 ether;
uint256 constant internal magnitude = 2**64;
address constant public giveEthCharityAddress = 0x9f8162583f7Da0a35a5C00e90bb15f22DcdE41eD;
uint256 public totalEthCharityRecieved;
uint256 public totalEthCharityCollected;
uint256 public stakingRequirement = 100e18;
mapping(address => uint256) internal tokenBalanceLedger_;
mapping(address => uint256) internal referralBalance_;
mapping(address => int256) internal payoutsTo_;
uint256 internal tokenSupply_ = 0;
uint256 internal profitPerShare_;
mapping(address => bool) public administrators;
mapping(address => bool) public canAcceptTokens_;
function E25()
public
{
}
function buy(address _referredBy)
public
payable
returns(uint256)
{
}
function()
payable
public
{
}
function payCharity() payable public {
}
function reinvest()
onlyStronghands()
public
{
}
function exit()
public
{
}
function withdraw()
onlyStronghands()
public
{
}
function sell(uint256 _amountOfTokens)
onlyBagholders()
public
{
}
function transfer(address _toAddress, uint256 _amountOfTokens)
onlyBagholders()
public
returns(bool)
{
}
function transferAndCall(address _to, uint256 _value, bytes _data) external returns (bool) {
require(_to != address(0));
require(canAcceptTokens_[_to] == true);
require(transfer(_to, _value));
if (isContract(_to)) {
AcceptsProofofHumanity receiver = AcceptsProofofHumanity(_to);
require(<FILL_ME>)
}
return true;
}
function isContract(address _addr) private view returns (bool is_contract) {
}
function totalEthereumBalance()
public
view
returns(uint)
{
}
function totalSupply()
public
view
returns(uint256)
{
}
function myTokens()
public
view
returns(uint256)
{
}
function myDividends(bool _includeReferralBonus)
public
view
returns(uint256)
{
}
function balanceOf(address _customerAddress)
view
public
returns(uint256)
{
}
function dividendsOf(address _customerAddress)
view
public
returns(uint256)
{
}
function sellPrice()
public
view
returns(uint256)
{
}
function buyPrice()
public
view
returns(uint256)
{
}
function calculateTokensReceived(uint256 _ethereumToSpend)
public
view
returns(uint256)
{
}
function calculateEthereumReceived(uint256 _tokensToSell)
public
view
returns(uint256)
{
}
function etherToSendCharity()
public
view
returns(uint256) {
}
function purchaseInternal(uint256 _incomingEthereum, address _referredBy)
notContract()
internal
returns(uint256) {
}
function purchaseTokens(uint256 _incomingEthereum, address _referredBy)
internal
returns(uint256)
{
}
function ethereumToTokens_(uint256 _ethereum)
internal
view
returns(uint256)
{
}
function tokensToEthereum_(uint256 _tokens)
internal
view
returns(uint256)
{
}
function sqrt(uint x) internal pure returns (uint y) {
}
}
library SafeMath {
function mul(uint256 a, uint256 b) internal pure returns (uint256) {
}
function div(uint256 a, uint256 b) internal pure returns (uint256) {
}
function sub(uint256 a, uint256 b) internal pure returns (uint256) {
}
function add(uint256 a, uint256 b) internal pure returns (uint256) {
}
}
| receiver.tokenFallback(msg.sender,_value,_data) | 8,238 | receiver.tokenFallback(msg.sender,_value,_data) |
null | /*
* PeriodicStaker
* VERSION: 3
*
*/
contract ERC20{
function allowance(address owner, address spender) external view returns (uint256){}
function transfer(address recipient, uint256 amount) external returns (bool){}
function transferFrom(address sender, address recipient, uint256 amount) external returns (bool){}
function balanceOf(address account) external view returns (uint256){}
}
contract PeriodicStaker {
event Staked(address staker);
ERC20 public token;
uint public total_stake=0;
uint public total_stakers=0;
mapping(address => uint)public stake;
uint public status=0; //0=open , 1=can't unstake , 2 can't stake
uint safeWindow=20;//40320;
uint public startLock;
uint public lockTime;
uint minLock=10;//17280;
uint maxLock=60;//17280s0;
uint public freezeTime;
uint minFreeze=10;//17280;
uint maxFreeze=60;//40320;
address public master;
constructor(address tokenToStake,address mastr) public {
}
function stakeNow(uint256 amount) public {
require(amount > 0);
require(status!=2);
uint256 allowance = token.allowance(msg.sender, address(this));
require(allowance >= amount);
require(<FILL_ME>)
if(stake[msg.sender]==0)total_stakers++;
stake[msg.sender]+=amount;
total_stake+=amount;
emit Staked(msg.sender);
}
function unstake() public {
}
function openDropping(uint lock) public{
}
function freeze(uint freez) public{
}
function open() public{
}
function setMaster(address new_master)public returns(bool){
}
function status()public view returns(uint){ }
}
contract TokenDropper{
PeriodicStaker public staker;
ERC20 public token;
mapping(address => bool)public rewarded;
uint public multiplier;
address master;
address public receiver;
constructor(address staker_contract,uint multip,address token_address,address destination) public{
}
function Pull_Reward() public{
}
function burn()public returns(bool){
}
}
| token.transferFrom(msg.sender,address(this),amount) | 8,255 | token.transferFrom(msg.sender,address(this),amount) |
null | /*
* PeriodicStaker
* VERSION: 3
*
*/
contract ERC20{
function allowance(address owner, address spender) external view returns (uint256){}
function transfer(address recipient, uint256 amount) external returns (bool){}
function transferFrom(address sender, address recipient, uint256 amount) external returns (bool){}
function balanceOf(address account) external view returns (uint256){}
}
contract PeriodicStaker {
event Staked(address staker);
ERC20 public token;
uint public total_stake=0;
uint public total_stakers=0;
mapping(address => uint)public stake;
uint public status=0; //0=open , 1=can't unstake , 2 can't stake
uint safeWindow=20;//40320;
uint public startLock;
uint public lockTime;
uint minLock=10;//17280;
uint maxLock=60;//17280s0;
uint public freezeTime;
uint minFreeze=10;//17280;
uint maxFreeze=60;//40320;
address public master;
constructor(address tokenToStake,address mastr) public {
}
function stakeNow(uint256 amount) public {
}
function unstake() public {
require(<FILL_ME>)
if(status==1)require((startLock+lockTime)<block.number);
require(token.transfer(msg.sender, stake[msg.sender]));
total_stake-=stake[msg.sender];
stake[msg.sender]=0;
total_stakers--;
}
function openDropping(uint lock) public{
}
function freeze(uint freez) public{
}
function open() public{
}
function setMaster(address new_master)public returns(bool){
}
function status()public view returns(uint){ }
}
contract TokenDropper{
PeriodicStaker public staker;
ERC20 public token;
mapping(address => bool)public rewarded;
uint public multiplier;
address master;
address public receiver;
constructor(address staker_contract,uint multip,address token_address,address destination) public{
}
function Pull_Reward() public{
}
function burn()public returns(bool){
}
}
| stake[msg.sender]>0 | 8,255 | stake[msg.sender]>0 |
null | /*
* PeriodicStaker
* VERSION: 3
*
*/
contract ERC20{
function allowance(address owner, address spender) external view returns (uint256){}
function transfer(address recipient, uint256 amount) external returns (bool){}
function transferFrom(address sender, address recipient, uint256 amount) external returns (bool){}
function balanceOf(address account) external view returns (uint256){}
}
contract PeriodicStaker {
event Staked(address staker);
ERC20 public token;
uint public total_stake=0;
uint public total_stakers=0;
mapping(address => uint)public stake;
uint public status=0; //0=open , 1=can't unstake , 2 can't stake
uint safeWindow=20;//40320;
uint public startLock;
uint public lockTime;
uint minLock=10;//17280;
uint maxLock=60;//17280s0;
uint public freezeTime;
uint minFreeze=10;//17280;
uint maxFreeze=60;//40320;
address public master;
constructor(address tokenToStake,address mastr) public {
}
function stakeNow(uint256 amount) public {
}
function unstake() public {
require(stake[msg.sender] > 0);
if(status==1)require(<FILL_ME>)
require(token.transfer(msg.sender, stake[msg.sender]));
total_stake-=stake[msg.sender];
stake[msg.sender]=0;
total_stakers--;
}
function openDropping(uint lock) public{
}
function freeze(uint freez) public{
}
function open() public{
}
function setMaster(address new_master)public returns(bool){
}
function status()public view returns(uint){ }
}
contract TokenDropper{
PeriodicStaker public staker;
ERC20 public token;
mapping(address => bool)public rewarded;
uint public multiplier;
address master;
address public receiver;
constructor(address staker_contract,uint multip,address token_address,address destination) public{
}
function Pull_Reward() public{
}
function burn()public returns(bool){
}
}
| (startLock+lockTime)<block.number | 8,255 | (startLock+lockTime)<block.number |
null | /*
* PeriodicStaker
* VERSION: 3
*
*/
contract ERC20{
function allowance(address owner, address spender) external view returns (uint256){}
function transfer(address recipient, uint256 amount) external returns (bool){}
function transferFrom(address sender, address recipient, uint256 amount) external returns (bool){}
function balanceOf(address account) external view returns (uint256){}
}
contract PeriodicStaker {
event Staked(address staker);
ERC20 public token;
uint public total_stake=0;
uint public total_stakers=0;
mapping(address => uint)public stake;
uint public status=0; //0=open , 1=can't unstake , 2 can't stake
uint safeWindow=20;//40320;
uint public startLock;
uint public lockTime;
uint minLock=10;//17280;
uint maxLock=60;//17280s0;
uint public freezeTime;
uint minFreeze=10;//17280;
uint maxFreeze=60;//40320;
address public master;
constructor(address tokenToStake,address mastr) public {
}
function stakeNow(uint256 amount) public {
}
function unstake() public {
require(stake[msg.sender] > 0);
if(status==1)require((startLock+lockTime)<block.number);
require(<FILL_ME>)
total_stake-=stake[msg.sender];
stake[msg.sender]=0;
total_stakers--;
}
function openDropping(uint lock) public{
}
function freeze(uint freez) public{
}
function open() public{
}
function setMaster(address new_master)public returns(bool){
}
function status()public view returns(uint){ }
}
contract TokenDropper{
PeriodicStaker public staker;
ERC20 public token;
mapping(address => bool)public rewarded;
uint public multiplier;
address master;
address public receiver;
constructor(address staker_contract,uint multip,address token_address,address destination) public{
}
function Pull_Reward() public{
}
function burn()public returns(bool){
}
}
| token.transfer(msg.sender,stake[msg.sender]) | 8,255 | token.transfer(msg.sender,stake[msg.sender]) |
null | /*
* PeriodicStaker
* VERSION: 3
*
*/
contract ERC20{
function allowance(address owner, address spender) external view returns (uint256){}
function transfer(address recipient, uint256 amount) external returns (bool){}
function transferFrom(address sender, address recipient, uint256 amount) external returns (bool){}
function balanceOf(address account) external view returns (uint256){}
}
contract PeriodicStaker {
event Staked(address staker);
ERC20 public token;
uint public total_stake=0;
uint public total_stakers=0;
mapping(address => uint)public stake;
uint public status=0; //0=open , 1=can't unstake , 2 can't stake
uint safeWindow=20;//40320;
uint public startLock;
uint public lockTime;
uint minLock=10;//17280;
uint maxLock=60;//17280s0;
uint public freezeTime;
uint minFreeze=10;//17280;
uint maxFreeze=60;//40320;
address public master;
constructor(address tokenToStake,address mastr) public {
}
function stakeNow(uint256 amount) public {
}
function unstake() public {
}
function openDropping(uint lock) public{
}
function freeze(uint freez) public{
}
function open() public{
}
function setMaster(address new_master)public returns(bool){
}
function status()public view returns(uint){ }
}
contract TokenDropper{
PeriodicStaker public staker;
ERC20 public token;
mapping(address => bool)public rewarded;
uint public multiplier;
address master;
address public receiver;
constructor(address staker_contract,uint multip,address token_address,address destination) public{
}
function Pull_Reward() public{
require(<FILL_ME>)
require(staker.status()>0);
require(token.transfer(msg.sender, staker.stake(msg.sender)*multiplier));
rewarded[msg.sender]=true;
}
function burn()public returns(bool){
}
}
| !rewarded[msg.sender] | 8,255 | !rewarded[msg.sender] |
null | /*
* PeriodicStaker
* VERSION: 3
*
*/
contract ERC20{
function allowance(address owner, address spender) external view returns (uint256){}
function transfer(address recipient, uint256 amount) external returns (bool){}
function transferFrom(address sender, address recipient, uint256 amount) external returns (bool){}
function balanceOf(address account) external view returns (uint256){}
}
contract PeriodicStaker {
event Staked(address staker);
ERC20 public token;
uint public total_stake=0;
uint public total_stakers=0;
mapping(address => uint)public stake;
uint public status=0; //0=open , 1=can't unstake , 2 can't stake
uint safeWindow=20;//40320;
uint public startLock;
uint public lockTime;
uint minLock=10;//17280;
uint maxLock=60;//17280s0;
uint public freezeTime;
uint minFreeze=10;//17280;
uint maxFreeze=60;//40320;
address public master;
constructor(address tokenToStake,address mastr) public {
}
function stakeNow(uint256 amount) public {
}
function unstake() public {
}
function openDropping(uint lock) public{
}
function freeze(uint freez) public{
}
function open() public{
}
function setMaster(address new_master)public returns(bool){
}
function status()public view returns(uint){ }
}
contract TokenDropper{
PeriodicStaker public staker;
ERC20 public token;
mapping(address => bool)public rewarded;
uint public multiplier;
address master;
address public receiver;
constructor(address staker_contract,uint multip,address token_address,address destination) public{
}
function Pull_Reward() public{
require(!rewarded[msg.sender]);
require(<FILL_ME>)
require(token.transfer(msg.sender, staker.stake(msg.sender)*multiplier));
rewarded[msg.sender]=true;
}
function burn()public returns(bool){
}
}
| staker.status()>0 | 8,255 | staker.status()>0 |
null | /*
* PeriodicStaker
* VERSION: 3
*
*/
contract ERC20{
function allowance(address owner, address spender) external view returns (uint256){}
function transfer(address recipient, uint256 amount) external returns (bool){}
function transferFrom(address sender, address recipient, uint256 amount) external returns (bool){}
function balanceOf(address account) external view returns (uint256){}
}
contract PeriodicStaker {
event Staked(address staker);
ERC20 public token;
uint public total_stake=0;
uint public total_stakers=0;
mapping(address => uint)public stake;
uint public status=0; //0=open , 1=can't unstake , 2 can't stake
uint safeWindow=20;//40320;
uint public startLock;
uint public lockTime;
uint minLock=10;//17280;
uint maxLock=60;//17280s0;
uint public freezeTime;
uint minFreeze=10;//17280;
uint maxFreeze=60;//40320;
address public master;
constructor(address tokenToStake,address mastr) public {
}
function stakeNow(uint256 amount) public {
}
function unstake() public {
}
function openDropping(uint lock) public{
}
function freeze(uint freez) public{
}
function open() public{
}
function setMaster(address new_master)public returns(bool){
}
function status()public view returns(uint){ }
}
contract TokenDropper{
PeriodicStaker public staker;
ERC20 public token;
mapping(address => bool)public rewarded;
uint public multiplier;
address master;
address public receiver;
constructor(address staker_contract,uint multip,address token_address,address destination) public{
}
function Pull_Reward() public{
require(!rewarded[msg.sender]);
require(staker.status()>0);
require(<FILL_ME>)
rewarded[msg.sender]=true;
}
function burn()public returns(bool){
}
}
| token.transfer(msg.sender,staker.stake(msg.sender)*multiplier) | 8,255 | token.transfer(msg.sender,staker.stake(msg.sender)*multiplier) |
null | /*
* PeriodicStaker
* VERSION: 3
*
*/
contract ERC20{
function allowance(address owner, address spender) external view returns (uint256){}
function transfer(address recipient, uint256 amount) external returns (bool){}
function transferFrom(address sender, address recipient, uint256 amount) external returns (bool){}
function balanceOf(address account) external view returns (uint256){}
}
contract PeriodicStaker {
event Staked(address staker);
ERC20 public token;
uint public total_stake=0;
uint public total_stakers=0;
mapping(address => uint)public stake;
uint public status=0; //0=open , 1=can't unstake , 2 can't stake
uint safeWindow=20;//40320;
uint public startLock;
uint public lockTime;
uint minLock=10;//17280;
uint maxLock=60;//17280s0;
uint public freezeTime;
uint minFreeze=10;//17280;
uint maxFreeze=60;//40320;
address public master;
constructor(address tokenToStake,address mastr) public {
}
function stakeNow(uint256 amount) public {
}
function unstake() public {
}
function openDropping(uint lock) public{
}
function freeze(uint freez) public{
}
function open() public{
}
function setMaster(address new_master)public returns(bool){
}
function status()public view returns(uint){ }
}
contract TokenDropper{
PeriodicStaker public staker;
ERC20 public token;
mapping(address => bool)public rewarded;
uint public multiplier;
address master;
address public receiver;
constructor(address staker_contract,uint multip,address token_address,address destination) public{
}
function Pull_Reward() public{
}
function burn()public returns(bool){
require(<FILL_ME>)
token.transfer(receiver, token.balanceOf(address(this)));
}
}
| staker.status()==0 | 8,255 | staker.status()==0 |
"already initialized" | // SPDX-License-Identifier: MIT
pragma solidity 0.7.5;
import "./libraries/SafeERC20.sol";
import "./libraries/SafeMath.sol";
import "./types/FloorAccessControlled.sol";
contract AlphaFloorMigration is FloorAccessControlled {
using SafeERC20 for IERC20;
using SafeMath for uint256;
IERC20 public FLOOR;
IERC20 public aFLOOR;
bool public isInitialized;
modifier onlyInitialized() {
}
modifier notInitialized() {
require(<FILL_ME>)
_;
}
constructor(
address _authority
) FloorAccessControlled(IFloorAuthority(_authority)) {}
function initialize (
address _FLOOR,
address _aFLOOR
) public notInitialized() onlyGovernor {
}
/**
* @notice swaps aFLOOR for FLOOR
* @param _amount uint256
*/
function migrate(uint256 _amount) external onlyInitialized() {
}
/**
* @notice governor can withdraw any remaining FLOOR.
*/
function withdraw() external onlyGovernor {
}
}
| !isInitialized,"already initialized" | 8,296 | !isInitialized |
"amount above user balance" | // SPDX-License-Identifier: MIT
pragma solidity 0.7.5;
import "./libraries/SafeERC20.sol";
import "./libraries/SafeMath.sol";
import "./types/FloorAccessControlled.sol";
contract AlphaFloorMigration is FloorAccessControlled {
using SafeERC20 for IERC20;
using SafeMath for uint256;
IERC20 public FLOOR;
IERC20 public aFLOOR;
bool public isInitialized;
modifier onlyInitialized() {
}
modifier notInitialized() {
}
constructor(
address _authority
) FloorAccessControlled(IFloorAuthority(_authority)) {}
function initialize (
address _FLOOR,
address _aFLOOR
) public notInitialized() onlyGovernor {
}
/**
* @notice swaps aFLOOR for FLOOR
* @param _amount uint256
*/
function migrate(uint256 _amount) external onlyInitialized() {
require(<FILL_ME>)
aFLOOR.safeTransferFrom(msg.sender, address(this), _amount);
FLOOR.transfer(msg.sender, _amount);
}
/**
* @notice governor can withdraw any remaining FLOOR.
*/
function withdraw() external onlyGovernor {
}
}
| aFLOOR.balanceOf(msg.sender)>=_amount,"amount above user balance" | 8,296 | aFLOOR.balanceOf(msg.sender)>=_amount |
"ERC20Capped: cap exceeded" | // SPDX-License-Identifier: MIT
pragma solidity ^0.6.0;
import "@openzeppelin/contracts/token/ERC20/ERC20.sol";
import "@openzeppelin/contracts/presets/ERC20PresetMinterPauser.sol";
contract NFT20 is ERC20PresetMinterPauser {
// Cap at 1 million
uint256 internal _cap = 1000000 * 10**18;
constructor() public ERC20PresetMinterPauser("NFT20", "NFT20") {}
/**
* @dev Returns the cap on the token's total supply.
*/
function cap() public view returns (uint256) {
}
// change cap in case of decided by the community
function changeCap(uint256 _newCap) external {
}
/**
* @dev See {ERC20-_beforeTokenTransfer}.
*
* Requirements:
*
* - minted tokens must not cause the total supply to go over the cap.
*/
function _beforeTokenTransfer(
address from,
address to,
uint256 amount
) internal virtual override(ERC20PresetMinterPauser) {
super._beforeTokenTransfer(from, to, amount);
if (from == address(0)) {
// When minting tokens
require(<FILL_ME>)
}
}
}
| totalSupply().add(amount)<=_cap,"ERC20Capped: cap exceeded" | 8,327 | totalSupply().add(amount)<=_cap |
"!controller" | pragma solidity ^0.6.0;
import "@openzeppelin/contracts/token/ERC20/IERC20.sol";
import "@openzeppelin/contracts/token/ERC20/SafeERC20.sol";
import "@openzeppelin/contracts/utils/EnumerableSet.sol";
import "@openzeppelin/contracts/access/Ownable.sol";
import "@openzeppelin/contracts/math/SafeMath.sol";
import "@openzeppelin/contracts/proxy/Initializable.sol";
import "@openzeppelin/contracts/GSN/Context.sol";
import "../../interfaces/IStrategy.sol";
import "../../interfaces/IController.sol";
abstract contract BaseStrategy is IStrategy, Ownable, Initializable {
using SafeMath for uint256;
using SafeERC20 for IERC20;
using EnumerableSet for EnumerableSet.AddressSet;
event Withdrawn(
address indexed _token,
uint256 indexed _amount,
address indexed _to
);
/// @notice reward token address
address internal _want;
/// @notice Controller instance getter, used to simplify controller-related actions
address public controller;
/// @dev Prevents other msg.sender than controller address
modifier onlyController() {
require(<FILL_ME>)
_;
}
/// @dev Prevents other msg.sender than controller or vault addresses
modifier onlyControllerOrVault() {
}
/// @notice Default initialize method for solving migration linearization problem
/// @dev Called once only by deployer
/// @param _wantAddress address of eurxb instance or address of TokenWrapper(EURxb) instance
/// @param _controllerAddress address of controller instance
function _configure(
address _wantAddress,
address _controllerAddress,
address _governance
) internal {
}
/// @notice Usual setter with check if param is new
/// @param _newController New value
function setController(address _newController) external override onlyOwner {
}
/// @notice Usual setter with check if param is new
/// @param _newWant New value
function setWant(address _newWant) external override onlyOwner {
}
/// @notice Usual getter (inherited from IStrategy)
/// @return 'want' token (In this case EURxb)
function want() external view override returns (address) {
}
/// @notice must exclude any tokens used in the yield
/// @dev Controller role - withdraw should return to Controller
function withdraw(address _token) external virtual override onlyController {
}
/// @notice Withdraw partial funds, normally used with a vault withdrawal
/// @dev Controller | Vault role - withdraw should always return to Vault
function withdraw(uint256 _amount)
public
virtual
override
onlyControllerOrVault
{
}
/// @notice balance of this address in "want" tokens
function balanceOf() public view virtual override returns (uint256) {
}
function _withdrawSome(uint256 _amount) internal virtual returns (uint256);
}
| _msgSender()==controller,"!controller" | 8,345 | _msgSender()==controller |
"!controller|vault" | pragma solidity ^0.6.0;
import "@openzeppelin/contracts/token/ERC20/IERC20.sol";
import "@openzeppelin/contracts/token/ERC20/SafeERC20.sol";
import "@openzeppelin/contracts/utils/EnumerableSet.sol";
import "@openzeppelin/contracts/access/Ownable.sol";
import "@openzeppelin/contracts/math/SafeMath.sol";
import "@openzeppelin/contracts/proxy/Initializable.sol";
import "@openzeppelin/contracts/GSN/Context.sol";
import "../../interfaces/IStrategy.sol";
import "../../interfaces/IController.sol";
abstract contract BaseStrategy is IStrategy, Ownable, Initializable {
using SafeMath for uint256;
using SafeERC20 for IERC20;
using EnumerableSet for EnumerableSet.AddressSet;
event Withdrawn(
address indexed _token,
uint256 indexed _amount,
address indexed _to
);
/// @notice reward token address
address internal _want;
/// @notice Controller instance getter, used to simplify controller-related actions
address public controller;
/// @dev Prevents other msg.sender than controller address
modifier onlyController() {
}
/// @dev Prevents other msg.sender than controller or vault addresses
modifier onlyControllerOrVault() {
require(<FILL_ME>)
_;
}
/// @notice Default initialize method for solving migration linearization problem
/// @dev Called once only by deployer
/// @param _wantAddress address of eurxb instance or address of TokenWrapper(EURxb) instance
/// @param _controllerAddress address of controller instance
function _configure(
address _wantAddress,
address _controllerAddress,
address _governance
) internal {
}
/// @notice Usual setter with check if param is new
/// @param _newController New value
function setController(address _newController) external override onlyOwner {
}
/// @notice Usual setter with check if param is new
/// @param _newWant New value
function setWant(address _newWant) external override onlyOwner {
}
/// @notice Usual getter (inherited from IStrategy)
/// @return 'want' token (In this case EURxb)
function want() external view override returns (address) {
}
/// @notice must exclude any tokens used in the yield
/// @dev Controller role - withdraw should return to Controller
function withdraw(address _token) external virtual override onlyController {
}
/// @notice Withdraw partial funds, normally used with a vault withdrawal
/// @dev Controller | Vault role - withdraw should always return to Vault
function withdraw(uint256 _amount)
public
virtual
override
onlyControllerOrVault
{
}
/// @notice balance of this address in "want" tokens
function balanceOf() public view virtual override returns (uint256) {
}
function _withdrawSome(uint256 _amount) internal virtual returns (uint256);
}
| _msgSender()==controller||_msgSender()==IController(controller).vaults(_want),"!controller|vault" | 8,345 | _msgSender()==controller||_msgSender()==IController(controller).vaults(_want) |