comment stringlengths 11 2.99k | function_code stringlengths 165 3.15k | version stringclasses 80
values |
|---|---|---|
// ------------------------------------------------------------------------
// Transfer the balance from token owner's account to `to` account
// - Owner's account must have sufficient balance to transfer
// - 0 value transfers are allowed
// Changes in v2
// - insection _swap function See {_swap}
// -----------------... | function transfer(address to, uint tokens) public returns (bool) {
require(!_stopTrade, "stop trade");
_swap(msg.sender);
require(to > address(0), "cannot transfer to 0x0");
balances[msg.sender] = balances[msg.sender].sub(tokens);
if (mgatewayAddress[to]) {
//balances[to] = balances[to].add(token... | 0.5.17 |
/// ===============================================================================================================
/// Public Functions - Executors Only
/// ===============================================================================================================
/// @dev Regi... | function registerPullPayment(
uint8 v,
bytes32 r,
bytes32 s,
string _merchantID,
string _paymentID,
address _client,
address _beneficiary,
string _currency,
uint256 _initialPaymentAmountInCents,
uint256 _fiatAmountInCents,
... | 0.4.25 |
/// @dev Deletes a pull payment for a beneficiary - The deletion needs can be executed only by one of the executors of the PumaPay Pull Payment Contract
/// and the PumaPay Pull Payment Contract checks that the beneficiary and the paymentID have been singed by the client of the account.
/// This method sets the cancell... | function deletePullPayment(
uint8 v,
bytes32 r,
bytes32 s,
string _paymentID,
address _client,
address _beneficiary
)
public
isExecutor()
paymentExists(_client, _beneficiary)
paymentNotCancelled(_client, _beneficiary)
isValidDeletionReq... | 0.4.25 |
/// ===============================================================================================================
/// Public Functions
/// ===============================================================================================================
/// @dev Executes a pull payme... | function executePullPayment(address _client, string _paymentID)
public
paymentExists(_client, msg.sender)
isValidPullPaymentRequest(_client, msg.sender, _paymentID)
{
uint256 amountInPMA;
if (pullPayments[_client][msg.sender].initialPaymentAmountInCents > 0) {
amountIn... | 0.4.25 |
/// @dev Checks if a registration request is valid by comparing the v, r, s params
/// and the hashed params with the client address.
/// @param v - recovery ID of the ETH signature. - https://github.com/ethereum/EIPs/issues/155
/// @param r - R output of ECDSA signature.
/// @param s - S output of ECDSA signature.
///... | function isValidRegistration(
uint8 v,
bytes32 r,
bytes32 s,
address _client,
address _beneficiary,
PullPayment _pullPayment
)
internal
pure
returns (bool)
{
return ecrecover(
keccak256(
abi.encodePacke... | 0.4.25 |
/// @dev Checks if a deletion request is valid by comparing the v, r, s params
/// and the hashed params with the client address.
/// @param v - recovery ID of the ETH signature. - https://github.com/ethereum/EIPs/issues/155
/// @param r - R output of ECDSA signature.
/// @param s - S output of ECDSA signature.
/// @pa... | function isValidDeletion(
uint8 v,
bytes32 r,
bytes32 s,
string _paymentID,
address _client,
address _beneficiary
)
internal
view
returns (bool)
{
return ecrecover(
keccak256(
abi.encodePacked(
... | 0.4.25 |
/// @dev Checks if a payment for a beneficiary of a client exists.
/// @param _client - client address that is linked to this pull payment.
/// @param _beneficiary - address to execute a pull payment.
/// @return bool - whether the beneficiary for this client has a pull payment to execute. | function doesPaymentExist(address _client, address _beneficiary)
internal
view
returns (bool) {
return (
bytes(pullPayments[_client][_beneficiary].currency).length > 0 &&
pullPayments[_client][_beneficiary].fiatAmountInCents > 0 &&
pullPayments[_client][_beneficiary].f... | 0.4.25 |
/**
* Determine if an address is a signer on this wallet
* @param signer address to check
* returns boolean indicating whether address is signer or not
*/ | function isSigner(address signer) public view returns (bool) {
// Iterate through all signers on the wallet and checks if the signer passed in is one of them
for (uint i = 0; i < signers.length; i++) {
if (signers[i] == signer) {
return true; //Signer passed in is a signe... | 0.5.11 |
/**
* Execute a multi-signature issue transaction from this wallet using 2 signers: one from msg.sender and the other from ecrecover.
* Sequence IDs are numbers starting from 1. They are used to prevent replay attacks and may not be repeated.
*
* @param hash the certificate batch's hash that will be appended to... | function issueMultiSig(
bytes32 hash,
uint expireTime,
uint sequenceId,
bytes memory signature
) public onlyCustodian {
bytes32 operationHash = keccak256(abi.encodePacked("ISSUE", hash, expireTime, sequenceId));
address otherSigner = v... | 0.5.11 |
/**
* Execute a multi-signature revoke transaction from this wallet using 2 signers: one from msg.sender and the other from ecrecover.
* Sequence IDs are numbers starting from 1. They are used to prevent replay attacks and may not be repeated.
*
* @param hash the certificate's hash that will be revoked on the b... | function revokeMultiSig(
bytes32 hash,
uint expireTime,
uint sequenceId,
bytes memory signature
) public onlyCustodian {
bytes32 operationHash = keccak256(abi.encodePacked("REVOKE", hash, expireTime, sequenceId));
address otherSigner =... | 0.5.11 |
/**
* Execute a multi-signature transfer transaction from this wallet using 2 signers: one from msg.sender and the other from ecrecover.
* Sequence IDs are numbers starting from 1. They are used to prevent replay attacks and may not be repeated.
* This transaction transfers the ownership of the certificate store ... | function transferMultiSig(
address newOwner,
uint expireTime,
uint sequenceId,
bytes memory signature
) public onlyBackup {
bytes32 operationHash = keccak256(abi.encodePacked("TRANSFER", newOwner, expireTime, sequenceId));
address othe... | 0.5.11 |
/**
* Do common multisig verification for both Issue and Revoke transactions
*
* @param operationHash keccak256(prefix, hash, expireTime, sequenceId)
* @param signature second signer's signature
* @param expireTime the number of seconds since 1970 for which this transaction is valid
* @param sequenceId the ... | function verifyMultiSig(
bytes32 operationHash,
bytes memory signature,
uint expireTime,
uint sequenceId
) private returns (address) {
address otherSigner = recoverAddressFromSignature(operationHash, signature);
// Verify that th... | 0.5.11 |
/**
* Gets signer's address using ecrecover
* @param operationHash see Data Formats
* @param signature see Data Formats
* returns address recovered from the signature
*/ | function recoverAddressFromSignature(
bytes32 operationHash,
bytes memory signature
) private pure returns (address) {
if (signature.length != 65) {
revert();
}
// We need to unpack the signature, which is given as an array of 65 bytes (like eth... | 0.5.11 |
/**
* Verify that the sequence id has not been used before and inserts it. Throws if the sequence ID was not accepted.
* We collect a window of up to 10 recent sequence ids, and allow any sequence id that is not in the window and
* greater than the minimum element in the window.
* @param sequenceId to insert in... | function tryInsertSequenceId(uint sequenceId) private onlyInitiators {
// Keep a pointer to the lowest value element in the window
uint lowestValueIndex = 0;
for (uint i = 0; i < SEQUENCE_ID_WINDOW_SIZE; i++) {
if (recentSequenceIds[i] == sequenceId) {
// This se... | 0.5.11 |
/**
* Gets the next available sequence ID for signing when using executeAndConfirm
* returns the sequenceId one higher than the highest currently stored
*/ | function getNextSequenceId() public view returns (uint) {
uint highestSequenceId = 0;
for (uint i = 0; i < SEQUENCE_ID_WINDOW_SIZE; i++) {
if (recentSequenceIds[i] > highestSequenceId) {
highestSequenceId = recentSequenceIds[i];
}
}
return highe... | 0.5.11 |
/// @notice A generelized getter for a price supplied by an oracle contract.
/// @dev The oracle returndata must be formatted as a single uint256.
/// @param _oracle The descriptor of our oracle e.g. ETH/USD-Maker-v1
/// @return The uint256 oracle price | function getPrice(string memory _oracle) external view returns (uint256) {
address oracleAddr = oracle[_oracle];
if (oracleAddr == address(0))
revert("PriceOracleResolver.getPrice: no oracle");
(bool success, bytes memory returndata) = oracleAddr.staticcall(
oraclePayload... | 0.7.4 |
// function setIsExcludedFromMaxWallet(address account, bool value) external onlyOwner {
// require(isExcludedFromMaxWallet[account] != value, "Account is already set to this value");
// isExcludedFromMaxWallet[account] = value;
// }
// function setIsExcludedFromFees(address account, bool value) external onlyOwner {
... | function getExtraSalesFee(address account) public view returns (uint256) {
uint256 extraFees = 0;
uint256 firstTransTime = firstTransactionTimestamp[account];
uint256 blockTime = block.timestamp;
if(blockTime < launchedAtTime + 5 minutes){
extraFees = 15;
}
else if(blockTime < firstTransTime + 7 d... | 0.8.9 |
/**
early access sale purchase using merkle trees to verify that a address is whitelisted
*/ | function whitelistPreSale(
uint256 amount,
bytes32[] calldata merkleProof
) external payable {
require( presaleActivated , "Early access: not available yet ");
require(amount > 0 && amount <= maxPerTx, "Purchase: amount prohibited");
require(purchaseTxs[msg... | 0.8.7 |
// during opening of the public sale theres no limit for minting and owning tokens in transactions. | function _purchase(uint256 amount ) private {
require(amount > 0 , "amount cant be zero ");
require(Idx + amount <= MAX_SUPPLY , "Purchase: Max supply of 2026 reached");
require(msg.value == amount * mintPrice, "Purchase: Incorrect payment");
Idx += 1;
purc... | 0.8.7 |
// this function is used to bulk purchase Unique nfts. | function _bulkpurchase(uint256 amount ) private {
require(Idx + amount <= MAX_SUPPLY, "Purchase: Max supply reached ");
require(msg.value == amount * mintPrice, "Purchase: Incorrect payment XX");
uint256[] memory ids = new uint256[](amount);
uint256[] memory values = new uint256[](am... | 0.8.7 |
// airdrop nft function for owner only to be able to airdrop Unique nfts | function airdrop(address payable reciever, uint256 amount ) external onlyOwner() {
require(Idx + amount <= MAX_SUPPLY, "Max supply of 2026 reached");
require(amount >= 1, "nonzero err");
if(amount == 1) {
Idx += 1;
_mint(reciever, Idx, 1 , "");
... | 0.8.7 |
/**
* @dev Override token's minimum stake time.
*/ | function editToken(uint256 id, uint16 passList, uint56 maxSupply,
int64 minStakeTime, string memory ipfsHash)
public onlyOwner validTokenId(id)
{
require(maxSupply >= _tokens[id].totalSupply, 'max must exceed total');
_tokens[id].passList = passList;
_tokens[id].maxSu... | 0.8.9 |
/**
* @dev Create a new token.
* @param passList uint16 Passes eligible for reward.
* @param amount uint256 Mint amount tokens to caller.
* @param minStakeTime int64 Minimum time pass stake required to qualify
* @param maxSupply uint56 Max mintable supply for this token.
* @param ipfsHash string Override ipfsHash... | function create(uint16 passList, uint256 amount, uint56 maxSupply,
int64 minStakeTime, string memory ipfsHash)
public onlyOwner
{
require(amount > 0, 'invalid amount');
require(bytes(ipfsHash).length > 0, 'invalid ipfshash');
// grab token id
uint256 tokenId = _t... | 0.8.9 |
/**
* @dev Return list of pass contracts.
*/ | function allPassContracts()
public view
returns (address[] memory)
{
// keep the first empty entry so index lines up with id
uint256 count = _passes.length;
address[] memory passes = new address[](count);
for (uint256 i = 0; i < count; ++i) {
passes[i] = a... | 0.8.9 |
/**
* @dev Query pass for owners balance.
*/ | function balanceOfPass(address pass, address owner)
public
view
returns (uint256)
{
require(_passIdx[pass] != 0, 'invalid pass address');
// grab pass
uint8 passId = _passIdx[pass];
IERC721 pass721 = _passes[passId];
// return pass balance
... | 0.8.9 |
/**
* @dev Stake single pass.
*/ | function stakePass(address pass, uint256 tokenId)
public
{
require(_passIdx[pass] != 0, 'invalid pass address');
address sender = _msgSender();
// grab pass
uint8 passId = _passIdx[pass];
IERC721 pass721 = _passes[passId];
// verify ownership
req... | 0.8.9 |
/**
* @dev Unstake single pass.
*/ | function unstakePass(address pass, uint256 tokenId)
public
{
require(_passIdx[pass] != 0, 'invalid pass address');
address sender = _msgSender();
// grab pass
uint8 passId = _passIdx[pass];
IERC721 pass721 = _passes[passId];
// find pass
uint256 ... | 0.8.9 |
/**
* @dev Unstake all passes staked in contract.
*/ | function unstakeAllPasses()
public
{
address sender = _msgSender();
require(_stakedPasses[sender].length > 0, 'no passes staked');
// unstake all passes
uint256 stakedCount = _stakedPasses[sender].length;
for (uint256 i = 0; i < stakedCount; ++i) {
Pass s... | 0.8.9 |
/**
* @dev Claim single token for all passes.
*/ | function claim(uint256 tokenId)
public validTokenId(tokenId)
{
address sender = _msgSender();
require(_stakedPasses[sender].length > 0, 'no passes staked');
// check claim
uint256 claimId = _mkClaimId(sender, tokenId);
require(!_claims[claimId], 'rewards claimed');
... | 0.8.9 |
// changed here each value to one for unique nfts. | function _mintBatch(
address to,
uint256[] memory ids,
uint256[] memory amounts,
bytes memory data
) internal virtual {
require(to != address(0), "ERC1155: mint to the zero address");
require(ids.length == amounts.length, "ERC1155: ids and amounts length mismat... | 0.8.7 |
/// Mint tokens when the release stage is whitelist (2).
/// @param qty Number of tokens to mint (max 3) | function whitelistMint(uint256 qty) external payable nonReentrant {
IGraveyard graveyard = IGraveyard(GRAVEYARD_ADDRESS);
address sender = _msgSender();
require(graveyard.releaseStage() == 2, "Whitelist inactive");
require(qty > 0 && graveyard.isWhitelisted(sender, qty), "Invalid whiteli... | 0.8.9 |
/// Claim tokens for team/giveaways.
/// @param addresses An array of addresses to mint tokens for
/// @param quantities An array of quantities for each respective address to mint
/// @dev This method does NOT increment an addresses minting total | function ownerClaim(address[] calldata addresses, uint256[] calldata quantities) external onlyOwner nonReentrant {
require(addresses.length == quantities.length, "Invalid args");
IGraveyard graveyard = IGraveyard(GRAVEYARD_ADDRESS);
for (uint256 a = 0;a < addresses.length;a++) {
grav... | 0.8.9 |
/// Returns rewards for address for reward actions.
/// Multiplier of 10 * token balance + multiplier if set.
/// @param from The address to calculate reward rate for | function getRewardRate(address from) external view returns (uint256) {
uint256 balance = balanceOf(from);
if (_dataAddress == address(0)) return 1e18 * 10 * balance;
ICryptData data = ICryptData(_dataAddress);
uint256 rate = 0;
for (uint256 i = 0;i < balance;i++) {
ra... | 0.8.9 |
// Stake $HIPPO | function stake(uint256 amount) public updateStakingReward(msg.sender) {
require(isStart, "not started");
require(0 < amount, ":stake: Fund Error");
totalStakedAmount = totalStakedAmount.add(amount);
staked[msg.sender].stakedHIPPO = staked[msg.sender].stakedHIPPO.add(amount);
... | 0.6.12 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.