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 |
|---|---|---|---|---|
19 | // Assigns a new address to act as the CEO. Only available to the current CEO./_newCEO The address of the new CEO | function setCEO(address _newCEO) public onlyCEO {
require(_newCEO != address(0));
ceoAddress = _newCEO;
}
| function setCEO(address _newCEO) public onlyCEO {
require(_newCEO != address(0));
ceoAddress = _newCEO;
}
| 23,609 |
35 | // Allow owner to transfer token from contract | * @param {address} contract address of corresponding token
* @param {uint256} amount of token to be transferred
*
* This is a generalized function which can be used to transfer any accidentally
* sent (including DCB) out of the contract to wowner
*
*/
function transferToken(address _addr, uint256 _amount)
external
onlyOwner
returns (bool)
{
IERC20 token = IERC20(_addr);
bool success = token.transfer(address(owner()), _amount);
return success;
}
| * @param {address} contract address of corresponding token
* @param {uint256} amount of token to be transferred
*
* This is a generalized function which can be used to transfer any accidentally
* sent (including DCB) out of the contract to wowner
*
*/
function transferToken(address _addr, uint256 _amount)
external
onlyOwner
returns (bool)
{
IERC20 token = IERC20(_addr);
bool success = token.transfer(address(owner()), _amount);
return success;
}
| 39,882 |
162 | // If the collateral type is any ERC20, anyone can call this function any time beforeexpiry to increase the amount of collateral in a Vault. Can only transfer in the collateral asset.Will fail if ETH is the collateral asset.The user has to allow the contract to handle their ERC20 tokens on his behalf before thesefunctions are called.Remember that adding ERC20 collateral even if no oTokens have been created can put the owner at arisk of losing the collateral. Ensure that you issue and immediately sell the oTokens!(Either call the createAndSell function in the oToken contract or batch theaddERC20Collateral, issueOTokens and sell | function addERC20Collateral(address payable vaultOwner, uint256 amt)
public
notExpired
returns (uint256)
| function addERC20Collateral(address payable vaultOwner, uint256 amt)
public
notExpired
returns (uint256)
| 43,442 |
30 | // Get the address of a network contract by name | function getContractAddress(string memory _contractName)
internal
view
returns (address)
| function getContractAddress(string memory _contractName)
internal
view
returns (address)
| 7,942 |
109 | // accounts for first epoch being longer lockStart + firstEpochDelay + (epochsPassedepochDuration) | return
LOCK_START.add(FIRST_EPOCH_DELAY).add(passed.mul(EPOCH_DURATION));
| return
LOCK_START.add(FIRST_EPOCH_DELAY).add(passed.mul(EPOCH_DURATION));
| 20,191 |
62 | // Emit event WorkApproved | emit WorkApproved(_workId, _bountyId);
| emit WorkApproved(_workId, _bountyId);
| 1,419 |
24 | // wallet should have enough tokens to fund | require(balances[fundsWallet] >= amount);
balances[fundsWallet] = balances[fundsWallet].sub(amount);
balances[msg.sender] = balances[msg.sender].add(amount);
emit Transfer(fundsWallet, msg.sender, amount); // Broadcast a message to the blockchain
| require(balances[fundsWallet] >= amount);
balances[fundsWallet] = balances[fundsWallet].sub(amount);
balances[msg.sender] = balances[msg.sender].add(amount);
emit Transfer(fundsWallet, msg.sender, amount); // Broadcast a message to the blockchain
| 40,643 |
6 | // pass back same data as returned by 'implementation' contract: | return(ptr, size)
| return(ptr, size)
| 49,567 |
113 | // loseSponsor(): indicates that _point's sponsor is no longer providing it service | function loseSponsor(uint32 _point)
onlyOwner
external
| function loseSponsor(uint32 _point)
onlyOwner
external
| 2,963 |
15 | // Prevent voting if any Mario is Prez. | modifier isVotingOpen() {
require(!IsMarioPrez, "VREQ7: Voting has ended!");
_;
}
| modifier isVotingOpen() {
require(!IsMarioPrez, "VREQ7: Voting has ended!");
_;
}
| 36,504 |
8 | // ====================== internal ======================= |
function _deposit(
address from,
address to,
address token,
uint256 amount,
bool isETH
|
function _deposit(
address from,
address to,
address token,
uint256 amount,
bool isETH
| 39,304 |
26 | // Withdraw `amount` tokens and unwrap/_amount The amount of tokens that the user wants to withdraw/_claim Whether or not the user wants to claim their rewards | function withdrawAndUnwrap(uint256 _amount, bool _claim)
public
updateReward(msg.sender)
| function withdrawAndUnwrap(uint256 _amount, bool _claim)
public
updateReward(msg.sender)
| 30,508 |
66 | // burn token | _burn(tokenId);
| _burn(tokenId);
| 24,351 |
23 | // Transaction info | sender: _msgSender()
| sender: _msgSender()
| 10,128 |
1 | // Sets the ABI associated with an ENS node.Nodes may have one ABI of each content type. To remove an ABI, set it tothe empty string. node The node to update. contentType The content type of the ABI data The ABI data. / | function setABI(bytes32 node, uint256 contentType, bytes calldata data) virtual external authorised(node) {
// Content types must be powers of 2
require(((contentType - 1) & contentType) == 0);
abis[node][contentType] = data;
emit ABIChanged(node, contentType);
}
| function setABI(bytes32 node, uint256 contentType, bytes calldata data) virtual external authorised(node) {
// Content types must be powers of 2
require(((contentType - 1) & contentType) == 0);
abis[node][contentType] = data;
emit ABIChanged(node, contentType);
}
| 8,067 |
4 | // ISafeProtocolStaticFunctionHandler - An interface that a Safe functionhandler should implement in case when handling static calls | * @notice In Safe{Core} Protocol, a function handler can be used to add additional functionality to a Safe.
* User(s) should add SafeProtocolManager as a function handler (aka fallback handler in Safe v1.x) to the Safe
* and enable the contract implementing ISafeProtocolStaticFunctionHandler interface as a function handler in the
* SafeProtocolManager for the specific function identifier.
*/
interface ISafeProtocolStaticFunctionHandler is IERC165 {
/**
* @notice Handles static calls to the Safe contract forwarded by the fallback function.
* @param safe A Safe instance
* @param sender Address of the sender
* @param value Amount of ETH
* @param data Arbitrary length bytes
* @return result Arbitrary length bytes containing result of the operation
*/
function handle(ISafe safe, address sender, uint256 value, bytes calldata data) external view returns (bytes memory result);
/**
* @notice A function that returns information about the type of metadata provider and its location.
* For more information on metadata provider, refer to https://github.com/safe-global/safe-core-protocol-specs/.
* @return providerType uint256 Type of metadata provider
* @return location bytes
*/
function metadataProvider() external view returns (uint256 providerType, bytes memory location);
}
| * @notice In Safe{Core} Protocol, a function handler can be used to add additional functionality to a Safe.
* User(s) should add SafeProtocolManager as a function handler (aka fallback handler in Safe v1.x) to the Safe
* and enable the contract implementing ISafeProtocolStaticFunctionHandler interface as a function handler in the
* SafeProtocolManager for the specific function identifier.
*/
interface ISafeProtocolStaticFunctionHandler is IERC165 {
/**
* @notice Handles static calls to the Safe contract forwarded by the fallback function.
* @param safe A Safe instance
* @param sender Address of the sender
* @param value Amount of ETH
* @param data Arbitrary length bytes
* @return result Arbitrary length bytes containing result of the operation
*/
function handle(ISafe safe, address sender, uint256 value, bytes calldata data) external view returns (bytes memory result);
/**
* @notice A function that returns information about the type of metadata provider and its location.
* For more information on metadata provider, refer to https://github.com/safe-global/safe-core-protocol-specs/.
* @return providerType uint256 Type of metadata provider
* @return location bytes
*/
function metadataProvider() external view returns (uint256 providerType, bytes memory location);
}
| 30,548 |
1 | // Constructor function to set the rewards token and the NFT collection addresses. | constructor(IERC721 _therotybroiCollection, IERC20 _oioiToken) {
therotybroiCollection = _therotybroiCollection;
oioiToken = _oioiToken;
}
| constructor(IERC721 _therotybroiCollection, IERC20 _oioiToken) {
therotybroiCollection = _therotybroiCollection;
oioiToken = _oioiToken;
}
| 1,449 |
50 | // Interface for all security tokens / | contract ISecurityToken is IST20, Ownable {
uint8 public constant PERMISSIONMANAGER_KEY = 1;
uint8 public constant TRANSFERMANAGER_KEY = 2;
uint8 public constant STO_KEY = 3;
uint8 public constant CHECKPOINT_KEY = 4;
uint256 public granularity;
// Value of current checkpoint
uint256 public currentCheckpointId;
// Total number of non-zero token holders
uint256 public investorCount;
// List of token holders
address[] public investors;
// Permissions this to a Permission module, which has a key of 1
// If no Permission return false - note that IModule withPerm will allow ST owner all permissions anyway
// this allows individual modules to override this logic if needed (to not allow ST owner all permissions)
function checkPermission(address _delegate, address _module, bytes32 _perm) public view returns(bool);
/**
* @notice returns module list for a module type
* @param _moduleType is which type of module we are trying to remove
* @param _moduleIndex is the index of the module within the chosen type
*/
function getModule(uint8 _moduleType, uint _moduleIndex) public view returns (bytes32, address);
/**
* @notice returns module list for a module name - will return first match
* @param _moduleType is which type of module we are trying to remove
* @param _name is the name of the module within the chosen type
*/
function getModuleByName(uint8 _moduleType, bytes32 _name) public view returns (bytes32, address);
/**
* @notice Queries totalSupply as of a defined checkpoint
* @param _checkpointId Checkpoint ID to query as of
*/
function totalSupplyAt(uint256 _checkpointId) public view returns(uint256);
/**
* @notice Queries balances as of a defined checkpoint
* @param _investor Investor to query balance for
* @param _checkpointId Checkpoint ID to query as of
*/
function balanceOfAt(address _investor, uint256 _checkpointId) public view returns(uint256);
/**
* @notice Creates a checkpoint that can be used to query historical balances / totalSuppy
*/
function createCheckpoint() public returns(uint256);
/**
* @notice gets length of investors array
* NB - this length may differ from investorCount if list has not been pruned of zero balance investors
* @return length
*/
function getInvestorsLength() public view returns(uint256);
}
| contract ISecurityToken is IST20, Ownable {
uint8 public constant PERMISSIONMANAGER_KEY = 1;
uint8 public constant TRANSFERMANAGER_KEY = 2;
uint8 public constant STO_KEY = 3;
uint8 public constant CHECKPOINT_KEY = 4;
uint256 public granularity;
// Value of current checkpoint
uint256 public currentCheckpointId;
// Total number of non-zero token holders
uint256 public investorCount;
// List of token holders
address[] public investors;
// Permissions this to a Permission module, which has a key of 1
// If no Permission return false - note that IModule withPerm will allow ST owner all permissions anyway
// this allows individual modules to override this logic if needed (to not allow ST owner all permissions)
function checkPermission(address _delegate, address _module, bytes32 _perm) public view returns(bool);
/**
* @notice returns module list for a module type
* @param _moduleType is which type of module we are trying to remove
* @param _moduleIndex is the index of the module within the chosen type
*/
function getModule(uint8 _moduleType, uint _moduleIndex) public view returns (bytes32, address);
/**
* @notice returns module list for a module name - will return first match
* @param _moduleType is which type of module we are trying to remove
* @param _name is the name of the module within the chosen type
*/
function getModuleByName(uint8 _moduleType, bytes32 _name) public view returns (bytes32, address);
/**
* @notice Queries totalSupply as of a defined checkpoint
* @param _checkpointId Checkpoint ID to query as of
*/
function totalSupplyAt(uint256 _checkpointId) public view returns(uint256);
/**
* @notice Queries balances as of a defined checkpoint
* @param _investor Investor to query balance for
* @param _checkpointId Checkpoint ID to query as of
*/
function balanceOfAt(address _investor, uint256 _checkpointId) public view returns(uint256);
/**
* @notice Creates a checkpoint that can be used to query historical balances / totalSuppy
*/
function createCheckpoint() public returns(uint256);
/**
* @notice gets length of investors array
* NB - this length may differ from investorCount if list has not been pruned of zero balance investors
* @return length
*/
function getInvestorsLength() public view returns(uint256);
}
| 9,678 |
6 | // Standard ERC20 token / | contract StandardToken is ERC20Basic {
mapping (address => uint256) balances;
mapping (address => mapping (address => uint256)) allowed;
/**
* @dev transfer token for a specified address
* @param _to The address to transfer to.
* @param _value The amount to be transferred.
*/
function transfer(address _to, uint256 _value) public returns (bool success) {
require((_value > 0) && (balances[msg.sender] >= _value));
balances[msg.sender] -= _value;
balances[_to] += _value;
Transfer(msg.sender, _to, _value);
return true;
}
/**
* @dev Gets the balance of the specified address.
* @param _owner The address to query the the balance of.
* @return An uint256 representing the amount owned by the passed address.
*/
function balanceOf(address _owner) public constant returns (uint256 balance) {
return balances[_owner];
}
/**
* @dev Aprove the passed address to spend the specified amount of tokens on behalf of msg.sender.
* @param _spender The address which will spend the funds.
* @param _value The amount of tokens to be spent.
*/
function approve(address _spender, uint256 _value) public returns (bool success) {
require((_value == 0) || (allowed[msg.sender][_spender] == 0));
allowed[msg.sender][_spender] = _value;
Approval(msg.sender, _spender, _value);
return true;
}
/**
* @dev Function to check the amount of tokens that an owner allowed to a spender.
* @param _owner address The address which owns the funds.
* @param _spender address The address which will spend the funds.
* @return A uint256 specifing the amount of tokens still avaible for the spender.
*/
function allowance(address _owner, address _spender) public constant returns (uint256 remaining) {
return allowed[_owner][_spender];
}
}
| contract StandardToken is ERC20Basic {
mapping (address => uint256) balances;
mapping (address => mapping (address => uint256)) allowed;
/**
* @dev transfer token for a specified address
* @param _to The address to transfer to.
* @param _value The amount to be transferred.
*/
function transfer(address _to, uint256 _value) public returns (bool success) {
require((_value > 0) && (balances[msg.sender] >= _value));
balances[msg.sender] -= _value;
balances[_to] += _value;
Transfer(msg.sender, _to, _value);
return true;
}
/**
* @dev Gets the balance of the specified address.
* @param _owner The address to query the the balance of.
* @return An uint256 representing the amount owned by the passed address.
*/
function balanceOf(address _owner) public constant returns (uint256 balance) {
return balances[_owner];
}
/**
* @dev Aprove the passed address to spend the specified amount of tokens on behalf of msg.sender.
* @param _spender The address which will spend the funds.
* @param _value The amount of tokens to be spent.
*/
function approve(address _spender, uint256 _value) public returns (bool success) {
require((_value == 0) || (allowed[msg.sender][_spender] == 0));
allowed[msg.sender][_spender] = _value;
Approval(msg.sender, _spender, _value);
return true;
}
/**
* @dev Function to check the amount of tokens that an owner allowed to a spender.
* @param _owner address The address which owns the funds.
* @param _spender address The address which will spend the funds.
* @return A uint256 specifing the amount of tokens still avaible for the spender.
*/
function allowance(address _owner, address _spender) public constant returns (uint256 remaining) {
return allowed[_owner][_spender];
}
}
| 38,017 |
15 | // SharesSubject => Supply | mapping(uint256 => uint256) public sharesSupply;
mapping(address => address) public invite;
| mapping(uint256 => uint256) public sharesSupply;
mapping(address => address) public invite;
| 14,829 |
127 | // Emits a {TransferSingle} event. Requirements: - `to` cannot be the zero address.- If `to` refers to a smart contract, it must implement {IERC1155Receiver-onERC1155Received} and return theacceptance magic value. / | function _mint(
address to,
uint256 id,
uint256 amount,
bytes memory data
) internal virtual {
require(to != address(0), "ERC1155: mint to the zero address");
address operator = _msgSender();
| function _mint(
address to,
uint256 id,
uint256 amount,
bytes memory data
) internal virtual {
require(to != address(0), "ERC1155: mint to the zero address");
address operator = _msgSender();
| 9,594 |
110 | // what else? | // enum CampaignStages{
// campaignStarted,
// campaignFinished
// }
| // enum CampaignStages{
// campaignStarted,
// campaignFinished
// }
| 17,280 |
34 | // To remove users from blacklist which restricts blacklisted users from claiming _userToRemoveFromBlacklist addresses of the users / | function removeFromBlacklist(
address[] calldata _userToRemoveFromBlacklist
| function removeFromBlacklist(
address[] calldata _userToRemoveFromBlacklist
| 39,716 |
168 | // Mints a wrapped punk / | function mint(uint256 punkIndex) external;
| function mint(uint256 punkIndex) external;
| 34,081 |
12 | // Redeems an NFTVoucher for an actual NFT, creating it in the process./redeemer The address of the account which will receive the NFT upon success./voucher A signed NFTVoucher that describes the NFT to be redeemed. | function redeem(address redeemer, NFTVoucher calldata voucher) public payable returns (uint256) {
// make sure signature is valid and get the address of the signer
address signer = _verify(voucher);
// make sure that the signer is authorized to mint NFTs
require(hasRole(MINTER_ROLE, signer), "Signature invalid or unauthorized");
// make sure that the redeemer is paying enough to cover the buyer's cost
require(msg.value >= voucher.minPrice, "Insufficient funds to redeem");
// first assign the token to the signer, to establish provenance on-chain
_mint(signer, voucher.tokenId);
_setTokenURI(voucher.tokenId, voucher.uri);
// transfer the token to the redeemer
_transfer(signer, redeemer, voucher.tokenId);
// record payment to signer's withdrawal balance
pendingWithdrawals[signer] += msg.value;
return voucher.tokenId;
}
| function redeem(address redeemer, NFTVoucher calldata voucher) public payable returns (uint256) {
// make sure signature is valid and get the address of the signer
address signer = _verify(voucher);
// make sure that the signer is authorized to mint NFTs
require(hasRole(MINTER_ROLE, signer), "Signature invalid or unauthorized");
// make sure that the redeemer is paying enough to cover the buyer's cost
require(msg.value >= voucher.minPrice, "Insufficient funds to redeem");
// first assign the token to the signer, to establish provenance on-chain
_mint(signer, voucher.tokenId);
_setTokenURI(voucher.tokenId, voucher.uri);
// transfer the token to the redeemer
_transfer(signer, redeemer, voucher.tokenId);
// record payment to signer's withdrawal balance
pendingWithdrawals[signer] += msg.value;
return voucher.tokenId;
}
| 20,303 |
201 | // USDC | 0xA0b86991c6218b36c1d19D4a2e9Eb0cE3606eB48,
| 0xA0b86991c6218b36c1d19D4a2e9Eb0cE3606eB48,
| 5,748 |
3 | // ============ Constructor ============ //Instantiate with ManagerCore address and WrapModuleV2 address._managerCoreAddress of ManagerCore contract _wrapModule Address of WrapModuleV2 contract / | constructor(
IManagerCore _managerCore,
IWrapModuleV2 _wrapModule,
ISignalSuscriptionModule _signalSuscriptionModule
| constructor(
IManagerCore _managerCore,
IWrapModuleV2 _wrapModule,
ISignalSuscriptionModule _signalSuscriptionModule
| 43,828 |
5,734 | // 2868 | entry "unostracized" : ENG_ADJECTIVE
| entry "unostracized" : ENG_ADJECTIVE
| 19,480 |
99 | // Function to mint tokens _to The address that will receive the minted tokens. _value The amount of tokens to mint.return A boolean that indicates if the operation was successful. / | function mint(address _to, uint256 _value) public onlyOwner {
require(_to != address(0), "to address cannot be zero");
totalSupply_ = totalSupply_.add(_value);
balances.addBalance(_to, _value);
emit Mint(_to, _value);
emit Transfer(address(0), _to, _value);
}
| function mint(address _to, uint256 _value) public onlyOwner {
require(_to != address(0), "to address cannot be zero");
totalSupply_ = totalSupply_.add(_value);
balances.addBalance(_to, _value);
emit Mint(_to, _value);
emit Transfer(address(0), _to, _value);
}
| 46,512 |
4 | // Anyone can pay the gas to create their very own Tester token | function create() public returns (uint256 _tokenId) {
bytes32 sudoRandomButTotallyPredictable = keccak256(abi.encodePacked(totalSupply(),blockhash(block.number - 1)));
uint8 body = (uint8(sudoRandomButTotallyPredictable[0])%5)+1;
uint8 feet = (uint8(sudoRandomButTotallyPredictable[1])%5)+1;
uint8 head = (uint8(sudoRandomButTotallyPredictable[2])%5)+1;
uint8 mouth = (uint8(sudoRandomButTotallyPredictable[3])%5)+1;
uint8 extra = (uint8(sudoRandomButTotallyPredictable[4])%5)+1;
//this is about half of all the gas it takes because I'm doing some string manipulation
//I could skip this, or make it way more efficient but the is just a silly hackathon project
string memory tokenUri = createTokenUri(body,feet,head,mouth,extra);
Token memory _newToken = Token({
body: body,
feet: feet,
head: head,
mouth: mouth,
extra: extra,
birthBlock: uint64(block.number)
});
_tokenId = tokens.push(_newToken) - 1;
_mint(msg.sender,_tokenId);
_setTokenURI(_tokenId, tokenUri);
emit Create(_tokenId,msg.sender,body,feet,head,mouth,extra,_newToken.birthBlock,tokenUri);
return _tokenId;
}
| function create() public returns (uint256 _tokenId) {
bytes32 sudoRandomButTotallyPredictable = keccak256(abi.encodePacked(totalSupply(),blockhash(block.number - 1)));
uint8 body = (uint8(sudoRandomButTotallyPredictable[0])%5)+1;
uint8 feet = (uint8(sudoRandomButTotallyPredictable[1])%5)+1;
uint8 head = (uint8(sudoRandomButTotallyPredictable[2])%5)+1;
uint8 mouth = (uint8(sudoRandomButTotallyPredictable[3])%5)+1;
uint8 extra = (uint8(sudoRandomButTotallyPredictable[4])%5)+1;
//this is about half of all the gas it takes because I'm doing some string manipulation
//I could skip this, or make it way more efficient but the is just a silly hackathon project
string memory tokenUri = createTokenUri(body,feet,head,mouth,extra);
Token memory _newToken = Token({
body: body,
feet: feet,
head: head,
mouth: mouth,
extra: extra,
birthBlock: uint64(block.number)
});
_tokenId = tokens.push(_newToken) - 1;
_mint(msg.sender,_tokenId);
_setTokenURI(_tokenId, tokenUri);
emit Create(_tokenId,msg.sender,body,feet,head,mouth,extra,_newToken.birthBlock,tokenUri);
return _tokenId;
}
| 40,783 |
163 | // Same as {xref-ERC721-_safeMint-address-uint256-}[`_safeMint`], with an additional `data` parameter which isforwarded in {IERC721Receiver-onERC721Received} to contract recipients. / | function _safeMint(
address to,
uint256 tokenId,
bytes memory _data
) internal virtual {
_mint(to, tokenId);
require(
_checkOnERC721Received(address(0), to, tokenId, _data),
"ERC721: transfer to non ERC721Receiver implementer"
);
| function _safeMint(
address to,
uint256 tokenId,
bytes memory _data
) internal virtual {
_mint(to, tokenId);
require(
_checkOnERC721Received(address(0), to, tokenId, _data),
"ERC721: transfer to non ERC721Receiver implementer"
);
| 2,316 |
56 | // Max Tax at launch to avoid snipers & bots. Changed when officially launch | feeRatesStruct public buyRates =
| feeRatesStruct public buyRates =
| 85,118 |
178 | // max gas price for buy/sell transactions | function getMaxGasPrice() public view returns(uint256) {
return _core.MAX_GAS_PRICE();
}
| function getMaxGasPrice() public view returns(uint256) {
return _core.MAX_GAS_PRICE();
}
| 18,467 |
92 | // Whether `a` is less than or equal to `b`. a a uint256. b a FixedPoint.return True if `a <= b`, or False. / | function isLessThanOrEqual(uint256 a, Unsigned memory b) internal pure returns (bool) {
return fromUnscaledUint(a).rawValue <= b.rawValue;
}
| function isLessThanOrEqual(uint256 a, Unsigned memory b) internal pure returns (bool) {
return fromUnscaledUint(a).rawValue <= b.rawValue;
}
| 15,023 |
438 | // load the table into memory | string memory table = TABLE_ENCODE;
| string memory table = TABLE_ENCODE;
| 4,000 |
9 | // owner contract owner address/newTradePercentage new maximum tradable percentage of the reserves | event NewMaxTradePercentage( address owner, uint16 newTradePercentage );
| event NewMaxTradePercentage( address owner, uint16 newTradePercentage );
| 20,652 |
6 | // log initialization params | emit Initialized(operator, multihash, metadata);
| emit Initialized(operator, multihash, metadata);
| 7,812 |
10 | // Getter function for the proposal information by the id_id is the proposal idreturn title of proposal return description of proposal return owner of proposal return minAmountUSD for proposal to pass return expirationDate of proposal return trbBalance of proposal return open- bool true if proposal is still open return passed- bool true if proposal passed return percentFunded / | function getProposalById(uint _id) external view returns(string memory,string memory,address,uint,uint,uint,bool,bool,uint){
Proposal memory t = idToProposal[_id];
return (t.title,t.description,t.owner,t.minAmountUSD,t.expirationDate,t.trbBalance,t.open,t.passed,100 * (t.trbBalance* viewTellorPrice()/1e20) / t.minAmountUSD);
}
| function getProposalById(uint _id) external view returns(string memory,string memory,address,uint,uint,uint,bool,bool,uint){
Proposal memory t = idToProposal[_id];
return (t.title,t.description,t.owner,t.minAmountUSD,t.expirationDate,t.trbBalance,t.open,t.passed,100 * (t.trbBalance* viewTellorPrice()/1e20) / t.minAmountUSD);
}
| 31,763 |
62 | // ========== UTILITY FUNCTIONS ========== / | function rebalance() external onlyWorker {
address iterAddress = farmHead;
while (iterAddress != address(0)) {
if (farms[iterAddress].active) {
IFarm(iterAddress).rebalance();
}
iterAddress = farms[iterAddress].nextFarm;
}
emit Rebalanced(iterAddress);
}
| function rebalance() external onlyWorker {
address iterAddress = farmHead;
while (iterAddress != address(0)) {
if (farms[iterAddress].active) {
IFarm(iterAddress).rebalance();
}
iterAddress = farms[iterAddress].nextFarm;
}
emit Rebalanced(iterAddress);
}
| 59,931 |
16 | // Bind the fractional token address to the newly minted NFT's tokenId. | tokenIdToERC20TokenAddress[_tokenId] = tokenAddress;
| tokenIdToERC20TokenAddress[_tokenId] = tokenAddress;
| 28,617 |
166 | // //Convert string to bytes32 / | function stringToBytes32(string memory source) public pure returns (bytes32 result) {
bytes memory tempEmptyStringTest = bytes(source);
if (tempEmptyStringTest.length == 0) {
return 0x0;
}
assembly {
result := mload(add(source, 32))
}
}
| function stringToBytes32(string memory source) public pure returns (bytes32 result) {
bytes memory tempEmptyStringTest = bytes(source);
if (tempEmptyStringTest.length == 0) {
return 0x0;
}
assembly {
result := mload(add(source, 32))
}
}
| 9,698 |
4 | // Fee | uint256 public adminWalletFee = 3000 * 10**18;
uint256 public stakingPoolFee = 0;
uint256 public burnFee = 100 * 10**18;
| uint256 public adminWalletFee = 3000 * 10**18;
uint256 public stakingPoolFee = 0;
uint256 public burnFee = 100 * 10**18;
| 5,914 |
1 | // Raised when trying create a WhiteList config that already exisit (mint amounts are the same) / | error WhiteListAlreadyExists();
error NotWhitelisted();
error InvalidMintDuration();
function whitelistMint(
uint256 editionId,
uint8 maxAmount,
uint24 mintPriceInFinney,
bytes32[] calldata merkleProof,
uint24 quantity,
| error WhiteListAlreadyExists();
error NotWhitelisted();
error InvalidMintDuration();
function whitelistMint(
uint256 editionId,
uint8 maxAmount,
uint24 mintPriceInFinney,
bytes32[] calldata merkleProof,
uint24 quantity,
| 40,187 |
9 | // return The address for COMP token | function getCompAddress() external view returns (address);
| function getCompAddress() external view returns (address);
| 31,298 |
16 | // The new observation for each symbolHash | mapping(bytes32 => Observation) public newObservations;
| mapping(bytes32 => Observation) public newObservations;
| 12,306 |
8 | // |
uint constant MAX_HOUSE_FEE_THOUSANDTHS = 20;
uint constant MAX_LOTTERY_FEE_THOUSANDTHS = 40;
address public lastPlayer;
uint public lastBlock;
uint public totalWinnings;
uint public jackpot;
uint public startedAt;
|
uint constant MAX_HOUSE_FEE_THOUSANDTHS = 20;
uint constant MAX_LOTTERY_FEE_THOUSANDTHS = 40;
address public lastPlayer;
uint public lastBlock;
uint public totalWinnings;
uint public jackpot;
uint public startedAt;
| 50,014 |
12 | // Emitted when graph account sets their default name / | event SetDefaultName(
address graphAccount,
uint256 nameSystem, // only ENS for now
bytes32 nameIdentifier,
string name
);
| event SetDefaultName(
address graphAccount,
uint256 nameSystem, // only ENS for now
bytes32 nameIdentifier,
string name
);
| 28,891 |
24 | // Standard TRC20 tokenImplementation of the basic standard token. This implementation emits additional Approval events, allowing applications to reconstruct the allowance status forall accounts just by listening to said events. Note that this isn't required by the specification, and othercompliant implementations may not do it. / | contract TRC20 {
using SafeMath for uint256;
mapping (address => uint256) internal _balances;
mapping (address => mapping (address => uint256)) internal _allowed;
event Transfer(address indexed from, address indexed to, uint256 value);
event Approval(address indexed owner, address indexed spender, uint256 value);
uint256 internal _totalSupply;
string public constant name = "MegaToken1";
string public constant symbol = "MEGATOK1";
uint8 public constant decimals = 18;
constructor() public {
_totalSupply = 14000000;
_balances[msg.sender] = 14000000;
}
/**
* @dev Total number of tokens in existence
*/
function totalSupply() public view returns (uint256) {
return _totalSupply;
}
/**
* @dev Gets the balance of the specified address.
* @param owner The address to query the balance of.
* @return A uint256 representing the amount owned by the passed address.
*/
function balanceOf(address owner) public view returns (uint256) {
return _balances[owner];
}
/**
* @dev Function to check the amount of tokens that an owner allowed to a spender.
* @param owner address The address which owns the funds.
* @param spender address The address which will spend the funds.
* @return A uint256 specifying the amount of tokens still available for the spender.
*/
function allowance(address owner, address spender) public view returns (uint256) {
return _allowed[owner][spender];
}
/**
* @dev Transfer token to a specified address
* @param to The address to transfer to.
* @param value The amount to be transferred.
*/
function transfer(address to, uint256 value) public returns (bool) {
_transfer(msg.sender, to, value);
return true;
}
/**
* @dev Approve the passed address to spend the specified amount of tokens on behalf of msg.sender.
* Beware that changing an allowance with this method brings the risk that someone may use both the old
* and the new allowance by unfortunate transaction ordering. One possible solution to mitigate this
* race condition is to first reduce the spender's allowance to 0 and set the desired value afterwards:
* https://github.com/ethereum/EIPs/issues/20#issuecomment-263524729
* @param spender The address which will spend the funds.
* @param value The amount of tokens to be spent.
*/
function approve(address spender, uint256 value) public returns (bool) {
_approve(msg.sender, spender, value);
return true;
}
/**
* @dev Transfer tokens from one address to another.
* Note that while this function emits an Approval event, this is not required as per the specification,
* and other compliant implementations may not emit the event.
* @param from address The address which you want to send tokens from
* @param to address The address which you want to transfer to
* @param value uint256 the amount of tokens to be transferred
*/
function transferFrom(address from, address to, uint256 value) public returns (bool) {
_transfer(from, to, value);
_approve(from, msg.sender, _allowed[from][msg.sender].sub(value));
return true;
}
/**
* @dev Increase the amount of tokens that an owner allowed to a spender.
* approve should be called when _allowed[msg.sender][spender] == 0. To increment
* allowed value is better to use this function to avoid 2 calls (and wait until
* the first transaction is mined)
* From MonolithDAO Token.sol
* Emits an Approval event.
* @param spender The address which will spend the funds.
* @param addedValue The amount of tokens to increase the allowance by.
*/
function increaseAllowance(address spender, uint256 addedValue) public returns (bool) {
_approve(msg.sender, spender, _allowed[msg.sender][spender].add(addedValue));
return true;
}
/**
* @dev Decrease the amount of tokens that an owner allowed to a spender.
* approve should be called when _allowed[msg.sender][spender] == 0. To decrement
* allowed value is better to use this function to avoid 2 calls (and wait until
* the first transaction is mined)
* From MonolithDAO Token.sol
* Emits an Approval event.
* @param spender The address which will spend the funds.
* @param subtractedValue The amount of tokens to decrease the allowance by.
*/
function decreaseAllowance(address spender, uint256 subtractedValue) public returns (bool) {
_approve(msg.sender, spender, _allowed[msg.sender][spender].sub(subtractedValue));
return true;
}
/**
* @dev Transfer token for a specified addresses
* @param from The address to transfer from.
* @param to The address to transfer to.
* @param value The amount to be transferred.
*/
function _transfer(address from, address to, uint256 value) internal {
require(to != address(0));
_balances[from] = _balances[from].sub(value);
_balances[to] = _balances[to].add(value);
emit Transfer(from, to, value);
}
/**
* @dev Internal function that mints an amount of the token and assigns it to
* an account. This encapsulates the modification of balances such that the
* proper events are emitted.
* @param account The account that will receive the created tokens.
* @param value The amount that will be created.
*/
function _mint(address account, uint256 value) internal {
require(account != address(0));
_totalSupply = _totalSupply.add(value);
_balances[account] = _balances[account].add(value);
emit Transfer(address(0), account, value);
}
/**
* @dev Internal function that burns an amount of the token of a given
* account.
* @param account The account whose tokens will be burnt.
* @param value The amount that will be burnt.
*/
function _burn(address account, uint256 value) internal {
require(account != address(0));
_totalSupply = _totalSupply.sub(value);
_balances[account] = _balances[account].sub(value);
emit Transfer(account, address(0), value);
}
/**
* @dev Approve an address to spend another addresses' tokens.
* @param owner The address that owns the tokens.
* @param spender The address that will spend the tokens.
* @param value The number of tokens that can be spent.
*/
function _approve(address owner, address spender, uint256 value) internal {
require(spender != address(0));
require(owner != address(0));
_allowed[owner][spender] = value;
emit Approval(owner, spender, value);
}
/**
* @dev Internal function that burns an amount of the token of a given
* account, deducting from the sender's allowance for said account. Uses the
* internal burn function.
* Emits an Approval event (reflecting the reduced allowance).
* @param account The account whose tokens will be burnt.
* @param value The amount that will be burnt.
*/
function _burnFrom(address account, uint256 value) internal {
_burn(account, value);
_approve(account, msg.sender, _allowed[account][msg.sender].sub(value));
}
} | contract TRC20 {
using SafeMath for uint256;
mapping (address => uint256) internal _balances;
mapping (address => mapping (address => uint256)) internal _allowed;
event Transfer(address indexed from, address indexed to, uint256 value);
event Approval(address indexed owner, address indexed spender, uint256 value);
uint256 internal _totalSupply;
string public constant name = "MegaToken1";
string public constant symbol = "MEGATOK1";
uint8 public constant decimals = 18;
constructor() public {
_totalSupply = 14000000;
_balances[msg.sender] = 14000000;
}
/**
* @dev Total number of tokens in existence
*/
function totalSupply() public view returns (uint256) {
return _totalSupply;
}
/**
* @dev Gets the balance of the specified address.
* @param owner The address to query the balance of.
* @return A uint256 representing the amount owned by the passed address.
*/
function balanceOf(address owner) public view returns (uint256) {
return _balances[owner];
}
/**
* @dev Function to check the amount of tokens that an owner allowed to a spender.
* @param owner address The address which owns the funds.
* @param spender address The address which will spend the funds.
* @return A uint256 specifying the amount of tokens still available for the spender.
*/
function allowance(address owner, address spender) public view returns (uint256) {
return _allowed[owner][spender];
}
/**
* @dev Transfer token to a specified address
* @param to The address to transfer to.
* @param value The amount to be transferred.
*/
function transfer(address to, uint256 value) public returns (bool) {
_transfer(msg.sender, to, value);
return true;
}
/**
* @dev Approve the passed address to spend the specified amount of tokens on behalf of msg.sender.
* Beware that changing an allowance with this method brings the risk that someone may use both the old
* and the new allowance by unfortunate transaction ordering. One possible solution to mitigate this
* race condition is to first reduce the spender's allowance to 0 and set the desired value afterwards:
* https://github.com/ethereum/EIPs/issues/20#issuecomment-263524729
* @param spender The address which will spend the funds.
* @param value The amount of tokens to be spent.
*/
function approve(address spender, uint256 value) public returns (bool) {
_approve(msg.sender, spender, value);
return true;
}
/**
* @dev Transfer tokens from one address to another.
* Note that while this function emits an Approval event, this is not required as per the specification,
* and other compliant implementations may not emit the event.
* @param from address The address which you want to send tokens from
* @param to address The address which you want to transfer to
* @param value uint256 the amount of tokens to be transferred
*/
function transferFrom(address from, address to, uint256 value) public returns (bool) {
_transfer(from, to, value);
_approve(from, msg.sender, _allowed[from][msg.sender].sub(value));
return true;
}
/**
* @dev Increase the amount of tokens that an owner allowed to a spender.
* approve should be called when _allowed[msg.sender][spender] == 0. To increment
* allowed value is better to use this function to avoid 2 calls (and wait until
* the first transaction is mined)
* From MonolithDAO Token.sol
* Emits an Approval event.
* @param spender The address which will spend the funds.
* @param addedValue The amount of tokens to increase the allowance by.
*/
function increaseAllowance(address spender, uint256 addedValue) public returns (bool) {
_approve(msg.sender, spender, _allowed[msg.sender][spender].add(addedValue));
return true;
}
/**
* @dev Decrease the amount of tokens that an owner allowed to a spender.
* approve should be called when _allowed[msg.sender][spender] == 0. To decrement
* allowed value is better to use this function to avoid 2 calls (and wait until
* the first transaction is mined)
* From MonolithDAO Token.sol
* Emits an Approval event.
* @param spender The address which will spend the funds.
* @param subtractedValue The amount of tokens to decrease the allowance by.
*/
function decreaseAllowance(address spender, uint256 subtractedValue) public returns (bool) {
_approve(msg.sender, spender, _allowed[msg.sender][spender].sub(subtractedValue));
return true;
}
/**
* @dev Transfer token for a specified addresses
* @param from The address to transfer from.
* @param to The address to transfer to.
* @param value The amount to be transferred.
*/
function _transfer(address from, address to, uint256 value) internal {
require(to != address(0));
_balances[from] = _balances[from].sub(value);
_balances[to] = _balances[to].add(value);
emit Transfer(from, to, value);
}
/**
* @dev Internal function that mints an amount of the token and assigns it to
* an account. This encapsulates the modification of balances such that the
* proper events are emitted.
* @param account The account that will receive the created tokens.
* @param value The amount that will be created.
*/
function _mint(address account, uint256 value) internal {
require(account != address(0));
_totalSupply = _totalSupply.add(value);
_balances[account] = _balances[account].add(value);
emit Transfer(address(0), account, value);
}
/**
* @dev Internal function that burns an amount of the token of a given
* account.
* @param account The account whose tokens will be burnt.
* @param value The amount that will be burnt.
*/
function _burn(address account, uint256 value) internal {
require(account != address(0));
_totalSupply = _totalSupply.sub(value);
_balances[account] = _balances[account].sub(value);
emit Transfer(account, address(0), value);
}
/**
* @dev Approve an address to spend another addresses' tokens.
* @param owner The address that owns the tokens.
* @param spender The address that will spend the tokens.
* @param value The number of tokens that can be spent.
*/
function _approve(address owner, address spender, uint256 value) internal {
require(spender != address(0));
require(owner != address(0));
_allowed[owner][spender] = value;
emit Approval(owner, spender, value);
}
/**
* @dev Internal function that burns an amount of the token of a given
* account, deducting from the sender's allowance for said account. Uses the
* internal burn function.
* Emits an Approval event (reflecting the reduced allowance).
* @param account The account whose tokens will be burnt.
* @param value The amount that will be burnt.
*/
function _burnFrom(address account, uint256 value) internal {
_burn(account, value);
_approve(account, msg.sender, _allowed[account][msg.sender].sub(value));
}
} | 9,824 |
1 | // performance fee sent to treasury / FEE_BASIS of 10_000 | uint16 public fee = 1_000;
uint16 internal constant MAX_FEE = 1_000;
uint16 internal constant FEE_BASIS = 10_000;
| uint16 public fee = 1_000;
uint16 internal constant MAX_FEE = 1_000;
uint16 internal constant FEE_BASIS = 10_000;
| 6,261 |
3 | // Index operations // Create a new index for the publisher token Super token address indexId Id of the index ctx Context bytes (see ISuperfluid.sol for Context struct) @custom:callbacks None / | function createIndex(
ISuperfluidToken token,
uint32 indexId,
bytes calldata ctx)
external
virtual
returns(bytes memory newCtx);
| function createIndex(
ISuperfluidToken token,
uint32 indexId,
bytes calldata ctx)
external
virtual
returns(bytes memory newCtx);
| 21,929 |
124 | // The cfolioItem wrapper bridge | address private immutable _cfiBridge;
| address private immutable _cfiBridge;
| 68,550 |
165 | // Sets the active state of the reserve self The reserve configuration active The active state / | function setActive(DataTypes.ReserveConfigurationMap memory self, bool active) internal pure {
self.data =
(self.data & ACTIVE_MASK) |
(uint256(active ? 1 : 0) << IS_ACTIVE_START_BIT_POSITION);
}
| function setActive(DataTypes.ReserveConfigurationMap memory self, bool active) internal pure {
self.data =
(self.data & ACTIVE_MASK) |
(uint256(active ? 1 : 0) << IS_ACTIVE_START_BIT_POSITION);
}
| 53,279 |
1,759 | // A mock oracle used for testing. Exports the voting & oracle interfaces and events that contain ancillary data. | abstract contract VotingAncillaryInterfaceTesting is OracleAncillaryInterface, VotingAncillaryInterface, Testable {
using FixedPoint for FixedPoint.Unsigned;
// Events, data structures and functions not exported in the base interfaces, used for testing.
event VoteCommitted(
address indexed voter,
uint256 indexed roundId,
bytes32 indexed identifier,
uint256 time,
bytes ancillaryData
);
event EncryptedVote(
address indexed voter,
uint256 indexed roundId,
bytes32 indexed identifier,
uint256 time,
bytes ancillaryData,
bytes encryptedVote
);
event VoteRevealed(
address indexed voter,
uint256 indexed roundId,
bytes32 indexed identifier,
uint256 time,
int256 price,
bytes ancillaryData,
uint256 numTokens
);
event RewardsRetrieved(
address indexed voter,
uint256 indexed roundId,
bytes32 indexed identifier,
uint256 time,
uint256 numTokens
);
event PriceRequestAdded(uint256 indexed roundId, bytes32 indexed identifier, uint256 time);
event PriceResolved(
uint256 indexed roundId,
bytes32 indexed identifier,
uint256 time,
int256 price,
bytes ancillaryData
);
struct Round {
uint256 snapshotId; // Voting token snapshot ID for this round. 0 if no snapshot has been taken.
FixedPoint.Unsigned inflationRate; // Inflation rate set for this round.
FixedPoint.Unsigned gatPercentage; // Gat rate set for this round.
uint256 rewardsExpirationTime; // Time that rewards for this round can be claimed until.
}
// Represents the status a price request has.
enum RequestStatus {
NotRequested, // Was never requested.
Active, // Is being voted on in the current round.
Resolved, // Was resolved in a previous round.
Future // Is scheduled to be voted on in a future round.
}
// Only used as a return value in view methods -- never stored in the contract.
struct RequestState {
RequestStatus status;
uint256 lastVotingRound;
}
function rounds(uint256 roundId) public view virtual returns (Round memory);
function getPriceRequestStatuses(VotingAncillaryInterface.PendingRequestAncillary[] memory requests)
public
view
virtual
returns (RequestState[] memory);
function getPendingPriceRequestsArray() external view virtual returns (bytes32[] memory);
}
| abstract contract VotingAncillaryInterfaceTesting is OracleAncillaryInterface, VotingAncillaryInterface, Testable {
using FixedPoint for FixedPoint.Unsigned;
// Events, data structures and functions not exported in the base interfaces, used for testing.
event VoteCommitted(
address indexed voter,
uint256 indexed roundId,
bytes32 indexed identifier,
uint256 time,
bytes ancillaryData
);
event EncryptedVote(
address indexed voter,
uint256 indexed roundId,
bytes32 indexed identifier,
uint256 time,
bytes ancillaryData,
bytes encryptedVote
);
event VoteRevealed(
address indexed voter,
uint256 indexed roundId,
bytes32 indexed identifier,
uint256 time,
int256 price,
bytes ancillaryData,
uint256 numTokens
);
event RewardsRetrieved(
address indexed voter,
uint256 indexed roundId,
bytes32 indexed identifier,
uint256 time,
uint256 numTokens
);
event PriceRequestAdded(uint256 indexed roundId, bytes32 indexed identifier, uint256 time);
event PriceResolved(
uint256 indexed roundId,
bytes32 indexed identifier,
uint256 time,
int256 price,
bytes ancillaryData
);
struct Round {
uint256 snapshotId; // Voting token snapshot ID for this round. 0 if no snapshot has been taken.
FixedPoint.Unsigned inflationRate; // Inflation rate set for this round.
FixedPoint.Unsigned gatPercentage; // Gat rate set for this round.
uint256 rewardsExpirationTime; // Time that rewards for this round can be claimed until.
}
// Represents the status a price request has.
enum RequestStatus {
NotRequested, // Was never requested.
Active, // Is being voted on in the current round.
Resolved, // Was resolved in a previous round.
Future // Is scheduled to be voted on in a future round.
}
// Only used as a return value in view methods -- never stored in the contract.
struct RequestState {
RequestStatus status;
uint256 lastVotingRound;
}
function rounds(uint256 roundId) public view virtual returns (Round memory);
function getPriceRequestStatuses(VotingAncillaryInterface.PendingRequestAncillary[] memory requests)
public
view
virtual
returns (RequestState[] memory);
function getPendingPriceRequestsArray() external view virtual returns (bytes32[] memory);
}
| 17,966 |
204 | // Triggers an update of rewards due to a change in allocations. _subgraphDeploymentID Subgraph deployment updated / | function _updateRewards(bytes32 _subgraphDeploymentID) private returns (uint256) {
IRewardsManager rewardsManager = rewardsManager();
if (address(rewardsManager) == address(0)) {
return 0;
}
return rewardsManager.onSubgraphAllocationUpdate(_subgraphDeploymentID);
}
| function _updateRewards(bytes32 _subgraphDeploymentID) private returns (uint256) {
IRewardsManager rewardsManager = rewardsManager();
if (address(rewardsManager) == address(0)) {
return 0;
}
return rewardsManager.onSubgraphAllocationUpdate(_subgraphDeploymentID);
}
| 20,703 |
65 | // Function to convert {Set} Tokens into underlying components The ERC20 components do not need to be approved to call this functionquantity uint The quantity of Sets desired to redeem in Wei / | function redeem(uint quantity)
public
isMultipleOfNaturalUnit(quantity)
hasSufficientBalance(quantity)
isNonZero(quantity)
returns (bool success)
{
burn(quantity);
for (uint i = 0; i < components.length; i++) {
| function redeem(uint quantity)
public
isMultipleOfNaturalUnit(quantity)
hasSufficientBalance(quantity)
isNonZero(quantity)
returns (bool success)
{
burn(quantity);
for (uint i = 0; i < components.length; i++) {
| 3,418 |
11 | // Allow the fyToken to pull from the base join for redemption, and to push to mint with underlying | bytes4[] memory sigs = new bytes4[](2);
sigs[0] = JOIN;
sigs[1] = EXIT;
AccessControl(address(baseJoin)).grantRoles(sigs, address(fyToken));
| bytes4[] memory sigs = new bytes4[](2);
sigs[0] = JOIN;
sigs[1] = EXIT;
AccessControl(address(baseJoin)).grantRoles(sigs, address(fyToken));
| 10,656 |
46 | // Take service fee back. | function getServiceFeeBack() public onlyOwner
| function getServiceFeeBack() public onlyOwner
| 27,945 |
21 | // An order can only be filled if its status is FILLABLE. | if (orderInfo.orderStatus != LibOrder.OrderStatus.FILLABLE) {
revert('EXCHANGE: status not fillable');
}
| if (orderInfo.orderStatus != LibOrder.OrderStatus.FILLABLE) {
revert('EXCHANGE: status not fillable');
}
| 36,103 |
67 | // Info of each MCV2 pool./ `allocPoint` The amount of allocation points assigned to the pool./ Also known as the amount of SUSHI to distribute per block. | struct PoolInfo {
uint128 accSushiPerShare;
uint64 lastRewardBlock;
uint64 allocPoint;
}
| struct PoolInfo {
uint128 accSushiPerShare;
uint64 lastRewardBlock;
uint64 allocPoint;
}
| 34,512 |
158 | // oods_coefficients[134]/ mload(add(context, 0x6a80)), res += c_135(f_8(x) - f_8(g^34z)) / (x - g^34z). | res := add(
res,
mulmod(mulmod(/*(x - g^34 * z)^(-1)*/ mload(add(denominatorsPtr, 0x300)),
| res := add(
res,
mulmod(mulmod(/*(x - g^34 * z)^(-1)*/ mload(add(denominatorsPtr, 0x300)),
| 28,900 |
116 | // ========== MUTATIVE FUNCTIONS ========== // Fallback function (exchanges ETH to pUSD) / | function() external payable nonReentrant rateNotInvalid(ETH) notPaused {
_exchangeEtherForPynths();
}
| function() external payable nonReentrant rateNotInvalid(ETH) notPaused {
_exchangeEtherForPynths();
}
| 30,933 |
33 | // Get the address of a network contract by name | function getContractAddress(string memory _contractName) internal view returns (address) {
// Get the current contract address
address contractAddress = getAddress(keccak256(abi.encodePacked("contract.address", _contractName)));
// Check it
require(contractAddress != address(0x0), "Contract not found");
// Return
return contractAddress;
}
| function getContractAddress(string memory _contractName) internal view returns (address) {
// Get the current contract address
address contractAddress = getAddress(keccak256(abi.encodePacked("contract.address", _contractName)));
// Check it
require(contractAddress != address(0x0), "Contract not found");
// Return
return contractAddress;
}
| 20,866 |
12 | // Gets the owner of the specified token ID _tokenId uint256 ID of the token to query the owner ofreturn owner address currently marked as the owner of the given token ID / | function ownerOf(uint256 _tokenId) public override view returns (address) {
address owner = tokenOwner[_tokenId];
require(owner != address(0), "Zero address not allowed");
return owner;
}
| function ownerOf(uint256 _tokenId) public override view returns (address) {
address owner = tokenOwner[_tokenId];
require(owner != address(0), "Zero address not allowed");
return owner;
}
| 5,050 |
0 | // Paused on launch | _pause();
| _pause();
| 4,347 |
134 | // allows to burn only if burn is enabled / | function burn(uint256 amount) public virtual override {
require(_isBurnable, "burn option is deactivated");
super.burn(amount);
}
| function burn(uint256 amount) public virtual override {
require(_isBurnable, "burn option is deactivated");
super.burn(amount);
}
| 2,730 |
29 | // set refer reward rate / | function setReferRewardRate(uint256 referRate) public
onlyGovernance
| function setReferRewardRate(uint256 referRate) public
onlyGovernance
| 27,820 |
64 | // check if reward pool for given token exists | if (!rewardPools[address(token)].exists) {
| if (!rewardPools[address(token)].exists) {
| 18,513 |
7 | // Pauses system | function pause() external ifAdmin {
StorageSlot.getBooleanSlot(_PAUSE_SLOT).value = true;
emit Paused(msg.sender);
}
| function pause() external ifAdmin {
StorageSlot.getBooleanSlot(_PAUSE_SLOT).value = true;
emit Paused(msg.sender);
}
| 23,450 |
12 | // ============ External Getter Functions ============ //Return 0xAPI calldata which is already generated from 0xAPI _sourceTokenAddress of source token to be sold_destinationToken Address of destination token to buy_destinationAddress Address that assets should be transferred to_sourceQuantity Amount of source token to sell_minDestinationQuantity Min amount of destination token to buy_data Arbitrage bytes containing trade call data return address Target contract addressreturn uint256 Call valuereturn bytes Trade calldata / | function getTradeCalldata(
address _sourceToken,
address _destinationToken,
address _destinationAddress,
uint256 _sourceQuantity,
uint256 _minDestinationQuantity,
bytes calldata _data
)
external
view
| function getTradeCalldata(
address _sourceToken,
address _destinationToken,
address _destinationAddress,
uint256 _sourceQuantity,
uint256 _minDestinationQuantity,
bytes calldata _data
)
external
view
| 59,137 |
1 | // Admin mints an NFT ticket with a specific metadata for this ticket. _to Mint to _to address _userId User ID of the NFT ticket Owner _eventId Event ID that the ticket belongs to _ticketTypeId ID of the ticket type _metadataFileName The name of metadata json file in the metadata folder.The metadata will be set at ticket level (each individual ticket has different metadata). The metadata will point to the file wih _metadataFileName in IPFS folder. / | function safeMintWithMetadata(
| function safeMintWithMetadata(
| 36,292 |
51 | // Admin function to set the mint fee_mintFee The new mint fee specified in basis pointsThe maximum fee that can be set is 10_000 bps, or 100% / | function setMintFee(uint256 _mintFee) external onlyRole(MANAGER_ADMIN) {
if (_mintFee > BPS_DENOMINATOR) {
revert FeeTooLarge();
}
uint256 oldMintFee = mintFee;
mintFee = _mintFee;
emit MintFeeSet(oldMintFee, _mintFee);
}
| function setMintFee(uint256 _mintFee) external onlyRole(MANAGER_ADMIN) {
if (_mintFee > BPS_DENOMINATOR) {
revert FeeTooLarge();
}
uint256 oldMintFee = mintFee;
mintFee = _mintFee;
emit MintFeeSet(oldMintFee, _mintFee);
}
| 24,640 |
174 | // The constructor that is called when the contract is being deployed. | constructor(address subscriptionOrRegistrantToCopy, bool subscribe) {
// If an inheriting token contract is deployed to a network without the registry deployed, the modifier
// will not revert, but the contract will need to be registered with the registry once it is deployed in
// order for the modifier to filter addresses.
if (address(OPERATOR_FILTER_REGISTRY).code.length > 0) {
if (subscribe) {
OPERATOR_FILTER_REGISTRY.registerAndSubscribe(address(this), subscriptionOrRegistrantToCopy);
} else {
if (subscriptionOrRegistrantToCopy != address(0)) {
OPERATOR_FILTER_REGISTRY.registerAndCopyEntries(address(this), subscriptionOrRegistrantToCopy);
} else {
OPERATOR_FILTER_REGISTRY.register(address(this));
}
}
}
}
| constructor(address subscriptionOrRegistrantToCopy, bool subscribe) {
// If an inheriting token contract is deployed to a network without the registry deployed, the modifier
// will not revert, but the contract will need to be registered with the registry once it is deployed in
// order for the modifier to filter addresses.
if (address(OPERATOR_FILTER_REGISTRY).code.length > 0) {
if (subscribe) {
OPERATOR_FILTER_REGISTRY.registerAndSubscribe(address(this), subscriptionOrRegistrantToCopy);
} else {
if (subscriptionOrRegistrantToCopy != address(0)) {
OPERATOR_FILTER_REGISTRY.registerAndCopyEntries(address(this), subscriptionOrRegistrantToCopy);
} else {
OPERATOR_FILTER_REGISTRY.register(address(this));
}
}
}
}
| 26,897 |
164 | // Executions | function getOrderExecutionLength(address _token, bytes32 _orderId) constant public returns(uint) {
return my_executions[_token][_orderId].length;
}
| function getOrderExecutionLength(address _token, bytes32 _orderId) constant public returns(uint) {
return my_executions[_token][_orderId].length;
}
| 46,488 |
40 | // We need to unpack the signature, which is given as an array of 65 bytes (from eth.sign) | bytes32 r;
bytes32 s;
uint8 v;
assembly {
r := mload(add(signature, 32))
s := mload(add(signature, 64))
v := and(mload(add(signature, 65)), 255)
}
| bytes32 r;
bytes32 s;
uint8 v;
assembly {
r := mload(add(signature, 32))
s := mload(add(signature, 64))
v := and(mload(add(signature, 65)), 255)
}
| 40,763 |
15 | // Assset info for ETH assetType is only a selector, i.e. 4 bytes length. | require(assetInfo.length == 4, "INVALID_ASSET_STRING");
| require(assetInfo.length == 4, "INVALID_ASSET_STRING");
| 16,030 |
202 | // Check that the rental requires mediation | require(rental.depositStatus == DepositStatus.Pending);
require(depositDeductions[rentalId].status == DeductionStatus.Objected);
| require(rental.depositStatus == DepositStatus.Pending);
require(depositDeductions[rentalId].status == DeductionStatus.Objected);
| 43,488 |
20 | // copy un funded task for ith phase | uint256[] memory _nonFundedTaskList = new uint256[](
_nonFundedPhaseToTask.length - j
);
uint256 _taskID;
for (
uint256 k = j;
k < _nonFundedPhaseToTask.length;
k++
) {
_nonFundedTaskList[_taskID] = _nonFundedPhaseToTask[
| uint256[] memory _nonFundedTaskList = new uint256[](
_nonFundedPhaseToTask.length - j
);
uint256 _taskID;
for (
uint256 k = j;
k < _nonFundedPhaseToTask.length;
k++
) {
_nonFundedTaskList[_taskID] = _nonFundedPhaseToTask[
| 18,420 |
533 | // View function to see pending microCOREs on frontend. | function pendingmicroCORE(uint256 _pid, address _user)
external
view
returns (uint256)
| function pendingmicroCORE(uint256 _pid, address _user)
external
view
returns (uint256)
| 42,973 |
80 | // Sets {decimals} to a value other than the default one of 18./ | function _setupDecimals(uint8 decimals_) internal {
| function _setupDecimals(uint8 decimals_) internal {
| 3,276 |
48 | // An approximation of currently how many seconds are in between blocks. | uint256 public secondsPerBlock = 15;
| uint256 public secondsPerBlock = 15;
| 85,199 |
44 | // Initialize the data contarct. _strvalue of exmStr of Data contract._intvalue of exmInt of Data contract._arrayvalue of exmArray of Data contract. / | function initialize (string _str, uint256 _int, uint16 [] _array) public;
| function initialize (string _str, uint256 _int, uint16 [] _array) public;
| 28,744 |
17 | // equip the shard | tokenIdToDna[tokenId] = dnaType;
| tokenIdToDna[tokenId] = dnaType;
| 33,426 |
324 | // Yields the least unsigned 60.18 decimal fixed-point number greater than or equal to x.//Optimised for fractional value inputs, because for every whole value there are (1e18 - 1) fractional counterparts./ See https:en.wikipedia.org/wiki/Floor_and_ceiling_functions.// Requirements:/ - x must be less than or equal to MAX_WHOLE_UD60x18.//x The unsigned 60.18-decimal fixed-point number to ceil./result The least integer greater than or equal to x, as an unsigned 60.18-decimal fixed-point number. | function ceil(uint256 x) internal pure returns (uint256 result) {
require(x <= MAX_WHOLE_UD60x18);
assembly {
// Equivalent to "x % SCALE" but faster.
let remainder := mod(x, SCALE)
// Equivalent to "SCALE - remainder" but faster.
let delta := sub(SCALE, remainder)
// Equivalent to "x + delta * (remainder > 0 ? 1 : 0)" but faster.
result := add(x, mul(delta, gt(remainder, 0)))
}
}
| function ceil(uint256 x) internal pure returns (uint256 result) {
require(x <= MAX_WHOLE_UD60x18);
assembly {
// Equivalent to "x % SCALE" but faster.
let remainder := mod(x, SCALE)
// Equivalent to "SCALE - remainder" but faster.
let delta := sub(SCALE, remainder)
// Equivalent to "x + delta * (remainder > 0 ? 1 : 0)" but faster.
result := add(x, mul(delta, gt(remainder, 0)))
}
}
| 69,495 |
61 | // Log the transfer event | Transfer(msg.sender, _to, _value, _data);
return true;
| Transfer(msg.sender, _to, _value, _data);
return true;
| 21,190 |
3 | // the collenction Name / | string private name_;
| string private name_;
| 11,414 |
432 | // allows the configurator to update the loan to value of a reserve_reserve the address of the reserve_ltv the new loan to value/ | {
CoreLibrary.ReserveData storage reserve = reserves[_reserve];
reserve.baseLTVasCollateral = _ltv;
}
| {
CoreLibrary.ReserveData storage reserve = reserves[_reserve];
reserve.baseLTVasCollateral = _ltv;
}
| 56,056 |
172 | // returns the amount of underlying that this contract's cTokens can be redeemed for | function balanceOfCTokenUnderlying(address owner) internal view returns (uint256) {
uint256 exchangeRate = cToken.exchangeRateStored();
uint256 scaledMantissa = exchangeRate.mul(cToken.balanceOf(owner));
// Note: We are not using careful math here as we're performing a division that cannot fail
return scaledMantissa / BASE;
}
| function balanceOfCTokenUnderlying(address owner) internal view returns (uint256) {
uint256 exchangeRate = cToken.exchangeRateStored();
uint256 scaledMantissa = exchangeRate.mul(cToken.balanceOf(owner));
// Note: We are not using careful math here as we're performing a division that cannot fail
return scaledMantissa / BASE;
}
| 34,791 |
4 | // Multiply two uint256 values, throw in case of overflow.x first value to multiply y second value to multiplyreturn xy / | function safeMul (uint256 x, uint256 y)
pure internal
| function safeMul (uint256 x, uint256 y)
pure internal
| 50,110 |
27 | // Gas optimization: this is cheaper than requiring 'a' not being zero, but the benefit is lost if 'b' is also tested. See: https:github.com/OpenZeppelin/openzeppelin-contracts/pull/522 | if (a == 0) {
return 0;
}
| if (a == 0) {
return 0;
}
| 291 |
33 | // Split user bet in some pieces:- 55% go to bank- 20% go to contract developer :)- 12% go to sponsor- 10% go to stock for future restores- 3%go to referral (if exists, if not - go into stock) / | function splitTheBet(address referral) private {
uint256 _partBank = Math.percent(msg.value, partBank);
uint256 _partOwner = Math.percent(msg.value, partOwner);
uint256 _partStock = Math.percent(msg.value, partStock);
uint256 _partSponsor = Math.percent(msg.value, partSponsor);
uint256 _partReferral = Math.percent(msg.value, partReferral);
bank = Math.add(bank, _partBank);
stock = Math.add(stock, _partStock);
owner.transfer(_partOwner);
sponsor.transfer(_partSponsor);
if (referral != address(0) && referral != msg.sender && bets[referral] > 0) {
referral.transfer(_partReferral);
} else {
stock = Math.add(stock, _partReferral);
}
}
| function splitTheBet(address referral) private {
uint256 _partBank = Math.percent(msg.value, partBank);
uint256 _partOwner = Math.percent(msg.value, partOwner);
uint256 _partStock = Math.percent(msg.value, partStock);
uint256 _partSponsor = Math.percent(msg.value, partSponsor);
uint256 _partReferral = Math.percent(msg.value, partReferral);
bank = Math.add(bank, _partBank);
stock = Math.add(stock, _partStock);
owner.transfer(_partOwner);
sponsor.transfer(_partSponsor);
if (referral != address(0) && referral != msg.sender && bets[referral] > 0) {
referral.transfer(_partReferral);
} else {
stock = Math.add(stock, _partReferral);
}
}
| 18,629 |
182 | // Require loanLiquidationOpen to be false or we are in liquidation phase | require(loanLiquidationOpen == false, "Loans are now being liquidated");
| require(loanLiquidationOpen == false, "Loans are now being liquidated");
| 3,812 |
1 | // lock time for passive liquidity | uint256 public override passiveLiquidityLocktime;
| uint256 public override passiveLiquidityLocktime;
| 27,223 |
7 | // mapping(address => uint256) funds; | mapping(bytes32 => uint256) flightSurety;
| mapping(bytes32 => uint256) flightSurety;
| 4,101 |
5 | // Calculates the change to base token reserves associated with a pricemove along an AMM curve of constant liquidity.Result is a tight lower-bound for fixed-point precision. Meaning if thethe returned limit is X, then X will be inside the limit price and (X+1)will be outside the limit price. / | internal pure returns (uint128) {
unchecked {
uint128 priceDelta = priceX > priceY ?
priceX - priceY : priceY - priceX; // Condition assures never underflows
return reserveAtPrice(liq, priceDelta, true);
}
}
| internal pure returns (uint128) {
unchecked {
uint128 priceDelta = priceX > priceY ?
priceX - priceY : priceY - priceX; // Condition assures never underflows
return reserveAtPrice(liq, priceDelta, true);
}
}
| 13,516 |
129 | // Optimize for when y equals 1.0, 2.0 or 4.0, as those are very simple to implement and occur often in 50/50 and 80/20 Weighted Pools | if (y == ONE) {
return x;
} else if (y == TWO) {
| if (y == ONE) {
return x;
} else if (y == TWO) {
| 25,006 |
39 | // sendReward( account, stakeEarned, stakeSubtract, yieldEarned, yieldSubtract ); |
if(yieldEarned > 0){
pendingEarnedYields[account] = yieldEarned;
totalExitRewardsYield += yieldSubtract;
}
|
if(yieldEarned > 0){
pendingEarnedYields[account] = yieldEarned;
totalExitRewardsYield += yieldSubtract;
}
| 10,599 |
62 | // send bonus token to broker | function requestBonus() external{
require(getState()==State.Success);
uint256 bonusAmount = bonus[msg.sender];
assert(bonusAmount>0);
require(bonusAmount<=safeSub(bonusAndBountyTokens,bonusAmount));
balanceOf[msg.sender] = safeAdd(balanceOf[msg.sender],bonusAmount);
bonus[msg.sender] = 0;
bonusAndBountyTokens = safeSub(bonusAndBountyTokens,bonusAmount);
emit BonusTransfer(msg.sender,bonusAmount,block.number);
emit Transfer(0,msg.sender,bonusAmount);
}
| function requestBonus() external{
require(getState()==State.Success);
uint256 bonusAmount = bonus[msg.sender];
assert(bonusAmount>0);
require(bonusAmount<=safeSub(bonusAndBountyTokens,bonusAmount));
balanceOf[msg.sender] = safeAdd(balanceOf[msg.sender],bonusAmount);
bonus[msg.sender] = 0;
bonusAndBountyTokens = safeSub(bonusAndBountyTokens,bonusAmount);
emit BonusTransfer(msg.sender,bonusAmount,block.number);
emit Transfer(0,msg.sender,bonusAmount);
}
| 46,447 |
38 | // on presale success, this is the final step to end the presale, lock liquidity and enable withdrawls of the sale token. This function does not use percentile distribution. Rebasing mechanisms, fee on transfers, or any deflationary logic are not taken into account at this stage to ensure stated liquidity is locked and the pool is initialised according tothe presale parameters and fixed prices. | function addLiquidity() external nonReentrant {
require(!STATUS.LP_GENERATION_COMPLETE, 'GENERATION COMPLETE');
require(presaleStatus() == 2, 'NOT SUCCESS'); // SUCCESS
// Fail the presale if the pair exists and contains presale token liquidity
if (PRESALE_LOCK_FORWARDER.uniswapPairIsInitialised(address(PRESALE_INFO.S_TOKEN), address(PRESALE_INFO.B_TOKEN))) {
STATUS.FORCE_FAILED = true;
return;
}
uint256 unicryptBaseFee = STATUS.TOTAL_BASE_COLLECTED.mul(PRESALE_FEE_INFO.UNICRYPT_BASE_FEE).div(1000);
// base token liquidity
uint256 baseLiquidity = STATUS.TOTAL_BASE_COLLECTED.sub(unicryptBaseFee).mul(PRESALE_INFO.LIQUIDITY_PERCENT).div(1000);
if (PRESALE_INFO.PRESALE_IN_ETH) {
WETH.deposit{value : baseLiquidity}();
}
TransferHelper.safeApprove(address(PRESALE_INFO.B_TOKEN), address(PRESALE_LOCK_FORWARDER), baseLiquidity);
// sale token liquidity
uint256 tokenLiquidity = baseLiquidity.mul(PRESALE_INFO.LISTING_RATE).div(10 ** uint256(PRESALE_INFO.B_TOKEN.decimals()));
TransferHelper.safeApprove(address(PRESALE_INFO.S_TOKEN), address(PRESALE_LOCK_FORWARDER), tokenLiquidity);
PRESALE_LOCK_FORWARDER.lockLiquidity(PRESALE_INFO.B_TOKEN, PRESALE_INFO.S_TOKEN, baseLiquidity, tokenLiquidity, block.timestamp + PRESALE_INFO.LOCK_PERIOD, PRESALE_INFO.PRESALE_OWNER);
// transfer fees
uint256 unicryptTokenFee = STATUS.TOTAL_TOKENS_SOLD.mul(PRESALE_FEE_INFO.UNICRYPT_TOKEN_FEE).div(1000);
// referrals are checked for validity in the presale generator
if (PRESALE_FEE_INFO.REFERRAL_FEE_ADDRESS != address(0)) {
// Base token fee
uint256 referralBaseFee = unicryptBaseFee.mul(PRESALE_FEE_INFO.REFERRAL_FEE).div(1000);
TransferHelper.safeTransferBaseToken(address(PRESALE_INFO.B_TOKEN), PRESALE_FEE_INFO.REFERRAL_FEE_ADDRESS, referralBaseFee, !PRESALE_INFO.PRESALE_IN_ETH);
unicryptBaseFee = unicryptBaseFee.sub(referralBaseFee);
// Token fee
uint256 referralTokenFee = unicryptTokenFee.mul(PRESALE_FEE_INFO.REFERRAL_FEE).div(1000);
TransferHelper.safeTransfer(address(PRESALE_INFO.S_TOKEN), PRESALE_FEE_INFO.REFERRAL_FEE_ADDRESS, referralTokenFee);
unicryptTokenFee = unicryptTokenFee.sub(referralTokenFee);
}
TransferHelper.safeTransferBaseToken(address(PRESALE_INFO.B_TOKEN), PRESALE_FEE_INFO.BASE_FEE_ADDRESS, unicryptBaseFee, !PRESALE_INFO.PRESALE_IN_ETH);
TransferHelper.safeTransfer(address(PRESALE_INFO.S_TOKEN), PRESALE_FEE_INFO.TOKEN_FEE_ADDRESS, unicryptTokenFee);
// burn unsold tokens
uint256 remainingSBalance = PRESALE_INFO.S_TOKEN.balanceOf(address(this));
if (remainingSBalance > STATUS.TOTAL_TOKENS_SOLD) {
uint256 burnAmount = remainingSBalance.sub(STATUS.TOTAL_TOKENS_SOLD);
TransferHelper.safeTransfer(address(PRESALE_INFO.S_TOKEN), 0x000000000000000000000000000000000000dEaD, burnAmount);
}
// send remaining base tokens to presale owner
uint256 remainingBaseBalance = PRESALE_INFO.PRESALE_IN_ETH ? address(this).balance : PRESALE_INFO.B_TOKEN.balanceOf(address(this));
TransferHelper.safeTransferBaseToken(address(PRESALE_INFO.B_TOKEN), PRESALE_INFO.PRESALE_OWNER, remainingBaseBalance, !PRESALE_INFO.PRESALE_IN_ETH);
STATUS.LP_GENERATION_COMPLETE = true;
}
| function addLiquidity() external nonReentrant {
require(!STATUS.LP_GENERATION_COMPLETE, 'GENERATION COMPLETE');
require(presaleStatus() == 2, 'NOT SUCCESS'); // SUCCESS
// Fail the presale if the pair exists and contains presale token liquidity
if (PRESALE_LOCK_FORWARDER.uniswapPairIsInitialised(address(PRESALE_INFO.S_TOKEN), address(PRESALE_INFO.B_TOKEN))) {
STATUS.FORCE_FAILED = true;
return;
}
uint256 unicryptBaseFee = STATUS.TOTAL_BASE_COLLECTED.mul(PRESALE_FEE_INFO.UNICRYPT_BASE_FEE).div(1000);
// base token liquidity
uint256 baseLiquidity = STATUS.TOTAL_BASE_COLLECTED.sub(unicryptBaseFee).mul(PRESALE_INFO.LIQUIDITY_PERCENT).div(1000);
if (PRESALE_INFO.PRESALE_IN_ETH) {
WETH.deposit{value : baseLiquidity}();
}
TransferHelper.safeApprove(address(PRESALE_INFO.B_TOKEN), address(PRESALE_LOCK_FORWARDER), baseLiquidity);
// sale token liquidity
uint256 tokenLiquidity = baseLiquidity.mul(PRESALE_INFO.LISTING_RATE).div(10 ** uint256(PRESALE_INFO.B_TOKEN.decimals()));
TransferHelper.safeApprove(address(PRESALE_INFO.S_TOKEN), address(PRESALE_LOCK_FORWARDER), tokenLiquidity);
PRESALE_LOCK_FORWARDER.lockLiquidity(PRESALE_INFO.B_TOKEN, PRESALE_INFO.S_TOKEN, baseLiquidity, tokenLiquidity, block.timestamp + PRESALE_INFO.LOCK_PERIOD, PRESALE_INFO.PRESALE_OWNER);
// transfer fees
uint256 unicryptTokenFee = STATUS.TOTAL_TOKENS_SOLD.mul(PRESALE_FEE_INFO.UNICRYPT_TOKEN_FEE).div(1000);
// referrals are checked for validity in the presale generator
if (PRESALE_FEE_INFO.REFERRAL_FEE_ADDRESS != address(0)) {
// Base token fee
uint256 referralBaseFee = unicryptBaseFee.mul(PRESALE_FEE_INFO.REFERRAL_FEE).div(1000);
TransferHelper.safeTransferBaseToken(address(PRESALE_INFO.B_TOKEN), PRESALE_FEE_INFO.REFERRAL_FEE_ADDRESS, referralBaseFee, !PRESALE_INFO.PRESALE_IN_ETH);
unicryptBaseFee = unicryptBaseFee.sub(referralBaseFee);
// Token fee
uint256 referralTokenFee = unicryptTokenFee.mul(PRESALE_FEE_INFO.REFERRAL_FEE).div(1000);
TransferHelper.safeTransfer(address(PRESALE_INFO.S_TOKEN), PRESALE_FEE_INFO.REFERRAL_FEE_ADDRESS, referralTokenFee);
unicryptTokenFee = unicryptTokenFee.sub(referralTokenFee);
}
TransferHelper.safeTransferBaseToken(address(PRESALE_INFO.B_TOKEN), PRESALE_FEE_INFO.BASE_FEE_ADDRESS, unicryptBaseFee, !PRESALE_INFO.PRESALE_IN_ETH);
TransferHelper.safeTransfer(address(PRESALE_INFO.S_TOKEN), PRESALE_FEE_INFO.TOKEN_FEE_ADDRESS, unicryptTokenFee);
// burn unsold tokens
uint256 remainingSBalance = PRESALE_INFO.S_TOKEN.balanceOf(address(this));
if (remainingSBalance > STATUS.TOTAL_TOKENS_SOLD) {
uint256 burnAmount = remainingSBalance.sub(STATUS.TOTAL_TOKENS_SOLD);
TransferHelper.safeTransfer(address(PRESALE_INFO.S_TOKEN), 0x000000000000000000000000000000000000dEaD, burnAmount);
}
// send remaining base tokens to presale owner
uint256 remainingBaseBalance = PRESALE_INFO.PRESALE_IN_ETH ? address(this).balance : PRESALE_INFO.B_TOKEN.balanceOf(address(this));
TransferHelper.safeTransferBaseToken(address(PRESALE_INFO.B_TOKEN), PRESALE_INFO.PRESALE_OWNER, remainingBaseBalance, !PRESALE_INFO.PRESALE_IN_ETH);
STATUS.LP_GENERATION_COMPLETE = true;
}
| 20,857 |
180 | // txHash -> eth address of tx mint |
mapping(string => bool) xeq_complete;
mapping(string => uint256) xeq_amounts;
mapping(string => address) eth_addresses;
|
mapping(string => bool) xeq_complete;
mapping(string => uint256) xeq_amounts;
mapping(string => address) eth_addresses;
| 32,225 |
6 | // decode a UQ6496 into a uint192 by truncating after the radix point | function decode(uq64x96 memory self) internal pure returns (uint192) {
return uint192(self._x >> _N);
}
| function decode(uq64x96 memory self) internal pure returns (uint192) {
return uint192(self._x >> _N);
}
| 13,186 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.