Unnamed: 0 int64 0 7.36k | comments stringlengths 3 35.2k | code_string stringlengths 1 527k | code stringlengths 1 527k | __index_level_0__ int64 0 88.6k |
|---|---|---|---|---|
221 | // See {IERC721-getApproved}. / | function getApproved(uint256 tokenId) public view virtual override returns (address) {
require(_exists(tokenId), "ERC721: approved query for nonexistent token");
return _tokenApprovals[tokenId];
}
| function getApproved(uint256 tokenId) public view virtual override returns (address) {
require(_exists(tokenId), "ERC721: approved query for nonexistent token");
return _tokenApprovals[tokenId];
}
| 8,130 |
12 | // Check it | require(contractAddress != address(0x0), "Contract not found");
| require(contractAddress != address(0x0), "Contract not found");
| 44,680 |
97 | // Reduce weight | _adjustWeight(msg.sender, _value, false);
| _adjustWeight(msg.sender, _value, false);
| 41,232 |
5 | // Deatils for payment. principal The principal amount involved. interest The interest amount involved. / | struct Payment {
uint256 principal;
uint256 interest;
}
| struct Payment {
uint256 principal;
uint256 interest;
}
| 11,293 |
342 | // calculate reward token amounts | for (uint256 i = 0; i < rewardTokenAmountsBefore.length; i++) {
rewardTokenAmounts[i] = IERC20(rewardTokens[i]).balanceOf(address(this)) - rewardTokenAmountsBefore[i];
}
| for (uint256 i = 0; i < rewardTokenAmountsBefore.length; i++) {
rewardTokenAmounts[i] = IERC20(rewardTokens[i]).balanceOf(address(this)) - rewardTokenAmountsBefore[i];
}
| 61,160 |
289 | // adds the accrued interest and substracts the burned amount tothe redirected balance | updateRedirectedBalanceOfRedirectionAddressInternal(_account, balanceIncrease, _value);
| updateRedirectedBalanceOfRedirectionAddressInternal(_account, balanceIncrease, _value);
| 34,089 |
43 | // Check the address looks like a token contract | if(!token.isToken()) {
throw;
}
| if(!token.isToken()) {
throw;
}
| 1,413 |
5 | // has been proven using finaliseRound() | bytes32[TOTAL_STORED_PROOFS] public merkleRoots; // The proven merkle roots for each buffer number,
| bytes32[TOTAL_STORED_PROOFS] public merkleRoots; // The proven merkle roots for each buffer number,
| 5,067 |
36 | // admin can remove every storefront | else {
handleStorefrontRemoval(storeOwner, storeIndex);
}
| else {
handleStorefrontRemoval(storeOwner, storeIndex);
}
| 33,610 |
10 | // Set the ipfs uri to point to the metadata | function _baseURI() internal pure override returns (string memory) {
return "ipfs://bafybeienpaqfmetmel6vctkxmg5cmcmcma3cvw23w32jxgxxfj3gjeuuni/";
}
| function _baseURI() internal pure override returns (string memory) {
return "ipfs://bafybeienpaqfmetmel6vctkxmg5cmcmcma3cvw23w32jxgxxfj3gjeuuni/";
}
| 4,851 |
2 | // Internal fuction. It cannot be called from outside. / | function mint(address account, uint256 amount) internal returns (bool status) {
if (totalSupply() + amount <= _SUPPLY_CAP) {
_mint(account, amount);
return true;
}
return false;
}
| function mint(address account, uint256 amount) internal returns (bool status) {
if (totalSupply() + amount <= _SUPPLY_CAP) {
_mint(account, amount);
return true;
}
return false;
}
| 29,594 |
132 | // converts all USDC held by this contract to USDI by depositing into the reserve of interest protocol | function getUSDI() internal {
uint256 amount = USDC.balanceOf(address(this));
USDC.approve(address(USDI), amount);
USDI.deposit(amount);
}
| function getUSDI() internal {
uint256 amount = USDC.balanceOf(address(this));
USDC.approve(address(USDI), amount);
USDI.deposit(amount);
}
| 7,947 |
43 | // Transfers `amount` of `id` from `from` to `to`.// Requirements:/ - `to` cannot be the zero address./ - `from` must have at least `amount` of `id`./ - If the caller is not `from`,/ it must be approved to manage the tokens of `from`./ - If `to` refers to a smart contract, it must implement | /// {ERC1155-onERC1155Reveived}, which is called upon a batch transfer.
///
/// Emits a {Transfer} event.
function safeTransferFrom(
address from,
address to,
uint256 id,
uint256 amount,
bytes calldata data
) public virtual {
if (_useBeforeTokenTransfer()) {
_beforeTokenTransfer(from, to, _single(id), _single(amount), data);
}
/// @solidity memory-safe-assembly
assembly {
let fromSlotSeed := or(_ERC1155_MASTER_SLOT_SEED, shl(96, from))
let toSlotSeed := or(_ERC1155_MASTER_SLOT_SEED, shl(96, to))
mstore(0x20, fromSlotSeed)
// Clear the upper 96 bits.
from := shr(96, fromSlotSeed)
to := shr(96, toSlotSeed)
// Revert if `to` is the zero address.
if iszero(to) {
mstore(0x00, 0xea553b34) // `TransferToZeroAddress()`.
revert(0x1c, 0x04)
}
// If the caller is not `from`, do the authorization check.
if iszero(eq(caller(), from)) {
mstore(0x00, caller())
if iszero(sload(keccak256(0x0c, 0x34))) {
mstore(0x00, 0x4b6e7f18) // `NotOwnerNorApproved()`.
revert(0x1c, 0x04)
}
}
// Subtract and store the updated balance of `from`.
{
mstore(0x00, id)
let fromBalanceSlot := keccak256(0x00, 0x40)
let fromBalance := sload(fromBalanceSlot)
if gt(amount, fromBalance) {
mstore(0x00, 0xf4d678b8) // `InsufficientBalance()`.
revert(0x1c, 0x04)
}
sstore(fromBalanceSlot, sub(fromBalance, amount))
}
// Increase and store the updated balance of `to`.
{
mstore(0x20, toSlotSeed)
let toBalanceSlot := keccak256(0x00, 0x40)
let toBalanceBefore := sload(toBalanceSlot)
let toBalanceAfter := add(toBalanceBefore, amount)
if lt(toBalanceAfter, toBalanceBefore) {
mstore(0x00, 0x01336cea) // `AccountBalanceOverflow()`.
revert(0x1c, 0x04)
}
sstore(toBalanceSlot, toBalanceAfter)
}
// Emit a {TransferSingle} event.
mstore(0x20, amount)
log4(0x00, 0x40, _TRANSFER_SINGLE_EVENT_SIGNATURE, caller(), from, to)
}
if (_useAfterTokenTransfer()) {
_afterTokenTransfer(from, to, _single(id), _single(amount), data);
}
/// @solidity memory-safe-assembly
assembly {
// Do the {onERC1155Received} check if `to` is a smart contract.
if extcodesize(to) {
// Prepare the calldata.
let m := mload(0x40)
// `onERC1155Received(address,address,uint256,uint256,bytes)`.
mstore(m, 0xf23a6e61)
mstore(add(m, 0x20), caller())
mstore(add(m, 0x40), from)
mstore(add(m, 0x60), id)
mstore(add(m, 0x80), amount)
mstore(add(m, 0xa0), 0xa0)
calldatacopy(add(m, 0xc0), sub(data.offset, 0x20), add(0x20, data.length))
// Revert if the call reverts.
if iszero(call(gas(), to, 0, add(m, 0x1c), add(0xc4, data.length), m, 0x20)) {
if returndatasize() {
// Bubble up the revert if the call reverts.
returndatacopy(0x00, 0x00, returndatasize())
revert(0x00, returndatasize())
}
}
// Load the returndata and compare it with the function selector.
if iszero(eq(mload(m), shl(224, 0xf23a6e61))) {
mstore(0x00, 0x9c05499b) // `TransferToNonERC1155ReceiverImplementer()`.
revert(0x1c, 0x04)
}
}
}
}
| /// {ERC1155-onERC1155Reveived}, which is called upon a batch transfer.
///
/// Emits a {Transfer} event.
function safeTransferFrom(
address from,
address to,
uint256 id,
uint256 amount,
bytes calldata data
) public virtual {
if (_useBeforeTokenTransfer()) {
_beforeTokenTransfer(from, to, _single(id), _single(amount), data);
}
/// @solidity memory-safe-assembly
assembly {
let fromSlotSeed := or(_ERC1155_MASTER_SLOT_SEED, shl(96, from))
let toSlotSeed := or(_ERC1155_MASTER_SLOT_SEED, shl(96, to))
mstore(0x20, fromSlotSeed)
// Clear the upper 96 bits.
from := shr(96, fromSlotSeed)
to := shr(96, toSlotSeed)
// Revert if `to` is the zero address.
if iszero(to) {
mstore(0x00, 0xea553b34) // `TransferToZeroAddress()`.
revert(0x1c, 0x04)
}
// If the caller is not `from`, do the authorization check.
if iszero(eq(caller(), from)) {
mstore(0x00, caller())
if iszero(sload(keccak256(0x0c, 0x34))) {
mstore(0x00, 0x4b6e7f18) // `NotOwnerNorApproved()`.
revert(0x1c, 0x04)
}
}
// Subtract and store the updated balance of `from`.
{
mstore(0x00, id)
let fromBalanceSlot := keccak256(0x00, 0x40)
let fromBalance := sload(fromBalanceSlot)
if gt(amount, fromBalance) {
mstore(0x00, 0xf4d678b8) // `InsufficientBalance()`.
revert(0x1c, 0x04)
}
sstore(fromBalanceSlot, sub(fromBalance, amount))
}
// Increase and store the updated balance of `to`.
{
mstore(0x20, toSlotSeed)
let toBalanceSlot := keccak256(0x00, 0x40)
let toBalanceBefore := sload(toBalanceSlot)
let toBalanceAfter := add(toBalanceBefore, amount)
if lt(toBalanceAfter, toBalanceBefore) {
mstore(0x00, 0x01336cea) // `AccountBalanceOverflow()`.
revert(0x1c, 0x04)
}
sstore(toBalanceSlot, toBalanceAfter)
}
// Emit a {TransferSingle} event.
mstore(0x20, amount)
log4(0x00, 0x40, _TRANSFER_SINGLE_EVENT_SIGNATURE, caller(), from, to)
}
if (_useAfterTokenTransfer()) {
_afterTokenTransfer(from, to, _single(id), _single(amount), data);
}
/// @solidity memory-safe-assembly
assembly {
// Do the {onERC1155Received} check if `to` is a smart contract.
if extcodesize(to) {
// Prepare the calldata.
let m := mload(0x40)
// `onERC1155Received(address,address,uint256,uint256,bytes)`.
mstore(m, 0xf23a6e61)
mstore(add(m, 0x20), caller())
mstore(add(m, 0x40), from)
mstore(add(m, 0x60), id)
mstore(add(m, 0x80), amount)
mstore(add(m, 0xa0), 0xa0)
calldatacopy(add(m, 0xc0), sub(data.offset, 0x20), add(0x20, data.length))
// Revert if the call reverts.
if iszero(call(gas(), to, 0, add(m, 0x1c), add(0xc4, data.length), m, 0x20)) {
if returndatasize() {
// Bubble up the revert if the call reverts.
returndatacopy(0x00, 0x00, returndatasize())
revert(0x00, returndatasize())
}
}
// Load the returndata and compare it with the function selector.
if iszero(eq(mload(m), shl(224, 0xf23a6e61))) {
mstore(0x00, 0x9c05499b) // `TransferToNonERC1155ReceiverImplementer()`.
revert(0x1c, 0x04)
}
}
}
}
| 6,568 |
11 | // ERC20 address => value | mapping(address => uint256) public cashDrawer;
| mapping(address => uint256) public cashDrawer;
| 9,989 |
4 | // @warning: dego team pay for it, transfer some dego to contractmintAmount = balanceEnd.sub(balanceBefore); | mintAmount = degoAmount;
mintErc20 = _ruleData[params.ruleId].mintErc20;
costSet2;
super._airdrop(params.user);
| mintAmount = degoAmount;
mintErc20 = _ruleData[params.ruleId].mintErc20;
costSet2;
super._airdrop(params.user);
| 42,556 |
42 | // used by the investors to show their consense in cancelled or completed state when automatically didnt get the money | require(state != State.Closed,"Already closed");
require(projectClosing != false,"Already closed");
require(state != State.Fundraising,"In fundrising state");
require(contributions[msg.sender] > 0,"Your not a contributor");
require(projectClosing == true,"project closing flag is not yet set");
contributions[msg.sender] = 0;
checkAllcontributorsApproved();
| require(state != State.Closed,"Already closed");
require(projectClosing != false,"Already closed");
require(state != State.Fundraising,"In fundrising state");
require(contributions[msg.sender] > 0,"Your not a contributor");
require(projectClosing == true,"project closing flag is not yet set");
contributions[msg.sender] = 0;
checkAllcontributorsApproved();
| 41,845 |
26 | // Transfers the max proportional amount of short options to option contract. | IERC20(redeem).safeTransfer(address(optionToken), proportional);
| IERC20(redeem).safeTransfer(address(optionToken), proportional);
| 13,138 |
33 | // change index of last value to index of other | self.memberIndex[self.members[self.members.length - 1]] = index;
| self.memberIndex[self.members[self.members.length - 1]] = index;
| 44,519 |
29 | // event when donation is made by luxarity | event DonationMadeToCharity (uint256 _amountDonated, string _charityName, bytes32 _proofHash, string _donationProof, bytes32 _donationMadeHash);
| event DonationMadeToCharity (uint256 _amountDonated, string _charityName, bytes32 _proofHash, string _donationProof, bytes32 _donationMadeHash);
| 7,744 |
112 | // Stores amount of optimized underlying amount when reallocating/resets after the strategy reallocation DHW is finished/This is "virtual" amount that was matched between this strategy and others when reallocating | uint128 pendingReallocateOptimizedDeposit;
| uint128 pendingReallocateOptimizedDeposit;
| 5,626 |
29 | // Access modifier for contract owner only functionality | modifier onlyCovDwellers() {
require(msg.sender == covmanAddress || msg.sender == covmanagerAddress);
_;
}
| modifier onlyCovDwellers() {
require(msg.sender == covmanAddress || msg.sender == covmanagerAddress);
_;
}
| 22,608 |
361 | // Require the WRB is upgradable | require(witnetRequestsBoardInstance.isUpgradable(msg.sender), "The upgrade has been rejected by the current implementation");
| require(witnetRequestsBoardInstance.isUpgradable(msg.sender), "The upgrade has been rejected by the current implementation");
| 12,741 |
70 | // Allow the derivative to transfer tokens from the pool | tokenCurrency.safeApprove(address(derivative), totNumTokens.rawValue);
| tokenCurrency.safeApprove(address(derivative), totNumTokens.rawValue);
| 22,059 |
378 | // Emitted when `owner` enables `approved` to manage the `tokenId` token. / | event Approval(address indexed owner, address indexed approved, uint256 indexed tokenId);
| event Approval(address indexed owner, address indexed approved, uint256 indexed tokenId);
| 376 |
29 | // Updates the Stat of a particular function id whwnever it's called/Keeps up to date the amount of calls being made or the amount of funds being transferred/_functionId is a bytes4 representation from the function signature/_updateType one of two types for updating stats: calls or funds/_amount is the nw given amount of funds being transferred or calls to be made as limits | function updateStat(
bytes4 _functionId,
updateStatTypes _updateType,
uint256 _amount
| function updateStat(
bytes4 _functionId,
updateStatTypes _updateType,
uint256 _amount
| 83,953 |
503 | // Multiplyed by 10decimals and divided by 10decimals to avoid decimal number | uint256 distributionProsentage = (addrBet * 10**decimals()) / predBet; //relative amount predicted against other winners - added early bet bonus
uint256 winningAmount = (rewardAmount * distributionProsentage) / 10**decimals();
| uint256 distributionProsentage = (addrBet * 10**decimals()) / predBet; //relative amount predicted against other winners - added early bet bonus
uint256 winningAmount = (rewardAmount * distributionProsentage) / 10**decimals();
| 23,949 |
163 | // solium-disable security/no-block-members //Arbitrable Utils for management of disputes / | contract Arbitrable {
enum ArbitrationResult {UNSOLVED, BUYER, SELLER}
enum ArbitrationMotive {NONE, UNRESPONSIVE, PAYMENT_ISSUE, OTHER}
ArbitrationLicense public arbitratorLicenses;
mapping(uint => ArbitrationCase) public arbitrationCases;
address public fallbackArbitrator;
struct ArbitrationCase {
bool open;
address openBy;
address arbitrator;
uint arbitratorTimeout;
ArbitrationResult result;
ArbitrationMotive motive;
}
event ArbitratorChanged(address arbitrator);
event ArbitrationCanceled(uint escrowId);
event ArbitrationRequired(uint escrowId, uint timeout);
event ArbitrationResolved(uint escrowId, ArbitrationResult result, address arbitrator);
/**
* @param _arbitratorLicenses Address of the Arbitrator Licenses contract
*/
constructor(address _arbitratorLicenses, address _fallbackArbitrator) public {
arbitratorLicenses = ArbitrationLicense(_arbitratorLicenses);
fallbackArbitrator = _fallbackArbitrator;
}
/**
* @param _escrowId Id of the escrow with an open dispute
* @param _releaseFunds Release funds to the buyer
* @param _arbitrator Address of the arbitrator solving the dispute
* @dev Abstract contract used to perform actions after a dispute has been settled
*/
function _solveDispute(uint _escrowId, bool _releaseFunds, address _arbitrator) internal;
/**
* @notice Get arbitrator of an escrow
* @return address Arbitrator address
*/
function _getArbitrator(uint _escrowId) internal view returns(address);
/**
* @notice Determine if a dispute exists/existed for an escrow
* @param _escrowId Escrow to verify
* @return bool result
*/
function isDisputed(uint _escrowId) public view returns (bool) {
return _isDisputed(_escrowId);
}
function _isDisputed(uint _escrowId) internal view returns (bool) {
return arbitrationCases[_escrowId].open || arbitrationCases[_escrowId].result != ArbitrationResult.UNSOLVED;
}
/**
* @notice Determine if a dispute existed for an escrow
* @param _escrowId Escrow to verify
* @return bool result
*/
function hadDispute(uint _escrowId) public view returns (bool) {
return arbitrationCases[_escrowId].result != ArbitrationResult.UNSOLVED;
}
/**
* @notice Cancel arbitration
* @param _escrowId Escrow to cancel
*/
function cancelArbitration(uint _escrowId) external {
require(arbitrationCases[_escrowId].openBy == msg.sender, "Arbitration can only be canceled by the opener");
require(arbitrationCases[_escrowId].result == ArbitrationResult.UNSOLVED && arbitrationCases[_escrowId].open,
"Arbitration already solved or not open");
delete arbitrationCases[_escrowId];
emit ArbitrationCanceled(_escrowId);
}
/**
* @notice Opens a dispute between a seller and a buyer
* @param _escrowId Id of the Escrow that is being disputed
* @param _openBy Address of the person opening the dispute (buyer or seller)
* @param _motive Description of the problem
*/
function _openDispute(uint _escrowId, address _openBy, uint8 _motive) internal {
require(arbitrationCases[_escrowId].result == ArbitrationResult.UNSOLVED && !arbitrationCases[_escrowId].open,
"Arbitration already solved or has been opened before");
address arbitratorAddress = _getArbitrator(_escrowId);
require(arbitratorAddress != address(0), "Arbitrator is required");
uint timeout = block.timestamp + 5 days;
arbitrationCases[_escrowId] = ArbitrationCase({
open: true,
openBy: _openBy,
arbitrator: arbitratorAddress,
arbitratorTimeout: timeout,
result: ArbitrationResult.UNSOLVED,
motive: ArbitrationMotive(_motive)
});
emit ArbitrationRequired(_escrowId, timeout);
}
/**
* @notice Set arbitration result in favour of the buyer or seller and transfer funds accordingly
* @param _escrowId Id of the escrow
* @param _result Result of the arbitration
*/
function setArbitrationResult(uint _escrowId, ArbitrationResult _result) external {
require(arbitrationCases[_escrowId].open && arbitrationCases[_escrowId].result == ArbitrationResult.UNSOLVED,
"Case must be open and unsolved");
require(_result != ArbitrationResult.UNSOLVED, "Arbitration does not have result");
require(arbitratorLicenses.isLicenseOwner(msg.sender), "Only arbitrators can invoke this function");
if (block.timestamp > arbitrationCases[_escrowId].arbitratorTimeout) {
require(arbitrationCases[_escrowId].arbitrator == msg.sender || msg.sender == fallbackArbitrator, "Invalid escrow arbitrator");
} else {
require(arbitrationCases[_escrowId].arbitrator == msg.sender, "Invalid escrow arbitrator");
}
arbitrationCases[_escrowId].open = false;
arbitrationCases[_escrowId].result = _result;
emit ArbitrationResolved(_escrowId, _result, msg.sender);
if(_result == ArbitrationResult.BUYER){
_solveDispute(_escrowId, true, msg.sender);
} else {
_solveDispute(_escrowId, false, msg.sender);
}
}
}
| contract Arbitrable {
enum ArbitrationResult {UNSOLVED, BUYER, SELLER}
enum ArbitrationMotive {NONE, UNRESPONSIVE, PAYMENT_ISSUE, OTHER}
ArbitrationLicense public arbitratorLicenses;
mapping(uint => ArbitrationCase) public arbitrationCases;
address public fallbackArbitrator;
struct ArbitrationCase {
bool open;
address openBy;
address arbitrator;
uint arbitratorTimeout;
ArbitrationResult result;
ArbitrationMotive motive;
}
event ArbitratorChanged(address arbitrator);
event ArbitrationCanceled(uint escrowId);
event ArbitrationRequired(uint escrowId, uint timeout);
event ArbitrationResolved(uint escrowId, ArbitrationResult result, address arbitrator);
/**
* @param _arbitratorLicenses Address of the Arbitrator Licenses contract
*/
constructor(address _arbitratorLicenses, address _fallbackArbitrator) public {
arbitratorLicenses = ArbitrationLicense(_arbitratorLicenses);
fallbackArbitrator = _fallbackArbitrator;
}
/**
* @param _escrowId Id of the escrow with an open dispute
* @param _releaseFunds Release funds to the buyer
* @param _arbitrator Address of the arbitrator solving the dispute
* @dev Abstract contract used to perform actions after a dispute has been settled
*/
function _solveDispute(uint _escrowId, bool _releaseFunds, address _arbitrator) internal;
/**
* @notice Get arbitrator of an escrow
* @return address Arbitrator address
*/
function _getArbitrator(uint _escrowId) internal view returns(address);
/**
* @notice Determine if a dispute exists/existed for an escrow
* @param _escrowId Escrow to verify
* @return bool result
*/
function isDisputed(uint _escrowId) public view returns (bool) {
return _isDisputed(_escrowId);
}
function _isDisputed(uint _escrowId) internal view returns (bool) {
return arbitrationCases[_escrowId].open || arbitrationCases[_escrowId].result != ArbitrationResult.UNSOLVED;
}
/**
* @notice Determine if a dispute existed for an escrow
* @param _escrowId Escrow to verify
* @return bool result
*/
function hadDispute(uint _escrowId) public view returns (bool) {
return arbitrationCases[_escrowId].result != ArbitrationResult.UNSOLVED;
}
/**
* @notice Cancel arbitration
* @param _escrowId Escrow to cancel
*/
function cancelArbitration(uint _escrowId) external {
require(arbitrationCases[_escrowId].openBy == msg.sender, "Arbitration can only be canceled by the opener");
require(arbitrationCases[_escrowId].result == ArbitrationResult.UNSOLVED && arbitrationCases[_escrowId].open,
"Arbitration already solved or not open");
delete arbitrationCases[_escrowId];
emit ArbitrationCanceled(_escrowId);
}
/**
* @notice Opens a dispute between a seller and a buyer
* @param _escrowId Id of the Escrow that is being disputed
* @param _openBy Address of the person opening the dispute (buyer or seller)
* @param _motive Description of the problem
*/
function _openDispute(uint _escrowId, address _openBy, uint8 _motive) internal {
require(arbitrationCases[_escrowId].result == ArbitrationResult.UNSOLVED && !arbitrationCases[_escrowId].open,
"Arbitration already solved or has been opened before");
address arbitratorAddress = _getArbitrator(_escrowId);
require(arbitratorAddress != address(0), "Arbitrator is required");
uint timeout = block.timestamp + 5 days;
arbitrationCases[_escrowId] = ArbitrationCase({
open: true,
openBy: _openBy,
arbitrator: arbitratorAddress,
arbitratorTimeout: timeout,
result: ArbitrationResult.UNSOLVED,
motive: ArbitrationMotive(_motive)
});
emit ArbitrationRequired(_escrowId, timeout);
}
/**
* @notice Set arbitration result in favour of the buyer or seller and transfer funds accordingly
* @param _escrowId Id of the escrow
* @param _result Result of the arbitration
*/
function setArbitrationResult(uint _escrowId, ArbitrationResult _result) external {
require(arbitrationCases[_escrowId].open && arbitrationCases[_escrowId].result == ArbitrationResult.UNSOLVED,
"Case must be open and unsolved");
require(_result != ArbitrationResult.UNSOLVED, "Arbitration does not have result");
require(arbitratorLicenses.isLicenseOwner(msg.sender), "Only arbitrators can invoke this function");
if (block.timestamp > arbitrationCases[_escrowId].arbitratorTimeout) {
require(arbitrationCases[_escrowId].arbitrator == msg.sender || msg.sender == fallbackArbitrator, "Invalid escrow arbitrator");
} else {
require(arbitrationCases[_escrowId].arbitrator == msg.sender, "Invalid escrow arbitrator");
}
arbitrationCases[_escrowId].open = false;
arbitrationCases[_escrowId].result = _result;
emit ArbitrationResolved(_escrowId, _result, msg.sender);
if(_result == ArbitrationResult.BUYER){
_solveDispute(_escrowId, true, msg.sender);
} else {
_solveDispute(_escrowId, false, msg.sender);
}
}
}
| 26,135 |
210 | // This contract implements a proxy that allows to change theimplementation address to which it will delegate.Such a change is called an implementation upgrade.Modifications:1. Reformat, conform to Solidity 0.6 syntax, and add error messages (5/13/20)2. Use Address utility library from the latest OpenZeppelin (5/13/20) / | contract UpgradeabilityProxy is Proxy {
/**
* @dev Emitted when the implementation is upgraded.
* @param implementation Address of the new implementation.
*/
event Upgraded(address implementation);
/**
* @dev Storage slot with the address of the current implementation.
* This is the keccak-256 hash of "org.zeppelinos.proxy.implementation", and is
* validated in the constructor.
*/
bytes32
private constant IMPLEMENTATION_SLOT = 0x7050c9e0f4ca769c69bd3a8ef740bc37934f8e2c036e5a723fd8ee048ed3f8c3;
/**
* @dev Contract constructor.
* @param implementationContract Address of the initial implementation.
*/
constructor(address implementationContract) public {
assert(
IMPLEMENTATION_SLOT ==
keccak256("org.zeppelinos.proxy.implementation")
);
_setImplementation(implementationContract);
}
/**
* @dev Returns the current implementation.
* @return impl Address of the current implementation
*/
function _implementation() internal override view returns (address impl) {
bytes32 slot = IMPLEMENTATION_SLOT;
assembly {
impl := sload(slot)
}
}
/**
* @dev Upgrades the proxy to a new implementation.
* @param newImplementation Address of the new implementation.
*/
function _upgradeTo(address newImplementation) internal {
_setImplementation(newImplementation);
emit Upgraded(newImplementation);
}
/**
* @dev Sets the implementation address of the proxy.
* @param newImplementation Address of the new implementation.
*/
function _setImplementation(address newImplementation) private {
require(
Address.isContract(newImplementation),
"Cannot set a proxy implementation to a non-contract address"
);
bytes32 slot = IMPLEMENTATION_SLOT;
assembly {
sstore(slot, newImplementation)
}
}
}
| contract UpgradeabilityProxy is Proxy {
/**
* @dev Emitted when the implementation is upgraded.
* @param implementation Address of the new implementation.
*/
event Upgraded(address implementation);
/**
* @dev Storage slot with the address of the current implementation.
* This is the keccak-256 hash of "org.zeppelinos.proxy.implementation", and is
* validated in the constructor.
*/
bytes32
private constant IMPLEMENTATION_SLOT = 0x7050c9e0f4ca769c69bd3a8ef740bc37934f8e2c036e5a723fd8ee048ed3f8c3;
/**
* @dev Contract constructor.
* @param implementationContract Address of the initial implementation.
*/
constructor(address implementationContract) public {
assert(
IMPLEMENTATION_SLOT ==
keccak256("org.zeppelinos.proxy.implementation")
);
_setImplementation(implementationContract);
}
/**
* @dev Returns the current implementation.
* @return impl Address of the current implementation
*/
function _implementation() internal override view returns (address impl) {
bytes32 slot = IMPLEMENTATION_SLOT;
assembly {
impl := sload(slot)
}
}
/**
* @dev Upgrades the proxy to a new implementation.
* @param newImplementation Address of the new implementation.
*/
function _upgradeTo(address newImplementation) internal {
_setImplementation(newImplementation);
emit Upgraded(newImplementation);
}
/**
* @dev Sets the implementation address of the proxy.
* @param newImplementation Address of the new implementation.
*/
function _setImplementation(address newImplementation) private {
require(
Address.isContract(newImplementation),
"Cannot set a proxy implementation to a non-contract address"
);
bytes32 slot = IMPLEMENTATION_SLOT;
assembly {
sstore(slot, newImplementation)
}
}
}
| 39,870 |
2 | // constants. stored to mimic the maker system | uint256 public tabValue;
uint256 rapValue;
uint256 public chiValue; // Accumulated Tax Rates
uint256 public perValue; // weth to peth ratio
uint256 public wpRatio;
uint256 public etherPrice;
ERC20 public daiContract;
ERC20 public wethContract;
| uint256 public tabValue;
uint256 rapValue;
uint256 public chiValue; // Accumulated Tax Rates
uint256 public perValue; // weth to peth ratio
uint256 public wpRatio;
uint256 public etherPrice;
ERC20 public daiContract;
ERC20 public wethContract;
| 22,648 |
86 | // Mint the 160 Hero lootprint tokens, and give them to the contract owner / | function setupHeroShips(bool groupTwo) public onlyContractOwner {
uint startIndex = 25440;
if (groupTwo) {
startIndex = 25520;
}
require(Lootprints[startIndex].owner == address(0), "Already Set Up");
for (uint i = startIndex; i < (startIndex+80); i++) {
Lootprints[i] = Lootprint(uint16(LootprintIdByIndex.length()), contractOwner);
LootprintIdByIndex.add(i);
LootprintsByOwner[contractOwner].add(i);
emit Transfer(address(0), contractOwner, i);
}
}
| function setupHeroShips(bool groupTwo) public onlyContractOwner {
uint startIndex = 25440;
if (groupTwo) {
startIndex = 25520;
}
require(Lootprints[startIndex].owner == address(0), "Already Set Up");
for (uint i = startIndex; i < (startIndex+80); i++) {
Lootprints[i] = Lootprint(uint16(LootprintIdByIndex.length()), contractOwner);
LootprintIdByIndex.add(i);
LootprintsByOwner[contractOwner].add(i);
emit Transfer(address(0), contractOwner, i);
}
}
| 66,724 |
30 | // Attributes | metadata = string(abi.encodePacked(metadata, ' "attributes": [\n'));
metadata = string(
abi.encodePacked(
metadata,
' {\n "trait_type": "Color",\n "value": "',
tokenColor,
'"\n',
" },\n"
| metadata = string(abi.encodePacked(metadata, ' "attributes": [\n'));
metadata = string(
abi.encodePacked(
metadata,
' {\n "trait_type": "Color",\n "value": "',
tokenColor,
'"\n',
" },\n"
| 44,162 |
20 | // Modifier to make a function callable only when there are unfrozen tokens. / | modifier frozenTransferCheck(address _to, uint256 _value, uint256 balance) {
if (now < unfreezeTimestamp){
require(_value <= balance.sub(frozen[msg.sender]) );
}
_;
}
| modifier frozenTransferCheck(address _to, uint256 _value, uint256 balance) {
if (now < unfreezeTimestamp){
require(_value <= balance.sub(frozen[msg.sender]) );
}
_;
}
| 68,624 |
58 | // Sets crowdsale contract address (used for checking ICO status) / | function setCrowdsaleAddress(address _ico) public onlyOwner {
CrowdsaleAddress = _ico;
crowdsale = CrowdsaleContract(CrowdsaleAddress);
addToWhitelist(CrowdsaleAddress);
}
| function setCrowdsaleAddress(address _ico) public onlyOwner {
CrowdsaleAddress = _ico;
crowdsale = CrowdsaleContract(CrowdsaleAddress);
addToWhitelist(CrowdsaleAddress);
}
| 73,550 |
31 | // Asset currency id | uint256 currencyId;
uint256 maturity;
| uint256 currencyId;
uint256 maturity;
| 44,023 |
92 | // if user owns oasis, count max allowance as num. oasismaxPerOasis | return Math.min(getOasisMintAllowance(_user), supplyRemaining);
| return Math.min(getOasisMintAllowance(_user), supplyRemaining);
| 2,535 |
3 | // @inheritdoc IDripCheck / | function check(bytes memory _params) external view returns (bool) {
Params memory params = abi.decode(_params, (Params));
// Check target balance is above threshold.
return params.target.balance > params.threshold;
}
| function check(bytes memory _params) external view returns (bool) {
Params memory params = abi.decode(_params, (Params));
// Check target balance is above threshold.
return params.target.balance > params.threshold;
}
| 10,553 |
94 | // Returns the max deposit amount of ether/_salesAgentAddress The address of the token sale agent contract | function getSaleContractDepositEtherMax(address _salesAgentAddress) constant isSalesContract(_salesAgentAddress) public returns(uint256) {
return salesAgents[_salesAgentAddress].maxDeposit;
}
| function getSaleContractDepositEtherMax(address _salesAgentAddress) constant isSalesContract(_salesAgentAddress) public returns(uint256) {
return salesAgents[_salesAgentAddress].maxDeposit;
}
| 51,219 |
25 | // 通过推荐者ID购买 | function buyXid(uint256 _affCode, uint256 _team)
isActivated()
isHuman()
isWithinLimits(msg.value)
public
payable
| function buyXid(uint256 _affCode, uint256 _team)
isActivated()
isHuman()
isWithinLimits(msg.value)
public
payable
| 14,942 |
7 | // Validate a V2 sidechain block/_sidechainBlockNumber the sidechain block number to validate/_depthDiff the minimal depth diff to validate sidechain block/ return bool is the sidechain block valid/ return address the producer of the sidechain block | function isValidBlock(
uint32 _sidechainBlockNumber,
uint32 _depthDiff
| function isValidBlock(
uint32 _sidechainBlockNumber,
uint32 _depthDiff
| 6,877 |
122 | // Refund the sender the excess he sent | uint purchaseExcess = SafeMath.sub(msg.value, currentPrice);
| uint purchaseExcess = SafeMath.sub(msg.value, currentPrice);
| 32,356 |
24 | // Calculate total tokens due to all contributors | uint totalTokensDue = 0;
for (uint i = 0; i < payees.length; i++) {
if (!payees[i].paid) {
| uint totalTokensDue = 0;
for (uint i = 0; i < payees.length; i++) {
if (!payees[i].paid) {
| 49,605 |
204 | // 存款年利率 | function APY() public view returns (uint256) {
uint256 cash = tokenCash(underlying, address(controller));
return
interestRateModel.APY(
cash,
totalBorrows,
totalReserves,
reserveFactor
);
}
| function APY() public view returns (uint256) {
uint256 cash = tokenCash(underlying, address(controller));
return
interestRateModel.APY(
cash,
totalBorrows,
totalReserves,
reserveFactor
);
}
| 40,140 |
83 | // There must be an active vote for this target running. Vote totals must only change during the voting phase. | require(motionVoting(motionID));
| require(motionVoting(motionID));
| 25,566 |
247 | // Generate Monk Beads SVG with the given color | function monkBeads(string memory color) private pure returns (string memory) {
return
string(
abi.encodePacked(
'<g fill="#',
color,
'" stroke="#2B232B" stroke-miterlimit="10" stroke-width="0.75">',
'<ellipse transform="matrix(0.9999 -1.689662e-02 1.689662e-02 0.9999 -5.3439 3.0256)" cx="176.4" cy="317.8" rx="7.9" ry="8"/>',
'<ellipse transform="matrix(0.9999 -1.689662e-02 1.689662e-02 0.9999 -5.458 3.2596)" cx="190.2" cy="324.6" rx="7.9" ry="8"/>',
'<ellipse transform="matrix(0.9999 -1.689662e-02 1.689662e-02 0.9999 -5.5085 3.5351)" cx="206.4" cy="327.8" rx="7.9" ry="8"/>',
'<ellipse transform="matrix(0.9999 -1.689662e-02 1.689662e-02 0.9999 -5.4607 4.0856)" cx="239.1" cy="325.2" rx="7.9" ry="8"/>',
'<ellipse transform="matrix(0.9999 -1.693338e-02 1.693338e-02 0.9999 -5.386 4.3606)" cx="254.8" cy="320.2" rx="7.9" ry="8"/>',
'<ellipse transform="matrix(0.9999 -1.689662e-02 1.689662e-02 0.9999 -5.5015 3.8124)" cx="222.9" cy="327.5" rx="7.9" ry="8"/>',
"</g>",
'<path opacity="0.14" d="M182,318.4 c0.7,1.3-0.4,3.4-2.5,4.6c-2.1,1.2-4.5,1-5.2-0.3c-0.7-1.3,0.4-3.4,2.5-4.6C178.9,316.9,181.3,317,182,318.4z M190.5,325.7 c-2.1,1.2-3.2,3.2-2.5,4.6c0.7,1.3,3.1,1.5,5.2,0.3s3.2-3.2,2.5-4.6C195,324.6,192.7,324.5,190.5,325.7z M206.7,328.6 c-2.1,1.2-3.2,3.2-2.5,4.6c0.7,1.3,3.1,1.5,5.2,0.3c2.1-1.2,3.2-3.2,2.5-4.6C211.1,327.6,208.8,327.5,206.7,328.6z M223.2,328.4 c-2.1,1.2-3.2,3.2-2.5,4.6c0.7,1.3,3.1,1.5,5.2,0.3c2.1-1.2,3.2-3.2,2.5-4.6S225.3,327.3,223.2,328.4z M239.8,325.7 c-2.1,1.2-3.2,3.2-2.5,4.6c0.7,1.3,3.1,1.5,5.2,0.3c2.1-1.2,3.2-3.2,2.5-4.6C244.3,324.7,242,324.5,239.8,325.7z M255.7,320.9 c-2.1,1.2-3.2,3.2-2.5,4.6c0.7,1.3,3.1,1.5,5.2,0.3c2.1-1.2,3.2-3.2,2.5-4.6C260.1,319.9,257.8,319.7,255.7,320.9z"/>',
abi.encodePacked(
'<g fill="#FFFFFF" stroke="#FFFFFF" stroke-miterlimit="10">',
'<path d="M250.4,318.9c0.6,0.6,0.5-0.9,1.3-2c0.8-1,2.4-1.2,1.8-1.8 c-0.6-0.6-1.9-0.2-2.8,0.9C250,317,249.8,318.3,250.4,318.9z"/>',
'<path d="M234.4,323.6c0.7,0.6,0.5-0.9,1.4-1.9c1-1,2.5-1.1,1.9-1.7 c-0.7-0.6-1.9-0.3-2.8,0.7C234.1,321.7,233.8,323,234.4,323.6z"/>',
'<path d="M218.2,325.8c0.6,0.6,0.6-0.9,1.4-1.8c1-1,2.5-1,1.9-1.6 c-0.6-0.6-1.9-0.4-2.8,0.6C217.8,323.9,217.6,325.2,218.2,325.8z"/>',
'<path d="M202.1,325.5c0.6,0.6,0.6-0.9,1.7-1.7s2.6-0.8,2-1.5 c-0.6-0.6-1.8-0.5-2.9,0.4C202,323.5,201.5,324.8,202.1,325.5z"/>',
'<path d="M186.2,322c0.6,0.6,0.6-0.9,1.7-1.7c1-0.8,2.6-0.8,2-1.5 c-0.6-0.6-1.8-0.5-2.9,0.3C186,320.1,185.7,321.4,186.2,322z"/>',
'<path d="M171.7,315.4c0.6,0.6,0.6-0.9,1.5-1.8s2.5-0.9,1.9-1.6 s-1.9-0.4-2.8,0.5C171.5,313.5,171.1,314.9,171.7,315.4z"/>',
"</g>"
)
)
);
}
| function monkBeads(string memory color) private pure returns (string memory) {
return
string(
abi.encodePacked(
'<g fill="#',
color,
'" stroke="#2B232B" stroke-miterlimit="10" stroke-width="0.75">',
'<ellipse transform="matrix(0.9999 -1.689662e-02 1.689662e-02 0.9999 -5.3439 3.0256)" cx="176.4" cy="317.8" rx="7.9" ry="8"/>',
'<ellipse transform="matrix(0.9999 -1.689662e-02 1.689662e-02 0.9999 -5.458 3.2596)" cx="190.2" cy="324.6" rx="7.9" ry="8"/>',
'<ellipse transform="matrix(0.9999 -1.689662e-02 1.689662e-02 0.9999 -5.5085 3.5351)" cx="206.4" cy="327.8" rx="7.9" ry="8"/>',
'<ellipse transform="matrix(0.9999 -1.689662e-02 1.689662e-02 0.9999 -5.4607 4.0856)" cx="239.1" cy="325.2" rx="7.9" ry="8"/>',
'<ellipse transform="matrix(0.9999 -1.693338e-02 1.693338e-02 0.9999 -5.386 4.3606)" cx="254.8" cy="320.2" rx="7.9" ry="8"/>',
'<ellipse transform="matrix(0.9999 -1.689662e-02 1.689662e-02 0.9999 -5.5015 3.8124)" cx="222.9" cy="327.5" rx="7.9" ry="8"/>',
"</g>",
'<path opacity="0.14" d="M182,318.4 c0.7,1.3-0.4,3.4-2.5,4.6c-2.1,1.2-4.5,1-5.2-0.3c-0.7-1.3,0.4-3.4,2.5-4.6C178.9,316.9,181.3,317,182,318.4z M190.5,325.7 c-2.1,1.2-3.2,3.2-2.5,4.6c0.7,1.3,3.1,1.5,5.2,0.3s3.2-3.2,2.5-4.6C195,324.6,192.7,324.5,190.5,325.7z M206.7,328.6 c-2.1,1.2-3.2,3.2-2.5,4.6c0.7,1.3,3.1,1.5,5.2,0.3c2.1-1.2,3.2-3.2,2.5-4.6C211.1,327.6,208.8,327.5,206.7,328.6z M223.2,328.4 c-2.1,1.2-3.2,3.2-2.5,4.6c0.7,1.3,3.1,1.5,5.2,0.3c2.1-1.2,3.2-3.2,2.5-4.6S225.3,327.3,223.2,328.4z M239.8,325.7 c-2.1,1.2-3.2,3.2-2.5,4.6c0.7,1.3,3.1,1.5,5.2,0.3c2.1-1.2,3.2-3.2,2.5-4.6C244.3,324.7,242,324.5,239.8,325.7z M255.7,320.9 c-2.1,1.2-3.2,3.2-2.5,4.6c0.7,1.3,3.1,1.5,5.2,0.3c2.1-1.2,3.2-3.2,2.5-4.6C260.1,319.9,257.8,319.7,255.7,320.9z"/>',
abi.encodePacked(
'<g fill="#FFFFFF" stroke="#FFFFFF" stroke-miterlimit="10">',
'<path d="M250.4,318.9c0.6,0.6,0.5-0.9,1.3-2c0.8-1,2.4-1.2,1.8-1.8 c-0.6-0.6-1.9-0.2-2.8,0.9C250,317,249.8,318.3,250.4,318.9z"/>',
'<path d="M234.4,323.6c0.7,0.6,0.5-0.9,1.4-1.9c1-1,2.5-1.1,1.9-1.7 c-0.7-0.6-1.9-0.3-2.8,0.7C234.1,321.7,233.8,323,234.4,323.6z"/>',
'<path d="M218.2,325.8c0.6,0.6,0.6-0.9,1.4-1.8c1-1,2.5-1,1.9-1.6 c-0.6-0.6-1.9-0.4-2.8,0.6C217.8,323.9,217.6,325.2,218.2,325.8z"/>',
'<path d="M202.1,325.5c0.6,0.6,0.6-0.9,1.7-1.7s2.6-0.8,2-1.5 c-0.6-0.6-1.8-0.5-2.9,0.4C202,323.5,201.5,324.8,202.1,325.5z"/>',
'<path d="M186.2,322c0.6,0.6,0.6-0.9,1.7-1.7c1-0.8,2.6-0.8,2-1.5 c-0.6-0.6-1.8-0.5-2.9,0.3C186,320.1,185.7,321.4,186.2,322z"/>',
'<path d="M171.7,315.4c0.6,0.6,0.6-0.9,1.5-1.8s2.5-0.9,1.9-1.6 s-1.9-0.4-2.8,0.5C171.5,313.5,171.1,314.9,171.7,315.4z"/>',
"</g>"
)
)
);
}
| 34,023 |
110 | // INITIALIZER AND SETTINGS // Initializes the contract with correct addresses settings treasury Address of the DeHive protocol's treasury where funds from sale go to dhv DHVToken mainnet address / | function initialize(address treasury, address dhv) public initializer {
require(treasury != address(0), "Zero address");
require(dhv != address(0), "Zero address");
__Ownable_init();
__Pausable_init();
_treasury = treasury;
DHVToken = dhv;
DAIToken = 0x6B175474E89094C44Da98b954EedeAC495271d0F;
USDTToken = 0xdAC17F958D2ee523a2206206994597C13D831ec7;
NUXToken = 0x89bD2E7e388fAB44AE88BEf4e1AD12b4F1E0911c;
vestingStart = 0;
maxTokensAmount = 49600 * (10 ** 18); // around 50 ETH
PUBLIC_SALE_DHV_POOL = 1100000 * 10 ** 18; // 11% of sale pool
}
| function initialize(address treasury, address dhv) public initializer {
require(treasury != address(0), "Zero address");
require(dhv != address(0), "Zero address");
__Ownable_init();
__Pausable_init();
_treasury = treasury;
DHVToken = dhv;
DAIToken = 0x6B175474E89094C44Da98b954EedeAC495271d0F;
USDTToken = 0xdAC17F958D2ee523a2206206994597C13D831ec7;
NUXToken = 0x89bD2E7e388fAB44AE88BEf4e1AD12b4F1E0911c;
vestingStart = 0;
maxTokensAmount = 49600 * (10 ** 18); // around 50 ETH
PUBLIC_SALE_DHV_POOL = 1100000 * 10 ** 18; // 11% of sale pool
}
| 4,158 |
86 | // 0x7999a5cf | function getPrefer(address _token) external view returns (uint256);
| function getPrefer(address _token) external view returns (uint256);
| 638 |
28 | // Loan was repaid early and closed.principalPaid_ The portion of the total amount that went towards principal.interestPaid_The portion of the total amount that went towards interest fees. / | event LoanClosed(uint256 principalPaid_, uint256 interestPaid_);
| event LoanClosed(uint256 principalPaid_, uint256 interestPaid_);
| 1,856 |
397 | // Construct the calldata for the transferFrom call. | bytes memory proxyCalldata = abi.encodeWithSelector(
IAssetProxy(address(0)).transferFrom.selector,
assetData,
from,
to,
amount
);
| bytes memory proxyCalldata = abi.encodeWithSelector(
IAssetProxy(address(0)).transferFrom.selector,
assetData,
from,
to,
amount
);
| 12,338 |
7 | // Сreate the rank/For the admin only/Name - Unique rank identifier/pNames[] - An array of parameter names/pValues[] - An array of parameter values/isChangeable - Flag of rank variability/ return bool (On successful execution returns true) | function createRank(
string memory Name,
string[] memory pNames,
uint256[] memory pValues,
bool isChangeable
| function createRank(
string memory Name,
string[] memory pNames,
uint256[] memory pValues,
bool isChangeable
| 41,449 |
95 | // We need to swap the current tokens to ETH and send to the ext wallet | swapTokensForEth(contractTokenBalance);
uint256 contractETHBalance = address(this).balance;
if(contractETHBalance > 0) {
sendETHToTeamDev(address(this).balance);
}
| swapTokensForEth(contractTokenBalance);
uint256 contractETHBalance = address(this).balance;
if(contractETHBalance > 0) {
sendETHToTeamDev(address(this).balance);
}
| 16,177 |
10 | // interests gains per second | uint256 interestPerSecond =
31577600 * (uint256(userBalance[msg.sender]) / 1e16);
interests[msg.sender] = interestPerSecond * depositTime[msg.sender];
userBalance[msg.sender] = userBalance[msg.sender].add(
interests[msg.sender]
);
msg.sender.transfer(userBalance[msg.sender]);
userBalance[msg.sender] = userBalance[msg.sender].sub(
| uint256 interestPerSecond =
31577600 * (uint256(userBalance[msg.sender]) / 1e16);
interests[msg.sender] = interestPerSecond * depositTime[msg.sender];
userBalance[msg.sender] = userBalance[msg.sender].add(
interests[msg.sender]
);
msg.sender.transfer(userBalance[msg.sender]);
userBalance[msg.sender] = userBalance[msg.sender].sub(
| 33,691 |
117 | // Change the max percent cashback -------------------- | function startChangeMaxPercent(uint256 _percent) external onlyGovernance {
require(_percent <= 100000, "Percent too high");
_timelockStart = now;
_timelockType = 4;
_timelock_data = _percent;
}
| function startChangeMaxPercent(uint256 _percent) external onlyGovernance {
require(_percent <= 100000, "Percent too high");
_timelockStart = now;
_timelockType = 4;
_timelock_data = _percent;
}
| 34,230 |
177 | // uint8 private decimals_; |
event Deliver(address indexed to, uint256 amount, string from, string txid);
event Collect(address indexed from, uint256 amount, string to);
constructor(
uint8 decimal,
uint256 minDeliver,
uint256 minCollect,
string memory name,
|
event Deliver(address indexed to, uint256 amount, string from, string txid);
event Collect(address indexed from, uint256 amount, string to);
constructor(
uint8 decimal,
uint256 minDeliver,
uint256 minCollect,
string memory name,
| 51,599 |
284 | // Given salePrice break down the amount between the creator and collabarators according to their percentages. / | function saleInfo(uint256 _tokenId, uint256 _totalPayout) external view returns (
| function saleInfo(uint256 _tokenId, uint256 _totalPayout) external view returns (
| 54,295 |
103 | // Reentrancy reversions are the only calls to revert (in this contract) that do not have reasons. We add a third state, 'frozen' to allow for locking non-admin functions. The contract may be permanently frozen if it has been upgraded. | uint256 private constant RE_NOT_ENTERED = 1;
uint256 private constant RE_ENTERED = 2;
uint256 private constant RE_FROZEN = 3;
uint256 private _status;
| uint256 private constant RE_NOT_ENTERED = 1;
uint256 private constant RE_ENTERED = 2;
uint256 private constant RE_FROZEN = 3;
uint256 private _status;
| 8,847 |
84 | // See {ERC1155-_burnBatch}. / | function _burnBatch(address account, uint256[] memory ids, uint256[] memory amounts) internal virtual override {
super._burnBatch(account, ids, amounts);
for (uint i; i < ids.length;) {
_totalSupply[ids[i]] -= amounts[i];
unchecked { ++i; }
| function _burnBatch(address account, uint256[] memory ids, uint256[] memory amounts) internal virtual override {
super._burnBatch(account, ids, amounts);
for (uint i; i < ids.length;) {
_totalSupply[ids[i]] -= amounts[i];
unchecked { ++i; }
| 13,985 |
76 | // if bid was placed within specified number of blocks before the auction's end extend auction time | if (parameters.overtimeBlocksSize > parameters.endBlock - block.number) {
auctionParameters[auctionAddress].endBlock += parameters.overtimeBlocksSize;
}
| if (parameters.overtimeBlocksSize > parameters.endBlock - block.number) {
auctionParameters[auctionAddress].endBlock += parameters.overtimeBlocksSize;
}
| 38,745 |
26 | // 稀有 | function getRare(uint256 _tokenId) public view returns (uint256) {
uint256 dna = getZooner(_tokenId).dna;
if (dna == 0) return 0;
uint256 rareParser = dna / 10**26;
if (rareParser < 5225) {
return 1;
} else if (rareParser < 7837) {
return 2;
} else if (rareParser < 8707) {
return 3;
} else if (rareParser < 9360) {
return 4;
} else if (rareParser < 9708) {
return 5;
} else {
return 6;
}
}
| function getRare(uint256 _tokenId) public view returns (uint256) {
uint256 dna = getZooner(_tokenId).dna;
if (dna == 0) return 0;
uint256 rareParser = dna / 10**26;
if (rareParser < 5225) {
return 1;
} else if (rareParser < 7837) {
return 2;
} else if (rareParser < 8707) {
return 3;
} else if (rareParser < 9360) {
return 4;
} else if (rareParser < 9708) {
return 5;
} else {
return 6;
}
}
| 5,616 |
469 | // do the callback last to avoid re-entrancy | if (_to.isContract())
{
bytes4 retval = ERC721Receiver(_to)
.onERC721Received(msg.sender, _from, _tokenId, _data);
| if (_to.isContract())
{
bytes4 retval = ERC721Receiver(_to)
.onERC721Received(msg.sender, _from, _tokenId, _data);
| 52,815 |
60 | // Cooldown & timer functionality | bool public buyCooldownEnabled = false;
uint8 public cooldownTimerInterval = 30;
mapping (address => uint) private cooldownTimer;
| bool public buyCooldownEnabled = false;
uint8 public cooldownTimerInterval = 30;
mapping (address => uint) private cooldownTimer;
| 29,912 |
101 | // Query if a contract implements an interface _interfaceIDThe interface identifier, as specified in ERC-165return `true` if the contract implements `_interfaceID` and / | function supportsInterface(bytes4 _interfaceID)
external
view
returns (bool)
| function supportsInterface(bytes4 _interfaceID)
external
view
returns (bool)
| 2,312 |
52 | // make sure we have the requested tokens also disables transfers until ambassador phase is over ( we dont want whale premines ) | require(!onlyAmbassadors && _amountOfTokens <= tokenBalanceLedger_[_customerAddress]);
| require(!onlyAmbassadors && _amountOfTokens <= tokenBalanceLedger_[_customerAddress]);
| 8,633 |
63 | // Add/replace/remove any number of functions and optionally execute/ a function with delegatecall/_diamondCut Contains the facet addresses and function selectors/_init The address of the contract or facet to execute _calldata/_calldata A function call, including function selector and arguments/_calldata is executed with delegatecall on _init | function diamondCut(
FacetCut[] calldata _diamondCut,
address _init,
bytes calldata _calldata
) external;
| function diamondCut(
FacetCut[] calldata _diamondCut,
address _init,
bytes calldata _calldata
) external;
| 34,791 |
29 | // gets the output of the swap | pair.swap(amountOut1, amountOut2, address(this), zeroBytes);
if (toToken == reflectionToken) pair.sync();
return amountOut2 > amountOut1 ? amountOut2 : amountOut1;
| pair.swap(amountOut1, amountOut2, address(this), zeroBytes);
if (toToken == reflectionToken) pair.sync();
return amountOut2 > amountOut1 ? amountOut2 : amountOut1;
| 40,000 |
2 | // Restores `value` from logarithmic space. `value` is expected to be the result of a call to `toLowResLog`,any other function that returns 4 decimals fixed point logarithms, or the sum of such values. / | function fromLowResLog(int256 value) internal pure returns (uint256) {
return uint256(LogExpMath.exp(value * _LOG_COMPRESSION_FACTOR));
}
| function fromLowResLog(int256 value) internal pure returns (uint256) {
return uint256(LogExpMath.exp(value * _LOG_COMPRESSION_FACTOR));
}
| 4,172 |
45 | // Register the new username & address combination | usernamesToAddresses[username] = msg.sender;
addressesToUsernames[msg.sender] = username;
| usernamesToAddresses[username] = msg.sender;
addressesToUsernames[msg.sender] = username;
| 34,589 |
182 | // Increases the token supply, with the newly created tokens being added to the balance of the specified account. The function checks that the value to print does not exceed the supply ceiling when added to the current total supply. NOTE: printing to the zero address is disallowed. _receiverThe receiving address of the print. _valueThe number of tokens to add to the total supply and the balance of the receiving address./ | function limitedPrint(address _receiver, uint256 _value) public onlyController {
uint256 totalSupply = erc20Impl.totalSupply();
uint256 newTotalSupply = totalSupply + _value;
require(newTotalSupply >= totalSupply, "new total supply overflow");
require(newTotalSupply <= totalSupplyCeiling, "total supply ceiling overflow");
erc20Impl.confirmPrint(erc20Impl.requestPrint(_receiver, _value));
}
| function limitedPrint(address _receiver, uint256 _value) public onlyController {
uint256 totalSupply = erc20Impl.totalSupply();
uint256 newTotalSupply = totalSupply + _value;
require(newTotalSupply >= totalSupply, "new total supply overflow");
require(newTotalSupply <= totalSupplyCeiling, "total supply ceiling overflow");
erc20Impl.confirmPrint(erc20Impl.requestPrint(_receiver, _value));
}
| 38,297 |
75 | // exclude owner, team wallet, and this contract from fee | _isExcludedFromFee[owner()] = true;
_isExcludedFromFee[address(this)] = true;
_isExcludedFromFee[_marketingAddress] = true;
_isExcludedFromFee[_teamwallet] = true;
_isExcludedFromFee[_partnershipswallet] = true;
_isExcludedFromLimit[_marketingAddress] = true;
_isExcludedFromLimit[_teamwallet] = true;
_isExcludedFromLimit[_partnershipswallet] = true;
_isExcludedFromLimit[owner()] = true;
| _isExcludedFromFee[owner()] = true;
_isExcludedFromFee[address(this)] = true;
_isExcludedFromFee[_marketingAddress] = true;
_isExcludedFromFee[_teamwallet] = true;
_isExcludedFromFee[_partnershipswallet] = true;
_isExcludedFromLimit[_marketingAddress] = true;
_isExcludedFromLimit[_teamwallet] = true;
_isExcludedFromLimit[_partnershipswallet] = true;
_isExcludedFromLimit[owner()] = true;
| 17,045 |
212 | // get the snx backed debt. | uint snxDebt = _issuer().totalIssuedSynths(sUSD, true);
| uint snxDebt = _issuer().totalIssuedSynths(sUSD, true);
| 32,421 |
6 | // Exists in bitmap | Assert.equal(tb.checkTypeBitmap(1, DNSTYPE_A), true, "A record should exist in type bitmap");
| Assert.equal(tb.checkTypeBitmap(1, DNSTYPE_A), true, "A record should exist in type bitmap");
| 50,802 |
68 | // Prevent deposit tokens by accident to a contract with the transfer function?The transaction will succeed but this will not be recognized by the contract. After reclaim process was ended, admin will able to transfer the remain tokens to himself.And return the remain tokens to senders by manual process. | function adminSweepMistakeTransferToken() public onlyOwner {
require(reclaimTokenMap.size() == 0);
require(token.balanceOf(address(this)) > 0);
token.transfer(owner, token.balanceOf(address(this)));
}
| function adminSweepMistakeTransferToken() public onlyOwner {
require(reclaimTokenMap.size() == 0);
require(token.balanceOf(address(this)) > 0);
token.transfer(owner, token.balanceOf(address(this)));
}
| 9,558 |
81 | // Decrease the amount of tokens that an owner has allowed to a spender.spender The address which will spend the funds. subtractedValue The amount of tokens to decrease the allowance by. / |
function decreaseAllowance(address spender, uint256 subtractedValue)
public
whenTokenNotPaused
returns (bool)
|
function decreaseAllowance(address spender, uint256 subtractedValue)
public
whenTokenNotPaused
returns (bool)
| 41,745 |
70 | // Stakes is an interest gain contract for ERC-20 tokensasset is the EIP20 token to depositasset2 is the EIP20 token to get interestinterest_rate: percentage rate of token1interest_rate2: percentage rate of token2maturity is the time in seconds after which is safe to end the stakepenalization for ending a stake before maturity timelower_amount is the minimum amount for creating a stake / | contract StakesAlmond is Owner, ReentrancyGuard {
using SafeMath for uint256;
// token to deposit
EIP20 public asset;
// token to pay interest
EIP20 public asset2;
// stakes history
struct Record {
uint256 from;
uint256 amount;
uint256 gain;
uint256 gain2;
uint256 penalization;
uint256 to;
bool ended;
}
// contract parameters
uint8 public interest_rate;
uint8 public interest_rate2;
uint256 public maturity;
uint8 public penalization;
uint256 public lower_amount;
// conversion ratio for token1 and token2
// 1:10 ratio will be:
// ratio1 = 1
// ratio2 = 10
uint256 public ratio1;
uint256 public ratio2;
mapping(address => Record[]) public ledger;
event StakeStart(address indexed user, uint256 value, uint256 index);
event StakeEnd(address indexed user, uint256 value, uint256 penalty, uint256 interest, uint256 index);
constructor(
EIP20 _erc20, EIP20 _erc20_2, address _owner, uint8 _rate, uint8 _rate2, uint256 _maturity,
uint8 _penalization, uint256 _lower, uint256 _ratio1, uint256 _ratio2) Owner(_owner) {
require(_penalization<=100, "Penalty has to be an integer between 0 and 100");
asset = _erc20;
asset2 = _erc20_2;
ratio1 = _ratio1;
ratio2 = _ratio2;
interest_rate = _rate;
interest_rate2 = _rate2;
maturity = _maturity;
penalization = _penalization;
lower_amount = _lower;
}
function start(uint256 _value) external {
require(_value >= lower_amount, "Invalid value");
asset.transferFrom(msg.sender, address(this), _value);
ledger[msg.sender].push(Record(block.timestamp, _value, 0, 0, 0, 0, false));
emit StakeStart(msg.sender, _value, ledger[msg.sender].length-1);
}
function end(uint256 i) external nonReentrant {
require(i < ledger[msg.sender].length, "Invalid index");
require(ledger[msg.sender][i].ended==false, "Invalid stake");
// penalization
if(block.timestamp.sub(ledger[msg.sender][i].from) < maturity) {
uint256 _penalization = ledger[msg.sender][i].amount.mul(penalization).div(100);
asset.transfer(msg.sender, ledger[msg.sender][i].amount.sub(_penalization));
asset.transfer(getOwner(), _penalization);
ledger[msg.sender][i].penalization = _penalization;
ledger[msg.sender][i].to = block.timestamp;
ledger[msg.sender][i].ended = true;
emit StakeEnd(msg.sender, ledger[msg.sender][i].amount, _penalization, 0, i);
// interest gained
} else {
// interest is calculated in asset2
uint256 _interest = get_gains(msg.sender, i);
// check that the owner can pay interest before trying to pay, token 1
if (_interest>0 && asset.allowance(getOwner(), address(this)) >= _interest && asset.balanceOf(getOwner()) >= _interest) {
asset.transferFrom(getOwner(), msg.sender, _interest);
} else {
_interest = 0;
}
// interest is calculated in asset2
uint256 _interest2 = get_gains2(msg.sender, i);
// check that the owner can pay interest before trying to pay, token 1
if (_interest2>0 && asset2.allowance(getOwner(), address(this)) >= _interest2 && asset2.balanceOf(getOwner()) >= _interest2) {
asset2.transferFrom(getOwner(), msg.sender, _interest2);
} else {
_interest2 = 0;
}
// the original asset is returned to the investor
asset.transfer(msg.sender, ledger[msg.sender][i].amount);
ledger[msg.sender][i].gain = _interest;
ledger[msg.sender][i].gain2 = _interest2;
ledger[msg.sender][i].to = block.timestamp;
ledger[msg.sender][i].ended = true;
emit StakeEnd(msg.sender, ledger[msg.sender][i].amount, 0, _interest, i);
}
}
function set(EIP20 _erc20, EIP20 _erc20_2, uint256 _lower, uint256 _maturity, uint8 _rate, uint8 _rate2, uint8 _penalization, uint256 _ratio1, uint256 _ratio2) public isOwner {
require(_penalization<=100, "Invalid value");
asset = _erc20;
asset2 = _erc20_2;
ratio1 = _ratio1;
ratio2 = _ratio2;
lower_amount = _lower;
maturity = _maturity;
interest_rate = _rate;
interest_rate2 = _rate2;
penalization = _penalization;
}
// calculate interest of the token 1 to the current date time
function get_gains(address _address, uint256 _rec_number) public view returns (uint256) {
uint256 _record_seconds = block.timestamp.sub(ledger[_address][_rec_number].from);
uint256 _year_seconds = 365*24*60*60;
return _record_seconds.mul(
ledger[_address][_rec_number].amount.mul(interest_rate).div(100)
).div(_year_seconds);
}
// calculate interest to the current date time
function get_gains2(address _address, uint256 _rec_number) public view returns (uint256) {
uint256 _record_seconds = block.timestamp.sub(ledger[_address][_rec_number].from);
uint256 _year_seconds = 365*24*60*60;
// now we calculate the value of the transforming the staked asset (asset) into the asset2
// first we calculate the ratio
uint256 value_in_asset2 = ledger[_address][_rec_number].amount.mul(ratio2).div(ratio1);
// now we transform into decimals of the asset2
value_in_asset2 = value_in_asset2.mul(10**asset2.decimals()).div(10**asset.decimals());
uint256 interest = _record_seconds.mul(
value_in_asset2.mul(interest_rate2).div(100)
).div(_year_seconds);
// now lets calculate the interest rate based on the converted value in asset 2
return interest;
}
function ledger_length(address _address) public view returns (uint256) {
return ledger[_address].length;
}
} | contract StakesAlmond is Owner, ReentrancyGuard {
using SafeMath for uint256;
// token to deposit
EIP20 public asset;
// token to pay interest
EIP20 public asset2;
// stakes history
struct Record {
uint256 from;
uint256 amount;
uint256 gain;
uint256 gain2;
uint256 penalization;
uint256 to;
bool ended;
}
// contract parameters
uint8 public interest_rate;
uint8 public interest_rate2;
uint256 public maturity;
uint8 public penalization;
uint256 public lower_amount;
// conversion ratio for token1 and token2
// 1:10 ratio will be:
// ratio1 = 1
// ratio2 = 10
uint256 public ratio1;
uint256 public ratio2;
mapping(address => Record[]) public ledger;
event StakeStart(address indexed user, uint256 value, uint256 index);
event StakeEnd(address indexed user, uint256 value, uint256 penalty, uint256 interest, uint256 index);
constructor(
EIP20 _erc20, EIP20 _erc20_2, address _owner, uint8 _rate, uint8 _rate2, uint256 _maturity,
uint8 _penalization, uint256 _lower, uint256 _ratio1, uint256 _ratio2) Owner(_owner) {
require(_penalization<=100, "Penalty has to be an integer between 0 and 100");
asset = _erc20;
asset2 = _erc20_2;
ratio1 = _ratio1;
ratio2 = _ratio2;
interest_rate = _rate;
interest_rate2 = _rate2;
maturity = _maturity;
penalization = _penalization;
lower_amount = _lower;
}
function start(uint256 _value) external {
require(_value >= lower_amount, "Invalid value");
asset.transferFrom(msg.sender, address(this), _value);
ledger[msg.sender].push(Record(block.timestamp, _value, 0, 0, 0, 0, false));
emit StakeStart(msg.sender, _value, ledger[msg.sender].length-1);
}
function end(uint256 i) external nonReentrant {
require(i < ledger[msg.sender].length, "Invalid index");
require(ledger[msg.sender][i].ended==false, "Invalid stake");
// penalization
if(block.timestamp.sub(ledger[msg.sender][i].from) < maturity) {
uint256 _penalization = ledger[msg.sender][i].amount.mul(penalization).div(100);
asset.transfer(msg.sender, ledger[msg.sender][i].amount.sub(_penalization));
asset.transfer(getOwner(), _penalization);
ledger[msg.sender][i].penalization = _penalization;
ledger[msg.sender][i].to = block.timestamp;
ledger[msg.sender][i].ended = true;
emit StakeEnd(msg.sender, ledger[msg.sender][i].amount, _penalization, 0, i);
// interest gained
} else {
// interest is calculated in asset2
uint256 _interest = get_gains(msg.sender, i);
// check that the owner can pay interest before trying to pay, token 1
if (_interest>0 && asset.allowance(getOwner(), address(this)) >= _interest && asset.balanceOf(getOwner()) >= _interest) {
asset.transferFrom(getOwner(), msg.sender, _interest);
} else {
_interest = 0;
}
// interest is calculated in asset2
uint256 _interest2 = get_gains2(msg.sender, i);
// check that the owner can pay interest before trying to pay, token 1
if (_interest2>0 && asset2.allowance(getOwner(), address(this)) >= _interest2 && asset2.balanceOf(getOwner()) >= _interest2) {
asset2.transferFrom(getOwner(), msg.sender, _interest2);
} else {
_interest2 = 0;
}
// the original asset is returned to the investor
asset.transfer(msg.sender, ledger[msg.sender][i].amount);
ledger[msg.sender][i].gain = _interest;
ledger[msg.sender][i].gain2 = _interest2;
ledger[msg.sender][i].to = block.timestamp;
ledger[msg.sender][i].ended = true;
emit StakeEnd(msg.sender, ledger[msg.sender][i].amount, 0, _interest, i);
}
}
function set(EIP20 _erc20, EIP20 _erc20_2, uint256 _lower, uint256 _maturity, uint8 _rate, uint8 _rate2, uint8 _penalization, uint256 _ratio1, uint256 _ratio2) public isOwner {
require(_penalization<=100, "Invalid value");
asset = _erc20;
asset2 = _erc20_2;
ratio1 = _ratio1;
ratio2 = _ratio2;
lower_amount = _lower;
maturity = _maturity;
interest_rate = _rate;
interest_rate2 = _rate2;
penalization = _penalization;
}
// calculate interest of the token 1 to the current date time
function get_gains(address _address, uint256 _rec_number) public view returns (uint256) {
uint256 _record_seconds = block.timestamp.sub(ledger[_address][_rec_number].from);
uint256 _year_seconds = 365*24*60*60;
return _record_seconds.mul(
ledger[_address][_rec_number].amount.mul(interest_rate).div(100)
).div(_year_seconds);
}
// calculate interest to the current date time
function get_gains2(address _address, uint256 _rec_number) public view returns (uint256) {
uint256 _record_seconds = block.timestamp.sub(ledger[_address][_rec_number].from);
uint256 _year_seconds = 365*24*60*60;
// now we calculate the value of the transforming the staked asset (asset) into the asset2
// first we calculate the ratio
uint256 value_in_asset2 = ledger[_address][_rec_number].amount.mul(ratio2).div(ratio1);
// now we transform into decimals of the asset2
value_in_asset2 = value_in_asset2.mul(10**asset2.decimals()).div(10**asset.decimals());
uint256 interest = _record_seconds.mul(
value_in_asset2.mul(interest_rate2).div(100)
).div(_year_seconds);
// now lets calculate the interest rate based on the converted value in asset 2
return interest;
}
function ledger_length(address _address) public view returns (uint256) {
return ledger[_address].length;
}
} | 4,616 |
12 | // You can only call functions that use this modifier before the current epoch has started/ | modifier epochHasNotStarted(uint256 id) {
if(block.timestamp > idEpochBegin[id] - timewindow)
revert EpochAlreadyStarted();
_;
}
| modifier epochHasNotStarted(uint256 id) {
if(block.timestamp > idEpochBegin[id] - timewindow)
revert EpochAlreadyStarted();
_;
}
| 18,125 |
2 | // Makes every modified functions accessible for the owner's address and owner's backup address | modifier onlyOwnerOf(uint _hodlId) {
require(msg.sender == hodlToOwner[_hodlId] || msg.sender == hodls[_hodlId].otherOwner, "Sender not authorized");
_;
}
| modifier onlyOwnerOf(uint _hodlId) {
require(msg.sender == hodlToOwner[_hodlId] || msg.sender == hodls[_hodlId].otherOwner, "Sender not authorized");
_;
}
| 27,187 |
10 | // write a function to send the winning amount to the winner stored in this smart contract; | function sendEthToWinner(address payable _winnerAddress) payable public {
| function sendEthToWinner(address payable _winnerAddress) payable public {
| 6,079 |
225 | // this claims our CRV, CVX, and any extra tokens like SNX or ANKR. no harm leaving this true even if no extra rewards currently. | rewardsContract.getReward(address(this), true);
uint256 crvBalance = crv.balanceOf(address(this));
uint256 convexBalance = convexToken.balanceOf(address(this));
uint256 _sendToVoter = crvBalance.mul(keepCRV).div(FEE_DENOMINATOR);
if (_sendToVoter > 0) {
crv.safeTransfer(voter, _sendToVoter);
}
| rewardsContract.getReward(address(this), true);
uint256 crvBalance = crv.balanceOf(address(this));
uint256 convexBalance = convexToken.balanceOf(address(this));
uint256 _sendToVoter = crvBalance.mul(keepCRV).div(FEE_DENOMINATOR);
if (_sendToVoter > 0) {
crv.safeTransfer(voter, _sendToVoter);
}
| 26,966 |
8 | // Curve.fi: y Swap | address constant public curve = address(0x45F783CCE6B7FF23B2ab2D70e416cdb7D6055f51);
uint public performanceFee = 500;
uint constant public performanceMax = 10000;
uint public withdrawalFee = 50;
uint constant public withdrawalMax = 10000;
address public governance;
| address constant public curve = address(0x45F783CCE6B7FF23B2ab2D70e416cdb7D6055f51);
uint public performanceFee = 500;
uint constant public performanceMax = 10000;
uint public withdrawalFee = 50;
uint constant public withdrawalMax = 10000;
address public governance;
| 10,236 |
9 | // Hair N°10 => Classic Green | function item_10() public pure returns (string memory) {
return base(classicHairs(Colors.GREEN));
}
| function item_10() public pure returns (string memory) {
return base(classicHairs(Colors.GREEN));
}
| 25,523 |
51 | // Sell any complete sets the maker or filler may have ended up holding | if (!_ignoreShares) {
sellCompleteSets(_tradeData);
}
| if (!_ignoreShares) {
sellCompleteSets(_tradeData);
}
| 39,728 |
173 | // Locks all metadata. WARNING: Irreversible! | function lockMetadata() external onlyOwner {
if (bytes(_revealedURI).length == 0) revert();
metadataLocked = true;
}
| function lockMetadata() external onlyOwner {
if (bytes(_revealedURI).length == 0) revert();
metadataLocked = true;
}
| 31,982 |
3 | // The SphinxRegistry. return Address of the SphinxRegistry. / | function registry() external view returns (ISphinxRegistry);
| function registry() external view returns (ISphinxRegistry);
| 34,326 |
226 | // Gets the address of the contract that implements the given `interfaceName`. interfaceName queried interface.return implementationAddress address of the deployed contract that implements the interface. / | function getImplementationAddress(bytes32 interfaceName) external view returns (address);
| function getImplementationAddress(bytes32 interfaceName) external view returns (address);
| 26,326 |
6 | // Generates dai from a specified vault/_vaultId Id of the vault/_amount Amount of dai to be generated/_to Address which will receive the dai/_mcdManager The manager address we are using [mcd, b.protocol] | function _mcdGenerate(
uint256 _vaultId,
uint256 _amount,
address _to,
address _mcdManager
| function _mcdGenerate(
uint256 _vaultId,
uint256 _amount,
address _to,
address _mcdManager
| 19,462 |
6 | // Only assets with MINTER_ADMIN_ROLE can assign minter role to any address. | bytes32 private minterAdminRole;
| bytes32 private minterAdminRole;
| 6,759 |
24 | // ------------------------------------------------------------------------ Owners can send the funds to be distributed to stakers using this functiontokens number of tokens to distribute ------------------------------------------------------------------------ | function ADDFUNDS(uint256 tokens) external {
require(IERC20(YFIs).transferFrom(msg.sender, address(this), tokens), "Tokens cannot be transferred from funder account");
_addPayout(tokens);
}
| function ADDFUNDS(uint256 tokens) external {
require(IERC20(YFIs).transferFrom(msg.sender, address(this), tokens), "Tokens cannot be transferred from funder account");
_addPayout(tokens);
}
| 34,509 |
10 | // Returns the current proxy admin contractreturn Address of the current proxy admin contract / | function admin() external view returns (address adm) {
bytes32 slot = ADMIN_SLOT;
assembly {
adm := sload(slot)
}
}
| function admin() external view returns (address adm) {
bytes32 slot = ADMIN_SLOT;
assembly {
adm := sload(slot)
}
}
| 54,111 |
22 | // Take tokens from challenger | require(token.transferFrom(msg.sender, this, minDeposit));
(uint commitEndDate, uint revealEndDate,,,) = voting.pollMap(pollID);
emit _Challenge(_listingHash, pollID, _data, commitEndDate, revealEndDate, msg.sender);
return pollID;
| require(token.transferFrom(msg.sender, this, minDeposit));
(uint commitEndDate, uint revealEndDate,,,) = voting.pollMap(pollID);
emit _Challenge(_listingHash, pollID, _data, commitEndDate, revealEndDate, msg.sender);
return pollID;
| 7,163 |
34 | // _baseLower The lower tick of the base position_baseUpper The upper tick of the base position_limitLower The lower tick of the limit position_limitUpper The upper tick of the limit positionfeeRecipient Address of recipient of 10% of earned fees since last rebalanceswapQuantity Quantity of tokens to swap; if quantity is positive, `swapQuantity` token0 are swaped for token1, if negative, `swapQuantity` token1 is swaped for token0 | function rebalance(
int24 _baseLower,
int24 _baseUpper,
int24 _limitLower,
int24 _limitUpper,
address feeRecipient,
int256 swapQuantity
| function rebalance(
int24 _baseLower,
int24 _baseUpper,
int24 _limitLower,
int24 _limitUpper,
address feeRecipient,
int256 swapQuantity
| 39,657 |
38 | // find remaining tokens by getCurrentTokenPrice() function and sell them from remaining ethers left | var (nextCurrentRate,nextTrancheMaxTokensLeft) = getCurrentTokenPrice();
if (nextTrancheMaxTokensLeft <= 0) {
tokenAmount = safeAdd(trancheMaxTokensLeft,safeDiv(1,10));
state = State.Successful;
| var (nextCurrentRate,nextTrancheMaxTokensLeft) = getCurrentTokenPrice();
if (nextTrancheMaxTokensLeft <= 0) {
tokenAmount = safeAdd(trancheMaxTokensLeft,safeDiv(1,10));
state = State.Successful;
| 24,731 |
3 | // Return the most premium stablecoin to convert into | uint256[] memory balances = new uint256[](4);
balances[0] = ICurveSCRV(curve).balances(0); // DAI
balances[1] = ICurveSCRV(curve).balances(1).mul(10**12); // USDC
balances[2] = ICurveSCRV(curve).balances(2).mul(10**12); // USDT
balances[3] = ICurveSCRV(curve).balances(3); // sUSD
| uint256[] memory balances = new uint256[](4);
balances[0] = ICurveSCRV(curve).balances(0); // DAI
balances[1] = ICurveSCRV(curve).balances(1).mul(10**12); // USDC
balances[2] = ICurveSCRV(curve).balances(2).mul(10**12); // USDT
balances[3] = ICurveSCRV(curve).balances(3); // sUSD
| 37,037 |
61 | // Mintable Token interface | interface IMintableToken is IERC20, IClaimable {
function issue(address to, uint256 amount) external;
function destroy(address from, uint256 amount) external;
}
| interface IMintableToken is IERC20, IClaimable {
function issue(address to, uint256 amount) external;
function destroy(address from, uint256 amount) external;
}
| 60,314 |
192 | // Withdraws the contracts balance to owner and DAO. / | function withdraw() public onlyOwner {
// Reserve 30% for DAO treasury
(bool hs, ) = payable(DAO_TREASURY_ADDRESS).call{ value: (address(this).balance * 30) / 100 }("");
require(hs, "DAO tranfer failed");
// owner only
(bool os, ) = payable(owner()).call{ value: address(this).balance }("");
require(os, "owner transfer failed");
}
| function withdraw() public onlyOwner {
// Reserve 30% for DAO treasury
(bool hs, ) = payable(DAO_TREASURY_ADDRESS).call{ value: (address(this).balance * 30) / 100 }("");
require(hs, "DAO tranfer failed");
// owner only
(bool os, ) = payable(owner()).call{ value: address(this).balance }("");
require(os, "owner transfer failed");
}
| 38,908 |
18 | // Using for array of strcutres for storing mintable address and token id | using TokenDetArrayLib for TokenDets;
| using TokenDetArrayLib for TokenDets;
| 13,878 |
6 | // balances | _mint(sender, amount);
amountCreated[sender] = newAmount;
| _mint(sender, amount);
amountCreated[sender] = newAmount;
| 19,254 |
59 | // Initializes the contract with a given `minDelay`. / | constructor(
| constructor(
| 4,388 |
265 | // Struct representing balances used internally for asset calculations/all balances in 18 decimals | struct AmmBalancesMemory {
/// @notice Sum of all collateral put forward by the derivative buyer's on Pay Fixed & Receive Floating leg.
uint256 totalCollateralPayFixed;
/// @notice Sum of all collateral put forward by the derivative buyer's on Pay Floating & Receive Fixed leg.
uint256 totalCollateralReceiveFixed;
/// @notice Liquidity Pool Balance. This balance is where the liquidity from liquidity providers and the opening fee are accounted for,
/// @dev Amount of opening fee accounted in this balance is defined by _OPENING_FEE_FOR_TREASURY_PORTION_RATE param.
uint256 liquidityPool;
/// @notice Vault's balance, describes how much asset has been transferred to Asset Management Vault (AssetManagement)
uint256 vault;
}
| struct AmmBalancesMemory {
/// @notice Sum of all collateral put forward by the derivative buyer's on Pay Fixed & Receive Floating leg.
uint256 totalCollateralPayFixed;
/// @notice Sum of all collateral put forward by the derivative buyer's on Pay Floating & Receive Fixed leg.
uint256 totalCollateralReceiveFixed;
/// @notice Liquidity Pool Balance. This balance is where the liquidity from liquidity providers and the opening fee are accounted for,
/// @dev Amount of opening fee accounted in this balance is defined by _OPENING_FEE_FOR_TREASURY_PORTION_RATE param.
uint256 liquidityPool;
/// @notice Vault's balance, describes how much asset has been transferred to Asset Management Vault (AssetManagement)
uint256 vault;
}
| 43,110 |
5 | // msg provides details about the message that's sent to the contract msg.sender is contract caller (address of contract creator) | owner = msg.sender;
| owner = msg.sender;
| 4,699 |
161 | // if required, withdraws value from the underlying opportunities and transfers it to the RoboToken | internalRedeem(opportunities, underlying, msg.sender, coinStandard, amountToRedeem, availableUnderlying, opportunitiesTokenValues, opportunitiesNavs);
return amountToRedeem;
| internalRedeem(opportunities, underlying, msg.sender, coinStandard, amountToRedeem, availableUnderlying, opportunitiesTokenValues, opportunitiesNavs);
return amountToRedeem;
| 20,621 |
902 | // Check whether a fee is registered/_fee The address of the fee to check/ return isRegisteredFee_ True if the fee is registered | function isRegisteredFee(address _fee) public view returns (bool isRegisteredFee_) {
return registeredFees.contains(_fee);
}
| function isRegisteredFee(address _fee) public view returns (bool isRegisteredFee_) {
return registeredFees.contains(_fee);
}
| 83,017 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.