contract_name
stringlengths
1
61
file_path
stringlengths
5
50.4k
contract_address
stringlengths
42
42
language
stringclasses
1 value
class_name
stringlengths
1
61
class_code
stringlengths
4
330k
class_documentation
stringlengths
0
29.1k
class_documentation_type
stringclasses
6 values
func_name
stringlengths
0
62
func_code
stringlengths
1
303k
func_documentation
stringlengths
2
14.9k
func_documentation_type
stringclasses
4 values
compiler_version
stringlengths
15
42
license_type
stringclasses
14 values
swarm_source
stringlengths
0
71
meta
dict
__index_level_0__
int64
0
60.4k
privlocatumICO
privlocatumICO.sol
0xd153fc5ed49c5ec9e7bdbc4b0310202c633143b1
Solidity
privlocatumICO
contract privlocatumICO is Owned, privlocatum { //Applies SafeMath library to uint256 operations using SafeMath for uint256; //Public Variables address public multiSigWallet; uint256 public amountRaised; uint256 public startTime; uint256 public stopTime; uint256 public hardcap; uint256 public price; //Variables bool crowdsaleClosed = true; string tokenName = "Privlocatum"; string tokenSymbol = "PLT"; uint256 multiplier = 100000000; uint8 decimalUnits = 8; //Initializes the token function privlocatumICO() privlocatum(tokenName, tokenSymbol, decimalUnits, multiplier) { multiSigWallet = msg.sender; hardcap = 70000000; hardcap = hardcap.mul(multiplier); } //Fallback function creates tokens and sends to investor when crowdsale is open function () payable { require(!crowdsaleClosed && (now < stopTime) && (totalSupply.add(msg.value.mul(getPrice()).mul(multiplier).div(1 ether)) <= hardcap)); address recipient = msg.sender; amountRaised = amountRaised.add(msg.value.div(1 ether)); uint256 tokens = msg.value.mul(getPrice()).mul(multiplier).div(1 ether); totalSupply = totalSupply.add(tokens); balance[recipient] = balance[recipient].add(tokens); require(multiSigWallet.send(msg.value)); Transfer(0, recipient, tokens); } //Returns the current price of the token for the crowdsale function getPrice() returns (uint256 result) { return price; } //Returns time remaining on crowdsale function getRemainingTime() constant returns (uint256) { return stopTime; } //Set the sale hardcap amount function setHardCapValue(uint256 newHardcap) onlyOwner returns (bool success) { hardcap = newHardcap.mul(multiplier); return true; } //Sets the multisig wallet for a crowdsale function setMultiSigWallet(address wallet) onlyOwner returns (bool success) { multiSigWallet = wallet; return true; } //Sets the token price function setPrice(uint256 newPriceperEther) onlyOwner returns (uint256) { require(newPriceperEther > 0); price = newPriceperEther; return price; } //Allows owner to start the crowdsale from the time of execution until a specified stopTime function startSale(uint256 saleStart, uint256 saleStop, uint256 salePrice, address setBeneficiary) onlyOwner returns (bool success) { require(saleStop > now); startTime = saleStart; stopTime = saleStop; crowdsaleClosed = false; setPrice(salePrice); setMultiSigWallet(setBeneficiary); return true; } //Allows owner to stop the crowdsale immediately function stopSale() onlyOwner returns (bool success) { stopTime = now; crowdsaleClosed = true; return true; } }
setMultiSigWallet
function setMultiSigWallet(address wallet) onlyOwner returns (bool success) { multiSigWallet = wallet; return true; }
//Sets the multisig wallet for a crowdsale
LineComment
v0.4.24-nightly.2018.5.16+commit.7f965c86
bzzr://9f84af8450e6c4a1cb8b540e44593ea54ef2065a4e2d8124a73dd2bb969debed
{ "func_code_index": [ 2146, 2297 ] }
57,661
privlocatumICO
privlocatumICO.sol
0xd153fc5ed49c5ec9e7bdbc4b0310202c633143b1
Solidity
privlocatumICO
contract privlocatumICO is Owned, privlocatum { //Applies SafeMath library to uint256 operations using SafeMath for uint256; //Public Variables address public multiSigWallet; uint256 public amountRaised; uint256 public startTime; uint256 public stopTime; uint256 public hardcap; uint256 public price; //Variables bool crowdsaleClosed = true; string tokenName = "Privlocatum"; string tokenSymbol = "PLT"; uint256 multiplier = 100000000; uint8 decimalUnits = 8; //Initializes the token function privlocatumICO() privlocatum(tokenName, tokenSymbol, decimalUnits, multiplier) { multiSigWallet = msg.sender; hardcap = 70000000; hardcap = hardcap.mul(multiplier); } //Fallback function creates tokens and sends to investor when crowdsale is open function () payable { require(!crowdsaleClosed && (now < stopTime) && (totalSupply.add(msg.value.mul(getPrice()).mul(multiplier).div(1 ether)) <= hardcap)); address recipient = msg.sender; amountRaised = amountRaised.add(msg.value.div(1 ether)); uint256 tokens = msg.value.mul(getPrice()).mul(multiplier).div(1 ether); totalSupply = totalSupply.add(tokens); balance[recipient] = balance[recipient].add(tokens); require(multiSigWallet.send(msg.value)); Transfer(0, recipient, tokens); } //Returns the current price of the token for the crowdsale function getPrice() returns (uint256 result) { return price; } //Returns time remaining on crowdsale function getRemainingTime() constant returns (uint256) { return stopTime; } //Set the sale hardcap amount function setHardCapValue(uint256 newHardcap) onlyOwner returns (bool success) { hardcap = newHardcap.mul(multiplier); return true; } //Sets the multisig wallet for a crowdsale function setMultiSigWallet(address wallet) onlyOwner returns (bool success) { multiSigWallet = wallet; return true; } //Sets the token price function setPrice(uint256 newPriceperEther) onlyOwner returns (uint256) { require(newPriceperEther > 0); price = newPriceperEther; return price; } //Allows owner to start the crowdsale from the time of execution until a specified stopTime function startSale(uint256 saleStart, uint256 saleStop, uint256 salePrice, address setBeneficiary) onlyOwner returns (bool success) { require(saleStop > now); startTime = saleStart; stopTime = saleStop; crowdsaleClosed = false; setPrice(salePrice); setMultiSigWallet(setBeneficiary); return true; } //Allows owner to stop the crowdsale immediately function stopSale() onlyOwner returns (bool success) { stopTime = now; crowdsaleClosed = true; return true; } }
setPrice
function setPrice(uint256 newPriceperEther) onlyOwner returns (uint256) { require(newPriceperEther > 0); price = newPriceperEther; return price; }
//Sets the token price
LineComment
v0.4.24-nightly.2018.5.16+commit.7f965c86
bzzr://9f84af8450e6c4a1cb8b540e44593ea54ef2065a4e2d8124a73dd2bb969debed
{ "func_code_index": [ 2334, 2525 ] }
57,662
privlocatumICO
privlocatumICO.sol
0xd153fc5ed49c5ec9e7bdbc4b0310202c633143b1
Solidity
privlocatumICO
contract privlocatumICO is Owned, privlocatum { //Applies SafeMath library to uint256 operations using SafeMath for uint256; //Public Variables address public multiSigWallet; uint256 public amountRaised; uint256 public startTime; uint256 public stopTime; uint256 public hardcap; uint256 public price; //Variables bool crowdsaleClosed = true; string tokenName = "Privlocatum"; string tokenSymbol = "PLT"; uint256 multiplier = 100000000; uint8 decimalUnits = 8; //Initializes the token function privlocatumICO() privlocatum(tokenName, tokenSymbol, decimalUnits, multiplier) { multiSigWallet = msg.sender; hardcap = 70000000; hardcap = hardcap.mul(multiplier); } //Fallback function creates tokens and sends to investor when crowdsale is open function () payable { require(!crowdsaleClosed && (now < stopTime) && (totalSupply.add(msg.value.mul(getPrice()).mul(multiplier).div(1 ether)) <= hardcap)); address recipient = msg.sender; amountRaised = amountRaised.add(msg.value.div(1 ether)); uint256 tokens = msg.value.mul(getPrice()).mul(multiplier).div(1 ether); totalSupply = totalSupply.add(tokens); balance[recipient] = balance[recipient].add(tokens); require(multiSigWallet.send(msg.value)); Transfer(0, recipient, tokens); } //Returns the current price of the token for the crowdsale function getPrice() returns (uint256 result) { return price; } //Returns time remaining on crowdsale function getRemainingTime() constant returns (uint256) { return stopTime; } //Set the sale hardcap amount function setHardCapValue(uint256 newHardcap) onlyOwner returns (bool success) { hardcap = newHardcap.mul(multiplier); return true; } //Sets the multisig wallet for a crowdsale function setMultiSigWallet(address wallet) onlyOwner returns (bool success) { multiSigWallet = wallet; return true; } //Sets the token price function setPrice(uint256 newPriceperEther) onlyOwner returns (uint256) { require(newPriceperEther > 0); price = newPriceperEther; return price; } //Allows owner to start the crowdsale from the time of execution until a specified stopTime function startSale(uint256 saleStart, uint256 saleStop, uint256 salePrice, address setBeneficiary) onlyOwner returns (bool success) { require(saleStop > now); startTime = saleStart; stopTime = saleStop; crowdsaleClosed = false; setPrice(salePrice); setMultiSigWallet(setBeneficiary); return true; } //Allows owner to stop the crowdsale immediately function stopSale() onlyOwner returns (bool success) { stopTime = now; crowdsaleClosed = true; return true; } }
startSale
function startSale(uint256 saleStart, uint256 saleStop, uint256 salePrice, address setBeneficiary) onlyOwner returns (bool success) { require(saleStop > now); startTime = saleStart; stopTime = saleStop; crowdsaleClosed = false; setPrice(salePrice); setMultiSigWallet(setBeneficiary); return true; }
//Allows owner to start the crowdsale from the time of execution until a specified stopTime
LineComment
v0.4.24-nightly.2018.5.16+commit.7f965c86
bzzr://9f84af8450e6c4a1cb8b540e44593ea54ef2065a4e2d8124a73dd2bb969debed
{ "func_code_index": [ 2631, 3018 ] }
57,663
privlocatumICO
privlocatumICO.sol
0xd153fc5ed49c5ec9e7bdbc4b0310202c633143b1
Solidity
privlocatumICO
contract privlocatumICO is Owned, privlocatum { //Applies SafeMath library to uint256 operations using SafeMath for uint256; //Public Variables address public multiSigWallet; uint256 public amountRaised; uint256 public startTime; uint256 public stopTime; uint256 public hardcap; uint256 public price; //Variables bool crowdsaleClosed = true; string tokenName = "Privlocatum"; string tokenSymbol = "PLT"; uint256 multiplier = 100000000; uint8 decimalUnits = 8; //Initializes the token function privlocatumICO() privlocatum(tokenName, tokenSymbol, decimalUnits, multiplier) { multiSigWallet = msg.sender; hardcap = 70000000; hardcap = hardcap.mul(multiplier); } //Fallback function creates tokens and sends to investor when crowdsale is open function () payable { require(!crowdsaleClosed && (now < stopTime) && (totalSupply.add(msg.value.mul(getPrice()).mul(multiplier).div(1 ether)) <= hardcap)); address recipient = msg.sender; amountRaised = amountRaised.add(msg.value.div(1 ether)); uint256 tokens = msg.value.mul(getPrice()).mul(multiplier).div(1 ether); totalSupply = totalSupply.add(tokens); balance[recipient] = balance[recipient].add(tokens); require(multiSigWallet.send(msg.value)); Transfer(0, recipient, tokens); } //Returns the current price of the token for the crowdsale function getPrice() returns (uint256 result) { return price; } //Returns time remaining on crowdsale function getRemainingTime() constant returns (uint256) { return stopTime; } //Set the sale hardcap amount function setHardCapValue(uint256 newHardcap) onlyOwner returns (bool success) { hardcap = newHardcap.mul(multiplier); return true; } //Sets the multisig wallet for a crowdsale function setMultiSigWallet(address wallet) onlyOwner returns (bool success) { multiSigWallet = wallet; return true; } //Sets the token price function setPrice(uint256 newPriceperEther) onlyOwner returns (uint256) { require(newPriceperEther > 0); price = newPriceperEther; return price; } //Allows owner to start the crowdsale from the time of execution until a specified stopTime function startSale(uint256 saleStart, uint256 saleStop, uint256 salePrice, address setBeneficiary) onlyOwner returns (bool success) { require(saleStop > now); startTime = saleStart; stopTime = saleStop; crowdsaleClosed = false; setPrice(salePrice); setMultiSigWallet(setBeneficiary); return true; } //Allows owner to stop the crowdsale immediately function stopSale() onlyOwner returns (bool success) { stopTime = now; crowdsaleClosed = true; return true; } }
stopSale
function stopSale() onlyOwner returns (bool success) { stopTime = now; crowdsaleClosed = true; return true; }
//Allows owner to stop the crowdsale immediately
LineComment
v0.4.24-nightly.2018.5.16+commit.7f965c86
bzzr://9f84af8450e6c4a1cb8b540e44593ea54ef2065a4e2d8124a73dd2bb969debed
{ "func_code_index": [ 3081, 3235 ] }
57,664
CHEDDAR
contracts/CHEDDAR.sol
0x68810fb2b13d48b2f4a0fb1fea2397a2a106ad2d
Solidity
CHEDDAR
contract CHEDDAR is ICHEDDAR, ERC20, Ownable { // Tracks the last block that a caller has written to state. // Disallow some access to functions if they occur while a change is being written. mapping(address => uint256) private lastWrite; // address => allowedToCallFunctions mapping(address => bool) private admins; uint256 private TOTAL_SUPPLY = 6000000000 ether; constructor() ERC20("CHEDDAR", "CHEDDAR") { } /** * enables an address to mint / burn * @param addr the address to enable */ function addAdmin(address addr) external onlyOwner { admins[addr] = true; } /** * disables an address from minting / burning * @param addr the address to disbale */ function removeAdmin(address addr) external onlyOwner { admins[addr] = false; } /** * mints $CHEDDAR to a recipient * @param to the recipient of the $CHEDDAR * @param amount the amount of $CHEDDAR to mint */ function mint(address to, uint256 amount) external override { require(admins[msg.sender], "Only admins can mint"); require(totalSupply() + amount <= TOTAL_SUPPLY, "Mint amount exceeds"); _mint(to, amount); } /** * burns $CHEDDAR from a holder * @param from the holder of the $CHEDDAR * @param amount the amount of $CHEDDAR to burn */ function burn(address from, uint256 amount) external override { require(admins[msg.sender], "Only admins can burn"); _burn(from, amount); } /** * @dev See {IERC20-transferFrom}. * * Emits an {Approval} event indicating the updated allowance. This is not * required by the EIP. See the note at the beginning of {ERC20}. * * Requirements: * * - `sender` and `recipient` cannot be the zero address. * - `sender` must have a balance of at least `amount`. * - the caller must have allowance for ``sender``'s tokens of at least * `amount`. */ function transferFrom( address sender, address recipient, uint256 amount ) public virtual override(ERC20, ICHEDDAR) disallowIfStateIsChanging returns (bool) { // NICE TRY MOUSE DRAGON require(admins[_msgSender()] || lastWrite[sender] < block.number , "hmmmm what doing?"); // If the entity invoking this transfer is an admin (i.e. the gameContract) // allow the transfer without approval. This saves gas and a transaction. // The sender address will still need to actually have the amount being attempted to send. if(admins[_msgSender()]) { // NOTE: This will omit any events from being written. This saves additional gas, // and the event emission is not a requirement by the EIP // (read this function summary / ERC20 summary for more details) _transfer(sender, recipient, amount); return true; } // If it's not an admin entity (game contract, habitat, etc) // The entity will need to be given permission to transfer these funds // For instance, someone can't just make a contract and siphon $CHEDDAR from every account return super.transferFrom(sender, recipient, amount); } /** SECURITEEEEEEEEEEEEEEEEE */ modifier disallowIfStateIsChanging() { // frens can always call whenever they want :) require(admins[_msgSender()] || lastWrite[tx.origin] < block.number, "hmmmm what doing?"); _; } function updateOriginAccess() external override { require(admins[_msgSender()], "Only admins can call this"); lastWrite[tx.origin] = block.number; } function balanceOf(address account) public view virtual override disallowIfStateIsChanging returns (uint256) { // Y U checking on this address in the same block it's being modified... hmmmm require(admins[_msgSender()] || lastWrite[account] < block.number, "hmmmm what doing?"); return super.balanceOf(account); } function transfer(address recipient, uint256 amount) public virtual override disallowIfStateIsChanging returns (bool) { // NICE TRY MOUSE DRAGON require(admins[_msgSender()] || lastWrite[_msgSender()] < block.number, "hmmmm what doing?"); return super.transfer(recipient, amount); } // Not ensuring state changed in this block as it would needlessly increase gas function allowance(address owner, address spender) public view virtual override returns (uint256) { return super.allowance(owner, spender); } // Not ensuring state changed in this block as it would needlessly increase gas function approve(address spender, uint256 amount) public virtual override returns (bool) { return super.approve(spender, amount); } // Not ensuring state changed in this block as it would needlessly increase gas function increaseAllowance(address spender, uint256 addedValue) public virtual override returns (bool) { return super.increaseAllowance(spender, addedValue); } // Not ensuring state changed in this block as it would needlessly increase gas function decreaseAllowance(address spender, uint256 subtractedValue) public virtual override returns (bool) { return super.decreaseAllowance(spender, subtractedValue); } }
addAdmin
function addAdmin(address addr) external onlyOwner { admins[addr] = true; }
/** * enables an address to mint / burn * @param addr the address to enable */
NatSpecMultiLine
v0.8.4+commit.c7e474f2
{ "func_code_index": [ 552, 643 ] }
57,665
CHEDDAR
contracts/CHEDDAR.sol
0x68810fb2b13d48b2f4a0fb1fea2397a2a106ad2d
Solidity
CHEDDAR
contract CHEDDAR is ICHEDDAR, ERC20, Ownable { // Tracks the last block that a caller has written to state. // Disallow some access to functions if they occur while a change is being written. mapping(address => uint256) private lastWrite; // address => allowedToCallFunctions mapping(address => bool) private admins; uint256 private TOTAL_SUPPLY = 6000000000 ether; constructor() ERC20("CHEDDAR", "CHEDDAR") { } /** * enables an address to mint / burn * @param addr the address to enable */ function addAdmin(address addr) external onlyOwner { admins[addr] = true; } /** * disables an address from minting / burning * @param addr the address to disbale */ function removeAdmin(address addr) external onlyOwner { admins[addr] = false; } /** * mints $CHEDDAR to a recipient * @param to the recipient of the $CHEDDAR * @param amount the amount of $CHEDDAR to mint */ function mint(address to, uint256 amount) external override { require(admins[msg.sender], "Only admins can mint"); require(totalSupply() + amount <= TOTAL_SUPPLY, "Mint amount exceeds"); _mint(to, amount); } /** * burns $CHEDDAR from a holder * @param from the holder of the $CHEDDAR * @param amount the amount of $CHEDDAR to burn */ function burn(address from, uint256 amount) external override { require(admins[msg.sender], "Only admins can burn"); _burn(from, amount); } /** * @dev See {IERC20-transferFrom}. * * Emits an {Approval} event indicating the updated allowance. This is not * required by the EIP. See the note at the beginning of {ERC20}. * * Requirements: * * - `sender` and `recipient` cannot be the zero address. * - `sender` must have a balance of at least `amount`. * - the caller must have allowance for ``sender``'s tokens of at least * `amount`. */ function transferFrom( address sender, address recipient, uint256 amount ) public virtual override(ERC20, ICHEDDAR) disallowIfStateIsChanging returns (bool) { // NICE TRY MOUSE DRAGON require(admins[_msgSender()] || lastWrite[sender] < block.number , "hmmmm what doing?"); // If the entity invoking this transfer is an admin (i.e. the gameContract) // allow the transfer without approval. This saves gas and a transaction. // The sender address will still need to actually have the amount being attempted to send. if(admins[_msgSender()]) { // NOTE: This will omit any events from being written. This saves additional gas, // and the event emission is not a requirement by the EIP // (read this function summary / ERC20 summary for more details) _transfer(sender, recipient, amount); return true; } // If it's not an admin entity (game contract, habitat, etc) // The entity will need to be given permission to transfer these funds // For instance, someone can't just make a contract and siphon $CHEDDAR from every account return super.transferFrom(sender, recipient, amount); } /** SECURITEEEEEEEEEEEEEEEEE */ modifier disallowIfStateIsChanging() { // frens can always call whenever they want :) require(admins[_msgSender()] || lastWrite[tx.origin] < block.number, "hmmmm what doing?"); _; } function updateOriginAccess() external override { require(admins[_msgSender()], "Only admins can call this"); lastWrite[tx.origin] = block.number; } function balanceOf(address account) public view virtual override disallowIfStateIsChanging returns (uint256) { // Y U checking on this address in the same block it's being modified... hmmmm require(admins[_msgSender()] || lastWrite[account] < block.number, "hmmmm what doing?"); return super.balanceOf(account); } function transfer(address recipient, uint256 amount) public virtual override disallowIfStateIsChanging returns (bool) { // NICE TRY MOUSE DRAGON require(admins[_msgSender()] || lastWrite[_msgSender()] < block.number, "hmmmm what doing?"); return super.transfer(recipient, amount); } // Not ensuring state changed in this block as it would needlessly increase gas function allowance(address owner, address spender) public view virtual override returns (uint256) { return super.allowance(owner, spender); } // Not ensuring state changed in this block as it would needlessly increase gas function approve(address spender, uint256 amount) public virtual override returns (bool) { return super.approve(spender, amount); } // Not ensuring state changed in this block as it would needlessly increase gas function increaseAllowance(address spender, uint256 addedValue) public virtual override returns (bool) { return super.increaseAllowance(spender, addedValue); } // Not ensuring state changed in this block as it would needlessly increase gas function decreaseAllowance(address spender, uint256 subtractedValue) public virtual override returns (bool) { return super.decreaseAllowance(spender, subtractedValue); } }
removeAdmin
function removeAdmin(address addr) external onlyOwner { admins[addr] = false; }
/** * disables an address from minting / burning * @param addr the address to disbale */
NatSpecMultiLine
v0.8.4+commit.c7e474f2
{ "func_code_index": [ 750, 847 ] }
57,666
CHEDDAR
contracts/CHEDDAR.sol
0x68810fb2b13d48b2f4a0fb1fea2397a2a106ad2d
Solidity
CHEDDAR
contract CHEDDAR is ICHEDDAR, ERC20, Ownable { // Tracks the last block that a caller has written to state. // Disallow some access to functions if they occur while a change is being written. mapping(address => uint256) private lastWrite; // address => allowedToCallFunctions mapping(address => bool) private admins; uint256 private TOTAL_SUPPLY = 6000000000 ether; constructor() ERC20("CHEDDAR", "CHEDDAR") { } /** * enables an address to mint / burn * @param addr the address to enable */ function addAdmin(address addr) external onlyOwner { admins[addr] = true; } /** * disables an address from minting / burning * @param addr the address to disbale */ function removeAdmin(address addr) external onlyOwner { admins[addr] = false; } /** * mints $CHEDDAR to a recipient * @param to the recipient of the $CHEDDAR * @param amount the amount of $CHEDDAR to mint */ function mint(address to, uint256 amount) external override { require(admins[msg.sender], "Only admins can mint"); require(totalSupply() + amount <= TOTAL_SUPPLY, "Mint amount exceeds"); _mint(to, amount); } /** * burns $CHEDDAR from a holder * @param from the holder of the $CHEDDAR * @param amount the amount of $CHEDDAR to burn */ function burn(address from, uint256 amount) external override { require(admins[msg.sender], "Only admins can burn"); _burn(from, amount); } /** * @dev See {IERC20-transferFrom}. * * Emits an {Approval} event indicating the updated allowance. This is not * required by the EIP. See the note at the beginning of {ERC20}. * * Requirements: * * - `sender` and `recipient` cannot be the zero address. * - `sender` must have a balance of at least `amount`. * - the caller must have allowance for ``sender``'s tokens of at least * `amount`. */ function transferFrom( address sender, address recipient, uint256 amount ) public virtual override(ERC20, ICHEDDAR) disallowIfStateIsChanging returns (bool) { // NICE TRY MOUSE DRAGON require(admins[_msgSender()] || lastWrite[sender] < block.number , "hmmmm what doing?"); // If the entity invoking this transfer is an admin (i.e. the gameContract) // allow the transfer without approval. This saves gas and a transaction. // The sender address will still need to actually have the amount being attempted to send. if(admins[_msgSender()]) { // NOTE: This will omit any events from being written. This saves additional gas, // and the event emission is not a requirement by the EIP // (read this function summary / ERC20 summary for more details) _transfer(sender, recipient, amount); return true; } // If it's not an admin entity (game contract, habitat, etc) // The entity will need to be given permission to transfer these funds // For instance, someone can't just make a contract and siphon $CHEDDAR from every account return super.transferFrom(sender, recipient, amount); } /** SECURITEEEEEEEEEEEEEEEEE */ modifier disallowIfStateIsChanging() { // frens can always call whenever they want :) require(admins[_msgSender()] || lastWrite[tx.origin] < block.number, "hmmmm what doing?"); _; } function updateOriginAccess() external override { require(admins[_msgSender()], "Only admins can call this"); lastWrite[tx.origin] = block.number; } function balanceOf(address account) public view virtual override disallowIfStateIsChanging returns (uint256) { // Y U checking on this address in the same block it's being modified... hmmmm require(admins[_msgSender()] || lastWrite[account] < block.number, "hmmmm what doing?"); return super.balanceOf(account); } function transfer(address recipient, uint256 amount) public virtual override disallowIfStateIsChanging returns (bool) { // NICE TRY MOUSE DRAGON require(admins[_msgSender()] || lastWrite[_msgSender()] < block.number, "hmmmm what doing?"); return super.transfer(recipient, amount); } // Not ensuring state changed in this block as it would needlessly increase gas function allowance(address owner, address spender) public view virtual override returns (uint256) { return super.allowance(owner, spender); } // Not ensuring state changed in this block as it would needlessly increase gas function approve(address spender, uint256 amount) public virtual override returns (bool) { return super.approve(spender, amount); } // Not ensuring state changed in this block as it would needlessly increase gas function increaseAllowance(address spender, uint256 addedValue) public virtual override returns (bool) { return super.increaseAllowance(spender, addedValue); } // Not ensuring state changed in this block as it would needlessly increase gas function decreaseAllowance(address spender, uint256 subtractedValue) public virtual override returns (bool) { return super.decreaseAllowance(spender, subtractedValue); } }
mint
function mint(address to, uint256 amount) external override { require(admins[msg.sender], "Only admins can mint"); require(totalSupply() + amount <= TOTAL_SUPPLY, "Mint amount exceeds"); _mint(to, amount); }
/** * mints $CHEDDAR to a recipient * @param to the recipient of the $CHEDDAR * @param amount the amount of $CHEDDAR to mint */
NatSpecMultiLine
v0.8.4+commit.c7e474f2
{ "func_code_index": [ 998, 1237 ] }
57,667
CHEDDAR
contracts/CHEDDAR.sol
0x68810fb2b13d48b2f4a0fb1fea2397a2a106ad2d
Solidity
CHEDDAR
contract CHEDDAR is ICHEDDAR, ERC20, Ownable { // Tracks the last block that a caller has written to state. // Disallow some access to functions if they occur while a change is being written. mapping(address => uint256) private lastWrite; // address => allowedToCallFunctions mapping(address => bool) private admins; uint256 private TOTAL_SUPPLY = 6000000000 ether; constructor() ERC20("CHEDDAR", "CHEDDAR") { } /** * enables an address to mint / burn * @param addr the address to enable */ function addAdmin(address addr) external onlyOwner { admins[addr] = true; } /** * disables an address from minting / burning * @param addr the address to disbale */ function removeAdmin(address addr) external onlyOwner { admins[addr] = false; } /** * mints $CHEDDAR to a recipient * @param to the recipient of the $CHEDDAR * @param amount the amount of $CHEDDAR to mint */ function mint(address to, uint256 amount) external override { require(admins[msg.sender], "Only admins can mint"); require(totalSupply() + amount <= TOTAL_SUPPLY, "Mint amount exceeds"); _mint(to, amount); } /** * burns $CHEDDAR from a holder * @param from the holder of the $CHEDDAR * @param amount the amount of $CHEDDAR to burn */ function burn(address from, uint256 amount) external override { require(admins[msg.sender], "Only admins can burn"); _burn(from, amount); } /** * @dev See {IERC20-transferFrom}. * * Emits an {Approval} event indicating the updated allowance. This is not * required by the EIP. See the note at the beginning of {ERC20}. * * Requirements: * * - `sender` and `recipient` cannot be the zero address. * - `sender` must have a balance of at least `amount`. * - the caller must have allowance for ``sender``'s tokens of at least * `amount`. */ function transferFrom( address sender, address recipient, uint256 amount ) public virtual override(ERC20, ICHEDDAR) disallowIfStateIsChanging returns (bool) { // NICE TRY MOUSE DRAGON require(admins[_msgSender()] || lastWrite[sender] < block.number , "hmmmm what doing?"); // If the entity invoking this transfer is an admin (i.e. the gameContract) // allow the transfer without approval. This saves gas and a transaction. // The sender address will still need to actually have the amount being attempted to send. if(admins[_msgSender()]) { // NOTE: This will omit any events from being written. This saves additional gas, // and the event emission is not a requirement by the EIP // (read this function summary / ERC20 summary for more details) _transfer(sender, recipient, amount); return true; } // If it's not an admin entity (game contract, habitat, etc) // The entity will need to be given permission to transfer these funds // For instance, someone can't just make a contract and siphon $CHEDDAR from every account return super.transferFrom(sender, recipient, amount); } /** SECURITEEEEEEEEEEEEEEEEE */ modifier disallowIfStateIsChanging() { // frens can always call whenever they want :) require(admins[_msgSender()] || lastWrite[tx.origin] < block.number, "hmmmm what doing?"); _; } function updateOriginAccess() external override { require(admins[_msgSender()], "Only admins can call this"); lastWrite[tx.origin] = block.number; } function balanceOf(address account) public view virtual override disallowIfStateIsChanging returns (uint256) { // Y U checking on this address in the same block it's being modified... hmmmm require(admins[_msgSender()] || lastWrite[account] < block.number, "hmmmm what doing?"); return super.balanceOf(account); } function transfer(address recipient, uint256 amount) public virtual override disallowIfStateIsChanging returns (bool) { // NICE TRY MOUSE DRAGON require(admins[_msgSender()] || lastWrite[_msgSender()] < block.number, "hmmmm what doing?"); return super.transfer(recipient, amount); } // Not ensuring state changed in this block as it would needlessly increase gas function allowance(address owner, address spender) public view virtual override returns (uint256) { return super.allowance(owner, spender); } // Not ensuring state changed in this block as it would needlessly increase gas function approve(address spender, uint256 amount) public virtual override returns (bool) { return super.approve(spender, amount); } // Not ensuring state changed in this block as it would needlessly increase gas function increaseAllowance(address spender, uint256 addedValue) public virtual override returns (bool) { return super.increaseAllowance(spender, addedValue); } // Not ensuring state changed in this block as it would needlessly increase gas function decreaseAllowance(address spender, uint256 subtractedValue) public virtual override returns (bool) { return super.decreaseAllowance(spender, subtractedValue); } }
burn
function burn(address from, uint256 amount) external override { require(admins[msg.sender], "Only admins can burn"); _burn(from, amount); }
/** * burns $CHEDDAR from a holder * @param from the holder of the $CHEDDAR * @param amount the amount of $CHEDDAR to burn */
NatSpecMultiLine
v0.8.4+commit.c7e474f2
{ "func_code_index": [ 1385, 1548 ] }
57,668
CHEDDAR
contracts/CHEDDAR.sol
0x68810fb2b13d48b2f4a0fb1fea2397a2a106ad2d
Solidity
CHEDDAR
contract CHEDDAR is ICHEDDAR, ERC20, Ownable { // Tracks the last block that a caller has written to state. // Disallow some access to functions if they occur while a change is being written. mapping(address => uint256) private lastWrite; // address => allowedToCallFunctions mapping(address => bool) private admins; uint256 private TOTAL_SUPPLY = 6000000000 ether; constructor() ERC20("CHEDDAR", "CHEDDAR") { } /** * enables an address to mint / burn * @param addr the address to enable */ function addAdmin(address addr) external onlyOwner { admins[addr] = true; } /** * disables an address from minting / burning * @param addr the address to disbale */ function removeAdmin(address addr) external onlyOwner { admins[addr] = false; } /** * mints $CHEDDAR to a recipient * @param to the recipient of the $CHEDDAR * @param amount the amount of $CHEDDAR to mint */ function mint(address to, uint256 amount) external override { require(admins[msg.sender], "Only admins can mint"); require(totalSupply() + amount <= TOTAL_SUPPLY, "Mint amount exceeds"); _mint(to, amount); } /** * burns $CHEDDAR from a holder * @param from the holder of the $CHEDDAR * @param amount the amount of $CHEDDAR to burn */ function burn(address from, uint256 amount) external override { require(admins[msg.sender], "Only admins can burn"); _burn(from, amount); } /** * @dev See {IERC20-transferFrom}. * * Emits an {Approval} event indicating the updated allowance. This is not * required by the EIP. See the note at the beginning of {ERC20}. * * Requirements: * * - `sender` and `recipient` cannot be the zero address. * - `sender` must have a balance of at least `amount`. * - the caller must have allowance for ``sender``'s tokens of at least * `amount`. */ function transferFrom( address sender, address recipient, uint256 amount ) public virtual override(ERC20, ICHEDDAR) disallowIfStateIsChanging returns (bool) { // NICE TRY MOUSE DRAGON require(admins[_msgSender()] || lastWrite[sender] < block.number , "hmmmm what doing?"); // If the entity invoking this transfer is an admin (i.e. the gameContract) // allow the transfer without approval. This saves gas and a transaction. // The sender address will still need to actually have the amount being attempted to send. if(admins[_msgSender()]) { // NOTE: This will omit any events from being written. This saves additional gas, // and the event emission is not a requirement by the EIP // (read this function summary / ERC20 summary for more details) _transfer(sender, recipient, amount); return true; } // If it's not an admin entity (game contract, habitat, etc) // The entity will need to be given permission to transfer these funds // For instance, someone can't just make a contract and siphon $CHEDDAR from every account return super.transferFrom(sender, recipient, amount); } /** SECURITEEEEEEEEEEEEEEEEE */ modifier disallowIfStateIsChanging() { // frens can always call whenever they want :) require(admins[_msgSender()] || lastWrite[tx.origin] < block.number, "hmmmm what doing?"); _; } function updateOriginAccess() external override { require(admins[_msgSender()], "Only admins can call this"); lastWrite[tx.origin] = block.number; } function balanceOf(address account) public view virtual override disallowIfStateIsChanging returns (uint256) { // Y U checking on this address in the same block it's being modified... hmmmm require(admins[_msgSender()] || lastWrite[account] < block.number, "hmmmm what doing?"); return super.balanceOf(account); } function transfer(address recipient, uint256 amount) public virtual override disallowIfStateIsChanging returns (bool) { // NICE TRY MOUSE DRAGON require(admins[_msgSender()] || lastWrite[_msgSender()] < block.number, "hmmmm what doing?"); return super.transfer(recipient, amount); } // Not ensuring state changed in this block as it would needlessly increase gas function allowance(address owner, address spender) public view virtual override returns (uint256) { return super.allowance(owner, spender); } // Not ensuring state changed in this block as it would needlessly increase gas function approve(address spender, uint256 amount) public virtual override returns (bool) { return super.approve(spender, amount); } // Not ensuring state changed in this block as it would needlessly increase gas function increaseAllowance(address spender, uint256 addedValue) public virtual override returns (bool) { return super.increaseAllowance(spender, addedValue); } // Not ensuring state changed in this block as it would needlessly increase gas function decreaseAllowance(address spender, uint256 subtractedValue) public virtual override returns (bool) { return super.decreaseAllowance(spender, subtractedValue); } }
transferFrom
function transferFrom( address sender, address recipient, uint256 amount ) public virtual override(ERC20, ICHEDDAR) disallowIfStateIsChanging returns (bool) { // NICE TRY MOUSE DRAGON require(admins[_msgSender()] || lastWrite[sender] < block.number , "hmmmm what doing?"); // If the entity invoking this transfer is an admin (i.e. the gameContract) // allow the transfer without approval. This saves gas and a transaction. // The sender address will still need to actually have the amount being attempted to send. if(admins[_msgSender()]) { // NOTE: This will omit any events from being written. This saves additional gas, // and the event emission is not a requirement by the EIP // (read this function summary / ERC20 summary for more details) _transfer(sender, recipient, amount); return true; } // If it's not an admin entity (game contract, habitat, etc) // The entity will need to be given permission to transfer these funds // For instance, someone can't just make a contract and siphon $CHEDDAR from every account return super.transferFrom(sender, recipient, amount); }
/** * @dev See {IERC20-transferFrom}. * * Emits an {Approval} event indicating the updated allowance. This is not * required by the EIP. See the note at the beginning of {ERC20}. * * Requirements: * * - `sender` and `recipient` cannot be the zero address. * - `sender` must have a balance of at least `amount`. * - the caller must have allowance for ``sender``'s tokens of at least * `amount`. */
NatSpecMultiLine
v0.8.4+commit.c7e474f2
{ "func_code_index": [ 2000, 3250 ] }
57,669
CHEDDAR
contracts/CHEDDAR.sol
0x68810fb2b13d48b2f4a0fb1fea2397a2a106ad2d
Solidity
CHEDDAR
contract CHEDDAR is ICHEDDAR, ERC20, Ownable { // Tracks the last block that a caller has written to state. // Disallow some access to functions if they occur while a change is being written. mapping(address => uint256) private lastWrite; // address => allowedToCallFunctions mapping(address => bool) private admins; uint256 private TOTAL_SUPPLY = 6000000000 ether; constructor() ERC20("CHEDDAR", "CHEDDAR") { } /** * enables an address to mint / burn * @param addr the address to enable */ function addAdmin(address addr) external onlyOwner { admins[addr] = true; } /** * disables an address from minting / burning * @param addr the address to disbale */ function removeAdmin(address addr) external onlyOwner { admins[addr] = false; } /** * mints $CHEDDAR to a recipient * @param to the recipient of the $CHEDDAR * @param amount the amount of $CHEDDAR to mint */ function mint(address to, uint256 amount) external override { require(admins[msg.sender], "Only admins can mint"); require(totalSupply() + amount <= TOTAL_SUPPLY, "Mint amount exceeds"); _mint(to, amount); } /** * burns $CHEDDAR from a holder * @param from the holder of the $CHEDDAR * @param amount the amount of $CHEDDAR to burn */ function burn(address from, uint256 amount) external override { require(admins[msg.sender], "Only admins can burn"); _burn(from, amount); } /** * @dev See {IERC20-transferFrom}. * * Emits an {Approval} event indicating the updated allowance. This is not * required by the EIP. See the note at the beginning of {ERC20}. * * Requirements: * * - `sender` and `recipient` cannot be the zero address. * - `sender` must have a balance of at least `amount`. * - the caller must have allowance for ``sender``'s tokens of at least * `amount`. */ function transferFrom( address sender, address recipient, uint256 amount ) public virtual override(ERC20, ICHEDDAR) disallowIfStateIsChanging returns (bool) { // NICE TRY MOUSE DRAGON require(admins[_msgSender()] || lastWrite[sender] < block.number , "hmmmm what doing?"); // If the entity invoking this transfer is an admin (i.e. the gameContract) // allow the transfer without approval. This saves gas and a transaction. // The sender address will still need to actually have the amount being attempted to send. if(admins[_msgSender()]) { // NOTE: This will omit any events from being written. This saves additional gas, // and the event emission is not a requirement by the EIP // (read this function summary / ERC20 summary for more details) _transfer(sender, recipient, amount); return true; } // If it's not an admin entity (game contract, habitat, etc) // The entity will need to be given permission to transfer these funds // For instance, someone can't just make a contract and siphon $CHEDDAR from every account return super.transferFrom(sender, recipient, amount); } /** SECURITEEEEEEEEEEEEEEEEE */ modifier disallowIfStateIsChanging() { // frens can always call whenever they want :) require(admins[_msgSender()] || lastWrite[tx.origin] < block.number, "hmmmm what doing?"); _; } function updateOriginAccess() external override { require(admins[_msgSender()], "Only admins can call this"); lastWrite[tx.origin] = block.number; } function balanceOf(address account) public view virtual override disallowIfStateIsChanging returns (uint256) { // Y U checking on this address in the same block it's being modified... hmmmm require(admins[_msgSender()] || lastWrite[account] < block.number, "hmmmm what doing?"); return super.balanceOf(account); } function transfer(address recipient, uint256 amount) public virtual override disallowIfStateIsChanging returns (bool) { // NICE TRY MOUSE DRAGON require(admins[_msgSender()] || lastWrite[_msgSender()] < block.number, "hmmmm what doing?"); return super.transfer(recipient, amount); } // Not ensuring state changed in this block as it would needlessly increase gas function allowance(address owner, address spender) public view virtual override returns (uint256) { return super.allowance(owner, spender); } // Not ensuring state changed in this block as it would needlessly increase gas function approve(address spender, uint256 amount) public virtual override returns (bool) { return super.approve(spender, amount); } // Not ensuring state changed in this block as it would needlessly increase gas function increaseAllowance(address spender, uint256 addedValue) public virtual override returns (bool) { return super.increaseAllowance(spender, addedValue); } // Not ensuring state changed in this block as it would needlessly increase gas function decreaseAllowance(address spender, uint256 subtractedValue) public virtual override returns (bool) { return super.decreaseAllowance(spender, subtractedValue); } }
allowance
function allowance(address owner, address spender) public view virtual override returns (uint256) { return super.allowance(owner, spender); }
// Not ensuring state changed in this block as it would needlessly increase gas
LineComment
v0.8.4+commit.c7e474f2
{ "func_code_index": [ 4426, 4583 ] }
57,670
CHEDDAR
contracts/CHEDDAR.sol
0x68810fb2b13d48b2f4a0fb1fea2397a2a106ad2d
Solidity
CHEDDAR
contract CHEDDAR is ICHEDDAR, ERC20, Ownable { // Tracks the last block that a caller has written to state. // Disallow some access to functions if they occur while a change is being written. mapping(address => uint256) private lastWrite; // address => allowedToCallFunctions mapping(address => bool) private admins; uint256 private TOTAL_SUPPLY = 6000000000 ether; constructor() ERC20("CHEDDAR", "CHEDDAR") { } /** * enables an address to mint / burn * @param addr the address to enable */ function addAdmin(address addr) external onlyOwner { admins[addr] = true; } /** * disables an address from minting / burning * @param addr the address to disbale */ function removeAdmin(address addr) external onlyOwner { admins[addr] = false; } /** * mints $CHEDDAR to a recipient * @param to the recipient of the $CHEDDAR * @param amount the amount of $CHEDDAR to mint */ function mint(address to, uint256 amount) external override { require(admins[msg.sender], "Only admins can mint"); require(totalSupply() + amount <= TOTAL_SUPPLY, "Mint amount exceeds"); _mint(to, amount); } /** * burns $CHEDDAR from a holder * @param from the holder of the $CHEDDAR * @param amount the amount of $CHEDDAR to burn */ function burn(address from, uint256 amount) external override { require(admins[msg.sender], "Only admins can burn"); _burn(from, amount); } /** * @dev See {IERC20-transferFrom}. * * Emits an {Approval} event indicating the updated allowance. This is not * required by the EIP. See the note at the beginning of {ERC20}. * * Requirements: * * - `sender` and `recipient` cannot be the zero address. * - `sender` must have a balance of at least `amount`. * - the caller must have allowance for ``sender``'s tokens of at least * `amount`. */ function transferFrom( address sender, address recipient, uint256 amount ) public virtual override(ERC20, ICHEDDAR) disallowIfStateIsChanging returns (bool) { // NICE TRY MOUSE DRAGON require(admins[_msgSender()] || lastWrite[sender] < block.number , "hmmmm what doing?"); // If the entity invoking this transfer is an admin (i.e. the gameContract) // allow the transfer without approval. This saves gas and a transaction. // The sender address will still need to actually have the amount being attempted to send. if(admins[_msgSender()]) { // NOTE: This will omit any events from being written. This saves additional gas, // and the event emission is not a requirement by the EIP // (read this function summary / ERC20 summary for more details) _transfer(sender, recipient, amount); return true; } // If it's not an admin entity (game contract, habitat, etc) // The entity will need to be given permission to transfer these funds // For instance, someone can't just make a contract and siphon $CHEDDAR from every account return super.transferFrom(sender, recipient, amount); } /** SECURITEEEEEEEEEEEEEEEEE */ modifier disallowIfStateIsChanging() { // frens can always call whenever they want :) require(admins[_msgSender()] || lastWrite[tx.origin] < block.number, "hmmmm what doing?"); _; } function updateOriginAccess() external override { require(admins[_msgSender()], "Only admins can call this"); lastWrite[tx.origin] = block.number; } function balanceOf(address account) public view virtual override disallowIfStateIsChanging returns (uint256) { // Y U checking on this address in the same block it's being modified... hmmmm require(admins[_msgSender()] || lastWrite[account] < block.number, "hmmmm what doing?"); return super.balanceOf(account); } function transfer(address recipient, uint256 amount) public virtual override disallowIfStateIsChanging returns (bool) { // NICE TRY MOUSE DRAGON require(admins[_msgSender()] || lastWrite[_msgSender()] < block.number, "hmmmm what doing?"); return super.transfer(recipient, amount); } // Not ensuring state changed in this block as it would needlessly increase gas function allowance(address owner, address spender) public view virtual override returns (uint256) { return super.allowance(owner, spender); } // Not ensuring state changed in this block as it would needlessly increase gas function approve(address spender, uint256 amount) public virtual override returns (bool) { return super.approve(spender, amount); } // Not ensuring state changed in this block as it would needlessly increase gas function increaseAllowance(address spender, uint256 addedValue) public virtual override returns (bool) { return super.increaseAllowance(spender, addedValue); } // Not ensuring state changed in this block as it would needlessly increase gas function decreaseAllowance(address spender, uint256 subtractedValue) public virtual override returns (bool) { return super.decreaseAllowance(spender, subtractedValue); } }
approve
function approve(address spender, uint256 amount) public virtual override returns (bool) { return super.approve(spender, amount); }
// Not ensuring state changed in this block as it would needlessly increase gas
LineComment
v0.8.4+commit.c7e474f2
{ "func_code_index": [ 4669, 4816 ] }
57,671
CHEDDAR
contracts/CHEDDAR.sol
0x68810fb2b13d48b2f4a0fb1fea2397a2a106ad2d
Solidity
CHEDDAR
contract CHEDDAR is ICHEDDAR, ERC20, Ownable { // Tracks the last block that a caller has written to state. // Disallow some access to functions if they occur while a change is being written. mapping(address => uint256) private lastWrite; // address => allowedToCallFunctions mapping(address => bool) private admins; uint256 private TOTAL_SUPPLY = 6000000000 ether; constructor() ERC20("CHEDDAR", "CHEDDAR") { } /** * enables an address to mint / burn * @param addr the address to enable */ function addAdmin(address addr) external onlyOwner { admins[addr] = true; } /** * disables an address from minting / burning * @param addr the address to disbale */ function removeAdmin(address addr) external onlyOwner { admins[addr] = false; } /** * mints $CHEDDAR to a recipient * @param to the recipient of the $CHEDDAR * @param amount the amount of $CHEDDAR to mint */ function mint(address to, uint256 amount) external override { require(admins[msg.sender], "Only admins can mint"); require(totalSupply() + amount <= TOTAL_SUPPLY, "Mint amount exceeds"); _mint(to, amount); } /** * burns $CHEDDAR from a holder * @param from the holder of the $CHEDDAR * @param amount the amount of $CHEDDAR to burn */ function burn(address from, uint256 amount) external override { require(admins[msg.sender], "Only admins can burn"); _burn(from, amount); } /** * @dev See {IERC20-transferFrom}. * * Emits an {Approval} event indicating the updated allowance. This is not * required by the EIP. See the note at the beginning of {ERC20}. * * Requirements: * * - `sender` and `recipient` cannot be the zero address. * - `sender` must have a balance of at least `amount`. * - the caller must have allowance for ``sender``'s tokens of at least * `amount`. */ function transferFrom( address sender, address recipient, uint256 amount ) public virtual override(ERC20, ICHEDDAR) disallowIfStateIsChanging returns (bool) { // NICE TRY MOUSE DRAGON require(admins[_msgSender()] || lastWrite[sender] < block.number , "hmmmm what doing?"); // If the entity invoking this transfer is an admin (i.e. the gameContract) // allow the transfer without approval. This saves gas and a transaction. // The sender address will still need to actually have the amount being attempted to send. if(admins[_msgSender()]) { // NOTE: This will omit any events from being written. This saves additional gas, // and the event emission is not a requirement by the EIP // (read this function summary / ERC20 summary for more details) _transfer(sender, recipient, amount); return true; } // If it's not an admin entity (game contract, habitat, etc) // The entity will need to be given permission to transfer these funds // For instance, someone can't just make a contract and siphon $CHEDDAR from every account return super.transferFrom(sender, recipient, amount); } /** SECURITEEEEEEEEEEEEEEEEE */ modifier disallowIfStateIsChanging() { // frens can always call whenever they want :) require(admins[_msgSender()] || lastWrite[tx.origin] < block.number, "hmmmm what doing?"); _; } function updateOriginAccess() external override { require(admins[_msgSender()], "Only admins can call this"); lastWrite[tx.origin] = block.number; } function balanceOf(address account) public view virtual override disallowIfStateIsChanging returns (uint256) { // Y U checking on this address in the same block it's being modified... hmmmm require(admins[_msgSender()] || lastWrite[account] < block.number, "hmmmm what doing?"); return super.balanceOf(account); } function transfer(address recipient, uint256 amount) public virtual override disallowIfStateIsChanging returns (bool) { // NICE TRY MOUSE DRAGON require(admins[_msgSender()] || lastWrite[_msgSender()] < block.number, "hmmmm what doing?"); return super.transfer(recipient, amount); } // Not ensuring state changed in this block as it would needlessly increase gas function allowance(address owner, address spender) public view virtual override returns (uint256) { return super.allowance(owner, spender); } // Not ensuring state changed in this block as it would needlessly increase gas function approve(address spender, uint256 amount) public virtual override returns (bool) { return super.approve(spender, amount); } // Not ensuring state changed in this block as it would needlessly increase gas function increaseAllowance(address spender, uint256 addedValue) public virtual override returns (bool) { return super.increaseAllowance(spender, addedValue); } // Not ensuring state changed in this block as it would needlessly increase gas function decreaseAllowance(address spender, uint256 subtractedValue) public virtual override returns (bool) { return super.decreaseAllowance(spender, subtractedValue); } }
increaseAllowance
function increaseAllowance(address spender, uint256 addedValue) public virtual override returns (bool) { return super.increaseAllowance(spender, addedValue); }
// Not ensuring state changed in this block as it would needlessly increase gas
LineComment
v0.8.4+commit.c7e474f2
{ "func_code_index": [ 4902, 5077 ] }
57,672
CHEDDAR
contracts/CHEDDAR.sol
0x68810fb2b13d48b2f4a0fb1fea2397a2a106ad2d
Solidity
CHEDDAR
contract CHEDDAR is ICHEDDAR, ERC20, Ownable { // Tracks the last block that a caller has written to state. // Disallow some access to functions if they occur while a change is being written. mapping(address => uint256) private lastWrite; // address => allowedToCallFunctions mapping(address => bool) private admins; uint256 private TOTAL_SUPPLY = 6000000000 ether; constructor() ERC20("CHEDDAR", "CHEDDAR") { } /** * enables an address to mint / burn * @param addr the address to enable */ function addAdmin(address addr) external onlyOwner { admins[addr] = true; } /** * disables an address from minting / burning * @param addr the address to disbale */ function removeAdmin(address addr) external onlyOwner { admins[addr] = false; } /** * mints $CHEDDAR to a recipient * @param to the recipient of the $CHEDDAR * @param amount the amount of $CHEDDAR to mint */ function mint(address to, uint256 amount) external override { require(admins[msg.sender], "Only admins can mint"); require(totalSupply() + amount <= TOTAL_SUPPLY, "Mint amount exceeds"); _mint(to, amount); } /** * burns $CHEDDAR from a holder * @param from the holder of the $CHEDDAR * @param amount the amount of $CHEDDAR to burn */ function burn(address from, uint256 amount) external override { require(admins[msg.sender], "Only admins can burn"); _burn(from, amount); } /** * @dev See {IERC20-transferFrom}. * * Emits an {Approval} event indicating the updated allowance. This is not * required by the EIP. See the note at the beginning of {ERC20}. * * Requirements: * * - `sender` and `recipient` cannot be the zero address. * - `sender` must have a balance of at least `amount`. * - the caller must have allowance for ``sender``'s tokens of at least * `amount`. */ function transferFrom( address sender, address recipient, uint256 amount ) public virtual override(ERC20, ICHEDDAR) disallowIfStateIsChanging returns (bool) { // NICE TRY MOUSE DRAGON require(admins[_msgSender()] || lastWrite[sender] < block.number , "hmmmm what doing?"); // If the entity invoking this transfer is an admin (i.e. the gameContract) // allow the transfer without approval. This saves gas and a transaction. // The sender address will still need to actually have the amount being attempted to send. if(admins[_msgSender()]) { // NOTE: This will omit any events from being written. This saves additional gas, // and the event emission is not a requirement by the EIP // (read this function summary / ERC20 summary for more details) _transfer(sender, recipient, amount); return true; } // If it's not an admin entity (game contract, habitat, etc) // The entity will need to be given permission to transfer these funds // For instance, someone can't just make a contract and siphon $CHEDDAR from every account return super.transferFrom(sender, recipient, amount); } /** SECURITEEEEEEEEEEEEEEEEE */ modifier disallowIfStateIsChanging() { // frens can always call whenever they want :) require(admins[_msgSender()] || lastWrite[tx.origin] < block.number, "hmmmm what doing?"); _; } function updateOriginAccess() external override { require(admins[_msgSender()], "Only admins can call this"); lastWrite[tx.origin] = block.number; } function balanceOf(address account) public view virtual override disallowIfStateIsChanging returns (uint256) { // Y U checking on this address in the same block it's being modified... hmmmm require(admins[_msgSender()] || lastWrite[account] < block.number, "hmmmm what doing?"); return super.balanceOf(account); } function transfer(address recipient, uint256 amount) public virtual override disallowIfStateIsChanging returns (bool) { // NICE TRY MOUSE DRAGON require(admins[_msgSender()] || lastWrite[_msgSender()] < block.number, "hmmmm what doing?"); return super.transfer(recipient, amount); } // Not ensuring state changed in this block as it would needlessly increase gas function allowance(address owner, address spender) public view virtual override returns (uint256) { return super.allowance(owner, spender); } // Not ensuring state changed in this block as it would needlessly increase gas function approve(address spender, uint256 amount) public virtual override returns (bool) { return super.approve(spender, amount); } // Not ensuring state changed in this block as it would needlessly increase gas function increaseAllowance(address spender, uint256 addedValue) public virtual override returns (bool) { return super.increaseAllowance(spender, addedValue); } // Not ensuring state changed in this block as it would needlessly increase gas function decreaseAllowance(address spender, uint256 subtractedValue) public virtual override returns (bool) { return super.decreaseAllowance(spender, subtractedValue); } }
decreaseAllowance
function decreaseAllowance(address spender, uint256 subtractedValue) public virtual override returns (bool) { return super.decreaseAllowance(spender, subtractedValue); }
// Not ensuring state changed in this block as it would needlessly increase gas
LineComment
v0.8.4+commit.c7e474f2
{ "func_code_index": [ 5163, 5348 ] }
57,673
Multisig
Multisig.sol
0xa313392fc17c1d1db87b35cdccb930bbf1b08b72
Solidity
Multisig
contract Multisig { address[] public owners; mapping (address => mapping(address => uint)) withdrawalRequests; mapping (address => mapping(address => address[])) withdrawalApprovals; mapping (address => address[]) ownershipAdditions; mapping (address => address[]) ownershipRemovals; event ApproveNewOwner(address indexed approver, address indexed subject); event ApproveRemovalOfOwner(address indexed approver, address indexed subject); event OwnershipChange(address indexed owner, bool indexed isAddition, bool indexed isRemoved); event Deposit(address indexed tokenContract, address indexed sender, uint amount); event Withdrawal(address indexed tokenContract, address indexed recipient, uint amount); event WithdrawalRequest(address indexed tokenContract, address indexed recipient, uint amount); event WithdrawalApproval(address indexed tokenContract, address indexed approver, address indexed recipient, uint amount); function getOwners() public view returns(address[] memory) { return owners; } function getOwnershipAdditions(address _account) public view returns(address[] memory) { return ownershipAdditions[_account]; } function getOwnershipRemovals(address _account) public view returns(address[] memory) { return ownershipRemovals[_account]; } function getWithdrawalApprovals(address _erc20, address _account) public view returns(uint amount, address[] memory approvals) { amount = withdrawalRequests[_erc20][_account]; approvals = withdrawalApprovals[_erc20][_account]; } function getMinimumApprovals() public view returns(uint approvalCount) { approvalCount = (owners.length + 1) / 2; } modifier isOwner(address _test) { require(_isOwner(_test) == true, "address must be an owner"); _; } modifier isNotOwner(address _test) { require(_isOwner(_test) == false, "address must NOT be an owner"); _; } modifier isNotMe(address _test) { require(msg.sender != _test, "test must not be sender"); _; } constructor(address _owner2, address _owner3) public { require(msg.sender != _owner2, "owner 1 and 2 can't be the same"); require(msg.sender != _owner3, "owner 1 and 3 can't be the same"); require(_owner2 != _owner3, "owner 2 and 3 can't be the same"); require(_owner2 != address(0), "owner 2 can't be the zero address"); require(_owner3 != address(0), "owner 2 can't be the zero address"); owners.push(msg.sender); owners.push(_owner2); owners.push(_owner3); } function _isOwner(address _test) internal view returns(bool) { for(uint i = 0; i < owners.length; i++) { if(_test == owners[i]) { return true; } } return false; } // @dev Requests, or approves an ownership addition. The new owner is NOT automatically added. // @param _address - the address of the owner to add. function approveOwner(address _address) public isOwner(msg.sender) isNotOwner(_address) isNotMe(_address) { require(owners.length < 10, "no more than 10 owners"); for(uint i = 0; i < ownershipAdditions[_address].length; i++) { require(ownershipAdditions[_address][i] != msg.sender, "sender has not already approved this removal"); } ownershipAdditions[_address].push(msg.sender); emit ApproveNewOwner(msg.sender, _address); } // @dev After being approved for ownership, the new owner must call this function to become an owner. function acceptOwnership() external isNotOwner(msg.sender) { require( ownershipAdditions[msg.sender].length >= getMinimumApprovals(), "sender doesn't have enough ownership approvals"); owners.push(msg.sender); delete ownershipAdditions[msg.sender]; emit OwnershipChange(msg.sender, true, false); } // @dev Requests, or approves a ownership removal. Once enough approvals are given, the owner is // automatically removed. // @param _address - the address of the owner to be removed. function removeOwner(address _address) public isOwner(msg.sender) isOwner(_address) isNotMe(_address) { require(owners.length > 3, "can't remove below 3 owners - add a new owner first"); uint i; for(i = 0; i < ownershipRemovals[_address].length; i++) { require(ownershipRemovals[_address][i] != msg.sender, "sender must not have already approved this removal"); } emit ApproveRemovalOfOwner(msg.sender, _address); ownershipRemovals[_address].push(msg.sender); // owners.length / 2 is the number of approvals required AFTER this account is removed. // This guarantees there are still enough active approvers left. if(ownershipRemovals[_address].length >= getMinimumApprovals()) { for(i = 0; i < owners.length; i++) { if(owners[i] == _address) { uint lastSlot = owners.length - 1; owners[i] = owners[lastSlot]; owners[lastSlot] = address(0); owners.length = lastSlot; break; } } delete ownershipRemovals[_address]; emit OwnershipChange(_address, false, true); } } // @dev Cancels a ownership removal. Only requires one owner to call this, // but the subject of the removal cannot call it themselves. // @param _address - the address of the owner to be removed. function vetoRemoval(address _address) public isOwner(msg.sender) isOwner(_address) isNotMe(_address) { delete ownershipRemovals[_address]; } // @dev Cancels a ownership addition. Only requires one owner to call this. // @param _address - the address of the owner to be added. function vetoOwnership(address _address) public isOwner(msg.sender) isNotMe(_address) { delete ownershipAdditions[_address]; } // @dev Cancels a withdrawal. Only requires one owner to call this. // @param _tokenContract - the contract of the erc20 token to withdraw (or, use the zero address for ETH) // @param _amount - the amount to withdraw. Amount must match the approved withdrawal amount. function vetoWithdrawal(address _tokenContract, address _requestor) public isOwner(msg.sender) { delete withdrawalRequests[_tokenContract][_requestor]; delete withdrawalApprovals[_tokenContract][_requestor]; } // @dev allows any owner to deposit any ERC20 token in this contract. // @dev Once the ERC20 token is deposited, it can only be withdrawn if enough accounts allow it. // @param _tokenContract - the contract of the erc20 token to deposit // @param _amount - the amount to deposit. // @notice For this function to work, you have to already have set an allowance for the transfer // @notice You CANNOT deposit Ether using this function. Use depositEth() instead. function depositERC20(address _tokenContract, uint _amount) public isOwner(msg.sender) { ERC20Interface erc20 = ERC20Interface(_tokenContract); emit Deposit(_tokenContract, msg.sender, _amount); erc20.transferFrom(msg.sender, address(this), _amount); } // @dev allows any owner to deposit Ether in this contract. // @dev Once ether is deposited, it can only be withdrawn if enough accounts allow it. function depositEth() public payable isOwner(msg.sender) { emit Deposit(address(0), msg.sender, msg.value); } // @dev Requests a withdrawal, changes a withdrawal request, or approves an existing withdrawal request. // To request or change, set _recipient to msg.sender. Changes wipe all approvals. // To approve, set _recipient to the previously requested account, and send from another owner account // @param _tokenContract - the contract of the erc20 token to withdraw (or, use the zero address for ETH) // @param _recipient - the account which will receive the withdrawal. // @param _amount - the amount to withdraw. Amount must match the approved withdrawal amount. function approveWithdrawal(address _tokenContract, address _recipient, uint _amount) public isOwner(msg.sender) { ERC20Interface erc20 = ERC20Interface(_tokenContract); // If Withdrawer == msg.sender, this is a new request. Cancel all previous approvals. require(_amount > 0, "can't withdraw zero"); if (_recipient == msg.sender) { if(_tokenContract == address(0)) { require(_amount <= address(this).balance, "can't withdraw more ETH than the balance"); } else { require(_amount <= erc20.balanceOf(address(this)), "can't withdraw more erc20 tokens than balance"); } delete withdrawalApprovals[_tokenContract][_recipient]; withdrawalRequests[_tokenContract][_recipient] = _amount; withdrawalApprovals[_tokenContract][_recipient].push(msg.sender); emit WithdrawalRequest(_tokenContract, _recipient, _amount); } else { require( withdrawalApprovals[_tokenContract][_recipient].length >= 1, "you can't initiate a withdrawal request for another user"); require( withdrawalRequests[_tokenContract][_recipient] == _amount, "approval amount must exactly match withdrawal request"); for(uint i = 0; i < withdrawalApprovals[_tokenContract][_recipient].length; i++) { require( withdrawalApprovals[_tokenContract][_recipient][i] != msg.sender, "sender has not already approved this withdrawal"); } withdrawalApprovals[_tokenContract][_recipient].push(msg.sender); } emit WithdrawalApproval(_tokenContract, msg.sender, _recipient, _amount); } // @dev Completes an approved withdrawal, transferring the erc20 tokens or Ether to the withdrawing account // @param _tokenContract - the contract of the erc20 token to withdraw (or, use the zero address for ETH) // @param _amount - the amount to withdraw. Amount must match the approved withdrawal amount. function completeWithdrawal(address _tokenContract, uint _amount) external isOwner(msg.sender) { require( withdrawalApprovals[_tokenContract][msg.sender].length >= getMinimumApprovals(), "insufficient approvals to complete this withdrawal"); require(withdrawalRequests[_tokenContract][msg.sender] == _amount, "incorrect withdrawal amount specified"); delete withdrawalRequests[_tokenContract][msg.sender]; delete withdrawalApprovals[_tokenContract][msg.sender]; emit Withdrawal(_tokenContract, msg.sender, _amount); if(_tokenContract == address(0)) { require(_amount <= address(this).balance, "can't withdraw more ETH than the balance"); msg.sender.transfer(_amount); } else { ERC20Interface erc20 = ERC20Interface(_tokenContract); require(_amount <= erc20.balanceOf(address(this)), "can't withdraw more erc20 tokens than balance"); erc20.transfer(msg.sender, _amount); } } }
// @title Multisig ERC20 and Ether contract // @dev Allows multisig management of Ether and ERC20 funds, requiring 50% of owners (rounded up) // to approve any withdrawal or change in ownership // @author Nova Token (https://www.novatoken.io) // (c) 2019 Nova Token Ltd. All Rights Reserved. This code is not open source.
LineComment
approveOwner
function approveOwner(address _address) public isOwner(msg.sender) isNotOwner(_address) isNotMe(_address) { require(owners.length < 10, "no more than 10 owners"); for(uint i = 0; i < ownershipAdditions[_address].length; i++) { require(ownershipAdditions[_address][i] != msg.sender, "sender has not already approved this removal"); } ownershipAdditions[_address].push(msg.sender); emit ApproveNewOwner(msg.sender, _address); }
// @dev Requests, or approves an ownership addition. The new owner is NOT automatically added. // @param _address - the address of the owner to add.
LineComment
v0.5.8+commit.23d335f2
None
bzzr://8c34ed56fc39d3079b9814f9727ffc764eb200c96ba8c10252eae5c7bc9e2c28
{ "func_code_index": [ 3038, 3524 ] }
57,674
Multisig
Multisig.sol
0xa313392fc17c1d1db87b35cdccb930bbf1b08b72
Solidity
Multisig
contract Multisig { address[] public owners; mapping (address => mapping(address => uint)) withdrawalRequests; mapping (address => mapping(address => address[])) withdrawalApprovals; mapping (address => address[]) ownershipAdditions; mapping (address => address[]) ownershipRemovals; event ApproveNewOwner(address indexed approver, address indexed subject); event ApproveRemovalOfOwner(address indexed approver, address indexed subject); event OwnershipChange(address indexed owner, bool indexed isAddition, bool indexed isRemoved); event Deposit(address indexed tokenContract, address indexed sender, uint amount); event Withdrawal(address indexed tokenContract, address indexed recipient, uint amount); event WithdrawalRequest(address indexed tokenContract, address indexed recipient, uint amount); event WithdrawalApproval(address indexed tokenContract, address indexed approver, address indexed recipient, uint amount); function getOwners() public view returns(address[] memory) { return owners; } function getOwnershipAdditions(address _account) public view returns(address[] memory) { return ownershipAdditions[_account]; } function getOwnershipRemovals(address _account) public view returns(address[] memory) { return ownershipRemovals[_account]; } function getWithdrawalApprovals(address _erc20, address _account) public view returns(uint amount, address[] memory approvals) { amount = withdrawalRequests[_erc20][_account]; approvals = withdrawalApprovals[_erc20][_account]; } function getMinimumApprovals() public view returns(uint approvalCount) { approvalCount = (owners.length + 1) / 2; } modifier isOwner(address _test) { require(_isOwner(_test) == true, "address must be an owner"); _; } modifier isNotOwner(address _test) { require(_isOwner(_test) == false, "address must NOT be an owner"); _; } modifier isNotMe(address _test) { require(msg.sender != _test, "test must not be sender"); _; } constructor(address _owner2, address _owner3) public { require(msg.sender != _owner2, "owner 1 and 2 can't be the same"); require(msg.sender != _owner3, "owner 1 and 3 can't be the same"); require(_owner2 != _owner3, "owner 2 and 3 can't be the same"); require(_owner2 != address(0), "owner 2 can't be the zero address"); require(_owner3 != address(0), "owner 2 can't be the zero address"); owners.push(msg.sender); owners.push(_owner2); owners.push(_owner3); } function _isOwner(address _test) internal view returns(bool) { for(uint i = 0; i < owners.length; i++) { if(_test == owners[i]) { return true; } } return false; } // @dev Requests, or approves an ownership addition. The new owner is NOT automatically added. // @param _address - the address of the owner to add. function approveOwner(address _address) public isOwner(msg.sender) isNotOwner(_address) isNotMe(_address) { require(owners.length < 10, "no more than 10 owners"); for(uint i = 0; i < ownershipAdditions[_address].length; i++) { require(ownershipAdditions[_address][i] != msg.sender, "sender has not already approved this removal"); } ownershipAdditions[_address].push(msg.sender); emit ApproveNewOwner(msg.sender, _address); } // @dev After being approved for ownership, the new owner must call this function to become an owner. function acceptOwnership() external isNotOwner(msg.sender) { require( ownershipAdditions[msg.sender].length >= getMinimumApprovals(), "sender doesn't have enough ownership approvals"); owners.push(msg.sender); delete ownershipAdditions[msg.sender]; emit OwnershipChange(msg.sender, true, false); } // @dev Requests, or approves a ownership removal. Once enough approvals are given, the owner is // automatically removed. // @param _address - the address of the owner to be removed. function removeOwner(address _address) public isOwner(msg.sender) isOwner(_address) isNotMe(_address) { require(owners.length > 3, "can't remove below 3 owners - add a new owner first"); uint i; for(i = 0; i < ownershipRemovals[_address].length; i++) { require(ownershipRemovals[_address][i] != msg.sender, "sender must not have already approved this removal"); } emit ApproveRemovalOfOwner(msg.sender, _address); ownershipRemovals[_address].push(msg.sender); // owners.length / 2 is the number of approvals required AFTER this account is removed. // This guarantees there are still enough active approvers left. if(ownershipRemovals[_address].length >= getMinimumApprovals()) { for(i = 0; i < owners.length; i++) { if(owners[i] == _address) { uint lastSlot = owners.length - 1; owners[i] = owners[lastSlot]; owners[lastSlot] = address(0); owners.length = lastSlot; break; } } delete ownershipRemovals[_address]; emit OwnershipChange(_address, false, true); } } // @dev Cancels a ownership removal. Only requires one owner to call this, // but the subject of the removal cannot call it themselves. // @param _address - the address of the owner to be removed. function vetoRemoval(address _address) public isOwner(msg.sender) isOwner(_address) isNotMe(_address) { delete ownershipRemovals[_address]; } // @dev Cancels a ownership addition. Only requires one owner to call this. // @param _address - the address of the owner to be added. function vetoOwnership(address _address) public isOwner(msg.sender) isNotMe(_address) { delete ownershipAdditions[_address]; } // @dev Cancels a withdrawal. Only requires one owner to call this. // @param _tokenContract - the contract of the erc20 token to withdraw (or, use the zero address for ETH) // @param _amount - the amount to withdraw. Amount must match the approved withdrawal amount. function vetoWithdrawal(address _tokenContract, address _requestor) public isOwner(msg.sender) { delete withdrawalRequests[_tokenContract][_requestor]; delete withdrawalApprovals[_tokenContract][_requestor]; } // @dev allows any owner to deposit any ERC20 token in this contract. // @dev Once the ERC20 token is deposited, it can only be withdrawn if enough accounts allow it. // @param _tokenContract - the contract of the erc20 token to deposit // @param _amount - the amount to deposit. // @notice For this function to work, you have to already have set an allowance for the transfer // @notice You CANNOT deposit Ether using this function. Use depositEth() instead. function depositERC20(address _tokenContract, uint _amount) public isOwner(msg.sender) { ERC20Interface erc20 = ERC20Interface(_tokenContract); emit Deposit(_tokenContract, msg.sender, _amount); erc20.transferFrom(msg.sender, address(this), _amount); } // @dev allows any owner to deposit Ether in this contract. // @dev Once ether is deposited, it can only be withdrawn if enough accounts allow it. function depositEth() public payable isOwner(msg.sender) { emit Deposit(address(0), msg.sender, msg.value); } // @dev Requests a withdrawal, changes a withdrawal request, or approves an existing withdrawal request. // To request or change, set _recipient to msg.sender. Changes wipe all approvals. // To approve, set _recipient to the previously requested account, and send from another owner account // @param _tokenContract - the contract of the erc20 token to withdraw (or, use the zero address for ETH) // @param _recipient - the account which will receive the withdrawal. // @param _amount - the amount to withdraw. Amount must match the approved withdrawal amount. function approveWithdrawal(address _tokenContract, address _recipient, uint _amount) public isOwner(msg.sender) { ERC20Interface erc20 = ERC20Interface(_tokenContract); // If Withdrawer == msg.sender, this is a new request. Cancel all previous approvals. require(_amount > 0, "can't withdraw zero"); if (_recipient == msg.sender) { if(_tokenContract == address(0)) { require(_amount <= address(this).balance, "can't withdraw more ETH than the balance"); } else { require(_amount <= erc20.balanceOf(address(this)), "can't withdraw more erc20 tokens than balance"); } delete withdrawalApprovals[_tokenContract][_recipient]; withdrawalRequests[_tokenContract][_recipient] = _amount; withdrawalApprovals[_tokenContract][_recipient].push(msg.sender); emit WithdrawalRequest(_tokenContract, _recipient, _amount); } else { require( withdrawalApprovals[_tokenContract][_recipient].length >= 1, "you can't initiate a withdrawal request for another user"); require( withdrawalRequests[_tokenContract][_recipient] == _amount, "approval amount must exactly match withdrawal request"); for(uint i = 0; i < withdrawalApprovals[_tokenContract][_recipient].length; i++) { require( withdrawalApprovals[_tokenContract][_recipient][i] != msg.sender, "sender has not already approved this withdrawal"); } withdrawalApprovals[_tokenContract][_recipient].push(msg.sender); } emit WithdrawalApproval(_tokenContract, msg.sender, _recipient, _amount); } // @dev Completes an approved withdrawal, transferring the erc20 tokens or Ether to the withdrawing account // @param _tokenContract - the contract of the erc20 token to withdraw (or, use the zero address for ETH) // @param _amount - the amount to withdraw. Amount must match the approved withdrawal amount. function completeWithdrawal(address _tokenContract, uint _amount) external isOwner(msg.sender) { require( withdrawalApprovals[_tokenContract][msg.sender].length >= getMinimumApprovals(), "insufficient approvals to complete this withdrawal"); require(withdrawalRequests[_tokenContract][msg.sender] == _amount, "incorrect withdrawal amount specified"); delete withdrawalRequests[_tokenContract][msg.sender]; delete withdrawalApprovals[_tokenContract][msg.sender]; emit Withdrawal(_tokenContract, msg.sender, _amount); if(_tokenContract == address(0)) { require(_amount <= address(this).balance, "can't withdraw more ETH than the balance"); msg.sender.transfer(_amount); } else { ERC20Interface erc20 = ERC20Interface(_tokenContract); require(_amount <= erc20.balanceOf(address(this)), "can't withdraw more erc20 tokens than balance"); erc20.transfer(msg.sender, _amount); } } }
// @title Multisig ERC20 and Ether contract // @dev Allows multisig management of Ether and ERC20 funds, requiring 50% of owners (rounded up) // to approve any withdrawal or change in ownership // @author Nova Token (https://www.novatoken.io) // (c) 2019 Nova Token Ltd. All Rights Reserved. This code is not open source.
LineComment
acceptOwnership
function acceptOwnership() external isNotOwner(msg.sender) { require( ownershipAdditions[msg.sender].length >= getMinimumApprovals(), "sender doesn't have enough ownership approvals"); owners.push(msg.sender); delete ownershipAdditions[msg.sender]; emit OwnershipChange(msg.sender, true, false); }
// @dev After being approved for ownership, the new owner must call this function to become an owner.
LineComment
v0.5.8+commit.23d335f2
None
bzzr://8c34ed56fc39d3079b9814f9727ffc764eb200c96ba8c10252eae5c7bc9e2c28
{ "func_code_index": [ 3632, 3982 ] }
57,675
Multisig
Multisig.sol
0xa313392fc17c1d1db87b35cdccb930bbf1b08b72
Solidity
Multisig
contract Multisig { address[] public owners; mapping (address => mapping(address => uint)) withdrawalRequests; mapping (address => mapping(address => address[])) withdrawalApprovals; mapping (address => address[]) ownershipAdditions; mapping (address => address[]) ownershipRemovals; event ApproveNewOwner(address indexed approver, address indexed subject); event ApproveRemovalOfOwner(address indexed approver, address indexed subject); event OwnershipChange(address indexed owner, bool indexed isAddition, bool indexed isRemoved); event Deposit(address indexed tokenContract, address indexed sender, uint amount); event Withdrawal(address indexed tokenContract, address indexed recipient, uint amount); event WithdrawalRequest(address indexed tokenContract, address indexed recipient, uint amount); event WithdrawalApproval(address indexed tokenContract, address indexed approver, address indexed recipient, uint amount); function getOwners() public view returns(address[] memory) { return owners; } function getOwnershipAdditions(address _account) public view returns(address[] memory) { return ownershipAdditions[_account]; } function getOwnershipRemovals(address _account) public view returns(address[] memory) { return ownershipRemovals[_account]; } function getWithdrawalApprovals(address _erc20, address _account) public view returns(uint amount, address[] memory approvals) { amount = withdrawalRequests[_erc20][_account]; approvals = withdrawalApprovals[_erc20][_account]; } function getMinimumApprovals() public view returns(uint approvalCount) { approvalCount = (owners.length + 1) / 2; } modifier isOwner(address _test) { require(_isOwner(_test) == true, "address must be an owner"); _; } modifier isNotOwner(address _test) { require(_isOwner(_test) == false, "address must NOT be an owner"); _; } modifier isNotMe(address _test) { require(msg.sender != _test, "test must not be sender"); _; } constructor(address _owner2, address _owner3) public { require(msg.sender != _owner2, "owner 1 and 2 can't be the same"); require(msg.sender != _owner3, "owner 1 and 3 can't be the same"); require(_owner2 != _owner3, "owner 2 and 3 can't be the same"); require(_owner2 != address(0), "owner 2 can't be the zero address"); require(_owner3 != address(0), "owner 2 can't be the zero address"); owners.push(msg.sender); owners.push(_owner2); owners.push(_owner3); } function _isOwner(address _test) internal view returns(bool) { for(uint i = 0; i < owners.length; i++) { if(_test == owners[i]) { return true; } } return false; } // @dev Requests, or approves an ownership addition. The new owner is NOT automatically added. // @param _address - the address of the owner to add. function approveOwner(address _address) public isOwner(msg.sender) isNotOwner(_address) isNotMe(_address) { require(owners.length < 10, "no more than 10 owners"); for(uint i = 0; i < ownershipAdditions[_address].length; i++) { require(ownershipAdditions[_address][i] != msg.sender, "sender has not already approved this removal"); } ownershipAdditions[_address].push(msg.sender); emit ApproveNewOwner(msg.sender, _address); } // @dev After being approved for ownership, the new owner must call this function to become an owner. function acceptOwnership() external isNotOwner(msg.sender) { require( ownershipAdditions[msg.sender].length >= getMinimumApprovals(), "sender doesn't have enough ownership approvals"); owners.push(msg.sender); delete ownershipAdditions[msg.sender]; emit OwnershipChange(msg.sender, true, false); } // @dev Requests, or approves a ownership removal. Once enough approvals are given, the owner is // automatically removed. // @param _address - the address of the owner to be removed. function removeOwner(address _address) public isOwner(msg.sender) isOwner(_address) isNotMe(_address) { require(owners.length > 3, "can't remove below 3 owners - add a new owner first"); uint i; for(i = 0; i < ownershipRemovals[_address].length; i++) { require(ownershipRemovals[_address][i] != msg.sender, "sender must not have already approved this removal"); } emit ApproveRemovalOfOwner(msg.sender, _address); ownershipRemovals[_address].push(msg.sender); // owners.length / 2 is the number of approvals required AFTER this account is removed. // This guarantees there are still enough active approvers left. if(ownershipRemovals[_address].length >= getMinimumApprovals()) { for(i = 0; i < owners.length; i++) { if(owners[i] == _address) { uint lastSlot = owners.length - 1; owners[i] = owners[lastSlot]; owners[lastSlot] = address(0); owners.length = lastSlot; break; } } delete ownershipRemovals[_address]; emit OwnershipChange(_address, false, true); } } // @dev Cancels a ownership removal. Only requires one owner to call this, // but the subject of the removal cannot call it themselves. // @param _address - the address of the owner to be removed. function vetoRemoval(address _address) public isOwner(msg.sender) isOwner(_address) isNotMe(_address) { delete ownershipRemovals[_address]; } // @dev Cancels a ownership addition. Only requires one owner to call this. // @param _address - the address of the owner to be added. function vetoOwnership(address _address) public isOwner(msg.sender) isNotMe(_address) { delete ownershipAdditions[_address]; } // @dev Cancels a withdrawal. Only requires one owner to call this. // @param _tokenContract - the contract of the erc20 token to withdraw (or, use the zero address for ETH) // @param _amount - the amount to withdraw. Amount must match the approved withdrawal amount. function vetoWithdrawal(address _tokenContract, address _requestor) public isOwner(msg.sender) { delete withdrawalRequests[_tokenContract][_requestor]; delete withdrawalApprovals[_tokenContract][_requestor]; } // @dev allows any owner to deposit any ERC20 token in this contract. // @dev Once the ERC20 token is deposited, it can only be withdrawn if enough accounts allow it. // @param _tokenContract - the contract of the erc20 token to deposit // @param _amount - the amount to deposit. // @notice For this function to work, you have to already have set an allowance for the transfer // @notice You CANNOT deposit Ether using this function. Use depositEth() instead. function depositERC20(address _tokenContract, uint _amount) public isOwner(msg.sender) { ERC20Interface erc20 = ERC20Interface(_tokenContract); emit Deposit(_tokenContract, msg.sender, _amount); erc20.transferFrom(msg.sender, address(this), _amount); } // @dev allows any owner to deposit Ether in this contract. // @dev Once ether is deposited, it can only be withdrawn if enough accounts allow it. function depositEth() public payable isOwner(msg.sender) { emit Deposit(address(0), msg.sender, msg.value); } // @dev Requests a withdrawal, changes a withdrawal request, or approves an existing withdrawal request. // To request or change, set _recipient to msg.sender. Changes wipe all approvals. // To approve, set _recipient to the previously requested account, and send from another owner account // @param _tokenContract - the contract of the erc20 token to withdraw (or, use the zero address for ETH) // @param _recipient - the account which will receive the withdrawal. // @param _amount - the amount to withdraw. Amount must match the approved withdrawal amount. function approveWithdrawal(address _tokenContract, address _recipient, uint _amount) public isOwner(msg.sender) { ERC20Interface erc20 = ERC20Interface(_tokenContract); // If Withdrawer == msg.sender, this is a new request. Cancel all previous approvals. require(_amount > 0, "can't withdraw zero"); if (_recipient == msg.sender) { if(_tokenContract == address(0)) { require(_amount <= address(this).balance, "can't withdraw more ETH than the balance"); } else { require(_amount <= erc20.balanceOf(address(this)), "can't withdraw more erc20 tokens than balance"); } delete withdrawalApprovals[_tokenContract][_recipient]; withdrawalRequests[_tokenContract][_recipient] = _amount; withdrawalApprovals[_tokenContract][_recipient].push(msg.sender); emit WithdrawalRequest(_tokenContract, _recipient, _amount); } else { require( withdrawalApprovals[_tokenContract][_recipient].length >= 1, "you can't initiate a withdrawal request for another user"); require( withdrawalRequests[_tokenContract][_recipient] == _amount, "approval amount must exactly match withdrawal request"); for(uint i = 0; i < withdrawalApprovals[_tokenContract][_recipient].length; i++) { require( withdrawalApprovals[_tokenContract][_recipient][i] != msg.sender, "sender has not already approved this withdrawal"); } withdrawalApprovals[_tokenContract][_recipient].push(msg.sender); } emit WithdrawalApproval(_tokenContract, msg.sender, _recipient, _amount); } // @dev Completes an approved withdrawal, transferring the erc20 tokens or Ether to the withdrawing account // @param _tokenContract - the contract of the erc20 token to withdraw (or, use the zero address for ETH) // @param _amount - the amount to withdraw. Amount must match the approved withdrawal amount. function completeWithdrawal(address _tokenContract, uint _amount) external isOwner(msg.sender) { require( withdrawalApprovals[_tokenContract][msg.sender].length >= getMinimumApprovals(), "insufficient approvals to complete this withdrawal"); require(withdrawalRequests[_tokenContract][msg.sender] == _amount, "incorrect withdrawal amount specified"); delete withdrawalRequests[_tokenContract][msg.sender]; delete withdrawalApprovals[_tokenContract][msg.sender]; emit Withdrawal(_tokenContract, msg.sender, _amount); if(_tokenContract == address(0)) { require(_amount <= address(this).balance, "can't withdraw more ETH than the balance"); msg.sender.transfer(_amount); } else { ERC20Interface erc20 = ERC20Interface(_tokenContract); require(_amount <= erc20.balanceOf(address(this)), "can't withdraw more erc20 tokens than balance"); erc20.transfer(msg.sender, _amount); } } }
// @title Multisig ERC20 and Ether contract // @dev Allows multisig management of Ether and ERC20 funds, requiring 50% of owners (rounded up) // to approve any withdrawal or change in ownership // @author Nova Token (https://www.novatoken.io) // (c) 2019 Nova Token Ltd. All Rights Reserved. This code is not open source.
LineComment
removeOwner
function removeOwner(address _address) public isOwner(msg.sender) isOwner(_address) isNotMe(_address) { require(owners.length > 3, "can't remove below 3 owners - add a new owner first"); uint i; for(i = 0; i < ownershipRemovals[_address].length; i++) { require(ownershipRemovals[_address][i] != msg.sender, "sender must not have already approved this removal"); } emit ApproveRemovalOfOwner(msg.sender, _address); ownershipRemovals[_address].push(msg.sender); // owners.length / 2 is the number of approvals required AFTER this account is removed. // This guarantees there are still enough active approvers left. if(ownershipRemovals[_address].length >= getMinimumApprovals()) { for(i = 0; i < owners.length; i++) { if(owners[i] == _address) { uint lastSlot = owners.length - 1; owners[i] = owners[lastSlot]; owners[lastSlot] = address(0); owners.length = lastSlot; break; } } delete ownershipRemovals[_address]; emit OwnershipChange(_address, false, true); } }
// @dev Requests, or approves a ownership removal. Once enough approvals are given, the owner is // automatically removed. // @param _address - the address of the owner to be removed.
LineComment
v0.5.8+commit.23d335f2
None
bzzr://8c34ed56fc39d3079b9814f9727ffc764eb200c96ba8c10252eae5c7bc9e2c28
{ "func_code_index": [ 4180, 5328 ] }
57,676
Multisig
Multisig.sol
0xa313392fc17c1d1db87b35cdccb930bbf1b08b72
Solidity
Multisig
contract Multisig { address[] public owners; mapping (address => mapping(address => uint)) withdrawalRequests; mapping (address => mapping(address => address[])) withdrawalApprovals; mapping (address => address[]) ownershipAdditions; mapping (address => address[]) ownershipRemovals; event ApproveNewOwner(address indexed approver, address indexed subject); event ApproveRemovalOfOwner(address indexed approver, address indexed subject); event OwnershipChange(address indexed owner, bool indexed isAddition, bool indexed isRemoved); event Deposit(address indexed tokenContract, address indexed sender, uint amount); event Withdrawal(address indexed tokenContract, address indexed recipient, uint amount); event WithdrawalRequest(address indexed tokenContract, address indexed recipient, uint amount); event WithdrawalApproval(address indexed tokenContract, address indexed approver, address indexed recipient, uint amount); function getOwners() public view returns(address[] memory) { return owners; } function getOwnershipAdditions(address _account) public view returns(address[] memory) { return ownershipAdditions[_account]; } function getOwnershipRemovals(address _account) public view returns(address[] memory) { return ownershipRemovals[_account]; } function getWithdrawalApprovals(address _erc20, address _account) public view returns(uint amount, address[] memory approvals) { amount = withdrawalRequests[_erc20][_account]; approvals = withdrawalApprovals[_erc20][_account]; } function getMinimumApprovals() public view returns(uint approvalCount) { approvalCount = (owners.length + 1) / 2; } modifier isOwner(address _test) { require(_isOwner(_test) == true, "address must be an owner"); _; } modifier isNotOwner(address _test) { require(_isOwner(_test) == false, "address must NOT be an owner"); _; } modifier isNotMe(address _test) { require(msg.sender != _test, "test must not be sender"); _; } constructor(address _owner2, address _owner3) public { require(msg.sender != _owner2, "owner 1 and 2 can't be the same"); require(msg.sender != _owner3, "owner 1 and 3 can't be the same"); require(_owner2 != _owner3, "owner 2 and 3 can't be the same"); require(_owner2 != address(0), "owner 2 can't be the zero address"); require(_owner3 != address(0), "owner 2 can't be the zero address"); owners.push(msg.sender); owners.push(_owner2); owners.push(_owner3); } function _isOwner(address _test) internal view returns(bool) { for(uint i = 0; i < owners.length; i++) { if(_test == owners[i]) { return true; } } return false; } // @dev Requests, or approves an ownership addition. The new owner is NOT automatically added. // @param _address - the address of the owner to add. function approveOwner(address _address) public isOwner(msg.sender) isNotOwner(_address) isNotMe(_address) { require(owners.length < 10, "no more than 10 owners"); for(uint i = 0; i < ownershipAdditions[_address].length; i++) { require(ownershipAdditions[_address][i] != msg.sender, "sender has not already approved this removal"); } ownershipAdditions[_address].push(msg.sender); emit ApproveNewOwner(msg.sender, _address); } // @dev After being approved for ownership, the new owner must call this function to become an owner. function acceptOwnership() external isNotOwner(msg.sender) { require( ownershipAdditions[msg.sender].length >= getMinimumApprovals(), "sender doesn't have enough ownership approvals"); owners.push(msg.sender); delete ownershipAdditions[msg.sender]; emit OwnershipChange(msg.sender, true, false); } // @dev Requests, or approves a ownership removal. Once enough approvals are given, the owner is // automatically removed. // @param _address - the address of the owner to be removed. function removeOwner(address _address) public isOwner(msg.sender) isOwner(_address) isNotMe(_address) { require(owners.length > 3, "can't remove below 3 owners - add a new owner first"); uint i; for(i = 0; i < ownershipRemovals[_address].length; i++) { require(ownershipRemovals[_address][i] != msg.sender, "sender must not have already approved this removal"); } emit ApproveRemovalOfOwner(msg.sender, _address); ownershipRemovals[_address].push(msg.sender); // owners.length / 2 is the number of approvals required AFTER this account is removed. // This guarantees there are still enough active approvers left. if(ownershipRemovals[_address].length >= getMinimumApprovals()) { for(i = 0; i < owners.length; i++) { if(owners[i] == _address) { uint lastSlot = owners.length - 1; owners[i] = owners[lastSlot]; owners[lastSlot] = address(0); owners.length = lastSlot; break; } } delete ownershipRemovals[_address]; emit OwnershipChange(_address, false, true); } } // @dev Cancels a ownership removal. Only requires one owner to call this, // but the subject of the removal cannot call it themselves. // @param _address - the address of the owner to be removed. function vetoRemoval(address _address) public isOwner(msg.sender) isOwner(_address) isNotMe(_address) { delete ownershipRemovals[_address]; } // @dev Cancels a ownership addition. Only requires one owner to call this. // @param _address - the address of the owner to be added. function vetoOwnership(address _address) public isOwner(msg.sender) isNotMe(_address) { delete ownershipAdditions[_address]; } // @dev Cancels a withdrawal. Only requires one owner to call this. // @param _tokenContract - the contract of the erc20 token to withdraw (or, use the zero address for ETH) // @param _amount - the amount to withdraw. Amount must match the approved withdrawal amount. function vetoWithdrawal(address _tokenContract, address _requestor) public isOwner(msg.sender) { delete withdrawalRequests[_tokenContract][_requestor]; delete withdrawalApprovals[_tokenContract][_requestor]; } // @dev allows any owner to deposit any ERC20 token in this contract. // @dev Once the ERC20 token is deposited, it can only be withdrawn if enough accounts allow it. // @param _tokenContract - the contract of the erc20 token to deposit // @param _amount - the amount to deposit. // @notice For this function to work, you have to already have set an allowance for the transfer // @notice You CANNOT deposit Ether using this function. Use depositEth() instead. function depositERC20(address _tokenContract, uint _amount) public isOwner(msg.sender) { ERC20Interface erc20 = ERC20Interface(_tokenContract); emit Deposit(_tokenContract, msg.sender, _amount); erc20.transferFrom(msg.sender, address(this), _amount); } // @dev allows any owner to deposit Ether in this contract. // @dev Once ether is deposited, it can only be withdrawn if enough accounts allow it. function depositEth() public payable isOwner(msg.sender) { emit Deposit(address(0), msg.sender, msg.value); } // @dev Requests a withdrawal, changes a withdrawal request, or approves an existing withdrawal request. // To request or change, set _recipient to msg.sender. Changes wipe all approvals. // To approve, set _recipient to the previously requested account, and send from another owner account // @param _tokenContract - the contract of the erc20 token to withdraw (or, use the zero address for ETH) // @param _recipient - the account which will receive the withdrawal. // @param _amount - the amount to withdraw. Amount must match the approved withdrawal amount. function approveWithdrawal(address _tokenContract, address _recipient, uint _amount) public isOwner(msg.sender) { ERC20Interface erc20 = ERC20Interface(_tokenContract); // If Withdrawer == msg.sender, this is a new request. Cancel all previous approvals. require(_amount > 0, "can't withdraw zero"); if (_recipient == msg.sender) { if(_tokenContract == address(0)) { require(_amount <= address(this).balance, "can't withdraw more ETH than the balance"); } else { require(_amount <= erc20.balanceOf(address(this)), "can't withdraw more erc20 tokens than balance"); } delete withdrawalApprovals[_tokenContract][_recipient]; withdrawalRequests[_tokenContract][_recipient] = _amount; withdrawalApprovals[_tokenContract][_recipient].push(msg.sender); emit WithdrawalRequest(_tokenContract, _recipient, _amount); } else { require( withdrawalApprovals[_tokenContract][_recipient].length >= 1, "you can't initiate a withdrawal request for another user"); require( withdrawalRequests[_tokenContract][_recipient] == _amount, "approval amount must exactly match withdrawal request"); for(uint i = 0; i < withdrawalApprovals[_tokenContract][_recipient].length; i++) { require( withdrawalApprovals[_tokenContract][_recipient][i] != msg.sender, "sender has not already approved this withdrawal"); } withdrawalApprovals[_tokenContract][_recipient].push(msg.sender); } emit WithdrawalApproval(_tokenContract, msg.sender, _recipient, _amount); } // @dev Completes an approved withdrawal, transferring the erc20 tokens or Ether to the withdrawing account // @param _tokenContract - the contract of the erc20 token to withdraw (or, use the zero address for ETH) // @param _amount - the amount to withdraw. Amount must match the approved withdrawal amount. function completeWithdrawal(address _tokenContract, uint _amount) external isOwner(msg.sender) { require( withdrawalApprovals[_tokenContract][msg.sender].length >= getMinimumApprovals(), "insufficient approvals to complete this withdrawal"); require(withdrawalRequests[_tokenContract][msg.sender] == _amount, "incorrect withdrawal amount specified"); delete withdrawalRequests[_tokenContract][msg.sender]; delete withdrawalApprovals[_tokenContract][msg.sender]; emit Withdrawal(_tokenContract, msg.sender, _amount); if(_tokenContract == address(0)) { require(_amount <= address(this).balance, "can't withdraw more ETH than the balance"); msg.sender.transfer(_amount); } else { ERC20Interface erc20 = ERC20Interface(_tokenContract); require(_amount <= erc20.balanceOf(address(this)), "can't withdraw more erc20 tokens than balance"); erc20.transfer(msg.sender, _amount); } } }
// @title Multisig ERC20 and Ether contract // @dev Allows multisig management of Ether and ERC20 funds, requiring 50% of owners (rounded up) // to approve any withdrawal or change in ownership // @author Nova Token (https://www.novatoken.io) // (c) 2019 Nova Token Ltd. All Rights Reserved. This code is not open source.
LineComment
vetoRemoval
function vetoRemoval(address _address) public isOwner(msg.sender) isOwner(_address) isNotMe(_address) { delete ownershipRemovals[_address]; }
// @dev Cancels a ownership removal. Only requires one owner to call this, // but the subject of the removal cannot call it themselves. // @param _address - the address of the owner to be removed.
LineComment
v0.5.8+commit.23d335f2
None
bzzr://8c34ed56fc39d3079b9814f9727ffc764eb200c96ba8c10252eae5c7bc9e2c28
{ "func_code_index": [ 5539, 5714 ] }
57,677
Multisig
Multisig.sol
0xa313392fc17c1d1db87b35cdccb930bbf1b08b72
Solidity
Multisig
contract Multisig { address[] public owners; mapping (address => mapping(address => uint)) withdrawalRequests; mapping (address => mapping(address => address[])) withdrawalApprovals; mapping (address => address[]) ownershipAdditions; mapping (address => address[]) ownershipRemovals; event ApproveNewOwner(address indexed approver, address indexed subject); event ApproveRemovalOfOwner(address indexed approver, address indexed subject); event OwnershipChange(address indexed owner, bool indexed isAddition, bool indexed isRemoved); event Deposit(address indexed tokenContract, address indexed sender, uint amount); event Withdrawal(address indexed tokenContract, address indexed recipient, uint amount); event WithdrawalRequest(address indexed tokenContract, address indexed recipient, uint amount); event WithdrawalApproval(address indexed tokenContract, address indexed approver, address indexed recipient, uint amount); function getOwners() public view returns(address[] memory) { return owners; } function getOwnershipAdditions(address _account) public view returns(address[] memory) { return ownershipAdditions[_account]; } function getOwnershipRemovals(address _account) public view returns(address[] memory) { return ownershipRemovals[_account]; } function getWithdrawalApprovals(address _erc20, address _account) public view returns(uint amount, address[] memory approvals) { amount = withdrawalRequests[_erc20][_account]; approvals = withdrawalApprovals[_erc20][_account]; } function getMinimumApprovals() public view returns(uint approvalCount) { approvalCount = (owners.length + 1) / 2; } modifier isOwner(address _test) { require(_isOwner(_test) == true, "address must be an owner"); _; } modifier isNotOwner(address _test) { require(_isOwner(_test) == false, "address must NOT be an owner"); _; } modifier isNotMe(address _test) { require(msg.sender != _test, "test must not be sender"); _; } constructor(address _owner2, address _owner3) public { require(msg.sender != _owner2, "owner 1 and 2 can't be the same"); require(msg.sender != _owner3, "owner 1 and 3 can't be the same"); require(_owner2 != _owner3, "owner 2 and 3 can't be the same"); require(_owner2 != address(0), "owner 2 can't be the zero address"); require(_owner3 != address(0), "owner 2 can't be the zero address"); owners.push(msg.sender); owners.push(_owner2); owners.push(_owner3); } function _isOwner(address _test) internal view returns(bool) { for(uint i = 0; i < owners.length; i++) { if(_test == owners[i]) { return true; } } return false; } // @dev Requests, or approves an ownership addition. The new owner is NOT automatically added. // @param _address - the address of the owner to add. function approveOwner(address _address) public isOwner(msg.sender) isNotOwner(_address) isNotMe(_address) { require(owners.length < 10, "no more than 10 owners"); for(uint i = 0; i < ownershipAdditions[_address].length; i++) { require(ownershipAdditions[_address][i] != msg.sender, "sender has not already approved this removal"); } ownershipAdditions[_address].push(msg.sender); emit ApproveNewOwner(msg.sender, _address); } // @dev After being approved for ownership, the new owner must call this function to become an owner. function acceptOwnership() external isNotOwner(msg.sender) { require( ownershipAdditions[msg.sender].length >= getMinimumApprovals(), "sender doesn't have enough ownership approvals"); owners.push(msg.sender); delete ownershipAdditions[msg.sender]; emit OwnershipChange(msg.sender, true, false); } // @dev Requests, or approves a ownership removal. Once enough approvals are given, the owner is // automatically removed. // @param _address - the address of the owner to be removed. function removeOwner(address _address) public isOwner(msg.sender) isOwner(_address) isNotMe(_address) { require(owners.length > 3, "can't remove below 3 owners - add a new owner first"); uint i; for(i = 0; i < ownershipRemovals[_address].length; i++) { require(ownershipRemovals[_address][i] != msg.sender, "sender must not have already approved this removal"); } emit ApproveRemovalOfOwner(msg.sender, _address); ownershipRemovals[_address].push(msg.sender); // owners.length / 2 is the number of approvals required AFTER this account is removed. // This guarantees there are still enough active approvers left. if(ownershipRemovals[_address].length >= getMinimumApprovals()) { for(i = 0; i < owners.length; i++) { if(owners[i] == _address) { uint lastSlot = owners.length - 1; owners[i] = owners[lastSlot]; owners[lastSlot] = address(0); owners.length = lastSlot; break; } } delete ownershipRemovals[_address]; emit OwnershipChange(_address, false, true); } } // @dev Cancels a ownership removal. Only requires one owner to call this, // but the subject of the removal cannot call it themselves. // @param _address - the address of the owner to be removed. function vetoRemoval(address _address) public isOwner(msg.sender) isOwner(_address) isNotMe(_address) { delete ownershipRemovals[_address]; } // @dev Cancels a ownership addition. Only requires one owner to call this. // @param _address - the address of the owner to be added. function vetoOwnership(address _address) public isOwner(msg.sender) isNotMe(_address) { delete ownershipAdditions[_address]; } // @dev Cancels a withdrawal. Only requires one owner to call this. // @param _tokenContract - the contract of the erc20 token to withdraw (or, use the zero address for ETH) // @param _amount - the amount to withdraw. Amount must match the approved withdrawal amount. function vetoWithdrawal(address _tokenContract, address _requestor) public isOwner(msg.sender) { delete withdrawalRequests[_tokenContract][_requestor]; delete withdrawalApprovals[_tokenContract][_requestor]; } // @dev allows any owner to deposit any ERC20 token in this contract. // @dev Once the ERC20 token is deposited, it can only be withdrawn if enough accounts allow it. // @param _tokenContract - the contract of the erc20 token to deposit // @param _amount - the amount to deposit. // @notice For this function to work, you have to already have set an allowance for the transfer // @notice You CANNOT deposit Ether using this function. Use depositEth() instead. function depositERC20(address _tokenContract, uint _amount) public isOwner(msg.sender) { ERC20Interface erc20 = ERC20Interface(_tokenContract); emit Deposit(_tokenContract, msg.sender, _amount); erc20.transferFrom(msg.sender, address(this), _amount); } // @dev allows any owner to deposit Ether in this contract. // @dev Once ether is deposited, it can only be withdrawn if enough accounts allow it. function depositEth() public payable isOwner(msg.sender) { emit Deposit(address(0), msg.sender, msg.value); } // @dev Requests a withdrawal, changes a withdrawal request, or approves an existing withdrawal request. // To request or change, set _recipient to msg.sender. Changes wipe all approvals. // To approve, set _recipient to the previously requested account, and send from another owner account // @param _tokenContract - the contract of the erc20 token to withdraw (or, use the zero address for ETH) // @param _recipient - the account which will receive the withdrawal. // @param _amount - the amount to withdraw. Amount must match the approved withdrawal amount. function approveWithdrawal(address _tokenContract, address _recipient, uint _amount) public isOwner(msg.sender) { ERC20Interface erc20 = ERC20Interface(_tokenContract); // If Withdrawer == msg.sender, this is a new request. Cancel all previous approvals. require(_amount > 0, "can't withdraw zero"); if (_recipient == msg.sender) { if(_tokenContract == address(0)) { require(_amount <= address(this).balance, "can't withdraw more ETH than the balance"); } else { require(_amount <= erc20.balanceOf(address(this)), "can't withdraw more erc20 tokens than balance"); } delete withdrawalApprovals[_tokenContract][_recipient]; withdrawalRequests[_tokenContract][_recipient] = _amount; withdrawalApprovals[_tokenContract][_recipient].push(msg.sender); emit WithdrawalRequest(_tokenContract, _recipient, _amount); } else { require( withdrawalApprovals[_tokenContract][_recipient].length >= 1, "you can't initiate a withdrawal request for another user"); require( withdrawalRequests[_tokenContract][_recipient] == _amount, "approval amount must exactly match withdrawal request"); for(uint i = 0; i < withdrawalApprovals[_tokenContract][_recipient].length; i++) { require( withdrawalApprovals[_tokenContract][_recipient][i] != msg.sender, "sender has not already approved this withdrawal"); } withdrawalApprovals[_tokenContract][_recipient].push(msg.sender); } emit WithdrawalApproval(_tokenContract, msg.sender, _recipient, _amount); } // @dev Completes an approved withdrawal, transferring the erc20 tokens or Ether to the withdrawing account // @param _tokenContract - the contract of the erc20 token to withdraw (or, use the zero address for ETH) // @param _amount - the amount to withdraw. Amount must match the approved withdrawal amount. function completeWithdrawal(address _tokenContract, uint _amount) external isOwner(msg.sender) { require( withdrawalApprovals[_tokenContract][msg.sender].length >= getMinimumApprovals(), "insufficient approvals to complete this withdrawal"); require(withdrawalRequests[_tokenContract][msg.sender] == _amount, "incorrect withdrawal amount specified"); delete withdrawalRequests[_tokenContract][msg.sender]; delete withdrawalApprovals[_tokenContract][msg.sender]; emit Withdrawal(_tokenContract, msg.sender, _amount); if(_tokenContract == address(0)) { require(_amount <= address(this).balance, "can't withdraw more ETH than the balance"); msg.sender.transfer(_amount); } else { ERC20Interface erc20 = ERC20Interface(_tokenContract); require(_amount <= erc20.balanceOf(address(this)), "can't withdraw more erc20 tokens than balance"); erc20.transfer(msg.sender, _amount); } } }
// @title Multisig ERC20 and Ether contract // @dev Allows multisig management of Ether and ERC20 funds, requiring 50% of owners (rounded up) // to approve any withdrawal or change in ownership // @author Nova Token (https://www.novatoken.io) // (c) 2019 Nova Token Ltd. All Rights Reserved. This code is not open source.
LineComment
vetoOwnership
function vetoOwnership(address _address) public isOwner(msg.sender) isNotMe(_address) { delete ownershipAdditions[_address]; }
// @dev Cancels a ownership addition. Only requires one owner to call this. // @param _address - the address of the owner to be added.
LineComment
v0.5.8+commit.23d335f2
None
bzzr://8c34ed56fc39d3079b9814f9727ffc764eb200c96ba8c10252eae5c7bc9e2c28
{ "func_code_index": [ 5858, 6013 ] }
57,678
Multisig
Multisig.sol
0xa313392fc17c1d1db87b35cdccb930bbf1b08b72
Solidity
Multisig
contract Multisig { address[] public owners; mapping (address => mapping(address => uint)) withdrawalRequests; mapping (address => mapping(address => address[])) withdrawalApprovals; mapping (address => address[]) ownershipAdditions; mapping (address => address[]) ownershipRemovals; event ApproveNewOwner(address indexed approver, address indexed subject); event ApproveRemovalOfOwner(address indexed approver, address indexed subject); event OwnershipChange(address indexed owner, bool indexed isAddition, bool indexed isRemoved); event Deposit(address indexed tokenContract, address indexed sender, uint amount); event Withdrawal(address indexed tokenContract, address indexed recipient, uint amount); event WithdrawalRequest(address indexed tokenContract, address indexed recipient, uint amount); event WithdrawalApproval(address indexed tokenContract, address indexed approver, address indexed recipient, uint amount); function getOwners() public view returns(address[] memory) { return owners; } function getOwnershipAdditions(address _account) public view returns(address[] memory) { return ownershipAdditions[_account]; } function getOwnershipRemovals(address _account) public view returns(address[] memory) { return ownershipRemovals[_account]; } function getWithdrawalApprovals(address _erc20, address _account) public view returns(uint amount, address[] memory approvals) { amount = withdrawalRequests[_erc20][_account]; approvals = withdrawalApprovals[_erc20][_account]; } function getMinimumApprovals() public view returns(uint approvalCount) { approvalCount = (owners.length + 1) / 2; } modifier isOwner(address _test) { require(_isOwner(_test) == true, "address must be an owner"); _; } modifier isNotOwner(address _test) { require(_isOwner(_test) == false, "address must NOT be an owner"); _; } modifier isNotMe(address _test) { require(msg.sender != _test, "test must not be sender"); _; } constructor(address _owner2, address _owner3) public { require(msg.sender != _owner2, "owner 1 and 2 can't be the same"); require(msg.sender != _owner3, "owner 1 and 3 can't be the same"); require(_owner2 != _owner3, "owner 2 and 3 can't be the same"); require(_owner2 != address(0), "owner 2 can't be the zero address"); require(_owner3 != address(0), "owner 2 can't be the zero address"); owners.push(msg.sender); owners.push(_owner2); owners.push(_owner3); } function _isOwner(address _test) internal view returns(bool) { for(uint i = 0; i < owners.length; i++) { if(_test == owners[i]) { return true; } } return false; } // @dev Requests, or approves an ownership addition. The new owner is NOT automatically added. // @param _address - the address of the owner to add. function approveOwner(address _address) public isOwner(msg.sender) isNotOwner(_address) isNotMe(_address) { require(owners.length < 10, "no more than 10 owners"); for(uint i = 0; i < ownershipAdditions[_address].length; i++) { require(ownershipAdditions[_address][i] != msg.sender, "sender has not already approved this removal"); } ownershipAdditions[_address].push(msg.sender); emit ApproveNewOwner(msg.sender, _address); } // @dev After being approved for ownership, the new owner must call this function to become an owner. function acceptOwnership() external isNotOwner(msg.sender) { require( ownershipAdditions[msg.sender].length >= getMinimumApprovals(), "sender doesn't have enough ownership approvals"); owners.push(msg.sender); delete ownershipAdditions[msg.sender]; emit OwnershipChange(msg.sender, true, false); } // @dev Requests, or approves a ownership removal. Once enough approvals are given, the owner is // automatically removed. // @param _address - the address of the owner to be removed. function removeOwner(address _address) public isOwner(msg.sender) isOwner(_address) isNotMe(_address) { require(owners.length > 3, "can't remove below 3 owners - add a new owner first"); uint i; for(i = 0; i < ownershipRemovals[_address].length; i++) { require(ownershipRemovals[_address][i] != msg.sender, "sender must not have already approved this removal"); } emit ApproveRemovalOfOwner(msg.sender, _address); ownershipRemovals[_address].push(msg.sender); // owners.length / 2 is the number of approvals required AFTER this account is removed. // This guarantees there are still enough active approvers left. if(ownershipRemovals[_address].length >= getMinimumApprovals()) { for(i = 0; i < owners.length; i++) { if(owners[i] == _address) { uint lastSlot = owners.length - 1; owners[i] = owners[lastSlot]; owners[lastSlot] = address(0); owners.length = lastSlot; break; } } delete ownershipRemovals[_address]; emit OwnershipChange(_address, false, true); } } // @dev Cancels a ownership removal. Only requires one owner to call this, // but the subject of the removal cannot call it themselves. // @param _address - the address of the owner to be removed. function vetoRemoval(address _address) public isOwner(msg.sender) isOwner(_address) isNotMe(_address) { delete ownershipRemovals[_address]; } // @dev Cancels a ownership addition. Only requires one owner to call this. // @param _address - the address of the owner to be added. function vetoOwnership(address _address) public isOwner(msg.sender) isNotMe(_address) { delete ownershipAdditions[_address]; } // @dev Cancels a withdrawal. Only requires one owner to call this. // @param _tokenContract - the contract of the erc20 token to withdraw (or, use the zero address for ETH) // @param _amount - the amount to withdraw. Amount must match the approved withdrawal amount. function vetoWithdrawal(address _tokenContract, address _requestor) public isOwner(msg.sender) { delete withdrawalRequests[_tokenContract][_requestor]; delete withdrawalApprovals[_tokenContract][_requestor]; } // @dev allows any owner to deposit any ERC20 token in this contract. // @dev Once the ERC20 token is deposited, it can only be withdrawn if enough accounts allow it. // @param _tokenContract - the contract of the erc20 token to deposit // @param _amount - the amount to deposit. // @notice For this function to work, you have to already have set an allowance for the transfer // @notice You CANNOT deposit Ether using this function. Use depositEth() instead. function depositERC20(address _tokenContract, uint _amount) public isOwner(msg.sender) { ERC20Interface erc20 = ERC20Interface(_tokenContract); emit Deposit(_tokenContract, msg.sender, _amount); erc20.transferFrom(msg.sender, address(this), _amount); } // @dev allows any owner to deposit Ether in this contract. // @dev Once ether is deposited, it can only be withdrawn if enough accounts allow it. function depositEth() public payable isOwner(msg.sender) { emit Deposit(address(0), msg.sender, msg.value); } // @dev Requests a withdrawal, changes a withdrawal request, or approves an existing withdrawal request. // To request or change, set _recipient to msg.sender. Changes wipe all approvals. // To approve, set _recipient to the previously requested account, and send from another owner account // @param _tokenContract - the contract of the erc20 token to withdraw (or, use the zero address for ETH) // @param _recipient - the account which will receive the withdrawal. // @param _amount - the amount to withdraw. Amount must match the approved withdrawal amount. function approveWithdrawal(address _tokenContract, address _recipient, uint _amount) public isOwner(msg.sender) { ERC20Interface erc20 = ERC20Interface(_tokenContract); // If Withdrawer == msg.sender, this is a new request. Cancel all previous approvals. require(_amount > 0, "can't withdraw zero"); if (_recipient == msg.sender) { if(_tokenContract == address(0)) { require(_amount <= address(this).balance, "can't withdraw more ETH than the balance"); } else { require(_amount <= erc20.balanceOf(address(this)), "can't withdraw more erc20 tokens than balance"); } delete withdrawalApprovals[_tokenContract][_recipient]; withdrawalRequests[_tokenContract][_recipient] = _amount; withdrawalApprovals[_tokenContract][_recipient].push(msg.sender); emit WithdrawalRequest(_tokenContract, _recipient, _amount); } else { require( withdrawalApprovals[_tokenContract][_recipient].length >= 1, "you can't initiate a withdrawal request for another user"); require( withdrawalRequests[_tokenContract][_recipient] == _amount, "approval amount must exactly match withdrawal request"); for(uint i = 0; i < withdrawalApprovals[_tokenContract][_recipient].length; i++) { require( withdrawalApprovals[_tokenContract][_recipient][i] != msg.sender, "sender has not already approved this withdrawal"); } withdrawalApprovals[_tokenContract][_recipient].push(msg.sender); } emit WithdrawalApproval(_tokenContract, msg.sender, _recipient, _amount); } // @dev Completes an approved withdrawal, transferring the erc20 tokens or Ether to the withdrawing account // @param _tokenContract - the contract of the erc20 token to withdraw (or, use the zero address for ETH) // @param _amount - the amount to withdraw. Amount must match the approved withdrawal amount. function completeWithdrawal(address _tokenContract, uint _amount) external isOwner(msg.sender) { require( withdrawalApprovals[_tokenContract][msg.sender].length >= getMinimumApprovals(), "insufficient approvals to complete this withdrawal"); require(withdrawalRequests[_tokenContract][msg.sender] == _amount, "incorrect withdrawal amount specified"); delete withdrawalRequests[_tokenContract][msg.sender]; delete withdrawalApprovals[_tokenContract][msg.sender]; emit Withdrawal(_tokenContract, msg.sender, _amount); if(_tokenContract == address(0)) { require(_amount <= address(this).balance, "can't withdraw more ETH than the balance"); msg.sender.transfer(_amount); } else { ERC20Interface erc20 = ERC20Interface(_tokenContract); require(_amount <= erc20.balanceOf(address(this)), "can't withdraw more erc20 tokens than balance"); erc20.transfer(msg.sender, _amount); } } }
// @title Multisig ERC20 and Ether contract // @dev Allows multisig management of Ether and ERC20 funds, requiring 50% of owners (rounded up) // to approve any withdrawal or change in ownership // @author Nova Token (https://www.novatoken.io) // (c) 2019 Nova Token Ltd. All Rights Reserved. This code is not open source.
LineComment
vetoWithdrawal
function vetoWithdrawal(address _tokenContract, address _requestor) public isOwner(msg.sender) { delete withdrawalRequests[_tokenContract][_requestor]; delete withdrawalApprovals[_tokenContract][_requestor]; }
// @dev Cancels a withdrawal. Only requires one owner to call this. // @param _tokenContract - the contract of the erc20 token to withdraw (or, use the zero address for ETH) // @param _amount - the amount to withdraw. Amount must match the approved withdrawal amount.
LineComment
v0.5.8+commit.23d335f2
None
bzzr://8c34ed56fc39d3079b9814f9727ffc764eb200c96ba8c10252eae5c7bc9e2c28
{ "func_code_index": [ 6293, 6531 ] }
57,679
Multisig
Multisig.sol
0xa313392fc17c1d1db87b35cdccb930bbf1b08b72
Solidity
Multisig
contract Multisig { address[] public owners; mapping (address => mapping(address => uint)) withdrawalRequests; mapping (address => mapping(address => address[])) withdrawalApprovals; mapping (address => address[]) ownershipAdditions; mapping (address => address[]) ownershipRemovals; event ApproveNewOwner(address indexed approver, address indexed subject); event ApproveRemovalOfOwner(address indexed approver, address indexed subject); event OwnershipChange(address indexed owner, bool indexed isAddition, bool indexed isRemoved); event Deposit(address indexed tokenContract, address indexed sender, uint amount); event Withdrawal(address indexed tokenContract, address indexed recipient, uint amount); event WithdrawalRequest(address indexed tokenContract, address indexed recipient, uint amount); event WithdrawalApproval(address indexed tokenContract, address indexed approver, address indexed recipient, uint amount); function getOwners() public view returns(address[] memory) { return owners; } function getOwnershipAdditions(address _account) public view returns(address[] memory) { return ownershipAdditions[_account]; } function getOwnershipRemovals(address _account) public view returns(address[] memory) { return ownershipRemovals[_account]; } function getWithdrawalApprovals(address _erc20, address _account) public view returns(uint amount, address[] memory approvals) { amount = withdrawalRequests[_erc20][_account]; approvals = withdrawalApprovals[_erc20][_account]; } function getMinimumApprovals() public view returns(uint approvalCount) { approvalCount = (owners.length + 1) / 2; } modifier isOwner(address _test) { require(_isOwner(_test) == true, "address must be an owner"); _; } modifier isNotOwner(address _test) { require(_isOwner(_test) == false, "address must NOT be an owner"); _; } modifier isNotMe(address _test) { require(msg.sender != _test, "test must not be sender"); _; } constructor(address _owner2, address _owner3) public { require(msg.sender != _owner2, "owner 1 and 2 can't be the same"); require(msg.sender != _owner3, "owner 1 and 3 can't be the same"); require(_owner2 != _owner3, "owner 2 and 3 can't be the same"); require(_owner2 != address(0), "owner 2 can't be the zero address"); require(_owner3 != address(0), "owner 2 can't be the zero address"); owners.push(msg.sender); owners.push(_owner2); owners.push(_owner3); } function _isOwner(address _test) internal view returns(bool) { for(uint i = 0; i < owners.length; i++) { if(_test == owners[i]) { return true; } } return false; } // @dev Requests, or approves an ownership addition. The new owner is NOT automatically added. // @param _address - the address of the owner to add. function approveOwner(address _address) public isOwner(msg.sender) isNotOwner(_address) isNotMe(_address) { require(owners.length < 10, "no more than 10 owners"); for(uint i = 0; i < ownershipAdditions[_address].length; i++) { require(ownershipAdditions[_address][i] != msg.sender, "sender has not already approved this removal"); } ownershipAdditions[_address].push(msg.sender); emit ApproveNewOwner(msg.sender, _address); } // @dev After being approved for ownership, the new owner must call this function to become an owner. function acceptOwnership() external isNotOwner(msg.sender) { require( ownershipAdditions[msg.sender].length >= getMinimumApprovals(), "sender doesn't have enough ownership approvals"); owners.push(msg.sender); delete ownershipAdditions[msg.sender]; emit OwnershipChange(msg.sender, true, false); } // @dev Requests, or approves a ownership removal. Once enough approvals are given, the owner is // automatically removed. // @param _address - the address of the owner to be removed. function removeOwner(address _address) public isOwner(msg.sender) isOwner(_address) isNotMe(_address) { require(owners.length > 3, "can't remove below 3 owners - add a new owner first"); uint i; for(i = 0; i < ownershipRemovals[_address].length; i++) { require(ownershipRemovals[_address][i] != msg.sender, "sender must not have already approved this removal"); } emit ApproveRemovalOfOwner(msg.sender, _address); ownershipRemovals[_address].push(msg.sender); // owners.length / 2 is the number of approvals required AFTER this account is removed. // This guarantees there are still enough active approvers left. if(ownershipRemovals[_address].length >= getMinimumApprovals()) { for(i = 0; i < owners.length; i++) { if(owners[i] == _address) { uint lastSlot = owners.length - 1; owners[i] = owners[lastSlot]; owners[lastSlot] = address(0); owners.length = lastSlot; break; } } delete ownershipRemovals[_address]; emit OwnershipChange(_address, false, true); } } // @dev Cancels a ownership removal. Only requires one owner to call this, // but the subject of the removal cannot call it themselves. // @param _address - the address of the owner to be removed. function vetoRemoval(address _address) public isOwner(msg.sender) isOwner(_address) isNotMe(_address) { delete ownershipRemovals[_address]; } // @dev Cancels a ownership addition. Only requires one owner to call this. // @param _address - the address of the owner to be added. function vetoOwnership(address _address) public isOwner(msg.sender) isNotMe(_address) { delete ownershipAdditions[_address]; } // @dev Cancels a withdrawal. Only requires one owner to call this. // @param _tokenContract - the contract of the erc20 token to withdraw (or, use the zero address for ETH) // @param _amount - the amount to withdraw. Amount must match the approved withdrawal amount. function vetoWithdrawal(address _tokenContract, address _requestor) public isOwner(msg.sender) { delete withdrawalRequests[_tokenContract][_requestor]; delete withdrawalApprovals[_tokenContract][_requestor]; } // @dev allows any owner to deposit any ERC20 token in this contract. // @dev Once the ERC20 token is deposited, it can only be withdrawn if enough accounts allow it. // @param _tokenContract - the contract of the erc20 token to deposit // @param _amount - the amount to deposit. // @notice For this function to work, you have to already have set an allowance for the transfer // @notice You CANNOT deposit Ether using this function. Use depositEth() instead. function depositERC20(address _tokenContract, uint _amount) public isOwner(msg.sender) { ERC20Interface erc20 = ERC20Interface(_tokenContract); emit Deposit(_tokenContract, msg.sender, _amount); erc20.transferFrom(msg.sender, address(this), _amount); } // @dev allows any owner to deposit Ether in this contract. // @dev Once ether is deposited, it can only be withdrawn if enough accounts allow it. function depositEth() public payable isOwner(msg.sender) { emit Deposit(address(0), msg.sender, msg.value); } // @dev Requests a withdrawal, changes a withdrawal request, or approves an existing withdrawal request. // To request or change, set _recipient to msg.sender. Changes wipe all approvals. // To approve, set _recipient to the previously requested account, and send from another owner account // @param _tokenContract - the contract of the erc20 token to withdraw (or, use the zero address for ETH) // @param _recipient - the account which will receive the withdrawal. // @param _amount - the amount to withdraw. Amount must match the approved withdrawal amount. function approveWithdrawal(address _tokenContract, address _recipient, uint _amount) public isOwner(msg.sender) { ERC20Interface erc20 = ERC20Interface(_tokenContract); // If Withdrawer == msg.sender, this is a new request. Cancel all previous approvals. require(_amount > 0, "can't withdraw zero"); if (_recipient == msg.sender) { if(_tokenContract == address(0)) { require(_amount <= address(this).balance, "can't withdraw more ETH than the balance"); } else { require(_amount <= erc20.balanceOf(address(this)), "can't withdraw more erc20 tokens than balance"); } delete withdrawalApprovals[_tokenContract][_recipient]; withdrawalRequests[_tokenContract][_recipient] = _amount; withdrawalApprovals[_tokenContract][_recipient].push(msg.sender); emit WithdrawalRequest(_tokenContract, _recipient, _amount); } else { require( withdrawalApprovals[_tokenContract][_recipient].length >= 1, "you can't initiate a withdrawal request for another user"); require( withdrawalRequests[_tokenContract][_recipient] == _amount, "approval amount must exactly match withdrawal request"); for(uint i = 0; i < withdrawalApprovals[_tokenContract][_recipient].length; i++) { require( withdrawalApprovals[_tokenContract][_recipient][i] != msg.sender, "sender has not already approved this withdrawal"); } withdrawalApprovals[_tokenContract][_recipient].push(msg.sender); } emit WithdrawalApproval(_tokenContract, msg.sender, _recipient, _amount); } // @dev Completes an approved withdrawal, transferring the erc20 tokens or Ether to the withdrawing account // @param _tokenContract - the contract of the erc20 token to withdraw (or, use the zero address for ETH) // @param _amount - the amount to withdraw. Amount must match the approved withdrawal amount. function completeWithdrawal(address _tokenContract, uint _amount) external isOwner(msg.sender) { require( withdrawalApprovals[_tokenContract][msg.sender].length >= getMinimumApprovals(), "insufficient approvals to complete this withdrawal"); require(withdrawalRequests[_tokenContract][msg.sender] == _amount, "incorrect withdrawal amount specified"); delete withdrawalRequests[_tokenContract][msg.sender]; delete withdrawalApprovals[_tokenContract][msg.sender]; emit Withdrawal(_tokenContract, msg.sender, _amount); if(_tokenContract == address(0)) { require(_amount <= address(this).balance, "can't withdraw more ETH than the balance"); msg.sender.transfer(_amount); } else { ERC20Interface erc20 = ERC20Interface(_tokenContract); require(_amount <= erc20.balanceOf(address(this)), "can't withdraw more erc20 tokens than balance"); erc20.transfer(msg.sender, _amount); } } }
// @title Multisig ERC20 and Ether contract // @dev Allows multisig management of Ether and ERC20 funds, requiring 50% of owners (rounded up) // to approve any withdrawal or change in ownership // @author Nova Token (https://www.novatoken.io) // (c) 2019 Nova Token Ltd. All Rights Reserved. This code is not open source.
LineComment
depositERC20
function depositERC20(address _tokenContract, uint _amount) public isOwner(msg.sender) { ERC20Interface erc20 = ERC20Interface(_tokenContract); emit Deposit(_tokenContract, msg.sender, _amount); erc20.transferFrom(msg.sender, address(this), _amount); }
// @dev allows any owner to deposit any ERC20 token in this contract. // @dev Once the ERC20 token is deposited, it can only be withdrawn if enough accounts allow it. // @param _tokenContract - the contract of the erc20 token to deposit // @param _amount - the amount to deposit. // @notice For this function to work, you have to already have set an allowance for the transfer // @notice You CANNOT deposit Ether using this function. Use depositEth() instead.
LineComment
v0.5.8+commit.23d335f2
None
bzzr://8c34ed56fc39d3079b9814f9727ffc764eb200c96ba8c10252eae5c7bc9e2c28
{ "func_code_index": [ 7012, 7298 ] }
57,680
Multisig
Multisig.sol
0xa313392fc17c1d1db87b35cdccb930bbf1b08b72
Solidity
Multisig
contract Multisig { address[] public owners; mapping (address => mapping(address => uint)) withdrawalRequests; mapping (address => mapping(address => address[])) withdrawalApprovals; mapping (address => address[]) ownershipAdditions; mapping (address => address[]) ownershipRemovals; event ApproveNewOwner(address indexed approver, address indexed subject); event ApproveRemovalOfOwner(address indexed approver, address indexed subject); event OwnershipChange(address indexed owner, bool indexed isAddition, bool indexed isRemoved); event Deposit(address indexed tokenContract, address indexed sender, uint amount); event Withdrawal(address indexed tokenContract, address indexed recipient, uint amount); event WithdrawalRequest(address indexed tokenContract, address indexed recipient, uint amount); event WithdrawalApproval(address indexed tokenContract, address indexed approver, address indexed recipient, uint amount); function getOwners() public view returns(address[] memory) { return owners; } function getOwnershipAdditions(address _account) public view returns(address[] memory) { return ownershipAdditions[_account]; } function getOwnershipRemovals(address _account) public view returns(address[] memory) { return ownershipRemovals[_account]; } function getWithdrawalApprovals(address _erc20, address _account) public view returns(uint amount, address[] memory approvals) { amount = withdrawalRequests[_erc20][_account]; approvals = withdrawalApprovals[_erc20][_account]; } function getMinimumApprovals() public view returns(uint approvalCount) { approvalCount = (owners.length + 1) / 2; } modifier isOwner(address _test) { require(_isOwner(_test) == true, "address must be an owner"); _; } modifier isNotOwner(address _test) { require(_isOwner(_test) == false, "address must NOT be an owner"); _; } modifier isNotMe(address _test) { require(msg.sender != _test, "test must not be sender"); _; } constructor(address _owner2, address _owner3) public { require(msg.sender != _owner2, "owner 1 and 2 can't be the same"); require(msg.sender != _owner3, "owner 1 and 3 can't be the same"); require(_owner2 != _owner3, "owner 2 and 3 can't be the same"); require(_owner2 != address(0), "owner 2 can't be the zero address"); require(_owner3 != address(0), "owner 2 can't be the zero address"); owners.push(msg.sender); owners.push(_owner2); owners.push(_owner3); } function _isOwner(address _test) internal view returns(bool) { for(uint i = 0; i < owners.length; i++) { if(_test == owners[i]) { return true; } } return false; } // @dev Requests, or approves an ownership addition. The new owner is NOT automatically added. // @param _address - the address of the owner to add. function approveOwner(address _address) public isOwner(msg.sender) isNotOwner(_address) isNotMe(_address) { require(owners.length < 10, "no more than 10 owners"); for(uint i = 0; i < ownershipAdditions[_address].length; i++) { require(ownershipAdditions[_address][i] != msg.sender, "sender has not already approved this removal"); } ownershipAdditions[_address].push(msg.sender); emit ApproveNewOwner(msg.sender, _address); } // @dev After being approved for ownership, the new owner must call this function to become an owner. function acceptOwnership() external isNotOwner(msg.sender) { require( ownershipAdditions[msg.sender].length >= getMinimumApprovals(), "sender doesn't have enough ownership approvals"); owners.push(msg.sender); delete ownershipAdditions[msg.sender]; emit OwnershipChange(msg.sender, true, false); } // @dev Requests, or approves a ownership removal. Once enough approvals are given, the owner is // automatically removed. // @param _address - the address of the owner to be removed. function removeOwner(address _address) public isOwner(msg.sender) isOwner(_address) isNotMe(_address) { require(owners.length > 3, "can't remove below 3 owners - add a new owner first"); uint i; for(i = 0; i < ownershipRemovals[_address].length; i++) { require(ownershipRemovals[_address][i] != msg.sender, "sender must not have already approved this removal"); } emit ApproveRemovalOfOwner(msg.sender, _address); ownershipRemovals[_address].push(msg.sender); // owners.length / 2 is the number of approvals required AFTER this account is removed. // This guarantees there are still enough active approvers left. if(ownershipRemovals[_address].length >= getMinimumApprovals()) { for(i = 0; i < owners.length; i++) { if(owners[i] == _address) { uint lastSlot = owners.length - 1; owners[i] = owners[lastSlot]; owners[lastSlot] = address(0); owners.length = lastSlot; break; } } delete ownershipRemovals[_address]; emit OwnershipChange(_address, false, true); } } // @dev Cancels a ownership removal. Only requires one owner to call this, // but the subject of the removal cannot call it themselves. // @param _address - the address of the owner to be removed. function vetoRemoval(address _address) public isOwner(msg.sender) isOwner(_address) isNotMe(_address) { delete ownershipRemovals[_address]; } // @dev Cancels a ownership addition. Only requires one owner to call this. // @param _address - the address of the owner to be added. function vetoOwnership(address _address) public isOwner(msg.sender) isNotMe(_address) { delete ownershipAdditions[_address]; } // @dev Cancels a withdrawal. Only requires one owner to call this. // @param _tokenContract - the contract of the erc20 token to withdraw (or, use the zero address for ETH) // @param _amount - the amount to withdraw. Amount must match the approved withdrawal amount. function vetoWithdrawal(address _tokenContract, address _requestor) public isOwner(msg.sender) { delete withdrawalRequests[_tokenContract][_requestor]; delete withdrawalApprovals[_tokenContract][_requestor]; } // @dev allows any owner to deposit any ERC20 token in this contract. // @dev Once the ERC20 token is deposited, it can only be withdrawn if enough accounts allow it. // @param _tokenContract - the contract of the erc20 token to deposit // @param _amount - the amount to deposit. // @notice For this function to work, you have to already have set an allowance for the transfer // @notice You CANNOT deposit Ether using this function. Use depositEth() instead. function depositERC20(address _tokenContract, uint _amount) public isOwner(msg.sender) { ERC20Interface erc20 = ERC20Interface(_tokenContract); emit Deposit(_tokenContract, msg.sender, _amount); erc20.transferFrom(msg.sender, address(this), _amount); } // @dev allows any owner to deposit Ether in this contract. // @dev Once ether is deposited, it can only be withdrawn if enough accounts allow it. function depositEth() public payable isOwner(msg.sender) { emit Deposit(address(0), msg.sender, msg.value); } // @dev Requests a withdrawal, changes a withdrawal request, or approves an existing withdrawal request. // To request or change, set _recipient to msg.sender. Changes wipe all approvals. // To approve, set _recipient to the previously requested account, and send from another owner account // @param _tokenContract - the contract of the erc20 token to withdraw (or, use the zero address for ETH) // @param _recipient - the account which will receive the withdrawal. // @param _amount - the amount to withdraw. Amount must match the approved withdrawal amount. function approveWithdrawal(address _tokenContract, address _recipient, uint _amount) public isOwner(msg.sender) { ERC20Interface erc20 = ERC20Interface(_tokenContract); // If Withdrawer == msg.sender, this is a new request. Cancel all previous approvals. require(_amount > 0, "can't withdraw zero"); if (_recipient == msg.sender) { if(_tokenContract == address(0)) { require(_amount <= address(this).balance, "can't withdraw more ETH than the balance"); } else { require(_amount <= erc20.balanceOf(address(this)), "can't withdraw more erc20 tokens than balance"); } delete withdrawalApprovals[_tokenContract][_recipient]; withdrawalRequests[_tokenContract][_recipient] = _amount; withdrawalApprovals[_tokenContract][_recipient].push(msg.sender); emit WithdrawalRequest(_tokenContract, _recipient, _amount); } else { require( withdrawalApprovals[_tokenContract][_recipient].length >= 1, "you can't initiate a withdrawal request for another user"); require( withdrawalRequests[_tokenContract][_recipient] == _amount, "approval amount must exactly match withdrawal request"); for(uint i = 0; i < withdrawalApprovals[_tokenContract][_recipient].length; i++) { require( withdrawalApprovals[_tokenContract][_recipient][i] != msg.sender, "sender has not already approved this withdrawal"); } withdrawalApprovals[_tokenContract][_recipient].push(msg.sender); } emit WithdrawalApproval(_tokenContract, msg.sender, _recipient, _amount); } // @dev Completes an approved withdrawal, transferring the erc20 tokens or Ether to the withdrawing account // @param _tokenContract - the contract of the erc20 token to withdraw (or, use the zero address for ETH) // @param _amount - the amount to withdraw. Amount must match the approved withdrawal amount. function completeWithdrawal(address _tokenContract, uint _amount) external isOwner(msg.sender) { require( withdrawalApprovals[_tokenContract][msg.sender].length >= getMinimumApprovals(), "insufficient approvals to complete this withdrawal"); require(withdrawalRequests[_tokenContract][msg.sender] == _amount, "incorrect withdrawal amount specified"); delete withdrawalRequests[_tokenContract][msg.sender]; delete withdrawalApprovals[_tokenContract][msg.sender]; emit Withdrawal(_tokenContract, msg.sender, _amount); if(_tokenContract == address(0)) { require(_amount <= address(this).balance, "can't withdraw more ETH than the balance"); msg.sender.transfer(_amount); } else { ERC20Interface erc20 = ERC20Interface(_tokenContract); require(_amount <= erc20.balanceOf(address(this)), "can't withdraw more erc20 tokens than balance"); erc20.transfer(msg.sender, _amount); } } }
// @title Multisig ERC20 and Ether contract // @dev Allows multisig management of Ether and ERC20 funds, requiring 50% of owners (rounded up) // to approve any withdrawal or change in ownership // @author Nova Token (https://www.novatoken.io) // (c) 2019 Nova Token Ltd. All Rights Reserved. This code is not open source.
LineComment
depositEth
function depositEth() public payable isOwner(msg.sender) { emit Deposit(address(0), msg.sender, msg.value); }
// @dev allows any owner to deposit Ether in this contract. // @dev Once ether is deposited, it can only be withdrawn if enough accounts allow it.
LineComment
v0.5.8+commit.23d335f2
None
bzzr://8c34ed56fc39d3079b9814f9727ffc764eb200c96ba8c10252eae5c7bc9e2c28
{ "func_code_index": [ 7454, 7592 ] }
57,681
Multisig
Multisig.sol
0xa313392fc17c1d1db87b35cdccb930bbf1b08b72
Solidity
Multisig
contract Multisig { address[] public owners; mapping (address => mapping(address => uint)) withdrawalRequests; mapping (address => mapping(address => address[])) withdrawalApprovals; mapping (address => address[]) ownershipAdditions; mapping (address => address[]) ownershipRemovals; event ApproveNewOwner(address indexed approver, address indexed subject); event ApproveRemovalOfOwner(address indexed approver, address indexed subject); event OwnershipChange(address indexed owner, bool indexed isAddition, bool indexed isRemoved); event Deposit(address indexed tokenContract, address indexed sender, uint amount); event Withdrawal(address indexed tokenContract, address indexed recipient, uint amount); event WithdrawalRequest(address indexed tokenContract, address indexed recipient, uint amount); event WithdrawalApproval(address indexed tokenContract, address indexed approver, address indexed recipient, uint amount); function getOwners() public view returns(address[] memory) { return owners; } function getOwnershipAdditions(address _account) public view returns(address[] memory) { return ownershipAdditions[_account]; } function getOwnershipRemovals(address _account) public view returns(address[] memory) { return ownershipRemovals[_account]; } function getWithdrawalApprovals(address _erc20, address _account) public view returns(uint amount, address[] memory approvals) { amount = withdrawalRequests[_erc20][_account]; approvals = withdrawalApprovals[_erc20][_account]; } function getMinimumApprovals() public view returns(uint approvalCount) { approvalCount = (owners.length + 1) / 2; } modifier isOwner(address _test) { require(_isOwner(_test) == true, "address must be an owner"); _; } modifier isNotOwner(address _test) { require(_isOwner(_test) == false, "address must NOT be an owner"); _; } modifier isNotMe(address _test) { require(msg.sender != _test, "test must not be sender"); _; } constructor(address _owner2, address _owner3) public { require(msg.sender != _owner2, "owner 1 and 2 can't be the same"); require(msg.sender != _owner3, "owner 1 and 3 can't be the same"); require(_owner2 != _owner3, "owner 2 and 3 can't be the same"); require(_owner2 != address(0), "owner 2 can't be the zero address"); require(_owner3 != address(0), "owner 2 can't be the zero address"); owners.push(msg.sender); owners.push(_owner2); owners.push(_owner3); } function _isOwner(address _test) internal view returns(bool) { for(uint i = 0; i < owners.length; i++) { if(_test == owners[i]) { return true; } } return false; } // @dev Requests, or approves an ownership addition. The new owner is NOT automatically added. // @param _address - the address of the owner to add. function approveOwner(address _address) public isOwner(msg.sender) isNotOwner(_address) isNotMe(_address) { require(owners.length < 10, "no more than 10 owners"); for(uint i = 0; i < ownershipAdditions[_address].length; i++) { require(ownershipAdditions[_address][i] != msg.sender, "sender has not already approved this removal"); } ownershipAdditions[_address].push(msg.sender); emit ApproveNewOwner(msg.sender, _address); } // @dev After being approved for ownership, the new owner must call this function to become an owner. function acceptOwnership() external isNotOwner(msg.sender) { require( ownershipAdditions[msg.sender].length >= getMinimumApprovals(), "sender doesn't have enough ownership approvals"); owners.push(msg.sender); delete ownershipAdditions[msg.sender]; emit OwnershipChange(msg.sender, true, false); } // @dev Requests, or approves a ownership removal. Once enough approvals are given, the owner is // automatically removed. // @param _address - the address of the owner to be removed. function removeOwner(address _address) public isOwner(msg.sender) isOwner(_address) isNotMe(_address) { require(owners.length > 3, "can't remove below 3 owners - add a new owner first"); uint i; for(i = 0; i < ownershipRemovals[_address].length; i++) { require(ownershipRemovals[_address][i] != msg.sender, "sender must not have already approved this removal"); } emit ApproveRemovalOfOwner(msg.sender, _address); ownershipRemovals[_address].push(msg.sender); // owners.length / 2 is the number of approvals required AFTER this account is removed. // This guarantees there are still enough active approvers left. if(ownershipRemovals[_address].length >= getMinimumApprovals()) { for(i = 0; i < owners.length; i++) { if(owners[i] == _address) { uint lastSlot = owners.length - 1; owners[i] = owners[lastSlot]; owners[lastSlot] = address(0); owners.length = lastSlot; break; } } delete ownershipRemovals[_address]; emit OwnershipChange(_address, false, true); } } // @dev Cancels a ownership removal. Only requires one owner to call this, // but the subject of the removal cannot call it themselves. // @param _address - the address of the owner to be removed. function vetoRemoval(address _address) public isOwner(msg.sender) isOwner(_address) isNotMe(_address) { delete ownershipRemovals[_address]; } // @dev Cancels a ownership addition. Only requires one owner to call this. // @param _address - the address of the owner to be added. function vetoOwnership(address _address) public isOwner(msg.sender) isNotMe(_address) { delete ownershipAdditions[_address]; } // @dev Cancels a withdrawal. Only requires one owner to call this. // @param _tokenContract - the contract of the erc20 token to withdraw (or, use the zero address for ETH) // @param _amount - the amount to withdraw. Amount must match the approved withdrawal amount. function vetoWithdrawal(address _tokenContract, address _requestor) public isOwner(msg.sender) { delete withdrawalRequests[_tokenContract][_requestor]; delete withdrawalApprovals[_tokenContract][_requestor]; } // @dev allows any owner to deposit any ERC20 token in this contract. // @dev Once the ERC20 token is deposited, it can only be withdrawn if enough accounts allow it. // @param _tokenContract - the contract of the erc20 token to deposit // @param _amount - the amount to deposit. // @notice For this function to work, you have to already have set an allowance for the transfer // @notice You CANNOT deposit Ether using this function. Use depositEth() instead. function depositERC20(address _tokenContract, uint _amount) public isOwner(msg.sender) { ERC20Interface erc20 = ERC20Interface(_tokenContract); emit Deposit(_tokenContract, msg.sender, _amount); erc20.transferFrom(msg.sender, address(this), _amount); } // @dev allows any owner to deposit Ether in this contract. // @dev Once ether is deposited, it can only be withdrawn if enough accounts allow it. function depositEth() public payable isOwner(msg.sender) { emit Deposit(address(0), msg.sender, msg.value); } // @dev Requests a withdrawal, changes a withdrawal request, or approves an existing withdrawal request. // To request or change, set _recipient to msg.sender. Changes wipe all approvals. // To approve, set _recipient to the previously requested account, and send from another owner account // @param _tokenContract - the contract of the erc20 token to withdraw (or, use the zero address for ETH) // @param _recipient - the account which will receive the withdrawal. // @param _amount - the amount to withdraw. Amount must match the approved withdrawal amount. function approveWithdrawal(address _tokenContract, address _recipient, uint _amount) public isOwner(msg.sender) { ERC20Interface erc20 = ERC20Interface(_tokenContract); // If Withdrawer == msg.sender, this is a new request. Cancel all previous approvals. require(_amount > 0, "can't withdraw zero"); if (_recipient == msg.sender) { if(_tokenContract == address(0)) { require(_amount <= address(this).balance, "can't withdraw more ETH than the balance"); } else { require(_amount <= erc20.balanceOf(address(this)), "can't withdraw more erc20 tokens than balance"); } delete withdrawalApprovals[_tokenContract][_recipient]; withdrawalRequests[_tokenContract][_recipient] = _amount; withdrawalApprovals[_tokenContract][_recipient].push(msg.sender); emit WithdrawalRequest(_tokenContract, _recipient, _amount); } else { require( withdrawalApprovals[_tokenContract][_recipient].length >= 1, "you can't initiate a withdrawal request for another user"); require( withdrawalRequests[_tokenContract][_recipient] == _amount, "approval amount must exactly match withdrawal request"); for(uint i = 0; i < withdrawalApprovals[_tokenContract][_recipient].length; i++) { require( withdrawalApprovals[_tokenContract][_recipient][i] != msg.sender, "sender has not already approved this withdrawal"); } withdrawalApprovals[_tokenContract][_recipient].push(msg.sender); } emit WithdrawalApproval(_tokenContract, msg.sender, _recipient, _amount); } // @dev Completes an approved withdrawal, transferring the erc20 tokens or Ether to the withdrawing account // @param _tokenContract - the contract of the erc20 token to withdraw (or, use the zero address for ETH) // @param _amount - the amount to withdraw. Amount must match the approved withdrawal amount. function completeWithdrawal(address _tokenContract, uint _amount) external isOwner(msg.sender) { require( withdrawalApprovals[_tokenContract][msg.sender].length >= getMinimumApprovals(), "insufficient approvals to complete this withdrawal"); require(withdrawalRequests[_tokenContract][msg.sender] == _amount, "incorrect withdrawal amount specified"); delete withdrawalRequests[_tokenContract][msg.sender]; delete withdrawalApprovals[_tokenContract][msg.sender]; emit Withdrawal(_tokenContract, msg.sender, _amount); if(_tokenContract == address(0)) { require(_amount <= address(this).balance, "can't withdraw more ETH than the balance"); msg.sender.transfer(_amount); } else { ERC20Interface erc20 = ERC20Interface(_tokenContract); require(_amount <= erc20.balanceOf(address(this)), "can't withdraw more erc20 tokens than balance"); erc20.transfer(msg.sender, _amount); } } }
// @title Multisig ERC20 and Ether contract // @dev Allows multisig management of Ether and ERC20 funds, requiring 50% of owners (rounded up) // to approve any withdrawal or change in ownership // @author Nova Token (https://www.novatoken.io) // (c) 2019 Nova Token Ltd. All Rights Reserved. This code is not open source.
LineComment
approveWithdrawal
function approveWithdrawal(address _tokenContract, address _recipient, uint _amount) public isOwner(msg.sender) { ERC20Interface erc20 = ERC20Interface(_tokenContract); // If Withdrawer == msg.sender, this is a new request. Cancel all previous approvals. require(_amount > 0, "can't withdraw zero"); if (_recipient == msg.sender) { if(_tokenContract == address(0)) { require(_amount <= address(this).balance, "can't withdraw more ETH than the balance"); } else { require(_amount <= erc20.balanceOf(address(this)), "can't withdraw more erc20 tokens than balance"); } delete withdrawalApprovals[_tokenContract][_recipient]; withdrawalRequests[_tokenContract][_recipient] = _amount; withdrawalApprovals[_tokenContract][_recipient].push(msg.sender); emit WithdrawalRequest(_tokenContract, _recipient, _amount); } else { require( withdrawalApprovals[_tokenContract][_recipient].length >= 1, "you can't initiate a withdrawal request for another user"); require( withdrawalRequests[_tokenContract][_recipient] == _amount, "approval amount must exactly match withdrawal request"); for(uint i = 0; i < withdrawalApprovals[_tokenContract][_recipient].length; i++) { require( withdrawalApprovals[_tokenContract][_recipient][i] != msg.sender, "sender has not already approved this withdrawal"); } withdrawalApprovals[_tokenContract][_recipient].push(msg.sender); } emit WithdrawalApproval(_tokenContract, msg.sender, _recipient, _amount); }
// @dev Requests a withdrawal, changes a withdrawal request, or approves an existing withdrawal request. // To request or change, set _recipient to msg.sender. Changes wipe all approvals. // To approve, set _recipient to the previously requested account, and send from another owner account // @param _tokenContract - the contract of the erc20 token to withdraw (or, use the zero address for ETH) // @param _recipient - the account which will receive the withdrawal. // @param _amount - the amount to withdraw. Amount must match the approved withdrawal amount.
LineComment
v0.5.8+commit.23d335f2
None
bzzr://8c34ed56fc39d3079b9814f9727ffc764eb200c96ba8c10252eae5c7bc9e2c28
{ "func_code_index": [ 8176, 9827 ] }
57,682
Multisig
Multisig.sol
0xa313392fc17c1d1db87b35cdccb930bbf1b08b72
Solidity
Multisig
contract Multisig { address[] public owners; mapping (address => mapping(address => uint)) withdrawalRequests; mapping (address => mapping(address => address[])) withdrawalApprovals; mapping (address => address[]) ownershipAdditions; mapping (address => address[]) ownershipRemovals; event ApproveNewOwner(address indexed approver, address indexed subject); event ApproveRemovalOfOwner(address indexed approver, address indexed subject); event OwnershipChange(address indexed owner, bool indexed isAddition, bool indexed isRemoved); event Deposit(address indexed tokenContract, address indexed sender, uint amount); event Withdrawal(address indexed tokenContract, address indexed recipient, uint amount); event WithdrawalRequest(address indexed tokenContract, address indexed recipient, uint amount); event WithdrawalApproval(address indexed tokenContract, address indexed approver, address indexed recipient, uint amount); function getOwners() public view returns(address[] memory) { return owners; } function getOwnershipAdditions(address _account) public view returns(address[] memory) { return ownershipAdditions[_account]; } function getOwnershipRemovals(address _account) public view returns(address[] memory) { return ownershipRemovals[_account]; } function getWithdrawalApprovals(address _erc20, address _account) public view returns(uint amount, address[] memory approvals) { amount = withdrawalRequests[_erc20][_account]; approvals = withdrawalApprovals[_erc20][_account]; } function getMinimumApprovals() public view returns(uint approvalCount) { approvalCount = (owners.length + 1) / 2; } modifier isOwner(address _test) { require(_isOwner(_test) == true, "address must be an owner"); _; } modifier isNotOwner(address _test) { require(_isOwner(_test) == false, "address must NOT be an owner"); _; } modifier isNotMe(address _test) { require(msg.sender != _test, "test must not be sender"); _; } constructor(address _owner2, address _owner3) public { require(msg.sender != _owner2, "owner 1 and 2 can't be the same"); require(msg.sender != _owner3, "owner 1 and 3 can't be the same"); require(_owner2 != _owner3, "owner 2 and 3 can't be the same"); require(_owner2 != address(0), "owner 2 can't be the zero address"); require(_owner3 != address(0), "owner 2 can't be the zero address"); owners.push(msg.sender); owners.push(_owner2); owners.push(_owner3); } function _isOwner(address _test) internal view returns(bool) { for(uint i = 0; i < owners.length; i++) { if(_test == owners[i]) { return true; } } return false; } // @dev Requests, or approves an ownership addition. The new owner is NOT automatically added. // @param _address - the address of the owner to add. function approveOwner(address _address) public isOwner(msg.sender) isNotOwner(_address) isNotMe(_address) { require(owners.length < 10, "no more than 10 owners"); for(uint i = 0; i < ownershipAdditions[_address].length; i++) { require(ownershipAdditions[_address][i] != msg.sender, "sender has not already approved this removal"); } ownershipAdditions[_address].push(msg.sender); emit ApproveNewOwner(msg.sender, _address); } // @dev After being approved for ownership, the new owner must call this function to become an owner. function acceptOwnership() external isNotOwner(msg.sender) { require( ownershipAdditions[msg.sender].length >= getMinimumApprovals(), "sender doesn't have enough ownership approvals"); owners.push(msg.sender); delete ownershipAdditions[msg.sender]; emit OwnershipChange(msg.sender, true, false); } // @dev Requests, or approves a ownership removal. Once enough approvals are given, the owner is // automatically removed. // @param _address - the address of the owner to be removed. function removeOwner(address _address) public isOwner(msg.sender) isOwner(_address) isNotMe(_address) { require(owners.length > 3, "can't remove below 3 owners - add a new owner first"); uint i; for(i = 0; i < ownershipRemovals[_address].length; i++) { require(ownershipRemovals[_address][i] != msg.sender, "sender must not have already approved this removal"); } emit ApproveRemovalOfOwner(msg.sender, _address); ownershipRemovals[_address].push(msg.sender); // owners.length / 2 is the number of approvals required AFTER this account is removed. // This guarantees there are still enough active approvers left. if(ownershipRemovals[_address].length >= getMinimumApprovals()) { for(i = 0; i < owners.length; i++) { if(owners[i] == _address) { uint lastSlot = owners.length - 1; owners[i] = owners[lastSlot]; owners[lastSlot] = address(0); owners.length = lastSlot; break; } } delete ownershipRemovals[_address]; emit OwnershipChange(_address, false, true); } } // @dev Cancels a ownership removal. Only requires one owner to call this, // but the subject of the removal cannot call it themselves. // @param _address - the address of the owner to be removed. function vetoRemoval(address _address) public isOwner(msg.sender) isOwner(_address) isNotMe(_address) { delete ownershipRemovals[_address]; } // @dev Cancels a ownership addition. Only requires one owner to call this. // @param _address - the address of the owner to be added. function vetoOwnership(address _address) public isOwner(msg.sender) isNotMe(_address) { delete ownershipAdditions[_address]; } // @dev Cancels a withdrawal. Only requires one owner to call this. // @param _tokenContract - the contract of the erc20 token to withdraw (or, use the zero address for ETH) // @param _amount - the amount to withdraw. Amount must match the approved withdrawal amount. function vetoWithdrawal(address _tokenContract, address _requestor) public isOwner(msg.sender) { delete withdrawalRequests[_tokenContract][_requestor]; delete withdrawalApprovals[_tokenContract][_requestor]; } // @dev allows any owner to deposit any ERC20 token in this contract. // @dev Once the ERC20 token is deposited, it can only be withdrawn if enough accounts allow it. // @param _tokenContract - the contract of the erc20 token to deposit // @param _amount - the amount to deposit. // @notice For this function to work, you have to already have set an allowance for the transfer // @notice You CANNOT deposit Ether using this function. Use depositEth() instead. function depositERC20(address _tokenContract, uint _amount) public isOwner(msg.sender) { ERC20Interface erc20 = ERC20Interface(_tokenContract); emit Deposit(_tokenContract, msg.sender, _amount); erc20.transferFrom(msg.sender, address(this), _amount); } // @dev allows any owner to deposit Ether in this contract. // @dev Once ether is deposited, it can only be withdrawn if enough accounts allow it. function depositEth() public payable isOwner(msg.sender) { emit Deposit(address(0), msg.sender, msg.value); } // @dev Requests a withdrawal, changes a withdrawal request, or approves an existing withdrawal request. // To request or change, set _recipient to msg.sender. Changes wipe all approvals. // To approve, set _recipient to the previously requested account, and send from another owner account // @param _tokenContract - the contract of the erc20 token to withdraw (or, use the zero address for ETH) // @param _recipient - the account which will receive the withdrawal. // @param _amount - the amount to withdraw. Amount must match the approved withdrawal amount. function approveWithdrawal(address _tokenContract, address _recipient, uint _amount) public isOwner(msg.sender) { ERC20Interface erc20 = ERC20Interface(_tokenContract); // If Withdrawer == msg.sender, this is a new request. Cancel all previous approvals. require(_amount > 0, "can't withdraw zero"); if (_recipient == msg.sender) { if(_tokenContract == address(0)) { require(_amount <= address(this).balance, "can't withdraw more ETH than the balance"); } else { require(_amount <= erc20.balanceOf(address(this)), "can't withdraw more erc20 tokens than balance"); } delete withdrawalApprovals[_tokenContract][_recipient]; withdrawalRequests[_tokenContract][_recipient] = _amount; withdrawalApprovals[_tokenContract][_recipient].push(msg.sender); emit WithdrawalRequest(_tokenContract, _recipient, _amount); } else { require( withdrawalApprovals[_tokenContract][_recipient].length >= 1, "you can't initiate a withdrawal request for another user"); require( withdrawalRequests[_tokenContract][_recipient] == _amount, "approval amount must exactly match withdrawal request"); for(uint i = 0; i < withdrawalApprovals[_tokenContract][_recipient].length; i++) { require( withdrawalApprovals[_tokenContract][_recipient][i] != msg.sender, "sender has not already approved this withdrawal"); } withdrawalApprovals[_tokenContract][_recipient].push(msg.sender); } emit WithdrawalApproval(_tokenContract, msg.sender, _recipient, _amount); } // @dev Completes an approved withdrawal, transferring the erc20 tokens or Ether to the withdrawing account // @param _tokenContract - the contract of the erc20 token to withdraw (or, use the zero address for ETH) // @param _amount - the amount to withdraw. Amount must match the approved withdrawal amount. function completeWithdrawal(address _tokenContract, uint _amount) external isOwner(msg.sender) { require( withdrawalApprovals[_tokenContract][msg.sender].length >= getMinimumApprovals(), "insufficient approvals to complete this withdrawal"); require(withdrawalRequests[_tokenContract][msg.sender] == _amount, "incorrect withdrawal amount specified"); delete withdrawalRequests[_tokenContract][msg.sender]; delete withdrawalApprovals[_tokenContract][msg.sender]; emit Withdrawal(_tokenContract, msg.sender, _amount); if(_tokenContract == address(0)) { require(_amount <= address(this).balance, "can't withdraw more ETH than the balance"); msg.sender.transfer(_amount); } else { ERC20Interface erc20 = ERC20Interface(_tokenContract); require(_amount <= erc20.balanceOf(address(this)), "can't withdraw more erc20 tokens than balance"); erc20.transfer(msg.sender, _amount); } } }
// @title Multisig ERC20 and Ether contract // @dev Allows multisig management of Ether and ERC20 funds, requiring 50% of owners (rounded up) // to approve any withdrawal or change in ownership // @author Nova Token (https://www.novatoken.io) // (c) 2019 Nova Token Ltd. All Rights Reserved. This code is not open source.
LineComment
completeWithdrawal
function completeWithdrawal(address _tokenContract, uint _amount) external isOwner(msg.sender) { require( withdrawalApprovals[_tokenContract][msg.sender].length >= getMinimumApprovals(), "insufficient approvals to complete this withdrawal"); require(withdrawalRequests[_tokenContract][msg.sender] == _amount, "incorrect withdrawal amount specified"); delete withdrawalRequests[_tokenContract][msg.sender]; delete withdrawalApprovals[_tokenContract][msg.sender]; emit Withdrawal(_tokenContract, msg.sender, _amount); if(_tokenContract == address(0)) { require(_amount <= address(this).balance, "can't withdraw more ETH than the balance"); msg.sender.transfer(_amount); } else { ERC20Interface erc20 = ERC20Interface(_tokenContract); require(_amount <= erc20.balanceOf(address(this)), "can't withdraw more erc20 tokens than balance"); erc20.transfer(msg.sender, _amount); } }
// @dev Completes an approved withdrawal, transferring the erc20 tokens or Ether to the withdrawing account // @param _tokenContract - the contract of the erc20 token to withdraw (or, use the zero address for ETH) // @param _amount - the amount to withdraw. Amount must match the approved withdrawal amount.
LineComment
v0.5.8+commit.23d335f2
None
bzzr://8c34ed56fc39d3079b9814f9727ffc764eb200c96ba8c10252eae5c7bc9e2c28
{ "func_code_index": [ 10147, 11128 ] }
57,683
TorroDao
ITorroDao.sol
0x3cf9e9d45380b6ab61bde46b2e6cfcd7d8f6cdc1
Solidity
ITorroDao
interface ITorroDao { // Enums. /// @notice Enum of available proposal functions. enum DaoFunction { BUY, SELL, ADD_LIQUIDITY, REMOVE_LIQUIDITY, ADD_ADMIN, REMOVE_ADMIN, INVEST, WITHDRAW } // Initializer. /// @notice Initializer for DAO clones. /// @param torroToken_ main torro token address. /// @param governingToken_ torro token clone that's governing this dao. /// @param factory_ torro factory address. /// @param creator_ creator of cloned DAO. /// @param maxCost_ maximum cost of all governing tokens for cloned DAO. /// @param executeMinPct_ minimum percentage of votes needed for proposal execution. /// @param votingMinHours_ minimum lifetime of proposal before it closes. /// @param isPublic_ whether cloned DAO has public visibility. /// @param hasAdmins_ whether cloned DAO has admins, otherwise all stakers are treated as admins. function initializeCustom( address torroToken_, address governingToken_, address factory_, address creator_, uint256 maxCost_, uint256 executeMinPct_, uint256 votingMinHours_, bool isPublic_, bool hasAdmins_ ) external; // Public calls. /// @notice Address of DAO creator. /// @return DAO creator address. function daoCreator() external view returns (address); /// @notice Amount of tokens needed for a single vote. /// @return uint256 token amount. function voteWeight() external view returns (uint256); /// @notice Amount of votes that holder has. /// @param sender_ address of the holder. /// @return number of votes. function votesOf(address sender_) external view returns (uint256); /// @notice Address of the governing token. /// @return address of the governing token. function tokenAddress() external view returns (address); /// @notice Saved addresses of tokens that DAO is holding. /// @return array of holdings addresses. function holdings() external view returns (address[] memory); /// @notice Saved addresses of liquidity tokens that DAO is holding. /// @return array of liquidity addresses. function liquidities() external view returns (address[] memory); /// @notice Calculates address of liquidity token from ERC-20 token address. /// @param token_ token address to calculate liquidity address from. /// @return address of liquidity token. function liquidityToken(address token_) external view returns (address); /// @notice Gets tokens and liquidity token addresses of DAO's liquidity holdings. /// @return Arrays of tokens and liquidity tokens, should have the same length. function liquidityHoldings() external view returns (address[] memory, address[] memory); /// @notice DAO admins. /// @return Array of admin addresses. function admins() external view returns (address[] memory); /// @notice DAO balance for specified token. /// @param token_ token address to get balance for. /// @return uint256 token balance. function tokenBalance(address token_) external view returns (uint256); /// @notice DAO balance for liquidity token. /// @param token_ token address to get liquidity balance for. /// @return uin256 token liquidity balance. function liquidityBalance(address token_) external view returns (uint256); /// @notice DAO ethereum balance. /// @return uint256 wei balance. function availableBalance() external view returns (uint256); /// @notice Maximum cost for all tokens of cloned DAO. /// @return uint256 maximum cost in wei. function maxCost() external view returns (uint256); /// @notice Minimum percentage of votes needed to execute a proposal. /// @return uint256 minimum percentage of votes. function executeMinPct() external view returns (uint256); /// @notice Minimum lifetime of proposal before it closes. /// @return uint256 minimum number of hours for proposal lifetime. function votingMinHours() external view returns (uint256); /// @notice Whether DAO is public or private. /// @return bool true if public. function isPublic() external view returns (bool); /// @notice Whether DAO has admins. /// @return bool true if DAO has admins. function hasAdmins() external view returns (bool); /// @notice Proposal ids of DAO. /// @return array of proposal ids. function getProposalIds() external view returns (uint256[] memory); /// @notice Gets proposal info for proposal id. /// @param id_ id of proposal to get info for. /// @return proposalAddress address for proposal execution. /// @return investTokenAddress secondary address for proposal execution, used for investment proposals if ICO and token addresses differ. /// @return daoFunction proposal type. /// @return amount proposal amount eth/token to use during execution. /// @return creator address of proposal creator. /// @return endLifetime epoch time when proposal voting ends. /// @return votesFor amount of votes for the proposal. /// @return votesAgainst amount of votes against the proposal. /// @return executed whether proposal has been executed or not. function getProposal(uint256 id_) external view returns ( address proposalAddress, address investTokenAddress, DaoFunction daoFunction, uint256 amount, address creator, uint256 endLifetime, uint256 votesFor, uint256 votesAgainst, bool executed ); /// @notice Whether a holder is allowed to vote for a proposal. /// @param id_ proposal id to check whether holder is allowed to vote for. /// @param sender_ address of the holder. /// @return bool true if voting is allowed. function canVote(uint256 id_, address sender_) external view returns (bool); /// @notice Whether a holder is allowed to remove a proposal. /// @param id_ proposal id to check whether holder is allowed to remove. /// @param sender_ address of the holder. /// @return bool true if removal is allowed. function canRemove(uint256 id_, address sender_) external view returns (bool); /// @notice Whether a holder is allowed to execute a proposal. /// @param id_ proposal id to check whether holder is allowed to execute. /// @param sender_ address of the holder. /// @return bool true if execution is allowed. function canExecute(uint256 id_, address sender_) external view returns (bool); /// @notice Whether a holder is an admin. /// @param sender_ address of holder. /// @return bool true if holder is an admin (in DAO without admins all holders are treated as such). function isAdmin(address sender_) external view returns (bool); // Public transactions. /// @notice Saves new holdings addresses for DAO. /// @param tokens_ token addresses that DAO has holdings of. function addHoldingsAddresses(address[] calldata tokens_) external; /// @notice Saves new liquidity addresses for DAO. /// @param tokens_ token addresses that DAO has liquidities of. function addLiquidityAddresses(address[] calldata tokens_) external; /// @notice Creates new proposal. /// @param proposalAddress_ main address of the proposal, in investment proposals this is the address funds are sent to. /// @param investTokenAddress_ secondary address of the proposal, used in investment proposals to specify token address. /// @param daoFunction_ type of the proposal. /// @param amount_ amount of funds to use in the proposal. /// @param hoursLifetime_ voting lifetime of the proposal. function propose(address proposalAddress_, address investTokenAddress_, DaoFunction daoFunction_, uint256 amount_, uint256 hoursLifetime_) external; /// @notice Removes existing proposal. /// @param id_ id of proposal to remove. function unpropose(uint256 id_) external; /// @notice Voting for multiple proposals. /// @param ids_ ids of proposals to vote for. /// @param votes_ for or against votes for proposals. function vote(uint256[] calldata ids_, bool[] calldata votes_) external; /// @notice Executes a proposal. /// @param id_ id of proposal to be executed. function execute(uint256 id_) external; /// @notice Buying tokens for cloned DAO. function buy() external payable; /// @notice Sell tokens back to cloned DAO. /// @param amount_ amount of tokens to sell. function sell(uint256 amount_) external; // Owner transactions. /// @notice Sets factory address. /// @param factory_ address of TorroFactory. function setFactoryAddress(address factory_) external; /// @notice Sets vote weight divider. /// @param weight_ weight divider for a single vote. function setVoteWeightDivider(uint256 weight_) external; /// @notice Sets new address for router. /// @param router_ address for router. function setRouter(address router_) external; /// @notice Sets divider for BUY, INVEST, WITHDAW proposals. /// @param divider_ divider for BUY, INVEST, WITHDRAW proposals. function setSpendDivider(uint256 divider_) external; /// @notice Migrates balances of current DAO to a new DAO. /// @param newDao_ address of the new DAO to migrate to. function migrate(address newDao_) external; }
/// @title DAO for proposals, voting and execution. /// @notice Interface for creation, voting and execution of proposals. /// @author ORayskiy - @robitnik_TorroDao
NatSpecSingleLine
initializeCustom
function initializeCustom( address torroToken_, address governingToken_, address factory_, address creator_, uint256 maxCost_, uint256 executeMinPct_, uint256 votingMinHours_, bool isPublic_, bool hasAdmins_ ) external;
/// @notice Initializer for DAO clones. /// @param torroToken_ main torro token address. /// @param governingToken_ torro token clone that's governing this dao. /// @param factory_ torro factory address. /// @param creator_ creator of cloned DAO. /// @param maxCost_ maximum cost of all governing tokens for cloned DAO. /// @param executeMinPct_ minimum percentage of votes needed for proposal execution. /// @param votingMinHours_ minimum lifetime of proposal before it closes. /// @param isPublic_ whether cloned DAO has public visibility. /// @param hasAdmins_ whether cloned DAO has admins, otherwise all stakers are treated as admins.
NatSpecSingleLine
v0.6.6+commit.6c089d02
Unknown
ipfs://d1c6095fcf143d951c9754f00fe8cd59d29ab460461efe53b91eb289fd0fe5ac
{ "func_code_index": [ 898, 1168 ] }
57,684
TorroDao
ITorroDao.sol
0x3cf9e9d45380b6ab61bde46b2e6cfcd7d8f6cdc1
Solidity
ITorroDao
interface ITorroDao { // Enums. /// @notice Enum of available proposal functions. enum DaoFunction { BUY, SELL, ADD_LIQUIDITY, REMOVE_LIQUIDITY, ADD_ADMIN, REMOVE_ADMIN, INVEST, WITHDRAW } // Initializer. /// @notice Initializer for DAO clones. /// @param torroToken_ main torro token address. /// @param governingToken_ torro token clone that's governing this dao. /// @param factory_ torro factory address. /// @param creator_ creator of cloned DAO. /// @param maxCost_ maximum cost of all governing tokens for cloned DAO. /// @param executeMinPct_ minimum percentage of votes needed for proposal execution. /// @param votingMinHours_ minimum lifetime of proposal before it closes. /// @param isPublic_ whether cloned DAO has public visibility. /// @param hasAdmins_ whether cloned DAO has admins, otherwise all stakers are treated as admins. function initializeCustom( address torroToken_, address governingToken_, address factory_, address creator_, uint256 maxCost_, uint256 executeMinPct_, uint256 votingMinHours_, bool isPublic_, bool hasAdmins_ ) external; // Public calls. /// @notice Address of DAO creator. /// @return DAO creator address. function daoCreator() external view returns (address); /// @notice Amount of tokens needed for a single vote. /// @return uint256 token amount. function voteWeight() external view returns (uint256); /// @notice Amount of votes that holder has. /// @param sender_ address of the holder. /// @return number of votes. function votesOf(address sender_) external view returns (uint256); /// @notice Address of the governing token. /// @return address of the governing token. function tokenAddress() external view returns (address); /// @notice Saved addresses of tokens that DAO is holding. /// @return array of holdings addresses. function holdings() external view returns (address[] memory); /// @notice Saved addresses of liquidity tokens that DAO is holding. /// @return array of liquidity addresses. function liquidities() external view returns (address[] memory); /// @notice Calculates address of liquidity token from ERC-20 token address. /// @param token_ token address to calculate liquidity address from. /// @return address of liquidity token. function liquidityToken(address token_) external view returns (address); /// @notice Gets tokens and liquidity token addresses of DAO's liquidity holdings. /// @return Arrays of tokens and liquidity tokens, should have the same length. function liquidityHoldings() external view returns (address[] memory, address[] memory); /// @notice DAO admins. /// @return Array of admin addresses. function admins() external view returns (address[] memory); /// @notice DAO balance for specified token. /// @param token_ token address to get balance for. /// @return uint256 token balance. function tokenBalance(address token_) external view returns (uint256); /// @notice DAO balance for liquidity token. /// @param token_ token address to get liquidity balance for. /// @return uin256 token liquidity balance. function liquidityBalance(address token_) external view returns (uint256); /// @notice DAO ethereum balance. /// @return uint256 wei balance. function availableBalance() external view returns (uint256); /// @notice Maximum cost for all tokens of cloned DAO. /// @return uint256 maximum cost in wei. function maxCost() external view returns (uint256); /// @notice Minimum percentage of votes needed to execute a proposal. /// @return uint256 minimum percentage of votes. function executeMinPct() external view returns (uint256); /// @notice Minimum lifetime of proposal before it closes. /// @return uint256 minimum number of hours for proposal lifetime. function votingMinHours() external view returns (uint256); /// @notice Whether DAO is public or private. /// @return bool true if public. function isPublic() external view returns (bool); /// @notice Whether DAO has admins. /// @return bool true if DAO has admins. function hasAdmins() external view returns (bool); /// @notice Proposal ids of DAO. /// @return array of proposal ids. function getProposalIds() external view returns (uint256[] memory); /// @notice Gets proposal info for proposal id. /// @param id_ id of proposal to get info for. /// @return proposalAddress address for proposal execution. /// @return investTokenAddress secondary address for proposal execution, used for investment proposals if ICO and token addresses differ. /// @return daoFunction proposal type. /// @return amount proposal amount eth/token to use during execution. /// @return creator address of proposal creator. /// @return endLifetime epoch time when proposal voting ends. /// @return votesFor amount of votes for the proposal. /// @return votesAgainst amount of votes against the proposal. /// @return executed whether proposal has been executed or not. function getProposal(uint256 id_) external view returns ( address proposalAddress, address investTokenAddress, DaoFunction daoFunction, uint256 amount, address creator, uint256 endLifetime, uint256 votesFor, uint256 votesAgainst, bool executed ); /// @notice Whether a holder is allowed to vote for a proposal. /// @param id_ proposal id to check whether holder is allowed to vote for. /// @param sender_ address of the holder. /// @return bool true if voting is allowed. function canVote(uint256 id_, address sender_) external view returns (bool); /// @notice Whether a holder is allowed to remove a proposal. /// @param id_ proposal id to check whether holder is allowed to remove. /// @param sender_ address of the holder. /// @return bool true if removal is allowed. function canRemove(uint256 id_, address sender_) external view returns (bool); /// @notice Whether a holder is allowed to execute a proposal. /// @param id_ proposal id to check whether holder is allowed to execute. /// @param sender_ address of the holder. /// @return bool true if execution is allowed. function canExecute(uint256 id_, address sender_) external view returns (bool); /// @notice Whether a holder is an admin. /// @param sender_ address of holder. /// @return bool true if holder is an admin (in DAO without admins all holders are treated as such). function isAdmin(address sender_) external view returns (bool); // Public transactions. /// @notice Saves new holdings addresses for DAO. /// @param tokens_ token addresses that DAO has holdings of. function addHoldingsAddresses(address[] calldata tokens_) external; /// @notice Saves new liquidity addresses for DAO. /// @param tokens_ token addresses that DAO has liquidities of. function addLiquidityAddresses(address[] calldata tokens_) external; /// @notice Creates new proposal. /// @param proposalAddress_ main address of the proposal, in investment proposals this is the address funds are sent to. /// @param investTokenAddress_ secondary address of the proposal, used in investment proposals to specify token address. /// @param daoFunction_ type of the proposal. /// @param amount_ amount of funds to use in the proposal. /// @param hoursLifetime_ voting lifetime of the proposal. function propose(address proposalAddress_, address investTokenAddress_, DaoFunction daoFunction_, uint256 amount_, uint256 hoursLifetime_) external; /// @notice Removes existing proposal. /// @param id_ id of proposal to remove. function unpropose(uint256 id_) external; /// @notice Voting for multiple proposals. /// @param ids_ ids of proposals to vote for. /// @param votes_ for or against votes for proposals. function vote(uint256[] calldata ids_, bool[] calldata votes_) external; /// @notice Executes a proposal. /// @param id_ id of proposal to be executed. function execute(uint256 id_) external; /// @notice Buying tokens for cloned DAO. function buy() external payable; /// @notice Sell tokens back to cloned DAO. /// @param amount_ amount of tokens to sell. function sell(uint256 amount_) external; // Owner transactions. /// @notice Sets factory address. /// @param factory_ address of TorroFactory. function setFactoryAddress(address factory_) external; /// @notice Sets vote weight divider. /// @param weight_ weight divider for a single vote. function setVoteWeightDivider(uint256 weight_) external; /// @notice Sets new address for router. /// @param router_ address for router. function setRouter(address router_) external; /// @notice Sets divider for BUY, INVEST, WITHDAW proposals. /// @param divider_ divider for BUY, INVEST, WITHDRAW proposals. function setSpendDivider(uint256 divider_) external; /// @notice Migrates balances of current DAO to a new DAO. /// @param newDao_ address of the new DAO to migrate to. function migrate(address newDao_) external; }
/// @title DAO for proposals, voting and execution. /// @notice Interface for creation, voting and execution of proposals. /// @author ORayskiy - @robitnik_TorroDao
NatSpecSingleLine
daoCreator
function daoCreator() external view returns (address);
/// @notice Address of DAO creator. /// @return DAO creator address.
NatSpecSingleLine
v0.6.6+commit.6c089d02
Unknown
ipfs://d1c6095fcf143d951c9754f00fe8cd59d29ab460461efe53b91eb289fd0fe5ac
{ "func_code_index": [ 1268, 1325 ] }
57,685
TorroDao
ITorroDao.sol
0x3cf9e9d45380b6ab61bde46b2e6cfcd7d8f6cdc1
Solidity
ITorroDao
interface ITorroDao { // Enums. /// @notice Enum of available proposal functions. enum DaoFunction { BUY, SELL, ADD_LIQUIDITY, REMOVE_LIQUIDITY, ADD_ADMIN, REMOVE_ADMIN, INVEST, WITHDRAW } // Initializer. /// @notice Initializer for DAO clones. /// @param torroToken_ main torro token address. /// @param governingToken_ torro token clone that's governing this dao. /// @param factory_ torro factory address. /// @param creator_ creator of cloned DAO. /// @param maxCost_ maximum cost of all governing tokens for cloned DAO. /// @param executeMinPct_ minimum percentage of votes needed for proposal execution. /// @param votingMinHours_ minimum lifetime of proposal before it closes. /// @param isPublic_ whether cloned DAO has public visibility. /// @param hasAdmins_ whether cloned DAO has admins, otherwise all stakers are treated as admins. function initializeCustom( address torroToken_, address governingToken_, address factory_, address creator_, uint256 maxCost_, uint256 executeMinPct_, uint256 votingMinHours_, bool isPublic_, bool hasAdmins_ ) external; // Public calls. /// @notice Address of DAO creator. /// @return DAO creator address. function daoCreator() external view returns (address); /// @notice Amount of tokens needed for a single vote. /// @return uint256 token amount. function voteWeight() external view returns (uint256); /// @notice Amount of votes that holder has. /// @param sender_ address of the holder. /// @return number of votes. function votesOf(address sender_) external view returns (uint256); /// @notice Address of the governing token. /// @return address of the governing token. function tokenAddress() external view returns (address); /// @notice Saved addresses of tokens that DAO is holding. /// @return array of holdings addresses. function holdings() external view returns (address[] memory); /// @notice Saved addresses of liquidity tokens that DAO is holding. /// @return array of liquidity addresses. function liquidities() external view returns (address[] memory); /// @notice Calculates address of liquidity token from ERC-20 token address. /// @param token_ token address to calculate liquidity address from. /// @return address of liquidity token. function liquidityToken(address token_) external view returns (address); /// @notice Gets tokens and liquidity token addresses of DAO's liquidity holdings. /// @return Arrays of tokens and liquidity tokens, should have the same length. function liquidityHoldings() external view returns (address[] memory, address[] memory); /// @notice DAO admins. /// @return Array of admin addresses. function admins() external view returns (address[] memory); /// @notice DAO balance for specified token. /// @param token_ token address to get balance for. /// @return uint256 token balance. function tokenBalance(address token_) external view returns (uint256); /// @notice DAO balance for liquidity token. /// @param token_ token address to get liquidity balance for. /// @return uin256 token liquidity balance. function liquidityBalance(address token_) external view returns (uint256); /// @notice DAO ethereum balance. /// @return uint256 wei balance. function availableBalance() external view returns (uint256); /// @notice Maximum cost for all tokens of cloned DAO. /// @return uint256 maximum cost in wei. function maxCost() external view returns (uint256); /// @notice Minimum percentage of votes needed to execute a proposal. /// @return uint256 minimum percentage of votes. function executeMinPct() external view returns (uint256); /// @notice Minimum lifetime of proposal before it closes. /// @return uint256 minimum number of hours for proposal lifetime. function votingMinHours() external view returns (uint256); /// @notice Whether DAO is public or private. /// @return bool true if public. function isPublic() external view returns (bool); /// @notice Whether DAO has admins. /// @return bool true if DAO has admins. function hasAdmins() external view returns (bool); /// @notice Proposal ids of DAO. /// @return array of proposal ids. function getProposalIds() external view returns (uint256[] memory); /// @notice Gets proposal info for proposal id. /// @param id_ id of proposal to get info for. /// @return proposalAddress address for proposal execution. /// @return investTokenAddress secondary address for proposal execution, used for investment proposals if ICO and token addresses differ. /// @return daoFunction proposal type. /// @return amount proposal amount eth/token to use during execution. /// @return creator address of proposal creator. /// @return endLifetime epoch time when proposal voting ends. /// @return votesFor amount of votes for the proposal. /// @return votesAgainst amount of votes against the proposal. /// @return executed whether proposal has been executed or not. function getProposal(uint256 id_) external view returns ( address proposalAddress, address investTokenAddress, DaoFunction daoFunction, uint256 amount, address creator, uint256 endLifetime, uint256 votesFor, uint256 votesAgainst, bool executed ); /// @notice Whether a holder is allowed to vote for a proposal. /// @param id_ proposal id to check whether holder is allowed to vote for. /// @param sender_ address of the holder. /// @return bool true if voting is allowed. function canVote(uint256 id_, address sender_) external view returns (bool); /// @notice Whether a holder is allowed to remove a proposal. /// @param id_ proposal id to check whether holder is allowed to remove. /// @param sender_ address of the holder. /// @return bool true if removal is allowed. function canRemove(uint256 id_, address sender_) external view returns (bool); /// @notice Whether a holder is allowed to execute a proposal. /// @param id_ proposal id to check whether holder is allowed to execute. /// @param sender_ address of the holder. /// @return bool true if execution is allowed. function canExecute(uint256 id_, address sender_) external view returns (bool); /// @notice Whether a holder is an admin. /// @param sender_ address of holder. /// @return bool true if holder is an admin (in DAO without admins all holders are treated as such). function isAdmin(address sender_) external view returns (bool); // Public transactions. /// @notice Saves new holdings addresses for DAO. /// @param tokens_ token addresses that DAO has holdings of. function addHoldingsAddresses(address[] calldata tokens_) external; /// @notice Saves new liquidity addresses for DAO. /// @param tokens_ token addresses that DAO has liquidities of. function addLiquidityAddresses(address[] calldata tokens_) external; /// @notice Creates new proposal. /// @param proposalAddress_ main address of the proposal, in investment proposals this is the address funds are sent to. /// @param investTokenAddress_ secondary address of the proposal, used in investment proposals to specify token address. /// @param daoFunction_ type of the proposal. /// @param amount_ amount of funds to use in the proposal. /// @param hoursLifetime_ voting lifetime of the proposal. function propose(address proposalAddress_, address investTokenAddress_, DaoFunction daoFunction_, uint256 amount_, uint256 hoursLifetime_) external; /// @notice Removes existing proposal. /// @param id_ id of proposal to remove. function unpropose(uint256 id_) external; /// @notice Voting for multiple proposals. /// @param ids_ ids of proposals to vote for. /// @param votes_ for or against votes for proposals. function vote(uint256[] calldata ids_, bool[] calldata votes_) external; /// @notice Executes a proposal. /// @param id_ id of proposal to be executed. function execute(uint256 id_) external; /// @notice Buying tokens for cloned DAO. function buy() external payable; /// @notice Sell tokens back to cloned DAO. /// @param amount_ amount of tokens to sell. function sell(uint256 amount_) external; // Owner transactions. /// @notice Sets factory address. /// @param factory_ address of TorroFactory. function setFactoryAddress(address factory_) external; /// @notice Sets vote weight divider. /// @param weight_ weight divider for a single vote. function setVoteWeightDivider(uint256 weight_) external; /// @notice Sets new address for router. /// @param router_ address for router. function setRouter(address router_) external; /// @notice Sets divider for BUY, INVEST, WITHDAW proposals. /// @param divider_ divider for BUY, INVEST, WITHDRAW proposals. function setSpendDivider(uint256 divider_) external; /// @notice Migrates balances of current DAO to a new DAO. /// @param newDao_ address of the new DAO to migrate to. function migrate(address newDao_) external; }
/// @title DAO for proposals, voting and execution. /// @notice Interface for creation, voting and execution of proposals. /// @author ORayskiy - @robitnik_TorroDao
NatSpecSingleLine
voteWeight
function voteWeight() external view returns (uint256);
/// @notice Amount of tokens needed for a single vote. /// @return uint256 token amount.
NatSpecSingleLine
v0.6.6+commit.6c089d02
Unknown
ipfs://d1c6095fcf143d951c9754f00fe8cd59d29ab460461efe53b91eb289fd0fe5ac
{ "func_code_index": [ 1423, 1480 ] }
57,686
TorroDao
ITorroDao.sol
0x3cf9e9d45380b6ab61bde46b2e6cfcd7d8f6cdc1
Solidity
ITorroDao
interface ITorroDao { // Enums. /// @notice Enum of available proposal functions. enum DaoFunction { BUY, SELL, ADD_LIQUIDITY, REMOVE_LIQUIDITY, ADD_ADMIN, REMOVE_ADMIN, INVEST, WITHDRAW } // Initializer. /// @notice Initializer for DAO clones. /// @param torroToken_ main torro token address. /// @param governingToken_ torro token clone that's governing this dao. /// @param factory_ torro factory address. /// @param creator_ creator of cloned DAO. /// @param maxCost_ maximum cost of all governing tokens for cloned DAO. /// @param executeMinPct_ minimum percentage of votes needed for proposal execution. /// @param votingMinHours_ minimum lifetime of proposal before it closes. /// @param isPublic_ whether cloned DAO has public visibility. /// @param hasAdmins_ whether cloned DAO has admins, otherwise all stakers are treated as admins. function initializeCustom( address torroToken_, address governingToken_, address factory_, address creator_, uint256 maxCost_, uint256 executeMinPct_, uint256 votingMinHours_, bool isPublic_, bool hasAdmins_ ) external; // Public calls. /// @notice Address of DAO creator. /// @return DAO creator address. function daoCreator() external view returns (address); /// @notice Amount of tokens needed for a single vote. /// @return uint256 token amount. function voteWeight() external view returns (uint256); /// @notice Amount of votes that holder has. /// @param sender_ address of the holder. /// @return number of votes. function votesOf(address sender_) external view returns (uint256); /// @notice Address of the governing token. /// @return address of the governing token. function tokenAddress() external view returns (address); /// @notice Saved addresses of tokens that DAO is holding. /// @return array of holdings addresses. function holdings() external view returns (address[] memory); /// @notice Saved addresses of liquidity tokens that DAO is holding. /// @return array of liquidity addresses. function liquidities() external view returns (address[] memory); /// @notice Calculates address of liquidity token from ERC-20 token address. /// @param token_ token address to calculate liquidity address from. /// @return address of liquidity token. function liquidityToken(address token_) external view returns (address); /// @notice Gets tokens and liquidity token addresses of DAO's liquidity holdings. /// @return Arrays of tokens and liquidity tokens, should have the same length. function liquidityHoldings() external view returns (address[] memory, address[] memory); /// @notice DAO admins. /// @return Array of admin addresses. function admins() external view returns (address[] memory); /// @notice DAO balance for specified token. /// @param token_ token address to get balance for. /// @return uint256 token balance. function tokenBalance(address token_) external view returns (uint256); /// @notice DAO balance for liquidity token. /// @param token_ token address to get liquidity balance for. /// @return uin256 token liquidity balance. function liquidityBalance(address token_) external view returns (uint256); /// @notice DAO ethereum balance. /// @return uint256 wei balance. function availableBalance() external view returns (uint256); /// @notice Maximum cost for all tokens of cloned DAO. /// @return uint256 maximum cost in wei. function maxCost() external view returns (uint256); /// @notice Minimum percentage of votes needed to execute a proposal. /// @return uint256 minimum percentage of votes. function executeMinPct() external view returns (uint256); /// @notice Minimum lifetime of proposal before it closes. /// @return uint256 minimum number of hours for proposal lifetime. function votingMinHours() external view returns (uint256); /// @notice Whether DAO is public or private. /// @return bool true if public. function isPublic() external view returns (bool); /// @notice Whether DAO has admins. /// @return bool true if DAO has admins. function hasAdmins() external view returns (bool); /// @notice Proposal ids of DAO. /// @return array of proposal ids. function getProposalIds() external view returns (uint256[] memory); /// @notice Gets proposal info for proposal id. /// @param id_ id of proposal to get info for. /// @return proposalAddress address for proposal execution. /// @return investTokenAddress secondary address for proposal execution, used for investment proposals if ICO and token addresses differ. /// @return daoFunction proposal type. /// @return amount proposal amount eth/token to use during execution. /// @return creator address of proposal creator. /// @return endLifetime epoch time when proposal voting ends. /// @return votesFor amount of votes for the proposal. /// @return votesAgainst amount of votes against the proposal. /// @return executed whether proposal has been executed or not. function getProposal(uint256 id_) external view returns ( address proposalAddress, address investTokenAddress, DaoFunction daoFunction, uint256 amount, address creator, uint256 endLifetime, uint256 votesFor, uint256 votesAgainst, bool executed ); /// @notice Whether a holder is allowed to vote for a proposal. /// @param id_ proposal id to check whether holder is allowed to vote for. /// @param sender_ address of the holder. /// @return bool true if voting is allowed. function canVote(uint256 id_, address sender_) external view returns (bool); /// @notice Whether a holder is allowed to remove a proposal. /// @param id_ proposal id to check whether holder is allowed to remove. /// @param sender_ address of the holder. /// @return bool true if removal is allowed. function canRemove(uint256 id_, address sender_) external view returns (bool); /// @notice Whether a holder is allowed to execute a proposal. /// @param id_ proposal id to check whether holder is allowed to execute. /// @param sender_ address of the holder. /// @return bool true if execution is allowed. function canExecute(uint256 id_, address sender_) external view returns (bool); /// @notice Whether a holder is an admin. /// @param sender_ address of holder. /// @return bool true if holder is an admin (in DAO without admins all holders are treated as such). function isAdmin(address sender_) external view returns (bool); // Public transactions. /// @notice Saves new holdings addresses for DAO. /// @param tokens_ token addresses that DAO has holdings of. function addHoldingsAddresses(address[] calldata tokens_) external; /// @notice Saves new liquidity addresses for DAO. /// @param tokens_ token addresses that DAO has liquidities of. function addLiquidityAddresses(address[] calldata tokens_) external; /// @notice Creates new proposal. /// @param proposalAddress_ main address of the proposal, in investment proposals this is the address funds are sent to. /// @param investTokenAddress_ secondary address of the proposal, used in investment proposals to specify token address. /// @param daoFunction_ type of the proposal. /// @param amount_ amount of funds to use in the proposal. /// @param hoursLifetime_ voting lifetime of the proposal. function propose(address proposalAddress_, address investTokenAddress_, DaoFunction daoFunction_, uint256 amount_, uint256 hoursLifetime_) external; /// @notice Removes existing proposal. /// @param id_ id of proposal to remove. function unpropose(uint256 id_) external; /// @notice Voting for multiple proposals. /// @param ids_ ids of proposals to vote for. /// @param votes_ for or against votes for proposals. function vote(uint256[] calldata ids_, bool[] calldata votes_) external; /// @notice Executes a proposal. /// @param id_ id of proposal to be executed. function execute(uint256 id_) external; /// @notice Buying tokens for cloned DAO. function buy() external payable; /// @notice Sell tokens back to cloned DAO. /// @param amount_ amount of tokens to sell. function sell(uint256 amount_) external; // Owner transactions. /// @notice Sets factory address. /// @param factory_ address of TorroFactory. function setFactoryAddress(address factory_) external; /// @notice Sets vote weight divider. /// @param weight_ weight divider for a single vote. function setVoteWeightDivider(uint256 weight_) external; /// @notice Sets new address for router. /// @param router_ address for router. function setRouter(address router_) external; /// @notice Sets divider for BUY, INVEST, WITHDAW proposals. /// @param divider_ divider for BUY, INVEST, WITHDRAW proposals. function setSpendDivider(uint256 divider_) external; /// @notice Migrates balances of current DAO to a new DAO. /// @param newDao_ address of the new DAO to migrate to. function migrate(address newDao_) external; }
/// @title DAO for proposals, voting and execution. /// @notice Interface for creation, voting and execution of proposals. /// @author ORayskiy - @robitnik_TorroDao
NatSpecSingleLine
votesOf
function votesOf(address sender_) external view returns (uint256);
/// @notice Amount of votes that holder has. /// @param sender_ address of the holder. /// @return number of votes.
NatSpecSingleLine
v0.6.6+commit.6c089d02
Unknown
ipfs://d1c6095fcf143d951c9754f00fe8cd59d29ab460461efe53b91eb289fd0fe5ac
{ "func_code_index": [ 1608, 1677 ] }
57,687
TorroDao
ITorroDao.sol
0x3cf9e9d45380b6ab61bde46b2e6cfcd7d8f6cdc1
Solidity
ITorroDao
interface ITorroDao { // Enums. /// @notice Enum of available proposal functions. enum DaoFunction { BUY, SELL, ADD_LIQUIDITY, REMOVE_LIQUIDITY, ADD_ADMIN, REMOVE_ADMIN, INVEST, WITHDRAW } // Initializer. /// @notice Initializer for DAO clones. /// @param torroToken_ main torro token address. /// @param governingToken_ torro token clone that's governing this dao. /// @param factory_ torro factory address. /// @param creator_ creator of cloned DAO. /// @param maxCost_ maximum cost of all governing tokens for cloned DAO. /// @param executeMinPct_ minimum percentage of votes needed for proposal execution. /// @param votingMinHours_ minimum lifetime of proposal before it closes. /// @param isPublic_ whether cloned DAO has public visibility. /// @param hasAdmins_ whether cloned DAO has admins, otherwise all stakers are treated as admins. function initializeCustom( address torroToken_, address governingToken_, address factory_, address creator_, uint256 maxCost_, uint256 executeMinPct_, uint256 votingMinHours_, bool isPublic_, bool hasAdmins_ ) external; // Public calls. /// @notice Address of DAO creator. /// @return DAO creator address. function daoCreator() external view returns (address); /// @notice Amount of tokens needed for a single vote. /// @return uint256 token amount. function voteWeight() external view returns (uint256); /// @notice Amount of votes that holder has. /// @param sender_ address of the holder. /// @return number of votes. function votesOf(address sender_) external view returns (uint256); /// @notice Address of the governing token. /// @return address of the governing token. function tokenAddress() external view returns (address); /// @notice Saved addresses of tokens that DAO is holding. /// @return array of holdings addresses. function holdings() external view returns (address[] memory); /// @notice Saved addresses of liquidity tokens that DAO is holding. /// @return array of liquidity addresses. function liquidities() external view returns (address[] memory); /// @notice Calculates address of liquidity token from ERC-20 token address. /// @param token_ token address to calculate liquidity address from. /// @return address of liquidity token. function liquidityToken(address token_) external view returns (address); /// @notice Gets tokens and liquidity token addresses of DAO's liquidity holdings. /// @return Arrays of tokens and liquidity tokens, should have the same length. function liquidityHoldings() external view returns (address[] memory, address[] memory); /// @notice DAO admins. /// @return Array of admin addresses. function admins() external view returns (address[] memory); /// @notice DAO balance for specified token. /// @param token_ token address to get balance for. /// @return uint256 token balance. function tokenBalance(address token_) external view returns (uint256); /// @notice DAO balance for liquidity token. /// @param token_ token address to get liquidity balance for. /// @return uin256 token liquidity balance. function liquidityBalance(address token_) external view returns (uint256); /// @notice DAO ethereum balance. /// @return uint256 wei balance. function availableBalance() external view returns (uint256); /// @notice Maximum cost for all tokens of cloned DAO. /// @return uint256 maximum cost in wei. function maxCost() external view returns (uint256); /// @notice Minimum percentage of votes needed to execute a proposal. /// @return uint256 minimum percentage of votes. function executeMinPct() external view returns (uint256); /// @notice Minimum lifetime of proposal before it closes. /// @return uint256 minimum number of hours for proposal lifetime. function votingMinHours() external view returns (uint256); /// @notice Whether DAO is public or private. /// @return bool true if public. function isPublic() external view returns (bool); /// @notice Whether DAO has admins. /// @return bool true if DAO has admins. function hasAdmins() external view returns (bool); /// @notice Proposal ids of DAO. /// @return array of proposal ids. function getProposalIds() external view returns (uint256[] memory); /// @notice Gets proposal info for proposal id. /// @param id_ id of proposal to get info for. /// @return proposalAddress address for proposal execution. /// @return investTokenAddress secondary address for proposal execution, used for investment proposals if ICO and token addresses differ. /// @return daoFunction proposal type. /// @return amount proposal amount eth/token to use during execution. /// @return creator address of proposal creator. /// @return endLifetime epoch time when proposal voting ends. /// @return votesFor amount of votes for the proposal. /// @return votesAgainst amount of votes against the proposal. /// @return executed whether proposal has been executed or not. function getProposal(uint256 id_) external view returns ( address proposalAddress, address investTokenAddress, DaoFunction daoFunction, uint256 amount, address creator, uint256 endLifetime, uint256 votesFor, uint256 votesAgainst, bool executed ); /// @notice Whether a holder is allowed to vote for a proposal. /// @param id_ proposal id to check whether holder is allowed to vote for. /// @param sender_ address of the holder. /// @return bool true if voting is allowed. function canVote(uint256 id_, address sender_) external view returns (bool); /// @notice Whether a holder is allowed to remove a proposal. /// @param id_ proposal id to check whether holder is allowed to remove. /// @param sender_ address of the holder. /// @return bool true if removal is allowed. function canRemove(uint256 id_, address sender_) external view returns (bool); /// @notice Whether a holder is allowed to execute a proposal. /// @param id_ proposal id to check whether holder is allowed to execute. /// @param sender_ address of the holder. /// @return bool true if execution is allowed. function canExecute(uint256 id_, address sender_) external view returns (bool); /// @notice Whether a holder is an admin. /// @param sender_ address of holder. /// @return bool true if holder is an admin (in DAO without admins all holders are treated as such). function isAdmin(address sender_) external view returns (bool); // Public transactions. /// @notice Saves new holdings addresses for DAO. /// @param tokens_ token addresses that DAO has holdings of. function addHoldingsAddresses(address[] calldata tokens_) external; /// @notice Saves new liquidity addresses for DAO. /// @param tokens_ token addresses that DAO has liquidities of. function addLiquidityAddresses(address[] calldata tokens_) external; /// @notice Creates new proposal. /// @param proposalAddress_ main address of the proposal, in investment proposals this is the address funds are sent to. /// @param investTokenAddress_ secondary address of the proposal, used in investment proposals to specify token address. /// @param daoFunction_ type of the proposal. /// @param amount_ amount of funds to use in the proposal. /// @param hoursLifetime_ voting lifetime of the proposal. function propose(address proposalAddress_, address investTokenAddress_, DaoFunction daoFunction_, uint256 amount_, uint256 hoursLifetime_) external; /// @notice Removes existing proposal. /// @param id_ id of proposal to remove. function unpropose(uint256 id_) external; /// @notice Voting for multiple proposals. /// @param ids_ ids of proposals to vote for. /// @param votes_ for or against votes for proposals. function vote(uint256[] calldata ids_, bool[] calldata votes_) external; /// @notice Executes a proposal. /// @param id_ id of proposal to be executed. function execute(uint256 id_) external; /// @notice Buying tokens for cloned DAO. function buy() external payable; /// @notice Sell tokens back to cloned DAO. /// @param amount_ amount of tokens to sell. function sell(uint256 amount_) external; // Owner transactions. /// @notice Sets factory address. /// @param factory_ address of TorroFactory. function setFactoryAddress(address factory_) external; /// @notice Sets vote weight divider. /// @param weight_ weight divider for a single vote. function setVoteWeightDivider(uint256 weight_) external; /// @notice Sets new address for router. /// @param router_ address for router. function setRouter(address router_) external; /// @notice Sets divider for BUY, INVEST, WITHDAW proposals. /// @param divider_ divider for BUY, INVEST, WITHDRAW proposals. function setSpendDivider(uint256 divider_) external; /// @notice Migrates balances of current DAO to a new DAO. /// @param newDao_ address of the new DAO to migrate to. function migrate(address newDao_) external; }
/// @title DAO for proposals, voting and execution. /// @notice Interface for creation, voting and execution of proposals. /// @author ORayskiy - @robitnik_TorroDao
NatSpecSingleLine
tokenAddress
function tokenAddress() external view returns (address);
/// @notice Address of the governing token. /// @return address of the governing token.
NatSpecSingleLine
v0.6.6+commit.6c089d02
Unknown
ipfs://d1c6095fcf143d951c9754f00fe8cd59d29ab460461efe53b91eb289fd0fe5ac
{ "func_code_index": [ 1774, 1833 ] }
57,688
TorroDao
ITorroDao.sol
0x3cf9e9d45380b6ab61bde46b2e6cfcd7d8f6cdc1
Solidity
ITorroDao
interface ITorroDao { // Enums. /// @notice Enum of available proposal functions. enum DaoFunction { BUY, SELL, ADD_LIQUIDITY, REMOVE_LIQUIDITY, ADD_ADMIN, REMOVE_ADMIN, INVEST, WITHDRAW } // Initializer. /// @notice Initializer for DAO clones. /// @param torroToken_ main torro token address. /// @param governingToken_ torro token clone that's governing this dao. /// @param factory_ torro factory address. /// @param creator_ creator of cloned DAO. /// @param maxCost_ maximum cost of all governing tokens for cloned DAO. /// @param executeMinPct_ minimum percentage of votes needed for proposal execution. /// @param votingMinHours_ minimum lifetime of proposal before it closes. /// @param isPublic_ whether cloned DAO has public visibility. /// @param hasAdmins_ whether cloned DAO has admins, otherwise all stakers are treated as admins. function initializeCustom( address torroToken_, address governingToken_, address factory_, address creator_, uint256 maxCost_, uint256 executeMinPct_, uint256 votingMinHours_, bool isPublic_, bool hasAdmins_ ) external; // Public calls. /// @notice Address of DAO creator. /// @return DAO creator address. function daoCreator() external view returns (address); /// @notice Amount of tokens needed for a single vote. /// @return uint256 token amount. function voteWeight() external view returns (uint256); /// @notice Amount of votes that holder has. /// @param sender_ address of the holder. /// @return number of votes. function votesOf(address sender_) external view returns (uint256); /// @notice Address of the governing token. /// @return address of the governing token. function tokenAddress() external view returns (address); /// @notice Saved addresses of tokens that DAO is holding. /// @return array of holdings addresses. function holdings() external view returns (address[] memory); /// @notice Saved addresses of liquidity tokens that DAO is holding. /// @return array of liquidity addresses. function liquidities() external view returns (address[] memory); /// @notice Calculates address of liquidity token from ERC-20 token address. /// @param token_ token address to calculate liquidity address from. /// @return address of liquidity token. function liquidityToken(address token_) external view returns (address); /// @notice Gets tokens and liquidity token addresses of DAO's liquidity holdings. /// @return Arrays of tokens and liquidity tokens, should have the same length. function liquidityHoldings() external view returns (address[] memory, address[] memory); /// @notice DAO admins. /// @return Array of admin addresses. function admins() external view returns (address[] memory); /// @notice DAO balance for specified token. /// @param token_ token address to get balance for. /// @return uint256 token balance. function tokenBalance(address token_) external view returns (uint256); /// @notice DAO balance for liquidity token. /// @param token_ token address to get liquidity balance for. /// @return uin256 token liquidity balance. function liquidityBalance(address token_) external view returns (uint256); /// @notice DAO ethereum balance. /// @return uint256 wei balance. function availableBalance() external view returns (uint256); /// @notice Maximum cost for all tokens of cloned DAO. /// @return uint256 maximum cost in wei. function maxCost() external view returns (uint256); /// @notice Minimum percentage of votes needed to execute a proposal. /// @return uint256 minimum percentage of votes. function executeMinPct() external view returns (uint256); /// @notice Minimum lifetime of proposal before it closes. /// @return uint256 minimum number of hours for proposal lifetime. function votingMinHours() external view returns (uint256); /// @notice Whether DAO is public or private. /// @return bool true if public. function isPublic() external view returns (bool); /// @notice Whether DAO has admins. /// @return bool true if DAO has admins. function hasAdmins() external view returns (bool); /// @notice Proposal ids of DAO. /// @return array of proposal ids. function getProposalIds() external view returns (uint256[] memory); /// @notice Gets proposal info for proposal id. /// @param id_ id of proposal to get info for. /// @return proposalAddress address for proposal execution. /// @return investTokenAddress secondary address for proposal execution, used for investment proposals if ICO and token addresses differ. /// @return daoFunction proposal type. /// @return amount proposal amount eth/token to use during execution. /// @return creator address of proposal creator. /// @return endLifetime epoch time when proposal voting ends. /// @return votesFor amount of votes for the proposal. /// @return votesAgainst amount of votes against the proposal. /// @return executed whether proposal has been executed or not. function getProposal(uint256 id_) external view returns ( address proposalAddress, address investTokenAddress, DaoFunction daoFunction, uint256 amount, address creator, uint256 endLifetime, uint256 votesFor, uint256 votesAgainst, bool executed ); /// @notice Whether a holder is allowed to vote for a proposal. /// @param id_ proposal id to check whether holder is allowed to vote for. /// @param sender_ address of the holder. /// @return bool true if voting is allowed. function canVote(uint256 id_, address sender_) external view returns (bool); /// @notice Whether a holder is allowed to remove a proposal. /// @param id_ proposal id to check whether holder is allowed to remove. /// @param sender_ address of the holder. /// @return bool true if removal is allowed. function canRemove(uint256 id_, address sender_) external view returns (bool); /// @notice Whether a holder is allowed to execute a proposal. /// @param id_ proposal id to check whether holder is allowed to execute. /// @param sender_ address of the holder. /// @return bool true if execution is allowed. function canExecute(uint256 id_, address sender_) external view returns (bool); /// @notice Whether a holder is an admin. /// @param sender_ address of holder. /// @return bool true if holder is an admin (in DAO without admins all holders are treated as such). function isAdmin(address sender_) external view returns (bool); // Public transactions. /// @notice Saves new holdings addresses for DAO. /// @param tokens_ token addresses that DAO has holdings of. function addHoldingsAddresses(address[] calldata tokens_) external; /// @notice Saves new liquidity addresses for DAO. /// @param tokens_ token addresses that DAO has liquidities of. function addLiquidityAddresses(address[] calldata tokens_) external; /// @notice Creates new proposal. /// @param proposalAddress_ main address of the proposal, in investment proposals this is the address funds are sent to. /// @param investTokenAddress_ secondary address of the proposal, used in investment proposals to specify token address. /// @param daoFunction_ type of the proposal. /// @param amount_ amount of funds to use in the proposal. /// @param hoursLifetime_ voting lifetime of the proposal. function propose(address proposalAddress_, address investTokenAddress_, DaoFunction daoFunction_, uint256 amount_, uint256 hoursLifetime_) external; /// @notice Removes existing proposal. /// @param id_ id of proposal to remove. function unpropose(uint256 id_) external; /// @notice Voting for multiple proposals. /// @param ids_ ids of proposals to vote for. /// @param votes_ for or against votes for proposals. function vote(uint256[] calldata ids_, bool[] calldata votes_) external; /// @notice Executes a proposal. /// @param id_ id of proposal to be executed. function execute(uint256 id_) external; /// @notice Buying tokens for cloned DAO. function buy() external payable; /// @notice Sell tokens back to cloned DAO. /// @param amount_ amount of tokens to sell. function sell(uint256 amount_) external; // Owner transactions. /// @notice Sets factory address. /// @param factory_ address of TorroFactory. function setFactoryAddress(address factory_) external; /// @notice Sets vote weight divider. /// @param weight_ weight divider for a single vote. function setVoteWeightDivider(uint256 weight_) external; /// @notice Sets new address for router. /// @param router_ address for router. function setRouter(address router_) external; /// @notice Sets divider for BUY, INVEST, WITHDAW proposals. /// @param divider_ divider for BUY, INVEST, WITHDRAW proposals. function setSpendDivider(uint256 divider_) external; /// @notice Migrates balances of current DAO to a new DAO. /// @param newDao_ address of the new DAO to migrate to. function migrate(address newDao_) external; }
/// @title DAO for proposals, voting and execution. /// @notice Interface for creation, voting and execution of proposals. /// @author ORayskiy - @robitnik_TorroDao
NatSpecSingleLine
holdings
function holdings() external view returns (address[] memory);
/// @notice Saved addresses of tokens that DAO is holding. /// @return array of holdings addresses.
NatSpecSingleLine
v0.6.6+commit.6c089d02
Unknown
ipfs://d1c6095fcf143d951c9754f00fe8cd59d29ab460461efe53b91eb289fd0fe5ac
{ "func_code_index": [ 1942, 2006 ] }
57,689
TorroDao
ITorroDao.sol
0x3cf9e9d45380b6ab61bde46b2e6cfcd7d8f6cdc1
Solidity
ITorroDao
interface ITorroDao { // Enums. /// @notice Enum of available proposal functions. enum DaoFunction { BUY, SELL, ADD_LIQUIDITY, REMOVE_LIQUIDITY, ADD_ADMIN, REMOVE_ADMIN, INVEST, WITHDRAW } // Initializer. /// @notice Initializer for DAO clones. /// @param torroToken_ main torro token address. /// @param governingToken_ torro token clone that's governing this dao. /// @param factory_ torro factory address. /// @param creator_ creator of cloned DAO. /// @param maxCost_ maximum cost of all governing tokens for cloned DAO. /// @param executeMinPct_ minimum percentage of votes needed for proposal execution. /// @param votingMinHours_ minimum lifetime of proposal before it closes. /// @param isPublic_ whether cloned DAO has public visibility. /// @param hasAdmins_ whether cloned DAO has admins, otherwise all stakers are treated as admins. function initializeCustom( address torroToken_, address governingToken_, address factory_, address creator_, uint256 maxCost_, uint256 executeMinPct_, uint256 votingMinHours_, bool isPublic_, bool hasAdmins_ ) external; // Public calls. /// @notice Address of DAO creator. /// @return DAO creator address. function daoCreator() external view returns (address); /// @notice Amount of tokens needed for a single vote. /// @return uint256 token amount. function voteWeight() external view returns (uint256); /// @notice Amount of votes that holder has. /// @param sender_ address of the holder. /// @return number of votes. function votesOf(address sender_) external view returns (uint256); /// @notice Address of the governing token. /// @return address of the governing token. function tokenAddress() external view returns (address); /// @notice Saved addresses of tokens that DAO is holding. /// @return array of holdings addresses. function holdings() external view returns (address[] memory); /// @notice Saved addresses of liquidity tokens that DAO is holding. /// @return array of liquidity addresses. function liquidities() external view returns (address[] memory); /// @notice Calculates address of liquidity token from ERC-20 token address. /// @param token_ token address to calculate liquidity address from. /// @return address of liquidity token. function liquidityToken(address token_) external view returns (address); /// @notice Gets tokens and liquidity token addresses of DAO's liquidity holdings. /// @return Arrays of tokens and liquidity tokens, should have the same length. function liquidityHoldings() external view returns (address[] memory, address[] memory); /// @notice DAO admins. /// @return Array of admin addresses. function admins() external view returns (address[] memory); /// @notice DAO balance for specified token. /// @param token_ token address to get balance for. /// @return uint256 token balance. function tokenBalance(address token_) external view returns (uint256); /// @notice DAO balance for liquidity token. /// @param token_ token address to get liquidity balance for. /// @return uin256 token liquidity balance. function liquidityBalance(address token_) external view returns (uint256); /// @notice DAO ethereum balance. /// @return uint256 wei balance. function availableBalance() external view returns (uint256); /// @notice Maximum cost for all tokens of cloned DAO. /// @return uint256 maximum cost in wei. function maxCost() external view returns (uint256); /// @notice Minimum percentage of votes needed to execute a proposal. /// @return uint256 minimum percentage of votes. function executeMinPct() external view returns (uint256); /// @notice Minimum lifetime of proposal before it closes. /// @return uint256 minimum number of hours for proposal lifetime. function votingMinHours() external view returns (uint256); /// @notice Whether DAO is public or private. /// @return bool true if public. function isPublic() external view returns (bool); /// @notice Whether DAO has admins. /// @return bool true if DAO has admins. function hasAdmins() external view returns (bool); /// @notice Proposal ids of DAO. /// @return array of proposal ids. function getProposalIds() external view returns (uint256[] memory); /// @notice Gets proposal info for proposal id. /// @param id_ id of proposal to get info for. /// @return proposalAddress address for proposal execution. /// @return investTokenAddress secondary address for proposal execution, used for investment proposals if ICO and token addresses differ. /// @return daoFunction proposal type. /// @return amount proposal amount eth/token to use during execution. /// @return creator address of proposal creator. /// @return endLifetime epoch time when proposal voting ends. /// @return votesFor amount of votes for the proposal. /// @return votesAgainst amount of votes against the proposal. /// @return executed whether proposal has been executed or not. function getProposal(uint256 id_) external view returns ( address proposalAddress, address investTokenAddress, DaoFunction daoFunction, uint256 amount, address creator, uint256 endLifetime, uint256 votesFor, uint256 votesAgainst, bool executed ); /// @notice Whether a holder is allowed to vote for a proposal. /// @param id_ proposal id to check whether holder is allowed to vote for. /// @param sender_ address of the holder. /// @return bool true if voting is allowed. function canVote(uint256 id_, address sender_) external view returns (bool); /// @notice Whether a holder is allowed to remove a proposal. /// @param id_ proposal id to check whether holder is allowed to remove. /// @param sender_ address of the holder. /// @return bool true if removal is allowed. function canRemove(uint256 id_, address sender_) external view returns (bool); /// @notice Whether a holder is allowed to execute a proposal. /// @param id_ proposal id to check whether holder is allowed to execute. /// @param sender_ address of the holder. /// @return bool true if execution is allowed. function canExecute(uint256 id_, address sender_) external view returns (bool); /// @notice Whether a holder is an admin. /// @param sender_ address of holder. /// @return bool true if holder is an admin (in DAO without admins all holders are treated as such). function isAdmin(address sender_) external view returns (bool); // Public transactions. /// @notice Saves new holdings addresses for DAO. /// @param tokens_ token addresses that DAO has holdings of. function addHoldingsAddresses(address[] calldata tokens_) external; /// @notice Saves new liquidity addresses for DAO. /// @param tokens_ token addresses that DAO has liquidities of. function addLiquidityAddresses(address[] calldata tokens_) external; /// @notice Creates new proposal. /// @param proposalAddress_ main address of the proposal, in investment proposals this is the address funds are sent to. /// @param investTokenAddress_ secondary address of the proposal, used in investment proposals to specify token address. /// @param daoFunction_ type of the proposal. /// @param amount_ amount of funds to use in the proposal. /// @param hoursLifetime_ voting lifetime of the proposal. function propose(address proposalAddress_, address investTokenAddress_, DaoFunction daoFunction_, uint256 amount_, uint256 hoursLifetime_) external; /// @notice Removes existing proposal. /// @param id_ id of proposal to remove. function unpropose(uint256 id_) external; /// @notice Voting for multiple proposals. /// @param ids_ ids of proposals to vote for. /// @param votes_ for or against votes for proposals. function vote(uint256[] calldata ids_, bool[] calldata votes_) external; /// @notice Executes a proposal. /// @param id_ id of proposal to be executed. function execute(uint256 id_) external; /// @notice Buying tokens for cloned DAO. function buy() external payable; /// @notice Sell tokens back to cloned DAO. /// @param amount_ amount of tokens to sell. function sell(uint256 amount_) external; // Owner transactions. /// @notice Sets factory address. /// @param factory_ address of TorroFactory. function setFactoryAddress(address factory_) external; /// @notice Sets vote weight divider. /// @param weight_ weight divider for a single vote. function setVoteWeightDivider(uint256 weight_) external; /// @notice Sets new address for router. /// @param router_ address for router. function setRouter(address router_) external; /// @notice Sets divider for BUY, INVEST, WITHDAW proposals. /// @param divider_ divider for BUY, INVEST, WITHDRAW proposals. function setSpendDivider(uint256 divider_) external; /// @notice Migrates balances of current DAO to a new DAO. /// @param newDao_ address of the new DAO to migrate to. function migrate(address newDao_) external; }
/// @title DAO for proposals, voting and execution. /// @notice Interface for creation, voting and execution of proposals. /// @author ORayskiy - @robitnik_TorroDao
NatSpecSingleLine
liquidities
function liquidities() external view returns (address[] memory);
/// @notice Saved addresses of liquidity tokens that DAO is holding. /// @return array of liquidity addresses.
NatSpecSingleLine
v0.6.6+commit.6c089d02
Unknown
ipfs://d1c6095fcf143d951c9754f00fe8cd59d29ab460461efe53b91eb289fd0fe5ac
{ "func_code_index": [ 2126, 2193 ] }
57,690
TorroDao
ITorroDao.sol
0x3cf9e9d45380b6ab61bde46b2e6cfcd7d8f6cdc1
Solidity
ITorroDao
interface ITorroDao { // Enums. /// @notice Enum of available proposal functions. enum DaoFunction { BUY, SELL, ADD_LIQUIDITY, REMOVE_LIQUIDITY, ADD_ADMIN, REMOVE_ADMIN, INVEST, WITHDRAW } // Initializer. /// @notice Initializer for DAO clones. /// @param torroToken_ main torro token address. /// @param governingToken_ torro token clone that's governing this dao. /// @param factory_ torro factory address. /// @param creator_ creator of cloned DAO. /// @param maxCost_ maximum cost of all governing tokens for cloned DAO. /// @param executeMinPct_ minimum percentage of votes needed for proposal execution. /// @param votingMinHours_ minimum lifetime of proposal before it closes. /// @param isPublic_ whether cloned DAO has public visibility. /// @param hasAdmins_ whether cloned DAO has admins, otherwise all stakers are treated as admins. function initializeCustom( address torroToken_, address governingToken_, address factory_, address creator_, uint256 maxCost_, uint256 executeMinPct_, uint256 votingMinHours_, bool isPublic_, bool hasAdmins_ ) external; // Public calls. /// @notice Address of DAO creator. /// @return DAO creator address. function daoCreator() external view returns (address); /// @notice Amount of tokens needed for a single vote. /// @return uint256 token amount. function voteWeight() external view returns (uint256); /// @notice Amount of votes that holder has. /// @param sender_ address of the holder. /// @return number of votes. function votesOf(address sender_) external view returns (uint256); /// @notice Address of the governing token. /// @return address of the governing token. function tokenAddress() external view returns (address); /// @notice Saved addresses of tokens that DAO is holding. /// @return array of holdings addresses. function holdings() external view returns (address[] memory); /// @notice Saved addresses of liquidity tokens that DAO is holding. /// @return array of liquidity addresses. function liquidities() external view returns (address[] memory); /// @notice Calculates address of liquidity token from ERC-20 token address. /// @param token_ token address to calculate liquidity address from. /// @return address of liquidity token. function liquidityToken(address token_) external view returns (address); /// @notice Gets tokens and liquidity token addresses of DAO's liquidity holdings. /// @return Arrays of tokens and liquidity tokens, should have the same length. function liquidityHoldings() external view returns (address[] memory, address[] memory); /// @notice DAO admins. /// @return Array of admin addresses. function admins() external view returns (address[] memory); /// @notice DAO balance for specified token. /// @param token_ token address to get balance for. /// @return uint256 token balance. function tokenBalance(address token_) external view returns (uint256); /// @notice DAO balance for liquidity token. /// @param token_ token address to get liquidity balance for. /// @return uin256 token liquidity balance. function liquidityBalance(address token_) external view returns (uint256); /// @notice DAO ethereum balance. /// @return uint256 wei balance. function availableBalance() external view returns (uint256); /// @notice Maximum cost for all tokens of cloned DAO. /// @return uint256 maximum cost in wei. function maxCost() external view returns (uint256); /// @notice Minimum percentage of votes needed to execute a proposal. /// @return uint256 minimum percentage of votes. function executeMinPct() external view returns (uint256); /// @notice Minimum lifetime of proposal before it closes. /// @return uint256 minimum number of hours for proposal lifetime. function votingMinHours() external view returns (uint256); /// @notice Whether DAO is public or private. /// @return bool true if public. function isPublic() external view returns (bool); /// @notice Whether DAO has admins. /// @return bool true if DAO has admins. function hasAdmins() external view returns (bool); /// @notice Proposal ids of DAO. /// @return array of proposal ids. function getProposalIds() external view returns (uint256[] memory); /// @notice Gets proposal info for proposal id. /// @param id_ id of proposal to get info for. /// @return proposalAddress address for proposal execution. /// @return investTokenAddress secondary address for proposal execution, used for investment proposals if ICO and token addresses differ. /// @return daoFunction proposal type. /// @return amount proposal amount eth/token to use during execution. /// @return creator address of proposal creator. /// @return endLifetime epoch time when proposal voting ends. /// @return votesFor amount of votes for the proposal. /// @return votesAgainst amount of votes against the proposal. /// @return executed whether proposal has been executed or not. function getProposal(uint256 id_) external view returns ( address proposalAddress, address investTokenAddress, DaoFunction daoFunction, uint256 amount, address creator, uint256 endLifetime, uint256 votesFor, uint256 votesAgainst, bool executed ); /// @notice Whether a holder is allowed to vote for a proposal. /// @param id_ proposal id to check whether holder is allowed to vote for. /// @param sender_ address of the holder. /// @return bool true if voting is allowed. function canVote(uint256 id_, address sender_) external view returns (bool); /// @notice Whether a holder is allowed to remove a proposal. /// @param id_ proposal id to check whether holder is allowed to remove. /// @param sender_ address of the holder. /// @return bool true if removal is allowed. function canRemove(uint256 id_, address sender_) external view returns (bool); /// @notice Whether a holder is allowed to execute a proposal. /// @param id_ proposal id to check whether holder is allowed to execute. /// @param sender_ address of the holder. /// @return bool true if execution is allowed. function canExecute(uint256 id_, address sender_) external view returns (bool); /// @notice Whether a holder is an admin. /// @param sender_ address of holder. /// @return bool true if holder is an admin (in DAO without admins all holders are treated as such). function isAdmin(address sender_) external view returns (bool); // Public transactions. /// @notice Saves new holdings addresses for DAO. /// @param tokens_ token addresses that DAO has holdings of. function addHoldingsAddresses(address[] calldata tokens_) external; /// @notice Saves new liquidity addresses for DAO. /// @param tokens_ token addresses that DAO has liquidities of. function addLiquidityAddresses(address[] calldata tokens_) external; /// @notice Creates new proposal. /// @param proposalAddress_ main address of the proposal, in investment proposals this is the address funds are sent to. /// @param investTokenAddress_ secondary address of the proposal, used in investment proposals to specify token address. /// @param daoFunction_ type of the proposal. /// @param amount_ amount of funds to use in the proposal. /// @param hoursLifetime_ voting lifetime of the proposal. function propose(address proposalAddress_, address investTokenAddress_, DaoFunction daoFunction_, uint256 amount_, uint256 hoursLifetime_) external; /// @notice Removes existing proposal. /// @param id_ id of proposal to remove. function unpropose(uint256 id_) external; /// @notice Voting for multiple proposals. /// @param ids_ ids of proposals to vote for. /// @param votes_ for or against votes for proposals. function vote(uint256[] calldata ids_, bool[] calldata votes_) external; /// @notice Executes a proposal. /// @param id_ id of proposal to be executed. function execute(uint256 id_) external; /// @notice Buying tokens for cloned DAO. function buy() external payable; /// @notice Sell tokens back to cloned DAO. /// @param amount_ amount of tokens to sell. function sell(uint256 amount_) external; // Owner transactions. /// @notice Sets factory address. /// @param factory_ address of TorroFactory. function setFactoryAddress(address factory_) external; /// @notice Sets vote weight divider. /// @param weight_ weight divider for a single vote. function setVoteWeightDivider(uint256 weight_) external; /// @notice Sets new address for router. /// @param router_ address for router. function setRouter(address router_) external; /// @notice Sets divider for BUY, INVEST, WITHDAW proposals. /// @param divider_ divider for BUY, INVEST, WITHDRAW proposals. function setSpendDivider(uint256 divider_) external; /// @notice Migrates balances of current DAO to a new DAO. /// @param newDao_ address of the new DAO to migrate to. function migrate(address newDao_) external; }
/// @title DAO for proposals, voting and execution. /// @notice Interface for creation, voting and execution of proposals. /// @author ORayskiy - @robitnik_TorroDao
NatSpecSingleLine
liquidityToken
function liquidityToken(address token_) external view returns (address);
/// @notice Calculates address of liquidity token from ERC-20 token address. /// @param token_ token address to calculate liquidity address from. /// @return address of liquidity token.
NatSpecSingleLine
v0.6.6+commit.6c089d02
Unknown
ipfs://d1c6095fcf143d951c9754f00fe8cd59d29ab460461efe53b91eb289fd0fe5ac
{ "func_code_index": [ 2391, 2466 ] }
57,691
TorroDao
ITorroDao.sol
0x3cf9e9d45380b6ab61bde46b2e6cfcd7d8f6cdc1
Solidity
ITorroDao
interface ITorroDao { // Enums. /// @notice Enum of available proposal functions. enum DaoFunction { BUY, SELL, ADD_LIQUIDITY, REMOVE_LIQUIDITY, ADD_ADMIN, REMOVE_ADMIN, INVEST, WITHDRAW } // Initializer. /// @notice Initializer for DAO clones. /// @param torroToken_ main torro token address. /// @param governingToken_ torro token clone that's governing this dao. /// @param factory_ torro factory address. /// @param creator_ creator of cloned DAO. /// @param maxCost_ maximum cost of all governing tokens for cloned DAO. /// @param executeMinPct_ minimum percentage of votes needed for proposal execution. /// @param votingMinHours_ minimum lifetime of proposal before it closes. /// @param isPublic_ whether cloned DAO has public visibility. /// @param hasAdmins_ whether cloned DAO has admins, otherwise all stakers are treated as admins. function initializeCustom( address torroToken_, address governingToken_, address factory_, address creator_, uint256 maxCost_, uint256 executeMinPct_, uint256 votingMinHours_, bool isPublic_, bool hasAdmins_ ) external; // Public calls. /// @notice Address of DAO creator. /// @return DAO creator address. function daoCreator() external view returns (address); /// @notice Amount of tokens needed for a single vote. /// @return uint256 token amount. function voteWeight() external view returns (uint256); /// @notice Amount of votes that holder has. /// @param sender_ address of the holder. /// @return number of votes. function votesOf(address sender_) external view returns (uint256); /// @notice Address of the governing token. /// @return address of the governing token. function tokenAddress() external view returns (address); /// @notice Saved addresses of tokens that DAO is holding. /// @return array of holdings addresses. function holdings() external view returns (address[] memory); /// @notice Saved addresses of liquidity tokens that DAO is holding. /// @return array of liquidity addresses. function liquidities() external view returns (address[] memory); /// @notice Calculates address of liquidity token from ERC-20 token address. /// @param token_ token address to calculate liquidity address from. /// @return address of liquidity token. function liquidityToken(address token_) external view returns (address); /// @notice Gets tokens and liquidity token addresses of DAO's liquidity holdings. /// @return Arrays of tokens and liquidity tokens, should have the same length. function liquidityHoldings() external view returns (address[] memory, address[] memory); /// @notice DAO admins. /// @return Array of admin addresses. function admins() external view returns (address[] memory); /// @notice DAO balance for specified token. /// @param token_ token address to get balance for. /// @return uint256 token balance. function tokenBalance(address token_) external view returns (uint256); /// @notice DAO balance for liquidity token. /// @param token_ token address to get liquidity balance for. /// @return uin256 token liquidity balance. function liquidityBalance(address token_) external view returns (uint256); /// @notice DAO ethereum balance. /// @return uint256 wei balance. function availableBalance() external view returns (uint256); /// @notice Maximum cost for all tokens of cloned DAO. /// @return uint256 maximum cost in wei. function maxCost() external view returns (uint256); /// @notice Minimum percentage of votes needed to execute a proposal. /// @return uint256 minimum percentage of votes. function executeMinPct() external view returns (uint256); /// @notice Minimum lifetime of proposal before it closes. /// @return uint256 minimum number of hours for proposal lifetime. function votingMinHours() external view returns (uint256); /// @notice Whether DAO is public or private. /// @return bool true if public. function isPublic() external view returns (bool); /// @notice Whether DAO has admins. /// @return bool true if DAO has admins. function hasAdmins() external view returns (bool); /// @notice Proposal ids of DAO. /// @return array of proposal ids. function getProposalIds() external view returns (uint256[] memory); /// @notice Gets proposal info for proposal id. /// @param id_ id of proposal to get info for. /// @return proposalAddress address for proposal execution. /// @return investTokenAddress secondary address for proposal execution, used for investment proposals if ICO and token addresses differ. /// @return daoFunction proposal type. /// @return amount proposal amount eth/token to use during execution. /// @return creator address of proposal creator. /// @return endLifetime epoch time when proposal voting ends. /// @return votesFor amount of votes for the proposal. /// @return votesAgainst amount of votes against the proposal. /// @return executed whether proposal has been executed or not. function getProposal(uint256 id_) external view returns ( address proposalAddress, address investTokenAddress, DaoFunction daoFunction, uint256 amount, address creator, uint256 endLifetime, uint256 votesFor, uint256 votesAgainst, bool executed ); /// @notice Whether a holder is allowed to vote for a proposal. /// @param id_ proposal id to check whether holder is allowed to vote for. /// @param sender_ address of the holder. /// @return bool true if voting is allowed. function canVote(uint256 id_, address sender_) external view returns (bool); /// @notice Whether a holder is allowed to remove a proposal. /// @param id_ proposal id to check whether holder is allowed to remove. /// @param sender_ address of the holder. /// @return bool true if removal is allowed. function canRemove(uint256 id_, address sender_) external view returns (bool); /// @notice Whether a holder is allowed to execute a proposal. /// @param id_ proposal id to check whether holder is allowed to execute. /// @param sender_ address of the holder. /// @return bool true if execution is allowed. function canExecute(uint256 id_, address sender_) external view returns (bool); /// @notice Whether a holder is an admin. /// @param sender_ address of holder. /// @return bool true if holder is an admin (in DAO without admins all holders are treated as such). function isAdmin(address sender_) external view returns (bool); // Public transactions. /// @notice Saves new holdings addresses for DAO. /// @param tokens_ token addresses that DAO has holdings of. function addHoldingsAddresses(address[] calldata tokens_) external; /// @notice Saves new liquidity addresses for DAO. /// @param tokens_ token addresses that DAO has liquidities of. function addLiquidityAddresses(address[] calldata tokens_) external; /// @notice Creates new proposal. /// @param proposalAddress_ main address of the proposal, in investment proposals this is the address funds are sent to. /// @param investTokenAddress_ secondary address of the proposal, used in investment proposals to specify token address. /// @param daoFunction_ type of the proposal. /// @param amount_ amount of funds to use in the proposal. /// @param hoursLifetime_ voting lifetime of the proposal. function propose(address proposalAddress_, address investTokenAddress_, DaoFunction daoFunction_, uint256 amount_, uint256 hoursLifetime_) external; /// @notice Removes existing proposal. /// @param id_ id of proposal to remove. function unpropose(uint256 id_) external; /// @notice Voting for multiple proposals. /// @param ids_ ids of proposals to vote for. /// @param votes_ for or against votes for proposals. function vote(uint256[] calldata ids_, bool[] calldata votes_) external; /// @notice Executes a proposal. /// @param id_ id of proposal to be executed. function execute(uint256 id_) external; /// @notice Buying tokens for cloned DAO. function buy() external payable; /// @notice Sell tokens back to cloned DAO. /// @param amount_ amount of tokens to sell. function sell(uint256 amount_) external; // Owner transactions. /// @notice Sets factory address. /// @param factory_ address of TorroFactory. function setFactoryAddress(address factory_) external; /// @notice Sets vote weight divider. /// @param weight_ weight divider for a single vote. function setVoteWeightDivider(uint256 weight_) external; /// @notice Sets new address for router. /// @param router_ address for router. function setRouter(address router_) external; /// @notice Sets divider for BUY, INVEST, WITHDAW proposals. /// @param divider_ divider for BUY, INVEST, WITHDRAW proposals. function setSpendDivider(uint256 divider_) external; /// @notice Migrates balances of current DAO to a new DAO. /// @param newDao_ address of the new DAO to migrate to. function migrate(address newDao_) external; }
/// @title DAO for proposals, voting and execution. /// @notice Interface for creation, voting and execution of proposals. /// @author ORayskiy - @robitnik_TorroDao
NatSpecSingleLine
liquidityHoldings
function liquidityHoldings() external view returns (address[] memory, address[] memory);
/// @notice Gets tokens and liquidity token addresses of DAO's liquidity holdings. /// @return Arrays of tokens and liquidity tokens, should have the same length.
NatSpecSingleLine
v0.6.6+commit.6c089d02
Unknown
ipfs://d1c6095fcf143d951c9754f00fe8cd59d29ab460461efe53b91eb289fd0fe5ac
{ "func_code_index": [ 2638, 2729 ] }
57,692
TorroDao
ITorroDao.sol
0x3cf9e9d45380b6ab61bde46b2e6cfcd7d8f6cdc1
Solidity
ITorroDao
interface ITorroDao { // Enums. /// @notice Enum of available proposal functions. enum DaoFunction { BUY, SELL, ADD_LIQUIDITY, REMOVE_LIQUIDITY, ADD_ADMIN, REMOVE_ADMIN, INVEST, WITHDRAW } // Initializer. /// @notice Initializer for DAO clones. /// @param torroToken_ main torro token address. /// @param governingToken_ torro token clone that's governing this dao. /// @param factory_ torro factory address. /// @param creator_ creator of cloned DAO. /// @param maxCost_ maximum cost of all governing tokens for cloned DAO. /// @param executeMinPct_ minimum percentage of votes needed for proposal execution. /// @param votingMinHours_ minimum lifetime of proposal before it closes. /// @param isPublic_ whether cloned DAO has public visibility. /// @param hasAdmins_ whether cloned DAO has admins, otherwise all stakers are treated as admins. function initializeCustom( address torroToken_, address governingToken_, address factory_, address creator_, uint256 maxCost_, uint256 executeMinPct_, uint256 votingMinHours_, bool isPublic_, bool hasAdmins_ ) external; // Public calls. /// @notice Address of DAO creator. /// @return DAO creator address. function daoCreator() external view returns (address); /// @notice Amount of tokens needed for a single vote. /// @return uint256 token amount. function voteWeight() external view returns (uint256); /// @notice Amount of votes that holder has. /// @param sender_ address of the holder. /// @return number of votes. function votesOf(address sender_) external view returns (uint256); /// @notice Address of the governing token. /// @return address of the governing token. function tokenAddress() external view returns (address); /// @notice Saved addresses of tokens that DAO is holding. /// @return array of holdings addresses. function holdings() external view returns (address[] memory); /// @notice Saved addresses of liquidity tokens that DAO is holding. /// @return array of liquidity addresses. function liquidities() external view returns (address[] memory); /// @notice Calculates address of liquidity token from ERC-20 token address. /// @param token_ token address to calculate liquidity address from. /// @return address of liquidity token. function liquidityToken(address token_) external view returns (address); /// @notice Gets tokens and liquidity token addresses of DAO's liquidity holdings. /// @return Arrays of tokens and liquidity tokens, should have the same length. function liquidityHoldings() external view returns (address[] memory, address[] memory); /// @notice DAO admins. /// @return Array of admin addresses. function admins() external view returns (address[] memory); /// @notice DAO balance for specified token. /// @param token_ token address to get balance for. /// @return uint256 token balance. function tokenBalance(address token_) external view returns (uint256); /// @notice DAO balance for liquidity token. /// @param token_ token address to get liquidity balance for. /// @return uin256 token liquidity balance. function liquidityBalance(address token_) external view returns (uint256); /// @notice DAO ethereum balance. /// @return uint256 wei balance. function availableBalance() external view returns (uint256); /// @notice Maximum cost for all tokens of cloned DAO. /// @return uint256 maximum cost in wei. function maxCost() external view returns (uint256); /// @notice Minimum percentage of votes needed to execute a proposal. /// @return uint256 minimum percentage of votes. function executeMinPct() external view returns (uint256); /// @notice Minimum lifetime of proposal before it closes. /// @return uint256 minimum number of hours for proposal lifetime. function votingMinHours() external view returns (uint256); /// @notice Whether DAO is public or private. /// @return bool true if public. function isPublic() external view returns (bool); /// @notice Whether DAO has admins. /// @return bool true if DAO has admins. function hasAdmins() external view returns (bool); /// @notice Proposal ids of DAO. /// @return array of proposal ids. function getProposalIds() external view returns (uint256[] memory); /// @notice Gets proposal info for proposal id. /// @param id_ id of proposal to get info for. /// @return proposalAddress address for proposal execution. /// @return investTokenAddress secondary address for proposal execution, used for investment proposals if ICO and token addresses differ. /// @return daoFunction proposal type. /// @return amount proposal amount eth/token to use during execution. /// @return creator address of proposal creator. /// @return endLifetime epoch time when proposal voting ends. /// @return votesFor amount of votes for the proposal. /// @return votesAgainst amount of votes against the proposal. /// @return executed whether proposal has been executed or not. function getProposal(uint256 id_) external view returns ( address proposalAddress, address investTokenAddress, DaoFunction daoFunction, uint256 amount, address creator, uint256 endLifetime, uint256 votesFor, uint256 votesAgainst, bool executed ); /// @notice Whether a holder is allowed to vote for a proposal. /// @param id_ proposal id to check whether holder is allowed to vote for. /// @param sender_ address of the holder. /// @return bool true if voting is allowed. function canVote(uint256 id_, address sender_) external view returns (bool); /// @notice Whether a holder is allowed to remove a proposal. /// @param id_ proposal id to check whether holder is allowed to remove. /// @param sender_ address of the holder. /// @return bool true if removal is allowed. function canRemove(uint256 id_, address sender_) external view returns (bool); /// @notice Whether a holder is allowed to execute a proposal. /// @param id_ proposal id to check whether holder is allowed to execute. /// @param sender_ address of the holder. /// @return bool true if execution is allowed. function canExecute(uint256 id_, address sender_) external view returns (bool); /// @notice Whether a holder is an admin. /// @param sender_ address of holder. /// @return bool true if holder is an admin (in DAO without admins all holders are treated as such). function isAdmin(address sender_) external view returns (bool); // Public transactions. /// @notice Saves new holdings addresses for DAO. /// @param tokens_ token addresses that DAO has holdings of. function addHoldingsAddresses(address[] calldata tokens_) external; /// @notice Saves new liquidity addresses for DAO. /// @param tokens_ token addresses that DAO has liquidities of. function addLiquidityAddresses(address[] calldata tokens_) external; /// @notice Creates new proposal. /// @param proposalAddress_ main address of the proposal, in investment proposals this is the address funds are sent to. /// @param investTokenAddress_ secondary address of the proposal, used in investment proposals to specify token address. /// @param daoFunction_ type of the proposal. /// @param amount_ amount of funds to use in the proposal. /// @param hoursLifetime_ voting lifetime of the proposal. function propose(address proposalAddress_, address investTokenAddress_, DaoFunction daoFunction_, uint256 amount_, uint256 hoursLifetime_) external; /// @notice Removes existing proposal. /// @param id_ id of proposal to remove. function unpropose(uint256 id_) external; /// @notice Voting for multiple proposals. /// @param ids_ ids of proposals to vote for. /// @param votes_ for or against votes for proposals. function vote(uint256[] calldata ids_, bool[] calldata votes_) external; /// @notice Executes a proposal. /// @param id_ id of proposal to be executed. function execute(uint256 id_) external; /// @notice Buying tokens for cloned DAO. function buy() external payable; /// @notice Sell tokens back to cloned DAO. /// @param amount_ amount of tokens to sell. function sell(uint256 amount_) external; // Owner transactions. /// @notice Sets factory address. /// @param factory_ address of TorroFactory. function setFactoryAddress(address factory_) external; /// @notice Sets vote weight divider. /// @param weight_ weight divider for a single vote. function setVoteWeightDivider(uint256 weight_) external; /// @notice Sets new address for router. /// @param router_ address for router. function setRouter(address router_) external; /// @notice Sets divider for BUY, INVEST, WITHDAW proposals. /// @param divider_ divider for BUY, INVEST, WITHDRAW proposals. function setSpendDivider(uint256 divider_) external; /// @notice Migrates balances of current DAO to a new DAO. /// @param newDao_ address of the new DAO to migrate to. function migrate(address newDao_) external; }
/// @title DAO for proposals, voting and execution. /// @notice Interface for creation, voting and execution of proposals. /// @author ORayskiy - @robitnik_TorroDao
NatSpecSingleLine
admins
function admins() external view returns (address[] memory);
/// @notice DAO admins. /// @return Array of admin addresses.
NatSpecSingleLine
v0.6.6+commit.6c089d02
Unknown
ipfs://d1c6095fcf143d951c9754f00fe8cd59d29ab460461efe53b91eb289fd0fe5ac
{ "func_code_index": [ 2800, 2862 ] }
57,693
TorroDao
ITorroDao.sol
0x3cf9e9d45380b6ab61bde46b2e6cfcd7d8f6cdc1
Solidity
ITorroDao
interface ITorroDao { // Enums. /// @notice Enum of available proposal functions. enum DaoFunction { BUY, SELL, ADD_LIQUIDITY, REMOVE_LIQUIDITY, ADD_ADMIN, REMOVE_ADMIN, INVEST, WITHDRAW } // Initializer. /// @notice Initializer for DAO clones. /// @param torroToken_ main torro token address. /// @param governingToken_ torro token clone that's governing this dao. /// @param factory_ torro factory address. /// @param creator_ creator of cloned DAO. /// @param maxCost_ maximum cost of all governing tokens for cloned DAO. /// @param executeMinPct_ minimum percentage of votes needed for proposal execution. /// @param votingMinHours_ minimum lifetime of proposal before it closes. /// @param isPublic_ whether cloned DAO has public visibility. /// @param hasAdmins_ whether cloned DAO has admins, otherwise all stakers are treated as admins. function initializeCustom( address torroToken_, address governingToken_, address factory_, address creator_, uint256 maxCost_, uint256 executeMinPct_, uint256 votingMinHours_, bool isPublic_, bool hasAdmins_ ) external; // Public calls. /// @notice Address of DAO creator. /// @return DAO creator address. function daoCreator() external view returns (address); /// @notice Amount of tokens needed for a single vote. /// @return uint256 token amount. function voteWeight() external view returns (uint256); /// @notice Amount of votes that holder has. /// @param sender_ address of the holder. /// @return number of votes. function votesOf(address sender_) external view returns (uint256); /// @notice Address of the governing token. /// @return address of the governing token. function tokenAddress() external view returns (address); /// @notice Saved addresses of tokens that DAO is holding. /// @return array of holdings addresses. function holdings() external view returns (address[] memory); /// @notice Saved addresses of liquidity tokens that DAO is holding. /// @return array of liquidity addresses. function liquidities() external view returns (address[] memory); /// @notice Calculates address of liquidity token from ERC-20 token address. /// @param token_ token address to calculate liquidity address from. /// @return address of liquidity token. function liquidityToken(address token_) external view returns (address); /// @notice Gets tokens and liquidity token addresses of DAO's liquidity holdings. /// @return Arrays of tokens and liquidity tokens, should have the same length. function liquidityHoldings() external view returns (address[] memory, address[] memory); /// @notice DAO admins. /// @return Array of admin addresses. function admins() external view returns (address[] memory); /// @notice DAO balance for specified token. /// @param token_ token address to get balance for. /// @return uint256 token balance. function tokenBalance(address token_) external view returns (uint256); /// @notice DAO balance for liquidity token. /// @param token_ token address to get liquidity balance for. /// @return uin256 token liquidity balance. function liquidityBalance(address token_) external view returns (uint256); /// @notice DAO ethereum balance. /// @return uint256 wei balance. function availableBalance() external view returns (uint256); /// @notice Maximum cost for all tokens of cloned DAO. /// @return uint256 maximum cost in wei. function maxCost() external view returns (uint256); /// @notice Minimum percentage of votes needed to execute a proposal. /// @return uint256 minimum percentage of votes. function executeMinPct() external view returns (uint256); /// @notice Minimum lifetime of proposal before it closes. /// @return uint256 minimum number of hours for proposal lifetime. function votingMinHours() external view returns (uint256); /// @notice Whether DAO is public or private. /// @return bool true if public. function isPublic() external view returns (bool); /// @notice Whether DAO has admins. /// @return bool true if DAO has admins. function hasAdmins() external view returns (bool); /// @notice Proposal ids of DAO. /// @return array of proposal ids. function getProposalIds() external view returns (uint256[] memory); /// @notice Gets proposal info for proposal id. /// @param id_ id of proposal to get info for. /// @return proposalAddress address for proposal execution. /// @return investTokenAddress secondary address for proposal execution, used for investment proposals if ICO and token addresses differ. /// @return daoFunction proposal type. /// @return amount proposal amount eth/token to use during execution. /// @return creator address of proposal creator. /// @return endLifetime epoch time when proposal voting ends. /// @return votesFor amount of votes for the proposal. /// @return votesAgainst amount of votes against the proposal. /// @return executed whether proposal has been executed or not. function getProposal(uint256 id_) external view returns ( address proposalAddress, address investTokenAddress, DaoFunction daoFunction, uint256 amount, address creator, uint256 endLifetime, uint256 votesFor, uint256 votesAgainst, bool executed ); /// @notice Whether a holder is allowed to vote for a proposal. /// @param id_ proposal id to check whether holder is allowed to vote for. /// @param sender_ address of the holder. /// @return bool true if voting is allowed. function canVote(uint256 id_, address sender_) external view returns (bool); /// @notice Whether a holder is allowed to remove a proposal. /// @param id_ proposal id to check whether holder is allowed to remove. /// @param sender_ address of the holder. /// @return bool true if removal is allowed. function canRemove(uint256 id_, address sender_) external view returns (bool); /// @notice Whether a holder is allowed to execute a proposal. /// @param id_ proposal id to check whether holder is allowed to execute. /// @param sender_ address of the holder. /// @return bool true if execution is allowed. function canExecute(uint256 id_, address sender_) external view returns (bool); /// @notice Whether a holder is an admin. /// @param sender_ address of holder. /// @return bool true if holder is an admin (in DAO without admins all holders are treated as such). function isAdmin(address sender_) external view returns (bool); // Public transactions. /// @notice Saves new holdings addresses for DAO. /// @param tokens_ token addresses that DAO has holdings of. function addHoldingsAddresses(address[] calldata tokens_) external; /// @notice Saves new liquidity addresses for DAO. /// @param tokens_ token addresses that DAO has liquidities of. function addLiquidityAddresses(address[] calldata tokens_) external; /// @notice Creates new proposal. /// @param proposalAddress_ main address of the proposal, in investment proposals this is the address funds are sent to. /// @param investTokenAddress_ secondary address of the proposal, used in investment proposals to specify token address. /// @param daoFunction_ type of the proposal. /// @param amount_ amount of funds to use in the proposal. /// @param hoursLifetime_ voting lifetime of the proposal. function propose(address proposalAddress_, address investTokenAddress_, DaoFunction daoFunction_, uint256 amount_, uint256 hoursLifetime_) external; /// @notice Removes existing proposal. /// @param id_ id of proposal to remove. function unpropose(uint256 id_) external; /// @notice Voting for multiple proposals. /// @param ids_ ids of proposals to vote for. /// @param votes_ for or against votes for proposals. function vote(uint256[] calldata ids_, bool[] calldata votes_) external; /// @notice Executes a proposal. /// @param id_ id of proposal to be executed. function execute(uint256 id_) external; /// @notice Buying tokens for cloned DAO. function buy() external payable; /// @notice Sell tokens back to cloned DAO. /// @param amount_ amount of tokens to sell. function sell(uint256 amount_) external; // Owner transactions. /// @notice Sets factory address. /// @param factory_ address of TorroFactory. function setFactoryAddress(address factory_) external; /// @notice Sets vote weight divider. /// @param weight_ weight divider for a single vote. function setVoteWeightDivider(uint256 weight_) external; /// @notice Sets new address for router. /// @param router_ address for router. function setRouter(address router_) external; /// @notice Sets divider for BUY, INVEST, WITHDAW proposals. /// @param divider_ divider for BUY, INVEST, WITHDRAW proposals. function setSpendDivider(uint256 divider_) external; /// @notice Migrates balances of current DAO to a new DAO. /// @param newDao_ address of the new DAO to migrate to. function migrate(address newDao_) external; }
/// @title DAO for proposals, voting and execution. /// @notice Interface for creation, voting and execution of proposals. /// @author ORayskiy - @robitnik_TorroDao
NatSpecSingleLine
tokenBalance
function tokenBalance(address token_) external view returns (uint256);
/// @notice DAO balance for specified token. /// @param token_ token address to get balance for. /// @return uint256 token balance.
NatSpecSingleLine
v0.6.6+commit.6c089d02
Unknown
ipfs://d1c6095fcf143d951c9754f00fe8cd59d29ab460461efe53b91eb289fd0fe5ac
{ "func_code_index": [ 3006, 3079 ] }
57,694
TorroDao
ITorroDao.sol
0x3cf9e9d45380b6ab61bde46b2e6cfcd7d8f6cdc1
Solidity
ITorroDao
interface ITorroDao { // Enums. /// @notice Enum of available proposal functions. enum DaoFunction { BUY, SELL, ADD_LIQUIDITY, REMOVE_LIQUIDITY, ADD_ADMIN, REMOVE_ADMIN, INVEST, WITHDRAW } // Initializer. /// @notice Initializer for DAO clones. /// @param torroToken_ main torro token address. /// @param governingToken_ torro token clone that's governing this dao. /// @param factory_ torro factory address. /// @param creator_ creator of cloned DAO. /// @param maxCost_ maximum cost of all governing tokens for cloned DAO. /// @param executeMinPct_ minimum percentage of votes needed for proposal execution. /// @param votingMinHours_ minimum lifetime of proposal before it closes. /// @param isPublic_ whether cloned DAO has public visibility. /// @param hasAdmins_ whether cloned DAO has admins, otherwise all stakers are treated as admins. function initializeCustom( address torroToken_, address governingToken_, address factory_, address creator_, uint256 maxCost_, uint256 executeMinPct_, uint256 votingMinHours_, bool isPublic_, bool hasAdmins_ ) external; // Public calls. /// @notice Address of DAO creator. /// @return DAO creator address. function daoCreator() external view returns (address); /// @notice Amount of tokens needed for a single vote. /// @return uint256 token amount. function voteWeight() external view returns (uint256); /// @notice Amount of votes that holder has. /// @param sender_ address of the holder. /// @return number of votes. function votesOf(address sender_) external view returns (uint256); /// @notice Address of the governing token. /// @return address of the governing token. function tokenAddress() external view returns (address); /// @notice Saved addresses of tokens that DAO is holding. /// @return array of holdings addresses. function holdings() external view returns (address[] memory); /// @notice Saved addresses of liquidity tokens that DAO is holding. /// @return array of liquidity addresses. function liquidities() external view returns (address[] memory); /// @notice Calculates address of liquidity token from ERC-20 token address. /// @param token_ token address to calculate liquidity address from. /// @return address of liquidity token. function liquidityToken(address token_) external view returns (address); /// @notice Gets tokens and liquidity token addresses of DAO's liquidity holdings. /// @return Arrays of tokens and liquidity tokens, should have the same length. function liquidityHoldings() external view returns (address[] memory, address[] memory); /// @notice DAO admins. /// @return Array of admin addresses. function admins() external view returns (address[] memory); /// @notice DAO balance for specified token. /// @param token_ token address to get balance for. /// @return uint256 token balance. function tokenBalance(address token_) external view returns (uint256); /// @notice DAO balance for liquidity token. /// @param token_ token address to get liquidity balance for. /// @return uin256 token liquidity balance. function liquidityBalance(address token_) external view returns (uint256); /// @notice DAO ethereum balance. /// @return uint256 wei balance. function availableBalance() external view returns (uint256); /// @notice Maximum cost for all tokens of cloned DAO. /// @return uint256 maximum cost in wei. function maxCost() external view returns (uint256); /// @notice Minimum percentage of votes needed to execute a proposal. /// @return uint256 minimum percentage of votes. function executeMinPct() external view returns (uint256); /// @notice Minimum lifetime of proposal before it closes. /// @return uint256 minimum number of hours for proposal lifetime. function votingMinHours() external view returns (uint256); /// @notice Whether DAO is public or private. /// @return bool true if public. function isPublic() external view returns (bool); /// @notice Whether DAO has admins. /// @return bool true if DAO has admins. function hasAdmins() external view returns (bool); /// @notice Proposal ids of DAO. /// @return array of proposal ids. function getProposalIds() external view returns (uint256[] memory); /// @notice Gets proposal info for proposal id. /// @param id_ id of proposal to get info for. /// @return proposalAddress address for proposal execution. /// @return investTokenAddress secondary address for proposal execution, used for investment proposals if ICO and token addresses differ. /// @return daoFunction proposal type. /// @return amount proposal amount eth/token to use during execution. /// @return creator address of proposal creator. /// @return endLifetime epoch time when proposal voting ends. /// @return votesFor amount of votes for the proposal. /// @return votesAgainst amount of votes against the proposal. /// @return executed whether proposal has been executed or not. function getProposal(uint256 id_) external view returns ( address proposalAddress, address investTokenAddress, DaoFunction daoFunction, uint256 amount, address creator, uint256 endLifetime, uint256 votesFor, uint256 votesAgainst, bool executed ); /// @notice Whether a holder is allowed to vote for a proposal. /// @param id_ proposal id to check whether holder is allowed to vote for. /// @param sender_ address of the holder. /// @return bool true if voting is allowed. function canVote(uint256 id_, address sender_) external view returns (bool); /// @notice Whether a holder is allowed to remove a proposal. /// @param id_ proposal id to check whether holder is allowed to remove. /// @param sender_ address of the holder. /// @return bool true if removal is allowed. function canRemove(uint256 id_, address sender_) external view returns (bool); /// @notice Whether a holder is allowed to execute a proposal. /// @param id_ proposal id to check whether holder is allowed to execute. /// @param sender_ address of the holder. /// @return bool true if execution is allowed. function canExecute(uint256 id_, address sender_) external view returns (bool); /// @notice Whether a holder is an admin. /// @param sender_ address of holder. /// @return bool true if holder is an admin (in DAO without admins all holders are treated as such). function isAdmin(address sender_) external view returns (bool); // Public transactions. /// @notice Saves new holdings addresses for DAO. /// @param tokens_ token addresses that DAO has holdings of. function addHoldingsAddresses(address[] calldata tokens_) external; /// @notice Saves new liquidity addresses for DAO. /// @param tokens_ token addresses that DAO has liquidities of. function addLiquidityAddresses(address[] calldata tokens_) external; /// @notice Creates new proposal. /// @param proposalAddress_ main address of the proposal, in investment proposals this is the address funds are sent to. /// @param investTokenAddress_ secondary address of the proposal, used in investment proposals to specify token address. /// @param daoFunction_ type of the proposal. /// @param amount_ amount of funds to use in the proposal. /// @param hoursLifetime_ voting lifetime of the proposal. function propose(address proposalAddress_, address investTokenAddress_, DaoFunction daoFunction_, uint256 amount_, uint256 hoursLifetime_) external; /// @notice Removes existing proposal. /// @param id_ id of proposal to remove. function unpropose(uint256 id_) external; /// @notice Voting for multiple proposals. /// @param ids_ ids of proposals to vote for. /// @param votes_ for or against votes for proposals. function vote(uint256[] calldata ids_, bool[] calldata votes_) external; /// @notice Executes a proposal. /// @param id_ id of proposal to be executed. function execute(uint256 id_) external; /// @notice Buying tokens for cloned DAO. function buy() external payable; /// @notice Sell tokens back to cloned DAO. /// @param amount_ amount of tokens to sell. function sell(uint256 amount_) external; // Owner transactions. /// @notice Sets factory address. /// @param factory_ address of TorroFactory. function setFactoryAddress(address factory_) external; /// @notice Sets vote weight divider. /// @param weight_ weight divider for a single vote. function setVoteWeightDivider(uint256 weight_) external; /// @notice Sets new address for router. /// @param router_ address for router. function setRouter(address router_) external; /// @notice Sets divider for BUY, INVEST, WITHDAW proposals. /// @param divider_ divider for BUY, INVEST, WITHDRAW proposals. function setSpendDivider(uint256 divider_) external; /// @notice Migrates balances of current DAO to a new DAO. /// @param newDao_ address of the new DAO to migrate to. function migrate(address newDao_) external; }
/// @title DAO for proposals, voting and execution. /// @notice Interface for creation, voting and execution of proposals. /// @author ORayskiy - @robitnik_TorroDao
NatSpecSingleLine
liquidityBalance
function liquidityBalance(address token_) external view returns (uint256);
/// @notice DAO balance for liquidity token. /// @param token_ token address to get liquidity balance for. /// @return uin256 token liquidity balance.
NatSpecSingleLine
v0.6.6+commit.6c089d02
Unknown
ipfs://d1c6095fcf143d951c9754f00fe8cd59d29ab460461efe53b91eb289fd0fe5ac
{ "func_code_index": [ 3242, 3319 ] }
57,695
TorroDao
ITorroDao.sol
0x3cf9e9d45380b6ab61bde46b2e6cfcd7d8f6cdc1
Solidity
ITorroDao
interface ITorroDao { // Enums. /// @notice Enum of available proposal functions. enum DaoFunction { BUY, SELL, ADD_LIQUIDITY, REMOVE_LIQUIDITY, ADD_ADMIN, REMOVE_ADMIN, INVEST, WITHDRAW } // Initializer. /// @notice Initializer for DAO clones. /// @param torroToken_ main torro token address. /// @param governingToken_ torro token clone that's governing this dao. /// @param factory_ torro factory address. /// @param creator_ creator of cloned DAO. /// @param maxCost_ maximum cost of all governing tokens for cloned DAO. /// @param executeMinPct_ minimum percentage of votes needed for proposal execution. /// @param votingMinHours_ minimum lifetime of proposal before it closes. /// @param isPublic_ whether cloned DAO has public visibility. /// @param hasAdmins_ whether cloned DAO has admins, otherwise all stakers are treated as admins. function initializeCustom( address torroToken_, address governingToken_, address factory_, address creator_, uint256 maxCost_, uint256 executeMinPct_, uint256 votingMinHours_, bool isPublic_, bool hasAdmins_ ) external; // Public calls. /// @notice Address of DAO creator. /// @return DAO creator address. function daoCreator() external view returns (address); /// @notice Amount of tokens needed for a single vote. /// @return uint256 token amount. function voteWeight() external view returns (uint256); /// @notice Amount of votes that holder has. /// @param sender_ address of the holder. /// @return number of votes. function votesOf(address sender_) external view returns (uint256); /// @notice Address of the governing token. /// @return address of the governing token. function tokenAddress() external view returns (address); /// @notice Saved addresses of tokens that DAO is holding. /// @return array of holdings addresses. function holdings() external view returns (address[] memory); /// @notice Saved addresses of liquidity tokens that DAO is holding. /// @return array of liquidity addresses. function liquidities() external view returns (address[] memory); /// @notice Calculates address of liquidity token from ERC-20 token address. /// @param token_ token address to calculate liquidity address from. /// @return address of liquidity token. function liquidityToken(address token_) external view returns (address); /// @notice Gets tokens and liquidity token addresses of DAO's liquidity holdings. /// @return Arrays of tokens and liquidity tokens, should have the same length. function liquidityHoldings() external view returns (address[] memory, address[] memory); /// @notice DAO admins. /// @return Array of admin addresses. function admins() external view returns (address[] memory); /// @notice DAO balance for specified token. /// @param token_ token address to get balance for. /// @return uint256 token balance. function tokenBalance(address token_) external view returns (uint256); /// @notice DAO balance for liquidity token. /// @param token_ token address to get liquidity balance for. /// @return uin256 token liquidity balance. function liquidityBalance(address token_) external view returns (uint256); /// @notice DAO ethereum balance. /// @return uint256 wei balance. function availableBalance() external view returns (uint256); /// @notice Maximum cost for all tokens of cloned DAO. /// @return uint256 maximum cost in wei. function maxCost() external view returns (uint256); /// @notice Minimum percentage of votes needed to execute a proposal. /// @return uint256 minimum percentage of votes. function executeMinPct() external view returns (uint256); /// @notice Minimum lifetime of proposal before it closes. /// @return uint256 minimum number of hours for proposal lifetime. function votingMinHours() external view returns (uint256); /// @notice Whether DAO is public or private. /// @return bool true if public. function isPublic() external view returns (bool); /// @notice Whether DAO has admins. /// @return bool true if DAO has admins. function hasAdmins() external view returns (bool); /// @notice Proposal ids of DAO. /// @return array of proposal ids. function getProposalIds() external view returns (uint256[] memory); /// @notice Gets proposal info for proposal id. /// @param id_ id of proposal to get info for. /// @return proposalAddress address for proposal execution. /// @return investTokenAddress secondary address for proposal execution, used for investment proposals if ICO and token addresses differ. /// @return daoFunction proposal type. /// @return amount proposal amount eth/token to use during execution. /// @return creator address of proposal creator. /// @return endLifetime epoch time when proposal voting ends. /// @return votesFor amount of votes for the proposal. /// @return votesAgainst amount of votes against the proposal. /// @return executed whether proposal has been executed or not. function getProposal(uint256 id_) external view returns ( address proposalAddress, address investTokenAddress, DaoFunction daoFunction, uint256 amount, address creator, uint256 endLifetime, uint256 votesFor, uint256 votesAgainst, bool executed ); /// @notice Whether a holder is allowed to vote for a proposal. /// @param id_ proposal id to check whether holder is allowed to vote for. /// @param sender_ address of the holder. /// @return bool true if voting is allowed. function canVote(uint256 id_, address sender_) external view returns (bool); /// @notice Whether a holder is allowed to remove a proposal. /// @param id_ proposal id to check whether holder is allowed to remove. /// @param sender_ address of the holder. /// @return bool true if removal is allowed. function canRemove(uint256 id_, address sender_) external view returns (bool); /// @notice Whether a holder is allowed to execute a proposal. /// @param id_ proposal id to check whether holder is allowed to execute. /// @param sender_ address of the holder. /// @return bool true if execution is allowed. function canExecute(uint256 id_, address sender_) external view returns (bool); /// @notice Whether a holder is an admin. /// @param sender_ address of holder. /// @return bool true if holder is an admin (in DAO without admins all holders are treated as such). function isAdmin(address sender_) external view returns (bool); // Public transactions. /// @notice Saves new holdings addresses for DAO. /// @param tokens_ token addresses that DAO has holdings of. function addHoldingsAddresses(address[] calldata tokens_) external; /// @notice Saves new liquidity addresses for DAO. /// @param tokens_ token addresses that DAO has liquidities of. function addLiquidityAddresses(address[] calldata tokens_) external; /// @notice Creates new proposal. /// @param proposalAddress_ main address of the proposal, in investment proposals this is the address funds are sent to. /// @param investTokenAddress_ secondary address of the proposal, used in investment proposals to specify token address. /// @param daoFunction_ type of the proposal. /// @param amount_ amount of funds to use in the proposal. /// @param hoursLifetime_ voting lifetime of the proposal. function propose(address proposalAddress_, address investTokenAddress_, DaoFunction daoFunction_, uint256 amount_, uint256 hoursLifetime_) external; /// @notice Removes existing proposal. /// @param id_ id of proposal to remove. function unpropose(uint256 id_) external; /// @notice Voting for multiple proposals. /// @param ids_ ids of proposals to vote for. /// @param votes_ for or against votes for proposals. function vote(uint256[] calldata ids_, bool[] calldata votes_) external; /// @notice Executes a proposal. /// @param id_ id of proposal to be executed. function execute(uint256 id_) external; /// @notice Buying tokens for cloned DAO. function buy() external payable; /// @notice Sell tokens back to cloned DAO. /// @param amount_ amount of tokens to sell. function sell(uint256 amount_) external; // Owner transactions. /// @notice Sets factory address. /// @param factory_ address of TorroFactory. function setFactoryAddress(address factory_) external; /// @notice Sets vote weight divider. /// @param weight_ weight divider for a single vote. function setVoteWeightDivider(uint256 weight_) external; /// @notice Sets new address for router. /// @param router_ address for router. function setRouter(address router_) external; /// @notice Sets divider for BUY, INVEST, WITHDAW proposals. /// @param divider_ divider for BUY, INVEST, WITHDRAW proposals. function setSpendDivider(uint256 divider_) external; /// @notice Migrates balances of current DAO to a new DAO. /// @param newDao_ address of the new DAO to migrate to. function migrate(address newDao_) external; }
/// @title DAO for proposals, voting and execution. /// @notice Interface for creation, voting and execution of proposals. /// @author ORayskiy - @robitnik_TorroDao
NatSpecSingleLine
availableBalance
function availableBalance() external view returns (uint256);
/// @notice DAO ethereum balance. /// @return uint256 wei balance.
NatSpecSingleLine
v0.6.6+commit.6c089d02
Unknown
ipfs://d1c6095fcf143d951c9754f00fe8cd59d29ab460461efe53b91eb289fd0fe5ac
{ "func_code_index": [ 3395, 3458 ] }
57,696
TorroDao
ITorroDao.sol
0x3cf9e9d45380b6ab61bde46b2e6cfcd7d8f6cdc1
Solidity
ITorroDao
interface ITorroDao { // Enums. /// @notice Enum of available proposal functions. enum DaoFunction { BUY, SELL, ADD_LIQUIDITY, REMOVE_LIQUIDITY, ADD_ADMIN, REMOVE_ADMIN, INVEST, WITHDRAW } // Initializer. /// @notice Initializer for DAO clones. /// @param torroToken_ main torro token address. /// @param governingToken_ torro token clone that's governing this dao. /// @param factory_ torro factory address. /// @param creator_ creator of cloned DAO. /// @param maxCost_ maximum cost of all governing tokens for cloned DAO. /// @param executeMinPct_ minimum percentage of votes needed for proposal execution. /// @param votingMinHours_ minimum lifetime of proposal before it closes. /// @param isPublic_ whether cloned DAO has public visibility. /// @param hasAdmins_ whether cloned DAO has admins, otherwise all stakers are treated as admins. function initializeCustom( address torroToken_, address governingToken_, address factory_, address creator_, uint256 maxCost_, uint256 executeMinPct_, uint256 votingMinHours_, bool isPublic_, bool hasAdmins_ ) external; // Public calls. /// @notice Address of DAO creator. /// @return DAO creator address. function daoCreator() external view returns (address); /// @notice Amount of tokens needed for a single vote. /// @return uint256 token amount. function voteWeight() external view returns (uint256); /// @notice Amount of votes that holder has. /// @param sender_ address of the holder. /// @return number of votes. function votesOf(address sender_) external view returns (uint256); /// @notice Address of the governing token. /// @return address of the governing token. function tokenAddress() external view returns (address); /// @notice Saved addresses of tokens that DAO is holding. /// @return array of holdings addresses. function holdings() external view returns (address[] memory); /// @notice Saved addresses of liquidity tokens that DAO is holding. /// @return array of liquidity addresses. function liquidities() external view returns (address[] memory); /// @notice Calculates address of liquidity token from ERC-20 token address. /// @param token_ token address to calculate liquidity address from. /// @return address of liquidity token. function liquidityToken(address token_) external view returns (address); /// @notice Gets tokens and liquidity token addresses of DAO's liquidity holdings. /// @return Arrays of tokens and liquidity tokens, should have the same length. function liquidityHoldings() external view returns (address[] memory, address[] memory); /// @notice DAO admins. /// @return Array of admin addresses. function admins() external view returns (address[] memory); /// @notice DAO balance for specified token. /// @param token_ token address to get balance for. /// @return uint256 token balance. function tokenBalance(address token_) external view returns (uint256); /// @notice DAO balance for liquidity token. /// @param token_ token address to get liquidity balance for. /// @return uin256 token liquidity balance. function liquidityBalance(address token_) external view returns (uint256); /// @notice DAO ethereum balance. /// @return uint256 wei balance. function availableBalance() external view returns (uint256); /// @notice Maximum cost for all tokens of cloned DAO. /// @return uint256 maximum cost in wei. function maxCost() external view returns (uint256); /// @notice Minimum percentage of votes needed to execute a proposal. /// @return uint256 minimum percentage of votes. function executeMinPct() external view returns (uint256); /// @notice Minimum lifetime of proposal before it closes. /// @return uint256 minimum number of hours for proposal lifetime. function votingMinHours() external view returns (uint256); /// @notice Whether DAO is public or private. /// @return bool true if public. function isPublic() external view returns (bool); /// @notice Whether DAO has admins. /// @return bool true if DAO has admins. function hasAdmins() external view returns (bool); /// @notice Proposal ids of DAO. /// @return array of proposal ids. function getProposalIds() external view returns (uint256[] memory); /// @notice Gets proposal info for proposal id. /// @param id_ id of proposal to get info for. /// @return proposalAddress address for proposal execution. /// @return investTokenAddress secondary address for proposal execution, used for investment proposals if ICO and token addresses differ. /// @return daoFunction proposal type. /// @return amount proposal amount eth/token to use during execution. /// @return creator address of proposal creator. /// @return endLifetime epoch time when proposal voting ends. /// @return votesFor amount of votes for the proposal. /// @return votesAgainst amount of votes against the proposal. /// @return executed whether proposal has been executed or not. function getProposal(uint256 id_) external view returns ( address proposalAddress, address investTokenAddress, DaoFunction daoFunction, uint256 amount, address creator, uint256 endLifetime, uint256 votesFor, uint256 votesAgainst, bool executed ); /// @notice Whether a holder is allowed to vote for a proposal. /// @param id_ proposal id to check whether holder is allowed to vote for. /// @param sender_ address of the holder. /// @return bool true if voting is allowed. function canVote(uint256 id_, address sender_) external view returns (bool); /// @notice Whether a holder is allowed to remove a proposal. /// @param id_ proposal id to check whether holder is allowed to remove. /// @param sender_ address of the holder. /// @return bool true if removal is allowed. function canRemove(uint256 id_, address sender_) external view returns (bool); /// @notice Whether a holder is allowed to execute a proposal. /// @param id_ proposal id to check whether holder is allowed to execute. /// @param sender_ address of the holder. /// @return bool true if execution is allowed. function canExecute(uint256 id_, address sender_) external view returns (bool); /// @notice Whether a holder is an admin. /// @param sender_ address of holder. /// @return bool true if holder is an admin (in DAO without admins all holders are treated as such). function isAdmin(address sender_) external view returns (bool); // Public transactions. /// @notice Saves new holdings addresses for DAO. /// @param tokens_ token addresses that DAO has holdings of. function addHoldingsAddresses(address[] calldata tokens_) external; /// @notice Saves new liquidity addresses for DAO. /// @param tokens_ token addresses that DAO has liquidities of. function addLiquidityAddresses(address[] calldata tokens_) external; /// @notice Creates new proposal. /// @param proposalAddress_ main address of the proposal, in investment proposals this is the address funds are sent to. /// @param investTokenAddress_ secondary address of the proposal, used in investment proposals to specify token address. /// @param daoFunction_ type of the proposal. /// @param amount_ amount of funds to use in the proposal. /// @param hoursLifetime_ voting lifetime of the proposal. function propose(address proposalAddress_, address investTokenAddress_, DaoFunction daoFunction_, uint256 amount_, uint256 hoursLifetime_) external; /// @notice Removes existing proposal. /// @param id_ id of proposal to remove. function unpropose(uint256 id_) external; /// @notice Voting for multiple proposals. /// @param ids_ ids of proposals to vote for. /// @param votes_ for or against votes for proposals. function vote(uint256[] calldata ids_, bool[] calldata votes_) external; /// @notice Executes a proposal. /// @param id_ id of proposal to be executed. function execute(uint256 id_) external; /// @notice Buying tokens for cloned DAO. function buy() external payable; /// @notice Sell tokens back to cloned DAO. /// @param amount_ amount of tokens to sell. function sell(uint256 amount_) external; // Owner transactions. /// @notice Sets factory address. /// @param factory_ address of TorroFactory. function setFactoryAddress(address factory_) external; /// @notice Sets vote weight divider. /// @param weight_ weight divider for a single vote. function setVoteWeightDivider(uint256 weight_) external; /// @notice Sets new address for router. /// @param router_ address for router. function setRouter(address router_) external; /// @notice Sets divider for BUY, INVEST, WITHDAW proposals. /// @param divider_ divider for BUY, INVEST, WITHDRAW proposals. function setSpendDivider(uint256 divider_) external; /// @notice Migrates balances of current DAO to a new DAO. /// @param newDao_ address of the new DAO to migrate to. function migrate(address newDao_) external; }
/// @title DAO for proposals, voting and execution. /// @notice Interface for creation, voting and execution of proposals. /// @author ORayskiy - @robitnik_TorroDao
NatSpecSingleLine
maxCost
function maxCost() external view returns (uint256);
/// @notice Maximum cost for all tokens of cloned DAO. /// @return uint256 maximum cost in wei.
NatSpecSingleLine
v0.6.6+commit.6c089d02
Unknown
ipfs://d1c6095fcf143d951c9754f00fe8cd59d29ab460461efe53b91eb289fd0fe5ac
{ "func_code_index": [ 3563, 3617 ] }
57,697
TorroDao
ITorroDao.sol
0x3cf9e9d45380b6ab61bde46b2e6cfcd7d8f6cdc1
Solidity
ITorroDao
interface ITorroDao { // Enums. /// @notice Enum of available proposal functions. enum DaoFunction { BUY, SELL, ADD_LIQUIDITY, REMOVE_LIQUIDITY, ADD_ADMIN, REMOVE_ADMIN, INVEST, WITHDRAW } // Initializer. /// @notice Initializer for DAO clones. /// @param torroToken_ main torro token address. /// @param governingToken_ torro token clone that's governing this dao. /// @param factory_ torro factory address. /// @param creator_ creator of cloned DAO. /// @param maxCost_ maximum cost of all governing tokens for cloned DAO. /// @param executeMinPct_ minimum percentage of votes needed for proposal execution. /// @param votingMinHours_ minimum lifetime of proposal before it closes. /// @param isPublic_ whether cloned DAO has public visibility. /// @param hasAdmins_ whether cloned DAO has admins, otherwise all stakers are treated as admins. function initializeCustom( address torroToken_, address governingToken_, address factory_, address creator_, uint256 maxCost_, uint256 executeMinPct_, uint256 votingMinHours_, bool isPublic_, bool hasAdmins_ ) external; // Public calls. /// @notice Address of DAO creator. /// @return DAO creator address. function daoCreator() external view returns (address); /// @notice Amount of tokens needed for a single vote. /// @return uint256 token amount. function voteWeight() external view returns (uint256); /// @notice Amount of votes that holder has. /// @param sender_ address of the holder. /// @return number of votes. function votesOf(address sender_) external view returns (uint256); /// @notice Address of the governing token. /// @return address of the governing token. function tokenAddress() external view returns (address); /// @notice Saved addresses of tokens that DAO is holding. /// @return array of holdings addresses. function holdings() external view returns (address[] memory); /// @notice Saved addresses of liquidity tokens that DAO is holding. /// @return array of liquidity addresses. function liquidities() external view returns (address[] memory); /// @notice Calculates address of liquidity token from ERC-20 token address. /// @param token_ token address to calculate liquidity address from. /// @return address of liquidity token. function liquidityToken(address token_) external view returns (address); /// @notice Gets tokens and liquidity token addresses of DAO's liquidity holdings. /// @return Arrays of tokens and liquidity tokens, should have the same length. function liquidityHoldings() external view returns (address[] memory, address[] memory); /// @notice DAO admins. /// @return Array of admin addresses. function admins() external view returns (address[] memory); /// @notice DAO balance for specified token. /// @param token_ token address to get balance for. /// @return uint256 token balance. function tokenBalance(address token_) external view returns (uint256); /// @notice DAO balance for liquidity token. /// @param token_ token address to get liquidity balance for. /// @return uin256 token liquidity balance. function liquidityBalance(address token_) external view returns (uint256); /// @notice DAO ethereum balance. /// @return uint256 wei balance. function availableBalance() external view returns (uint256); /// @notice Maximum cost for all tokens of cloned DAO. /// @return uint256 maximum cost in wei. function maxCost() external view returns (uint256); /// @notice Minimum percentage of votes needed to execute a proposal. /// @return uint256 minimum percentage of votes. function executeMinPct() external view returns (uint256); /// @notice Minimum lifetime of proposal before it closes. /// @return uint256 minimum number of hours for proposal lifetime. function votingMinHours() external view returns (uint256); /// @notice Whether DAO is public or private. /// @return bool true if public. function isPublic() external view returns (bool); /// @notice Whether DAO has admins. /// @return bool true if DAO has admins. function hasAdmins() external view returns (bool); /// @notice Proposal ids of DAO. /// @return array of proposal ids. function getProposalIds() external view returns (uint256[] memory); /// @notice Gets proposal info for proposal id. /// @param id_ id of proposal to get info for. /// @return proposalAddress address for proposal execution. /// @return investTokenAddress secondary address for proposal execution, used for investment proposals if ICO and token addresses differ. /// @return daoFunction proposal type. /// @return amount proposal amount eth/token to use during execution. /// @return creator address of proposal creator. /// @return endLifetime epoch time when proposal voting ends. /// @return votesFor amount of votes for the proposal. /// @return votesAgainst amount of votes against the proposal. /// @return executed whether proposal has been executed or not. function getProposal(uint256 id_) external view returns ( address proposalAddress, address investTokenAddress, DaoFunction daoFunction, uint256 amount, address creator, uint256 endLifetime, uint256 votesFor, uint256 votesAgainst, bool executed ); /// @notice Whether a holder is allowed to vote for a proposal. /// @param id_ proposal id to check whether holder is allowed to vote for. /// @param sender_ address of the holder. /// @return bool true if voting is allowed. function canVote(uint256 id_, address sender_) external view returns (bool); /// @notice Whether a holder is allowed to remove a proposal. /// @param id_ proposal id to check whether holder is allowed to remove. /// @param sender_ address of the holder. /// @return bool true if removal is allowed. function canRemove(uint256 id_, address sender_) external view returns (bool); /// @notice Whether a holder is allowed to execute a proposal. /// @param id_ proposal id to check whether holder is allowed to execute. /// @param sender_ address of the holder. /// @return bool true if execution is allowed. function canExecute(uint256 id_, address sender_) external view returns (bool); /// @notice Whether a holder is an admin. /// @param sender_ address of holder. /// @return bool true if holder is an admin (in DAO without admins all holders are treated as such). function isAdmin(address sender_) external view returns (bool); // Public transactions. /// @notice Saves new holdings addresses for DAO. /// @param tokens_ token addresses that DAO has holdings of. function addHoldingsAddresses(address[] calldata tokens_) external; /// @notice Saves new liquidity addresses for DAO. /// @param tokens_ token addresses that DAO has liquidities of. function addLiquidityAddresses(address[] calldata tokens_) external; /// @notice Creates new proposal. /// @param proposalAddress_ main address of the proposal, in investment proposals this is the address funds are sent to. /// @param investTokenAddress_ secondary address of the proposal, used in investment proposals to specify token address. /// @param daoFunction_ type of the proposal. /// @param amount_ amount of funds to use in the proposal. /// @param hoursLifetime_ voting lifetime of the proposal. function propose(address proposalAddress_, address investTokenAddress_, DaoFunction daoFunction_, uint256 amount_, uint256 hoursLifetime_) external; /// @notice Removes existing proposal. /// @param id_ id of proposal to remove. function unpropose(uint256 id_) external; /// @notice Voting for multiple proposals. /// @param ids_ ids of proposals to vote for. /// @param votes_ for or against votes for proposals. function vote(uint256[] calldata ids_, bool[] calldata votes_) external; /// @notice Executes a proposal. /// @param id_ id of proposal to be executed. function execute(uint256 id_) external; /// @notice Buying tokens for cloned DAO. function buy() external payable; /// @notice Sell tokens back to cloned DAO. /// @param amount_ amount of tokens to sell. function sell(uint256 amount_) external; // Owner transactions. /// @notice Sets factory address. /// @param factory_ address of TorroFactory. function setFactoryAddress(address factory_) external; /// @notice Sets vote weight divider. /// @param weight_ weight divider for a single vote. function setVoteWeightDivider(uint256 weight_) external; /// @notice Sets new address for router. /// @param router_ address for router. function setRouter(address router_) external; /// @notice Sets divider for BUY, INVEST, WITHDAW proposals. /// @param divider_ divider for BUY, INVEST, WITHDRAW proposals. function setSpendDivider(uint256 divider_) external; /// @notice Migrates balances of current DAO to a new DAO. /// @param newDao_ address of the new DAO to migrate to. function migrate(address newDao_) external; }
/// @title DAO for proposals, voting and execution. /// @notice Interface for creation, voting and execution of proposals. /// @author ORayskiy - @robitnik_TorroDao
NatSpecSingleLine
executeMinPct
function executeMinPct() external view returns (uint256);
/// @notice Minimum percentage of votes needed to execute a proposal. /// @return uint256 minimum percentage of votes.
NatSpecSingleLine
v0.6.6+commit.6c089d02
Unknown
ipfs://d1c6095fcf143d951c9754f00fe8cd59d29ab460461efe53b91eb289fd0fe5ac
{ "func_code_index": [ 3745, 3805 ] }
57,698
TorroDao
ITorroDao.sol
0x3cf9e9d45380b6ab61bde46b2e6cfcd7d8f6cdc1
Solidity
ITorroDao
interface ITorroDao { // Enums. /// @notice Enum of available proposal functions. enum DaoFunction { BUY, SELL, ADD_LIQUIDITY, REMOVE_LIQUIDITY, ADD_ADMIN, REMOVE_ADMIN, INVEST, WITHDRAW } // Initializer. /// @notice Initializer for DAO clones. /// @param torroToken_ main torro token address. /// @param governingToken_ torro token clone that's governing this dao. /// @param factory_ torro factory address. /// @param creator_ creator of cloned DAO. /// @param maxCost_ maximum cost of all governing tokens for cloned DAO. /// @param executeMinPct_ minimum percentage of votes needed for proposal execution. /// @param votingMinHours_ minimum lifetime of proposal before it closes. /// @param isPublic_ whether cloned DAO has public visibility. /// @param hasAdmins_ whether cloned DAO has admins, otherwise all stakers are treated as admins. function initializeCustom( address torroToken_, address governingToken_, address factory_, address creator_, uint256 maxCost_, uint256 executeMinPct_, uint256 votingMinHours_, bool isPublic_, bool hasAdmins_ ) external; // Public calls. /// @notice Address of DAO creator. /// @return DAO creator address. function daoCreator() external view returns (address); /// @notice Amount of tokens needed for a single vote. /// @return uint256 token amount. function voteWeight() external view returns (uint256); /// @notice Amount of votes that holder has. /// @param sender_ address of the holder. /// @return number of votes. function votesOf(address sender_) external view returns (uint256); /// @notice Address of the governing token. /// @return address of the governing token. function tokenAddress() external view returns (address); /// @notice Saved addresses of tokens that DAO is holding. /// @return array of holdings addresses. function holdings() external view returns (address[] memory); /// @notice Saved addresses of liquidity tokens that DAO is holding. /// @return array of liquidity addresses. function liquidities() external view returns (address[] memory); /// @notice Calculates address of liquidity token from ERC-20 token address. /// @param token_ token address to calculate liquidity address from. /// @return address of liquidity token. function liquidityToken(address token_) external view returns (address); /// @notice Gets tokens and liquidity token addresses of DAO's liquidity holdings. /// @return Arrays of tokens and liquidity tokens, should have the same length. function liquidityHoldings() external view returns (address[] memory, address[] memory); /// @notice DAO admins. /// @return Array of admin addresses. function admins() external view returns (address[] memory); /// @notice DAO balance for specified token. /// @param token_ token address to get balance for. /// @return uint256 token balance. function tokenBalance(address token_) external view returns (uint256); /// @notice DAO balance for liquidity token. /// @param token_ token address to get liquidity balance for. /// @return uin256 token liquidity balance. function liquidityBalance(address token_) external view returns (uint256); /// @notice DAO ethereum balance. /// @return uint256 wei balance. function availableBalance() external view returns (uint256); /// @notice Maximum cost for all tokens of cloned DAO. /// @return uint256 maximum cost in wei. function maxCost() external view returns (uint256); /// @notice Minimum percentage of votes needed to execute a proposal. /// @return uint256 minimum percentage of votes. function executeMinPct() external view returns (uint256); /// @notice Minimum lifetime of proposal before it closes. /// @return uint256 minimum number of hours for proposal lifetime. function votingMinHours() external view returns (uint256); /// @notice Whether DAO is public or private. /// @return bool true if public. function isPublic() external view returns (bool); /// @notice Whether DAO has admins. /// @return bool true if DAO has admins. function hasAdmins() external view returns (bool); /// @notice Proposal ids of DAO. /// @return array of proposal ids. function getProposalIds() external view returns (uint256[] memory); /// @notice Gets proposal info for proposal id. /// @param id_ id of proposal to get info for. /// @return proposalAddress address for proposal execution. /// @return investTokenAddress secondary address for proposal execution, used for investment proposals if ICO and token addresses differ. /// @return daoFunction proposal type. /// @return amount proposal amount eth/token to use during execution. /// @return creator address of proposal creator. /// @return endLifetime epoch time when proposal voting ends. /// @return votesFor amount of votes for the proposal. /// @return votesAgainst amount of votes against the proposal. /// @return executed whether proposal has been executed or not. function getProposal(uint256 id_) external view returns ( address proposalAddress, address investTokenAddress, DaoFunction daoFunction, uint256 amount, address creator, uint256 endLifetime, uint256 votesFor, uint256 votesAgainst, bool executed ); /// @notice Whether a holder is allowed to vote for a proposal. /// @param id_ proposal id to check whether holder is allowed to vote for. /// @param sender_ address of the holder. /// @return bool true if voting is allowed. function canVote(uint256 id_, address sender_) external view returns (bool); /// @notice Whether a holder is allowed to remove a proposal. /// @param id_ proposal id to check whether holder is allowed to remove. /// @param sender_ address of the holder. /// @return bool true if removal is allowed. function canRemove(uint256 id_, address sender_) external view returns (bool); /// @notice Whether a holder is allowed to execute a proposal. /// @param id_ proposal id to check whether holder is allowed to execute. /// @param sender_ address of the holder. /// @return bool true if execution is allowed. function canExecute(uint256 id_, address sender_) external view returns (bool); /// @notice Whether a holder is an admin. /// @param sender_ address of holder. /// @return bool true if holder is an admin (in DAO without admins all holders are treated as such). function isAdmin(address sender_) external view returns (bool); // Public transactions. /// @notice Saves new holdings addresses for DAO. /// @param tokens_ token addresses that DAO has holdings of. function addHoldingsAddresses(address[] calldata tokens_) external; /// @notice Saves new liquidity addresses for DAO. /// @param tokens_ token addresses that DAO has liquidities of. function addLiquidityAddresses(address[] calldata tokens_) external; /// @notice Creates new proposal. /// @param proposalAddress_ main address of the proposal, in investment proposals this is the address funds are sent to. /// @param investTokenAddress_ secondary address of the proposal, used in investment proposals to specify token address. /// @param daoFunction_ type of the proposal. /// @param amount_ amount of funds to use in the proposal. /// @param hoursLifetime_ voting lifetime of the proposal. function propose(address proposalAddress_, address investTokenAddress_, DaoFunction daoFunction_, uint256 amount_, uint256 hoursLifetime_) external; /// @notice Removes existing proposal. /// @param id_ id of proposal to remove. function unpropose(uint256 id_) external; /// @notice Voting for multiple proposals. /// @param ids_ ids of proposals to vote for. /// @param votes_ for or against votes for proposals. function vote(uint256[] calldata ids_, bool[] calldata votes_) external; /// @notice Executes a proposal. /// @param id_ id of proposal to be executed. function execute(uint256 id_) external; /// @notice Buying tokens for cloned DAO. function buy() external payable; /// @notice Sell tokens back to cloned DAO. /// @param amount_ amount of tokens to sell. function sell(uint256 amount_) external; // Owner transactions. /// @notice Sets factory address. /// @param factory_ address of TorroFactory. function setFactoryAddress(address factory_) external; /// @notice Sets vote weight divider. /// @param weight_ weight divider for a single vote. function setVoteWeightDivider(uint256 weight_) external; /// @notice Sets new address for router. /// @param router_ address for router. function setRouter(address router_) external; /// @notice Sets divider for BUY, INVEST, WITHDAW proposals. /// @param divider_ divider for BUY, INVEST, WITHDRAW proposals. function setSpendDivider(uint256 divider_) external; /// @notice Migrates balances of current DAO to a new DAO. /// @param newDao_ address of the new DAO to migrate to. function migrate(address newDao_) external; }
/// @title DAO for proposals, voting and execution. /// @notice Interface for creation, voting and execution of proposals. /// @author ORayskiy - @robitnik_TorroDao
NatSpecSingleLine
votingMinHours
function votingMinHours() external view returns (uint256);
/// @notice Minimum lifetime of proposal before it closes. /// @return uint256 minimum number of hours for proposal lifetime.
NatSpecSingleLine
v0.6.6+commit.6c089d02
Unknown
ipfs://d1c6095fcf143d951c9754f00fe8cd59d29ab460461efe53b91eb289fd0fe5ac
{ "func_code_index": [ 3940, 4001 ] }
57,699
TorroDao
ITorroDao.sol
0x3cf9e9d45380b6ab61bde46b2e6cfcd7d8f6cdc1
Solidity
ITorroDao
interface ITorroDao { // Enums. /// @notice Enum of available proposal functions. enum DaoFunction { BUY, SELL, ADD_LIQUIDITY, REMOVE_LIQUIDITY, ADD_ADMIN, REMOVE_ADMIN, INVEST, WITHDRAW } // Initializer. /// @notice Initializer for DAO clones. /// @param torroToken_ main torro token address. /// @param governingToken_ torro token clone that's governing this dao. /// @param factory_ torro factory address. /// @param creator_ creator of cloned DAO. /// @param maxCost_ maximum cost of all governing tokens for cloned DAO. /// @param executeMinPct_ minimum percentage of votes needed for proposal execution. /// @param votingMinHours_ minimum lifetime of proposal before it closes. /// @param isPublic_ whether cloned DAO has public visibility. /// @param hasAdmins_ whether cloned DAO has admins, otherwise all stakers are treated as admins. function initializeCustom( address torroToken_, address governingToken_, address factory_, address creator_, uint256 maxCost_, uint256 executeMinPct_, uint256 votingMinHours_, bool isPublic_, bool hasAdmins_ ) external; // Public calls. /// @notice Address of DAO creator. /// @return DAO creator address. function daoCreator() external view returns (address); /// @notice Amount of tokens needed for a single vote. /// @return uint256 token amount. function voteWeight() external view returns (uint256); /// @notice Amount of votes that holder has. /// @param sender_ address of the holder. /// @return number of votes. function votesOf(address sender_) external view returns (uint256); /// @notice Address of the governing token. /// @return address of the governing token. function tokenAddress() external view returns (address); /// @notice Saved addresses of tokens that DAO is holding. /// @return array of holdings addresses. function holdings() external view returns (address[] memory); /// @notice Saved addresses of liquidity tokens that DAO is holding. /// @return array of liquidity addresses. function liquidities() external view returns (address[] memory); /// @notice Calculates address of liquidity token from ERC-20 token address. /// @param token_ token address to calculate liquidity address from. /// @return address of liquidity token. function liquidityToken(address token_) external view returns (address); /// @notice Gets tokens and liquidity token addresses of DAO's liquidity holdings. /// @return Arrays of tokens and liquidity tokens, should have the same length. function liquidityHoldings() external view returns (address[] memory, address[] memory); /// @notice DAO admins. /// @return Array of admin addresses. function admins() external view returns (address[] memory); /// @notice DAO balance for specified token. /// @param token_ token address to get balance for. /// @return uint256 token balance. function tokenBalance(address token_) external view returns (uint256); /// @notice DAO balance for liquidity token. /// @param token_ token address to get liquidity balance for. /// @return uin256 token liquidity balance. function liquidityBalance(address token_) external view returns (uint256); /// @notice DAO ethereum balance. /// @return uint256 wei balance. function availableBalance() external view returns (uint256); /// @notice Maximum cost for all tokens of cloned DAO. /// @return uint256 maximum cost in wei. function maxCost() external view returns (uint256); /// @notice Minimum percentage of votes needed to execute a proposal. /// @return uint256 minimum percentage of votes. function executeMinPct() external view returns (uint256); /// @notice Minimum lifetime of proposal before it closes. /// @return uint256 minimum number of hours for proposal lifetime. function votingMinHours() external view returns (uint256); /// @notice Whether DAO is public or private. /// @return bool true if public. function isPublic() external view returns (bool); /// @notice Whether DAO has admins. /// @return bool true if DAO has admins. function hasAdmins() external view returns (bool); /// @notice Proposal ids of DAO. /// @return array of proposal ids. function getProposalIds() external view returns (uint256[] memory); /// @notice Gets proposal info for proposal id. /// @param id_ id of proposal to get info for. /// @return proposalAddress address for proposal execution. /// @return investTokenAddress secondary address for proposal execution, used for investment proposals if ICO and token addresses differ. /// @return daoFunction proposal type. /// @return amount proposal amount eth/token to use during execution. /// @return creator address of proposal creator. /// @return endLifetime epoch time when proposal voting ends. /// @return votesFor amount of votes for the proposal. /// @return votesAgainst amount of votes against the proposal. /// @return executed whether proposal has been executed or not. function getProposal(uint256 id_) external view returns ( address proposalAddress, address investTokenAddress, DaoFunction daoFunction, uint256 amount, address creator, uint256 endLifetime, uint256 votesFor, uint256 votesAgainst, bool executed ); /// @notice Whether a holder is allowed to vote for a proposal. /// @param id_ proposal id to check whether holder is allowed to vote for. /// @param sender_ address of the holder. /// @return bool true if voting is allowed. function canVote(uint256 id_, address sender_) external view returns (bool); /// @notice Whether a holder is allowed to remove a proposal. /// @param id_ proposal id to check whether holder is allowed to remove. /// @param sender_ address of the holder. /// @return bool true if removal is allowed. function canRemove(uint256 id_, address sender_) external view returns (bool); /// @notice Whether a holder is allowed to execute a proposal. /// @param id_ proposal id to check whether holder is allowed to execute. /// @param sender_ address of the holder. /// @return bool true if execution is allowed. function canExecute(uint256 id_, address sender_) external view returns (bool); /// @notice Whether a holder is an admin. /// @param sender_ address of holder. /// @return bool true if holder is an admin (in DAO without admins all holders are treated as such). function isAdmin(address sender_) external view returns (bool); // Public transactions. /// @notice Saves new holdings addresses for DAO. /// @param tokens_ token addresses that DAO has holdings of. function addHoldingsAddresses(address[] calldata tokens_) external; /// @notice Saves new liquidity addresses for DAO. /// @param tokens_ token addresses that DAO has liquidities of. function addLiquidityAddresses(address[] calldata tokens_) external; /// @notice Creates new proposal. /// @param proposalAddress_ main address of the proposal, in investment proposals this is the address funds are sent to. /// @param investTokenAddress_ secondary address of the proposal, used in investment proposals to specify token address. /// @param daoFunction_ type of the proposal. /// @param amount_ amount of funds to use in the proposal. /// @param hoursLifetime_ voting lifetime of the proposal. function propose(address proposalAddress_, address investTokenAddress_, DaoFunction daoFunction_, uint256 amount_, uint256 hoursLifetime_) external; /// @notice Removes existing proposal. /// @param id_ id of proposal to remove. function unpropose(uint256 id_) external; /// @notice Voting for multiple proposals. /// @param ids_ ids of proposals to vote for. /// @param votes_ for or against votes for proposals. function vote(uint256[] calldata ids_, bool[] calldata votes_) external; /// @notice Executes a proposal. /// @param id_ id of proposal to be executed. function execute(uint256 id_) external; /// @notice Buying tokens for cloned DAO. function buy() external payable; /// @notice Sell tokens back to cloned DAO. /// @param amount_ amount of tokens to sell. function sell(uint256 amount_) external; // Owner transactions. /// @notice Sets factory address. /// @param factory_ address of TorroFactory. function setFactoryAddress(address factory_) external; /// @notice Sets vote weight divider. /// @param weight_ weight divider for a single vote. function setVoteWeightDivider(uint256 weight_) external; /// @notice Sets new address for router. /// @param router_ address for router. function setRouter(address router_) external; /// @notice Sets divider for BUY, INVEST, WITHDAW proposals. /// @param divider_ divider for BUY, INVEST, WITHDRAW proposals. function setSpendDivider(uint256 divider_) external; /// @notice Migrates balances of current DAO to a new DAO. /// @param newDao_ address of the new DAO to migrate to. function migrate(address newDao_) external; }
/// @title DAO for proposals, voting and execution. /// @notice Interface for creation, voting and execution of proposals. /// @author ORayskiy - @robitnik_TorroDao
NatSpecSingleLine
isPublic
function isPublic() external view returns (bool);
/// @notice Whether DAO is public or private. /// @return bool true if public.
NatSpecSingleLine
v0.6.6+commit.6c089d02
Unknown
ipfs://d1c6095fcf143d951c9754f00fe8cd59d29ab460461efe53b91eb289fd0fe5ac
{ "func_code_index": [ 4089, 4141 ] }
57,700
TorroDao
ITorroDao.sol
0x3cf9e9d45380b6ab61bde46b2e6cfcd7d8f6cdc1
Solidity
ITorroDao
interface ITorroDao { // Enums. /// @notice Enum of available proposal functions. enum DaoFunction { BUY, SELL, ADD_LIQUIDITY, REMOVE_LIQUIDITY, ADD_ADMIN, REMOVE_ADMIN, INVEST, WITHDRAW } // Initializer. /// @notice Initializer for DAO clones. /// @param torroToken_ main torro token address. /// @param governingToken_ torro token clone that's governing this dao. /// @param factory_ torro factory address. /// @param creator_ creator of cloned DAO. /// @param maxCost_ maximum cost of all governing tokens for cloned DAO. /// @param executeMinPct_ minimum percentage of votes needed for proposal execution. /// @param votingMinHours_ minimum lifetime of proposal before it closes. /// @param isPublic_ whether cloned DAO has public visibility. /// @param hasAdmins_ whether cloned DAO has admins, otherwise all stakers are treated as admins. function initializeCustom( address torroToken_, address governingToken_, address factory_, address creator_, uint256 maxCost_, uint256 executeMinPct_, uint256 votingMinHours_, bool isPublic_, bool hasAdmins_ ) external; // Public calls. /// @notice Address of DAO creator. /// @return DAO creator address. function daoCreator() external view returns (address); /// @notice Amount of tokens needed for a single vote. /// @return uint256 token amount. function voteWeight() external view returns (uint256); /// @notice Amount of votes that holder has. /// @param sender_ address of the holder. /// @return number of votes. function votesOf(address sender_) external view returns (uint256); /// @notice Address of the governing token. /// @return address of the governing token. function tokenAddress() external view returns (address); /// @notice Saved addresses of tokens that DAO is holding. /// @return array of holdings addresses. function holdings() external view returns (address[] memory); /// @notice Saved addresses of liquidity tokens that DAO is holding. /// @return array of liquidity addresses. function liquidities() external view returns (address[] memory); /// @notice Calculates address of liquidity token from ERC-20 token address. /// @param token_ token address to calculate liquidity address from. /// @return address of liquidity token. function liquidityToken(address token_) external view returns (address); /// @notice Gets tokens and liquidity token addresses of DAO's liquidity holdings. /// @return Arrays of tokens and liquidity tokens, should have the same length. function liquidityHoldings() external view returns (address[] memory, address[] memory); /// @notice DAO admins. /// @return Array of admin addresses. function admins() external view returns (address[] memory); /// @notice DAO balance for specified token. /// @param token_ token address to get balance for. /// @return uint256 token balance. function tokenBalance(address token_) external view returns (uint256); /// @notice DAO balance for liquidity token. /// @param token_ token address to get liquidity balance for. /// @return uin256 token liquidity balance. function liquidityBalance(address token_) external view returns (uint256); /// @notice DAO ethereum balance. /// @return uint256 wei balance. function availableBalance() external view returns (uint256); /// @notice Maximum cost for all tokens of cloned DAO. /// @return uint256 maximum cost in wei. function maxCost() external view returns (uint256); /// @notice Minimum percentage of votes needed to execute a proposal. /// @return uint256 minimum percentage of votes. function executeMinPct() external view returns (uint256); /// @notice Minimum lifetime of proposal before it closes. /// @return uint256 minimum number of hours for proposal lifetime. function votingMinHours() external view returns (uint256); /// @notice Whether DAO is public or private. /// @return bool true if public. function isPublic() external view returns (bool); /// @notice Whether DAO has admins. /// @return bool true if DAO has admins. function hasAdmins() external view returns (bool); /// @notice Proposal ids of DAO. /// @return array of proposal ids. function getProposalIds() external view returns (uint256[] memory); /// @notice Gets proposal info for proposal id. /// @param id_ id of proposal to get info for. /// @return proposalAddress address for proposal execution. /// @return investTokenAddress secondary address for proposal execution, used for investment proposals if ICO and token addresses differ. /// @return daoFunction proposal type. /// @return amount proposal amount eth/token to use during execution. /// @return creator address of proposal creator. /// @return endLifetime epoch time when proposal voting ends. /// @return votesFor amount of votes for the proposal. /// @return votesAgainst amount of votes against the proposal. /// @return executed whether proposal has been executed or not. function getProposal(uint256 id_) external view returns ( address proposalAddress, address investTokenAddress, DaoFunction daoFunction, uint256 amount, address creator, uint256 endLifetime, uint256 votesFor, uint256 votesAgainst, bool executed ); /// @notice Whether a holder is allowed to vote for a proposal. /// @param id_ proposal id to check whether holder is allowed to vote for. /// @param sender_ address of the holder. /// @return bool true if voting is allowed. function canVote(uint256 id_, address sender_) external view returns (bool); /// @notice Whether a holder is allowed to remove a proposal. /// @param id_ proposal id to check whether holder is allowed to remove. /// @param sender_ address of the holder. /// @return bool true if removal is allowed. function canRemove(uint256 id_, address sender_) external view returns (bool); /// @notice Whether a holder is allowed to execute a proposal. /// @param id_ proposal id to check whether holder is allowed to execute. /// @param sender_ address of the holder. /// @return bool true if execution is allowed. function canExecute(uint256 id_, address sender_) external view returns (bool); /// @notice Whether a holder is an admin. /// @param sender_ address of holder. /// @return bool true if holder is an admin (in DAO without admins all holders are treated as such). function isAdmin(address sender_) external view returns (bool); // Public transactions. /// @notice Saves new holdings addresses for DAO. /// @param tokens_ token addresses that DAO has holdings of. function addHoldingsAddresses(address[] calldata tokens_) external; /// @notice Saves new liquidity addresses for DAO. /// @param tokens_ token addresses that DAO has liquidities of. function addLiquidityAddresses(address[] calldata tokens_) external; /// @notice Creates new proposal. /// @param proposalAddress_ main address of the proposal, in investment proposals this is the address funds are sent to. /// @param investTokenAddress_ secondary address of the proposal, used in investment proposals to specify token address. /// @param daoFunction_ type of the proposal. /// @param amount_ amount of funds to use in the proposal. /// @param hoursLifetime_ voting lifetime of the proposal. function propose(address proposalAddress_, address investTokenAddress_, DaoFunction daoFunction_, uint256 amount_, uint256 hoursLifetime_) external; /// @notice Removes existing proposal. /// @param id_ id of proposal to remove. function unpropose(uint256 id_) external; /// @notice Voting for multiple proposals. /// @param ids_ ids of proposals to vote for. /// @param votes_ for or against votes for proposals. function vote(uint256[] calldata ids_, bool[] calldata votes_) external; /// @notice Executes a proposal. /// @param id_ id of proposal to be executed. function execute(uint256 id_) external; /// @notice Buying tokens for cloned DAO. function buy() external payable; /// @notice Sell tokens back to cloned DAO. /// @param amount_ amount of tokens to sell. function sell(uint256 amount_) external; // Owner transactions. /// @notice Sets factory address. /// @param factory_ address of TorroFactory. function setFactoryAddress(address factory_) external; /// @notice Sets vote weight divider. /// @param weight_ weight divider for a single vote. function setVoteWeightDivider(uint256 weight_) external; /// @notice Sets new address for router. /// @param router_ address for router. function setRouter(address router_) external; /// @notice Sets divider for BUY, INVEST, WITHDAW proposals. /// @param divider_ divider for BUY, INVEST, WITHDRAW proposals. function setSpendDivider(uint256 divider_) external; /// @notice Migrates balances of current DAO to a new DAO. /// @param newDao_ address of the new DAO to migrate to. function migrate(address newDao_) external; }
/// @title DAO for proposals, voting and execution. /// @notice Interface for creation, voting and execution of proposals. /// @author ORayskiy - @robitnik_TorroDao
NatSpecSingleLine
hasAdmins
function hasAdmins() external view returns (bool);
/// @notice Whether DAO has admins. /// @return bool true if DAO has admins.
NatSpecSingleLine
v0.6.6+commit.6c089d02
Unknown
ipfs://d1c6095fcf143d951c9754f00fe8cd59d29ab460461efe53b91eb289fd0fe5ac
{ "func_code_index": [ 4227, 4280 ] }
57,701
TorroDao
ITorroDao.sol
0x3cf9e9d45380b6ab61bde46b2e6cfcd7d8f6cdc1
Solidity
ITorroDao
interface ITorroDao { // Enums. /// @notice Enum of available proposal functions. enum DaoFunction { BUY, SELL, ADD_LIQUIDITY, REMOVE_LIQUIDITY, ADD_ADMIN, REMOVE_ADMIN, INVEST, WITHDRAW } // Initializer. /// @notice Initializer for DAO clones. /// @param torroToken_ main torro token address. /// @param governingToken_ torro token clone that's governing this dao. /// @param factory_ torro factory address. /// @param creator_ creator of cloned DAO. /// @param maxCost_ maximum cost of all governing tokens for cloned DAO. /// @param executeMinPct_ minimum percentage of votes needed for proposal execution. /// @param votingMinHours_ minimum lifetime of proposal before it closes. /// @param isPublic_ whether cloned DAO has public visibility. /// @param hasAdmins_ whether cloned DAO has admins, otherwise all stakers are treated as admins. function initializeCustom( address torroToken_, address governingToken_, address factory_, address creator_, uint256 maxCost_, uint256 executeMinPct_, uint256 votingMinHours_, bool isPublic_, bool hasAdmins_ ) external; // Public calls. /// @notice Address of DAO creator. /// @return DAO creator address. function daoCreator() external view returns (address); /// @notice Amount of tokens needed for a single vote. /// @return uint256 token amount. function voteWeight() external view returns (uint256); /// @notice Amount of votes that holder has. /// @param sender_ address of the holder. /// @return number of votes. function votesOf(address sender_) external view returns (uint256); /// @notice Address of the governing token. /// @return address of the governing token. function tokenAddress() external view returns (address); /// @notice Saved addresses of tokens that DAO is holding. /// @return array of holdings addresses. function holdings() external view returns (address[] memory); /// @notice Saved addresses of liquidity tokens that DAO is holding. /// @return array of liquidity addresses. function liquidities() external view returns (address[] memory); /// @notice Calculates address of liquidity token from ERC-20 token address. /// @param token_ token address to calculate liquidity address from. /// @return address of liquidity token. function liquidityToken(address token_) external view returns (address); /// @notice Gets tokens and liquidity token addresses of DAO's liquidity holdings. /// @return Arrays of tokens and liquidity tokens, should have the same length. function liquidityHoldings() external view returns (address[] memory, address[] memory); /// @notice DAO admins. /// @return Array of admin addresses. function admins() external view returns (address[] memory); /// @notice DAO balance for specified token. /// @param token_ token address to get balance for. /// @return uint256 token balance. function tokenBalance(address token_) external view returns (uint256); /// @notice DAO balance for liquidity token. /// @param token_ token address to get liquidity balance for. /// @return uin256 token liquidity balance. function liquidityBalance(address token_) external view returns (uint256); /// @notice DAO ethereum balance. /// @return uint256 wei balance. function availableBalance() external view returns (uint256); /// @notice Maximum cost for all tokens of cloned DAO. /// @return uint256 maximum cost in wei. function maxCost() external view returns (uint256); /// @notice Minimum percentage of votes needed to execute a proposal. /// @return uint256 minimum percentage of votes. function executeMinPct() external view returns (uint256); /// @notice Minimum lifetime of proposal before it closes. /// @return uint256 minimum number of hours for proposal lifetime. function votingMinHours() external view returns (uint256); /// @notice Whether DAO is public or private. /// @return bool true if public. function isPublic() external view returns (bool); /// @notice Whether DAO has admins. /// @return bool true if DAO has admins. function hasAdmins() external view returns (bool); /// @notice Proposal ids of DAO. /// @return array of proposal ids. function getProposalIds() external view returns (uint256[] memory); /// @notice Gets proposal info for proposal id. /// @param id_ id of proposal to get info for. /// @return proposalAddress address for proposal execution. /// @return investTokenAddress secondary address for proposal execution, used for investment proposals if ICO and token addresses differ. /// @return daoFunction proposal type. /// @return amount proposal amount eth/token to use during execution. /// @return creator address of proposal creator. /// @return endLifetime epoch time when proposal voting ends. /// @return votesFor amount of votes for the proposal. /// @return votesAgainst amount of votes against the proposal. /// @return executed whether proposal has been executed or not. function getProposal(uint256 id_) external view returns ( address proposalAddress, address investTokenAddress, DaoFunction daoFunction, uint256 amount, address creator, uint256 endLifetime, uint256 votesFor, uint256 votesAgainst, bool executed ); /// @notice Whether a holder is allowed to vote for a proposal. /// @param id_ proposal id to check whether holder is allowed to vote for. /// @param sender_ address of the holder. /// @return bool true if voting is allowed. function canVote(uint256 id_, address sender_) external view returns (bool); /// @notice Whether a holder is allowed to remove a proposal. /// @param id_ proposal id to check whether holder is allowed to remove. /// @param sender_ address of the holder. /// @return bool true if removal is allowed. function canRemove(uint256 id_, address sender_) external view returns (bool); /// @notice Whether a holder is allowed to execute a proposal. /// @param id_ proposal id to check whether holder is allowed to execute. /// @param sender_ address of the holder. /// @return bool true if execution is allowed. function canExecute(uint256 id_, address sender_) external view returns (bool); /// @notice Whether a holder is an admin. /// @param sender_ address of holder. /// @return bool true if holder is an admin (in DAO without admins all holders are treated as such). function isAdmin(address sender_) external view returns (bool); // Public transactions. /// @notice Saves new holdings addresses for DAO. /// @param tokens_ token addresses that DAO has holdings of. function addHoldingsAddresses(address[] calldata tokens_) external; /// @notice Saves new liquidity addresses for DAO. /// @param tokens_ token addresses that DAO has liquidities of. function addLiquidityAddresses(address[] calldata tokens_) external; /// @notice Creates new proposal. /// @param proposalAddress_ main address of the proposal, in investment proposals this is the address funds are sent to. /// @param investTokenAddress_ secondary address of the proposal, used in investment proposals to specify token address. /// @param daoFunction_ type of the proposal. /// @param amount_ amount of funds to use in the proposal. /// @param hoursLifetime_ voting lifetime of the proposal. function propose(address proposalAddress_, address investTokenAddress_, DaoFunction daoFunction_, uint256 amount_, uint256 hoursLifetime_) external; /// @notice Removes existing proposal. /// @param id_ id of proposal to remove. function unpropose(uint256 id_) external; /// @notice Voting for multiple proposals. /// @param ids_ ids of proposals to vote for. /// @param votes_ for or against votes for proposals. function vote(uint256[] calldata ids_, bool[] calldata votes_) external; /// @notice Executes a proposal. /// @param id_ id of proposal to be executed. function execute(uint256 id_) external; /// @notice Buying tokens for cloned DAO. function buy() external payable; /// @notice Sell tokens back to cloned DAO. /// @param amount_ amount of tokens to sell. function sell(uint256 amount_) external; // Owner transactions. /// @notice Sets factory address. /// @param factory_ address of TorroFactory. function setFactoryAddress(address factory_) external; /// @notice Sets vote weight divider. /// @param weight_ weight divider for a single vote. function setVoteWeightDivider(uint256 weight_) external; /// @notice Sets new address for router. /// @param router_ address for router. function setRouter(address router_) external; /// @notice Sets divider for BUY, INVEST, WITHDAW proposals. /// @param divider_ divider for BUY, INVEST, WITHDRAW proposals. function setSpendDivider(uint256 divider_) external; /// @notice Migrates balances of current DAO to a new DAO. /// @param newDao_ address of the new DAO to migrate to. function migrate(address newDao_) external; }
/// @title DAO for proposals, voting and execution. /// @notice Interface for creation, voting and execution of proposals. /// @author ORayskiy - @robitnik_TorroDao
NatSpecSingleLine
getProposalIds
function getProposalIds() external view returns (uint256[] memory);
/// @notice Proposal ids of DAO. /// @return array of proposal ids.
NatSpecSingleLine
v0.6.6+commit.6c089d02
Unknown
ipfs://d1c6095fcf143d951c9754f00fe8cd59d29ab460461efe53b91eb289fd0fe5ac
{ "func_code_index": [ 4357, 4427 ] }
57,702
TorroDao
ITorroDao.sol
0x3cf9e9d45380b6ab61bde46b2e6cfcd7d8f6cdc1
Solidity
ITorroDao
interface ITorroDao { // Enums. /// @notice Enum of available proposal functions. enum DaoFunction { BUY, SELL, ADD_LIQUIDITY, REMOVE_LIQUIDITY, ADD_ADMIN, REMOVE_ADMIN, INVEST, WITHDRAW } // Initializer. /// @notice Initializer for DAO clones. /// @param torroToken_ main torro token address. /// @param governingToken_ torro token clone that's governing this dao. /// @param factory_ torro factory address. /// @param creator_ creator of cloned DAO. /// @param maxCost_ maximum cost of all governing tokens for cloned DAO. /// @param executeMinPct_ minimum percentage of votes needed for proposal execution. /// @param votingMinHours_ minimum lifetime of proposal before it closes. /// @param isPublic_ whether cloned DAO has public visibility. /// @param hasAdmins_ whether cloned DAO has admins, otherwise all stakers are treated as admins. function initializeCustom( address torroToken_, address governingToken_, address factory_, address creator_, uint256 maxCost_, uint256 executeMinPct_, uint256 votingMinHours_, bool isPublic_, bool hasAdmins_ ) external; // Public calls. /// @notice Address of DAO creator. /// @return DAO creator address. function daoCreator() external view returns (address); /// @notice Amount of tokens needed for a single vote. /// @return uint256 token amount. function voteWeight() external view returns (uint256); /// @notice Amount of votes that holder has. /// @param sender_ address of the holder. /// @return number of votes. function votesOf(address sender_) external view returns (uint256); /// @notice Address of the governing token. /// @return address of the governing token. function tokenAddress() external view returns (address); /// @notice Saved addresses of tokens that DAO is holding. /// @return array of holdings addresses. function holdings() external view returns (address[] memory); /// @notice Saved addresses of liquidity tokens that DAO is holding. /// @return array of liquidity addresses. function liquidities() external view returns (address[] memory); /// @notice Calculates address of liquidity token from ERC-20 token address. /// @param token_ token address to calculate liquidity address from. /// @return address of liquidity token. function liquidityToken(address token_) external view returns (address); /// @notice Gets tokens and liquidity token addresses of DAO's liquidity holdings. /// @return Arrays of tokens and liquidity tokens, should have the same length. function liquidityHoldings() external view returns (address[] memory, address[] memory); /// @notice DAO admins. /// @return Array of admin addresses. function admins() external view returns (address[] memory); /// @notice DAO balance for specified token. /// @param token_ token address to get balance for. /// @return uint256 token balance. function tokenBalance(address token_) external view returns (uint256); /// @notice DAO balance for liquidity token. /// @param token_ token address to get liquidity balance for. /// @return uin256 token liquidity balance. function liquidityBalance(address token_) external view returns (uint256); /// @notice DAO ethereum balance. /// @return uint256 wei balance. function availableBalance() external view returns (uint256); /// @notice Maximum cost for all tokens of cloned DAO. /// @return uint256 maximum cost in wei. function maxCost() external view returns (uint256); /// @notice Minimum percentage of votes needed to execute a proposal. /// @return uint256 minimum percentage of votes. function executeMinPct() external view returns (uint256); /// @notice Minimum lifetime of proposal before it closes. /// @return uint256 minimum number of hours for proposal lifetime. function votingMinHours() external view returns (uint256); /// @notice Whether DAO is public or private. /// @return bool true if public. function isPublic() external view returns (bool); /// @notice Whether DAO has admins. /// @return bool true if DAO has admins. function hasAdmins() external view returns (bool); /// @notice Proposal ids of DAO. /// @return array of proposal ids. function getProposalIds() external view returns (uint256[] memory); /// @notice Gets proposal info for proposal id. /// @param id_ id of proposal to get info for. /// @return proposalAddress address for proposal execution. /// @return investTokenAddress secondary address for proposal execution, used for investment proposals if ICO and token addresses differ. /// @return daoFunction proposal type. /// @return amount proposal amount eth/token to use during execution. /// @return creator address of proposal creator. /// @return endLifetime epoch time when proposal voting ends. /// @return votesFor amount of votes for the proposal. /// @return votesAgainst amount of votes against the proposal. /// @return executed whether proposal has been executed or not. function getProposal(uint256 id_) external view returns ( address proposalAddress, address investTokenAddress, DaoFunction daoFunction, uint256 amount, address creator, uint256 endLifetime, uint256 votesFor, uint256 votesAgainst, bool executed ); /// @notice Whether a holder is allowed to vote for a proposal. /// @param id_ proposal id to check whether holder is allowed to vote for. /// @param sender_ address of the holder. /// @return bool true if voting is allowed. function canVote(uint256 id_, address sender_) external view returns (bool); /// @notice Whether a holder is allowed to remove a proposal. /// @param id_ proposal id to check whether holder is allowed to remove. /// @param sender_ address of the holder. /// @return bool true if removal is allowed. function canRemove(uint256 id_, address sender_) external view returns (bool); /// @notice Whether a holder is allowed to execute a proposal. /// @param id_ proposal id to check whether holder is allowed to execute. /// @param sender_ address of the holder. /// @return bool true if execution is allowed. function canExecute(uint256 id_, address sender_) external view returns (bool); /// @notice Whether a holder is an admin. /// @param sender_ address of holder. /// @return bool true if holder is an admin (in DAO without admins all holders are treated as such). function isAdmin(address sender_) external view returns (bool); // Public transactions. /// @notice Saves new holdings addresses for DAO. /// @param tokens_ token addresses that DAO has holdings of. function addHoldingsAddresses(address[] calldata tokens_) external; /// @notice Saves new liquidity addresses for DAO. /// @param tokens_ token addresses that DAO has liquidities of. function addLiquidityAddresses(address[] calldata tokens_) external; /// @notice Creates new proposal. /// @param proposalAddress_ main address of the proposal, in investment proposals this is the address funds are sent to. /// @param investTokenAddress_ secondary address of the proposal, used in investment proposals to specify token address. /// @param daoFunction_ type of the proposal. /// @param amount_ amount of funds to use in the proposal. /// @param hoursLifetime_ voting lifetime of the proposal. function propose(address proposalAddress_, address investTokenAddress_, DaoFunction daoFunction_, uint256 amount_, uint256 hoursLifetime_) external; /// @notice Removes existing proposal. /// @param id_ id of proposal to remove. function unpropose(uint256 id_) external; /// @notice Voting for multiple proposals. /// @param ids_ ids of proposals to vote for. /// @param votes_ for or against votes for proposals. function vote(uint256[] calldata ids_, bool[] calldata votes_) external; /// @notice Executes a proposal. /// @param id_ id of proposal to be executed. function execute(uint256 id_) external; /// @notice Buying tokens for cloned DAO. function buy() external payable; /// @notice Sell tokens back to cloned DAO. /// @param amount_ amount of tokens to sell. function sell(uint256 amount_) external; // Owner transactions. /// @notice Sets factory address. /// @param factory_ address of TorroFactory. function setFactoryAddress(address factory_) external; /// @notice Sets vote weight divider. /// @param weight_ weight divider for a single vote. function setVoteWeightDivider(uint256 weight_) external; /// @notice Sets new address for router. /// @param router_ address for router. function setRouter(address router_) external; /// @notice Sets divider for BUY, INVEST, WITHDAW proposals. /// @param divider_ divider for BUY, INVEST, WITHDRAW proposals. function setSpendDivider(uint256 divider_) external; /// @notice Migrates balances of current DAO to a new DAO. /// @param newDao_ address of the new DAO to migrate to. function migrate(address newDao_) external; }
/// @title DAO for proposals, voting and execution. /// @notice Interface for creation, voting and execution of proposals. /// @author ORayskiy - @robitnik_TorroDao
NatSpecSingleLine
getProposal
function getProposal(uint256 id_) external view returns ( address proposalAddress, address investTokenAddress, DaoFunction daoFunction, uint256 amount, address creator, uint256 endLifetime, uint256 votesFor, uint256 votesAgainst, bool executed );
/// @notice Gets proposal info for proposal id. /// @param id_ id of proposal to get info for. /// @return proposalAddress address for proposal execution. /// @return investTokenAddress secondary address for proposal execution, used for investment proposals if ICO and token addresses differ. /// @return daoFunction proposal type. /// @return amount proposal amount eth/token to use during execution. /// @return creator address of proposal creator. /// @return endLifetime epoch time when proposal voting ends. /// @return votesFor amount of votes for the proposal. /// @return votesAgainst amount of votes against the proposal. /// @return executed whether proposal has been executed or not.
NatSpecSingleLine
v0.6.6+commit.6c089d02
Unknown
ipfs://d1c6095fcf143d951c9754f00fe8cd59d29ab460461efe53b91eb289fd0fe5ac
{ "func_code_index": [ 5158, 5455 ] }
57,703
TorroDao
ITorroDao.sol
0x3cf9e9d45380b6ab61bde46b2e6cfcd7d8f6cdc1
Solidity
ITorroDao
interface ITorroDao { // Enums. /// @notice Enum of available proposal functions. enum DaoFunction { BUY, SELL, ADD_LIQUIDITY, REMOVE_LIQUIDITY, ADD_ADMIN, REMOVE_ADMIN, INVEST, WITHDRAW } // Initializer. /// @notice Initializer for DAO clones. /// @param torroToken_ main torro token address. /// @param governingToken_ torro token clone that's governing this dao. /// @param factory_ torro factory address. /// @param creator_ creator of cloned DAO. /// @param maxCost_ maximum cost of all governing tokens for cloned DAO. /// @param executeMinPct_ minimum percentage of votes needed for proposal execution. /// @param votingMinHours_ minimum lifetime of proposal before it closes. /// @param isPublic_ whether cloned DAO has public visibility. /// @param hasAdmins_ whether cloned DAO has admins, otherwise all stakers are treated as admins. function initializeCustom( address torroToken_, address governingToken_, address factory_, address creator_, uint256 maxCost_, uint256 executeMinPct_, uint256 votingMinHours_, bool isPublic_, bool hasAdmins_ ) external; // Public calls. /// @notice Address of DAO creator. /// @return DAO creator address. function daoCreator() external view returns (address); /// @notice Amount of tokens needed for a single vote. /// @return uint256 token amount. function voteWeight() external view returns (uint256); /// @notice Amount of votes that holder has. /// @param sender_ address of the holder. /// @return number of votes. function votesOf(address sender_) external view returns (uint256); /// @notice Address of the governing token. /// @return address of the governing token. function tokenAddress() external view returns (address); /// @notice Saved addresses of tokens that DAO is holding. /// @return array of holdings addresses. function holdings() external view returns (address[] memory); /// @notice Saved addresses of liquidity tokens that DAO is holding. /// @return array of liquidity addresses. function liquidities() external view returns (address[] memory); /// @notice Calculates address of liquidity token from ERC-20 token address. /// @param token_ token address to calculate liquidity address from. /// @return address of liquidity token. function liquidityToken(address token_) external view returns (address); /// @notice Gets tokens and liquidity token addresses of DAO's liquidity holdings. /// @return Arrays of tokens and liquidity tokens, should have the same length. function liquidityHoldings() external view returns (address[] memory, address[] memory); /// @notice DAO admins. /// @return Array of admin addresses. function admins() external view returns (address[] memory); /// @notice DAO balance for specified token. /// @param token_ token address to get balance for. /// @return uint256 token balance. function tokenBalance(address token_) external view returns (uint256); /// @notice DAO balance for liquidity token. /// @param token_ token address to get liquidity balance for. /// @return uin256 token liquidity balance. function liquidityBalance(address token_) external view returns (uint256); /// @notice DAO ethereum balance. /// @return uint256 wei balance. function availableBalance() external view returns (uint256); /// @notice Maximum cost for all tokens of cloned DAO. /// @return uint256 maximum cost in wei. function maxCost() external view returns (uint256); /// @notice Minimum percentage of votes needed to execute a proposal. /// @return uint256 minimum percentage of votes. function executeMinPct() external view returns (uint256); /// @notice Minimum lifetime of proposal before it closes. /// @return uint256 minimum number of hours for proposal lifetime. function votingMinHours() external view returns (uint256); /// @notice Whether DAO is public or private. /// @return bool true if public. function isPublic() external view returns (bool); /// @notice Whether DAO has admins. /// @return bool true if DAO has admins. function hasAdmins() external view returns (bool); /// @notice Proposal ids of DAO. /// @return array of proposal ids. function getProposalIds() external view returns (uint256[] memory); /// @notice Gets proposal info for proposal id. /// @param id_ id of proposal to get info for. /// @return proposalAddress address for proposal execution. /// @return investTokenAddress secondary address for proposal execution, used for investment proposals if ICO and token addresses differ. /// @return daoFunction proposal type. /// @return amount proposal amount eth/token to use during execution. /// @return creator address of proposal creator. /// @return endLifetime epoch time when proposal voting ends. /// @return votesFor amount of votes for the proposal. /// @return votesAgainst amount of votes against the proposal. /// @return executed whether proposal has been executed or not. function getProposal(uint256 id_) external view returns ( address proposalAddress, address investTokenAddress, DaoFunction daoFunction, uint256 amount, address creator, uint256 endLifetime, uint256 votesFor, uint256 votesAgainst, bool executed ); /// @notice Whether a holder is allowed to vote for a proposal. /// @param id_ proposal id to check whether holder is allowed to vote for. /// @param sender_ address of the holder. /// @return bool true if voting is allowed. function canVote(uint256 id_, address sender_) external view returns (bool); /// @notice Whether a holder is allowed to remove a proposal. /// @param id_ proposal id to check whether holder is allowed to remove. /// @param sender_ address of the holder. /// @return bool true if removal is allowed. function canRemove(uint256 id_, address sender_) external view returns (bool); /// @notice Whether a holder is allowed to execute a proposal. /// @param id_ proposal id to check whether holder is allowed to execute. /// @param sender_ address of the holder. /// @return bool true if execution is allowed. function canExecute(uint256 id_, address sender_) external view returns (bool); /// @notice Whether a holder is an admin. /// @param sender_ address of holder. /// @return bool true if holder is an admin (in DAO without admins all holders are treated as such). function isAdmin(address sender_) external view returns (bool); // Public transactions. /// @notice Saves new holdings addresses for DAO. /// @param tokens_ token addresses that DAO has holdings of. function addHoldingsAddresses(address[] calldata tokens_) external; /// @notice Saves new liquidity addresses for DAO. /// @param tokens_ token addresses that DAO has liquidities of. function addLiquidityAddresses(address[] calldata tokens_) external; /// @notice Creates new proposal. /// @param proposalAddress_ main address of the proposal, in investment proposals this is the address funds are sent to. /// @param investTokenAddress_ secondary address of the proposal, used in investment proposals to specify token address. /// @param daoFunction_ type of the proposal. /// @param amount_ amount of funds to use in the proposal. /// @param hoursLifetime_ voting lifetime of the proposal. function propose(address proposalAddress_, address investTokenAddress_, DaoFunction daoFunction_, uint256 amount_, uint256 hoursLifetime_) external; /// @notice Removes existing proposal. /// @param id_ id of proposal to remove. function unpropose(uint256 id_) external; /// @notice Voting for multiple proposals. /// @param ids_ ids of proposals to vote for. /// @param votes_ for or against votes for proposals. function vote(uint256[] calldata ids_, bool[] calldata votes_) external; /// @notice Executes a proposal. /// @param id_ id of proposal to be executed. function execute(uint256 id_) external; /// @notice Buying tokens for cloned DAO. function buy() external payable; /// @notice Sell tokens back to cloned DAO. /// @param amount_ amount of tokens to sell. function sell(uint256 amount_) external; // Owner transactions. /// @notice Sets factory address. /// @param factory_ address of TorroFactory. function setFactoryAddress(address factory_) external; /// @notice Sets vote weight divider. /// @param weight_ weight divider for a single vote. function setVoteWeightDivider(uint256 weight_) external; /// @notice Sets new address for router. /// @param router_ address for router. function setRouter(address router_) external; /// @notice Sets divider for BUY, INVEST, WITHDAW proposals. /// @param divider_ divider for BUY, INVEST, WITHDRAW proposals. function setSpendDivider(uint256 divider_) external; /// @notice Migrates balances of current DAO to a new DAO. /// @param newDao_ address of the new DAO to migrate to. function migrate(address newDao_) external; }
/// @title DAO for proposals, voting and execution. /// @notice Interface for creation, voting and execution of proposals. /// @author ORayskiy - @robitnik_TorroDao
NatSpecSingleLine
canVote
function canVote(uint256 id_, address sender_) external view returns (bool);
/// @notice Whether a holder is allowed to vote for a proposal. /// @param id_ proposal id to check whether holder is allowed to vote for. /// @param sender_ address of the holder. /// @return bool true if voting is allowed.
NatSpecSingleLine
v0.6.6+commit.6c089d02
Unknown
ipfs://d1c6095fcf143d951c9754f00fe8cd59d29ab460461efe53b91eb289fd0fe5ac
{ "func_code_index": [ 5695, 5774 ] }
57,704
TorroDao
ITorroDao.sol
0x3cf9e9d45380b6ab61bde46b2e6cfcd7d8f6cdc1
Solidity
ITorroDao
interface ITorroDao { // Enums. /// @notice Enum of available proposal functions. enum DaoFunction { BUY, SELL, ADD_LIQUIDITY, REMOVE_LIQUIDITY, ADD_ADMIN, REMOVE_ADMIN, INVEST, WITHDRAW } // Initializer. /// @notice Initializer for DAO clones. /// @param torroToken_ main torro token address. /// @param governingToken_ torro token clone that's governing this dao. /// @param factory_ torro factory address. /// @param creator_ creator of cloned DAO. /// @param maxCost_ maximum cost of all governing tokens for cloned DAO. /// @param executeMinPct_ minimum percentage of votes needed for proposal execution. /// @param votingMinHours_ minimum lifetime of proposal before it closes. /// @param isPublic_ whether cloned DAO has public visibility. /// @param hasAdmins_ whether cloned DAO has admins, otherwise all stakers are treated as admins. function initializeCustom( address torroToken_, address governingToken_, address factory_, address creator_, uint256 maxCost_, uint256 executeMinPct_, uint256 votingMinHours_, bool isPublic_, bool hasAdmins_ ) external; // Public calls. /// @notice Address of DAO creator. /// @return DAO creator address. function daoCreator() external view returns (address); /// @notice Amount of tokens needed for a single vote. /// @return uint256 token amount. function voteWeight() external view returns (uint256); /// @notice Amount of votes that holder has. /// @param sender_ address of the holder. /// @return number of votes. function votesOf(address sender_) external view returns (uint256); /// @notice Address of the governing token. /// @return address of the governing token. function tokenAddress() external view returns (address); /// @notice Saved addresses of tokens that DAO is holding. /// @return array of holdings addresses. function holdings() external view returns (address[] memory); /// @notice Saved addresses of liquidity tokens that DAO is holding. /// @return array of liquidity addresses. function liquidities() external view returns (address[] memory); /// @notice Calculates address of liquidity token from ERC-20 token address. /// @param token_ token address to calculate liquidity address from. /// @return address of liquidity token. function liquidityToken(address token_) external view returns (address); /// @notice Gets tokens and liquidity token addresses of DAO's liquidity holdings. /// @return Arrays of tokens and liquidity tokens, should have the same length. function liquidityHoldings() external view returns (address[] memory, address[] memory); /// @notice DAO admins. /// @return Array of admin addresses. function admins() external view returns (address[] memory); /// @notice DAO balance for specified token. /// @param token_ token address to get balance for. /// @return uint256 token balance. function tokenBalance(address token_) external view returns (uint256); /// @notice DAO balance for liquidity token. /// @param token_ token address to get liquidity balance for. /// @return uin256 token liquidity balance. function liquidityBalance(address token_) external view returns (uint256); /// @notice DAO ethereum balance. /// @return uint256 wei balance. function availableBalance() external view returns (uint256); /// @notice Maximum cost for all tokens of cloned DAO. /// @return uint256 maximum cost in wei. function maxCost() external view returns (uint256); /// @notice Minimum percentage of votes needed to execute a proposal. /// @return uint256 minimum percentage of votes. function executeMinPct() external view returns (uint256); /// @notice Minimum lifetime of proposal before it closes. /// @return uint256 minimum number of hours for proposal lifetime. function votingMinHours() external view returns (uint256); /// @notice Whether DAO is public or private. /// @return bool true if public. function isPublic() external view returns (bool); /// @notice Whether DAO has admins. /// @return bool true if DAO has admins. function hasAdmins() external view returns (bool); /// @notice Proposal ids of DAO. /// @return array of proposal ids. function getProposalIds() external view returns (uint256[] memory); /// @notice Gets proposal info for proposal id. /// @param id_ id of proposal to get info for. /// @return proposalAddress address for proposal execution. /// @return investTokenAddress secondary address for proposal execution, used for investment proposals if ICO and token addresses differ. /// @return daoFunction proposal type. /// @return amount proposal amount eth/token to use during execution. /// @return creator address of proposal creator. /// @return endLifetime epoch time when proposal voting ends. /// @return votesFor amount of votes for the proposal. /// @return votesAgainst amount of votes against the proposal. /// @return executed whether proposal has been executed or not. function getProposal(uint256 id_) external view returns ( address proposalAddress, address investTokenAddress, DaoFunction daoFunction, uint256 amount, address creator, uint256 endLifetime, uint256 votesFor, uint256 votesAgainst, bool executed ); /// @notice Whether a holder is allowed to vote for a proposal. /// @param id_ proposal id to check whether holder is allowed to vote for. /// @param sender_ address of the holder. /// @return bool true if voting is allowed. function canVote(uint256 id_, address sender_) external view returns (bool); /// @notice Whether a holder is allowed to remove a proposal. /// @param id_ proposal id to check whether holder is allowed to remove. /// @param sender_ address of the holder. /// @return bool true if removal is allowed. function canRemove(uint256 id_, address sender_) external view returns (bool); /// @notice Whether a holder is allowed to execute a proposal. /// @param id_ proposal id to check whether holder is allowed to execute. /// @param sender_ address of the holder. /// @return bool true if execution is allowed. function canExecute(uint256 id_, address sender_) external view returns (bool); /// @notice Whether a holder is an admin. /// @param sender_ address of holder. /// @return bool true if holder is an admin (in DAO without admins all holders are treated as such). function isAdmin(address sender_) external view returns (bool); // Public transactions. /// @notice Saves new holdings addresses for DAO. /// @param tokens_ token addresses that DAO has holdings of. function addHoldingsAddresses(address[] calldata tokens_) external; /// @notice Saves new liquidity addresses for DAO. /// @param tokens_ token addresses that DAO has liquidities of. function addLiquidityAddresses(address[] calldata tokens_) external; /// @notice Creates new proposal. /// @param proposalAddress_ main address of the proposal, in investment proposals this is the address funds are sent to. /// @param investTokenAddress_ secondary address of the proposal, used in investment proposals to specify token address. /// @param daoFunction_ type of the proposal. /// @param amount_ amount of funds to use in the proposal. /// @param hoursLifetime_ voting lifetime of the proposal. function propose(address proposalAddress_, address investTokenAddress_, DaoFunction daoFunction_, uint256 amount_, uint256 hoursLifetime_) external; /// @notice Removes existing proposal. /// @param id_ id of proposal to remove. function unpropose(uint256 id_) external; /// @notice Voting for multiple proposals. /// @param ids_ ids of proposals to vote for. /// @param votes_ for or against votes for proposals. function vote(uint256[] calldata ids_, bool[] calldata votes_) external; /// @notice Executes a proposal. /// @param id_ id of proposal to be executed. function execute(uint256 id_) external; /// @notice Buying tokens for cloned DAO. function buy() external payable; /// @notice Sell tokens back to cloned DAO. /// @param amount_ amount of tokens to sell. function sell(uint256 amount_) external; // Owner transactions. /// @notice Sets factory address. /// @param factory_ address of TorroFactory. function setFactoryAddress(address factory_) external; /// @notice Sets vote weight divider. /// @param weight_ weight divider for a single vote. function setVoteWeightDivider(uint256 weight_) external; /// @notice Sets new address for router. /// @param router_ address for router. function setRouter(address router_) external; /// @notice Sets divider for BUY, INVEST, WITHDAW proposals. /// @param divider_ divider for BUY, INVEST, WITHDRAW proposals. function setSpendDivider(uint256 divider_) external; /// @notice Migrates balances of current DAO to a new DAO. /// @param newDao_ address of the new DAO to migrate to. function migrate(address newDao_) external; }
/// @title DAO for proposals, voting and execution. /// @notice Interface for creation, voting and execution of proposals. /// @author ORayskiy - @robitnik_TorroDao
NatSpecSingleLine
canRemove
function canRemove(uint256 id_, address sender_) external view returns (bool);
/// @notice Whether a holder is allowed to remove a proposal. /// @param id_ proposal id to check whether holder is allowed to remove. /// @param sender_ address of the holder. /// @return bool true if removal is allowed.
NatSpecSingleLine
v0.6.6+commit.6c089d02
Unknown
ipfs://d1c6095fcf143d951c9754f00fe8cd59d29ab460461efe53b91eb289fd0fe5ac
{ "func_code_index": [ 6011, 6092 ] }
57,705
TorroDao
ITorroDao.sol
0x3cf9e9d45380b6ab61bde46b2e6cfcd7d8f6cdc1
Solidity
ITorroDao
interface ITorroDao { // Enums. /// @notice Enum of available proposal functions. enum DaoFunction { BUY, SELL, ADD_LIQUIDITY, REMOVE_LIQUIDITY, ADD_ADMIN, REMOVE_ADMIN, INVEST, WITHDRAW } // Initializer. /// @notice Initializer for DAO clones. /// @param torroToken_ main torro token address. /// @param governingToken_ torro token clone that's governing this dao. /// @param factory_ torro factory address. /// @param creator_ creator of cloned DAO. /// @param maxCost_ maximum cost of all governing tokens for cloned DAO. /// @param executeMinPct_ minimum percentage of votes needed for proposal execution. /// @param votingMinHours_ minimum lifetime of proposal before it closes. /// @param isPublic_ whether cloned DAO has public visibility. /// @param hasAdmins_ whether cloned DAO has admins, otherwise all stakers are treated as admins. function initializeCustom( address torroToken_, address governingToken_, address factory_, address creator_, uint256 maxCost_, uint256 executeMinPct_, uint256 votingMinHours_, bool isPublic_, bool hasAdmins_ ) external; // Public calls. /// @notice Address of DAO creator. /// @return DAO creator address. function daoCreator() external view returns (address); /// @notice Amount of tokens needed for a single vote. /// @return uint256 token amount. function voteWeight() external view returns (uint256); /// @notice Amount of votes that holder has. /// @param sender_ address of the holder. /// @return number of votes. function votesOf(address sender_) external view returns (uint256); /// @notice Address of the governing token. /// @return address of the governing token. function tokenAddress() external view returns (address); /// @notice Saved addresses of tokens that DAO is holding. /// @return array of holdings addresses. function holdings() external view returns (address[] memory); /// @notice Saved addresses of liquidity tokens that DAO is holding. /// @return array of liquidity addresses. function liquidities() external view returns (address[] memory); /// @notice Calculates address of liquidity token from ERC-20 token address. /// @param token_ token address to calculate liquidity address from. /// @return address of liquidity token. function liquidityToken(address token_) external view returns (address); /// @notice Gets tokens and liquidity token addresses of DAO's liquidity holdings. /// @return Arrays of tokens and liquidity tokens, should have the same length. function liquidityHoldings() external view returns (address[] memory, address[] memory); /// @notice DAO admins. /// @return Array of admin addresses. function admins() external view returns (address[] memory); /// @notice DAO balance for specified token. /// @param token_ token address to get balance for. /// @return uint256 token balance. function tokenBalance(address token_) external view returns (uint256); /// @notice DAO balance for liquidity token. /// @param token_ token address to get liquidity balance for. /// @return uin256 token liquidity balance. function liquidityBalance(address token_) external view returns (uint256); /// @notice DAO ethereum balance. /// @return uint256 wei balance. function availableBalance() external view returns (uint256); /// @notice Maximum cost for all tokens of cloned DAO. /// @return uint256 maximum cost in wei. function maxCost() external view returns (uint256); /// @notice Minimum percentage of votes needed to execute a proposal. /// @return uint256 minimum percentage of votes. function executeMinPct() external view returns (uint256); /// @notice Minimum lifetime of proposal before it closes. /// @return uint256 minimum number of hours for proposal lifetime. function votingMinHours() external view returns (uint256); /// @notice Whether DAO is public or private. /// @return bool true if public. function isPublic() external view returns (bool); /// @notice Whether DAO has admins. /// @return bool true if DAO has admins. function hasAdmins() external view returns (bool); /// @notice Proposal ids of DAO. /// @return array of proposal ids. function getProposalIds() external view returns (uint256[] memory); /// @notice Gets proposal info for proposal id. /// @param id_ id of proposal to get info for. /// @return proposalAddress address for proposal execution. /// @return investTokenAddress secondary address for proposal execution, used for investment proposals if ICO and token addresses differ. /// @return daoFunction proposal type. /// @return amount proposal amount eth/token to use during execution. /// @return creator address of proposal creator. /// @return endLifetime epoch time when proposal voting ends. /// @return votesFor amount of votes for the proposal. /// @return votesAgainst amount of votes against the proposal. /// @return executed whether proposal has been executed or not. function getProposal(uint256 id_) external view returns ( address proposalAddress, address investTokenAddress, DaoFunction daoFunction, uint256 amount, address creator, uint256 endLifetime, uint256 votesFor, uint256 votesAgainst, bool executed ); /// @notice Whether a holder is allowed to vote for a proposal. /// @param id_ proposal id to check whether holder is allowed to vote for. /// @param sender_ address of the holder. /// @return bool true if voting is allowed. function canVote(uint256 id_, address sender_) external view returns (bool); /// @notice Whether a holder is allowed to remove a proposal. /// @param id_ proposal id to check whether holder is allowed to remove. /// @param sender_ address of the holder. /// @return bool true if removal is allowed. function canRemove(uint256 id_, address sender_) external view returns (bool); /// @notice Whether a holder is allowed to execute a proposal. /// @param id_ proposal id to check whether holder is allowed to execute. /// @param sender_ address of the holder. /// @return bool true if execution is allowed. function canExecute(uint256 id_, address sender_) external view returns (bool); /// @notice Whether a holder is an admin. /// @param sender_ address of holder. /// @return bool true if holder is an admin (in DAO without admins all holders are treated as such). function isAdmin(address sender_) external view returns (bool); // Public transactions. /// @notice Saves new holdings addresses for DAO. /// @param tokens_ token addresses that DAO has holdings of. function addHoldingsAddresses(address[] calldata tokens_) external; /// @notice Saves new liquidity addresses for DAO. /// @param tokens_ token addresses that DAO has liquidities of. function addLiquidityAddresses(address[] calldata tokens_) external; /// @notice Creates new proposal. /// @param proposalAddress_ main address of the proposal, in investment proposals this is the address funds are sent to. /// @param investTokenAddress_ secondary address of the proposal, used in investment proposals to specify token address. /// @param daoFunction_ type of the proposal. /// @param amount_ amount of funds to use in the proposal. /// @param hoursLifetime_ voting lifetime of the proposal. function propose(address proposalAddress_, address investTokenAddress_, DaoFunction daoFunction_, uint256 amount_, uint256 hoursLifetime_) external; /// @notice Removes existing proposal. /// @param id_ id of proposal to remove. function unpropose(uint256 id_) external; /// @notice Voting for multiple proposals. /// @param ids_ ids of proposals to vote for. /// @param votes_ for or against votes for proposals. function vote(uint256[] calldata ids_, bool[] calldata votes_) external; /// @notice Executes a proposal. /// @param id_ id of proposal to be executed. function execute(uint256 id_) external; /// @notice Buying tokens for cloned DAO. function buy() external payable; /// @notice Sell tokens back to cloned DAO. /// @param amount_ amount of tokens to sell. function sell(uint256 amount_) external; // Owner transactions. /// @notice Sets factory address. /// @param factory_ address of TorroFactory. function setFactoryAddress(address factory_) external; /// @notice Sets vote weight divider. /// @param weight_ weight divider for a single vote. function setVoteWeightDivider(uint256 weight_) external; /// @notice Sets new address for router. /// @param router_ address for router. function setRouter(address router_) external; /// @notice Sets divider for BUY, INVEST, WITHDAW proposals. /// @param divider_ divider for BUY, INVEST, WITHDRAW proposals. function setSpendDivider(uint256 divider_) external; /// @notice Migrates balances of current DAO to a new DAO. /// @param newDao_ address of the new DAO to migrate to. function migrate(address newDao_) external; }
/// @title DAO for proposals, voting and execution. /// @notice Interface for creation, voting and execution of proposals. /// @author ORayskiy - @robitnik_TorroDao
NatSpecSingleLine
canExecute
function canExecute(uint256 id_, address sender_) external view returns (bool);
/// @notice Whether a holder is allowed to execute a proposal. /// @param id_ proposal id to check whether holder is allowed to execute. /// @param sender_ address of the holder. /// @return bool true if execution is allowed.
NatSpecSingleLine
v0.6.6+commit.6c089d02
Unknown
ipfs://d1c6095fcf143d951c9754f00fe8cd59d29ab460461efe53b91eb289fd0fe5ac
{ "func_code_index": [ 6333, 6415 ] }
57,706
TorroDao
ITorroDao.sol
0x3cf9e9d45380b6ab61bde46b2e6cfcd7d8f6cdc1
Solidity
ITorroDao
interface ITorroDao { // Enums. /// @notice Enum of available proposal functions. enum DaoFunction { BUY, SELL, ADD_LIQUIDITY, REMOVE_LIQUIDITY, ADD_ADMIN, REMOVE_ADMIN, INVEST, WITHDRAW } // Initializer. /// @notice Initializer for DAO clones. /// @param torroToken_ main torro token address. /// @param governingToken_ torro token clone that's governing this dao. /// @param factory_ torro factory address. /// @param creator_ creator of cloned DAO. /// @param maxCost_ maximum cost of all governing tokens for cloned DAO. /// @param executeMinPct_ minimum percentage of votes needed for proposal execution. /// @param votingMinHours_ minimum lifetime of proposal before it closes. /// @param isPublic_ whether cloned DAO has public visibility. /// @param hasAdmins_ whether cloned DAO has admins, otherwise all stakers are treated as admins. function initializeCustom( address torroToken_, address governingToken_, address factory_, address creator_, uint256 maxCost_, uint256 executeMinPct_, uint256 votingMinHours_, bool isPublic_, bool hasAdmins_ ) external; // Public calls. /// @notice Address of DAO creator. /// @return DAO creator address. function daoCreator() external view returns (address); /// @notice Amount of tokens needed for a single vote. /// @return uint256 token amount. function voteWeight() external view returns (uint256); /// @notice Amount of votes that holder has. /// @param sender_ address of the holder. /// @return number of votes. function votesOf(address sender_) external view returns (uint256); /// @notice Address of the governing token. /// @return address of the governing token. function tokenAddress() external view returns (address); /// @notice Saved addresses of tokens that DAO is holding. /// @return array of holdings addresses. function holdings() external view returns (address[] memory); /// @notice Saved addresses of liquidity tokens that DAO is holding. /// @return array of liquidity addresses. function liquidities() external view returns (address[] memory); /// @notice Calculates address of liquidity token from ERC-20 token address. /// @param token_ token address to calculate liquidity address from. /// @return address of liquidity token. function liquidityToken(address token_) external view returns (address); /// @notice Gets tokens and liquidity token addresses of DAO's liquidity holdings. /// @return Arrays of tokens and liquidity tokens, should have the same length. function liquidityHoldings() external view returns (address[] memory, address[] memory); /// @notice DAO admins. /// @return Array of admin addresses. function admins() external view returns (address[] memory); /// @notice DAO balance for specified token. /// @param token_ token address to get balance for. /// @return uint256 token balance. function tokenBalance(address token_) external view returns (uint256); /// @notice DAO balance for liquidity token. /// @param token_ token address to get liquidity balance for. /// @return uin256 token liquidity balance. function liquidityBalance(address token_) external view returns (uint256); /// @notice DAO ethereum balance. /// @return uint256 wei balance. function availableBalance() external view returns (uint256); /// @notice Maximum cost for all tokens of cloned DAO. /// @return uint256 maximum cost in wei. function maxCost() external view returns (uint256); /// @notice Minimum percentage of votes needed to execute a proposal. /// @return uint256 minimum percentage of votes. function executeMinPct() external view returns (uint256); /// @notice Minimum lifetime of proposal before it closes. /// @return uint256 minimum number of hours for proposal lifetime. function votingMinHours() external view returns (uint256); /// @notice Whether DAO is public or private. /// @return bool true if public. function isPublic() external view returns (bool); /// @notice Whether DAO has admins. /// @return bool true if DAO has admins. function hasAdmins() external view returns (bool); /// @notice Proposal ids of DAO. /// @return array of proposal ids. function getProposalIds() external view returns (uint256[] memory); /// @notice Gets proposal info for proposal id. /// @param id_ id of proposal to get info for. /// @return proposalAddress address for proposal execution. /// @return investTokenAddress secondary address for proposal execution, used for investment proposals if ICO and token addresses differ. /// @return daoFunction proposal type. /// @return amount proposal amount eth/token to use during execution. /// @return creator address of proposal creator. /// @return endLifetime epoch time when proposal voting ends. /// @return votesFor amount of votes for the proposal. /// @return votesAgainst amount of votes against the proposal. /// @return executed whether proposal has been executed or not. function getProposal(uint256 id_) external view returns ( address proposalAddress, address investTokenAddress, DaoFunction daoFunction, uint256 amount, address creator, uint256 endLifetime, uint256 votesFor, uint256 votesAgainst, bool executed ); /// @notice Whether a holder is allowed to vote for a proposal. /// @param id_ proposal id to check whether holder is allowed to vote for. /// @param sender_ address of the holder. /// @return bool true if voting is allowed. function canVote(uint256 id_, address sender_) external view returns (bool); /// @notice Whether a holder is allowed to remove a proposal. /// @param id_ proposal id to check whether holder is allowed to remove. /// @param sender_ address of the holder. /// @return bool true if removal is allowed. function canRemove(uint256 id_, address sender_) external view returns (bool); /// @notice Whether a holder is allowed to execute a proposal. /// @param id_ proposal id to check whether holder is allowed to execute. /// @param sender_ address of the holder. /// @return bool true if execution is allowed. function canExecute(uint256 id_, address sender_) external view returns (bool); /// @notice Whether a holder is an admin. /// @param sender_ address of holder. /// @return bool true if holder is an admin (in DAO without admins all holders are treated as such). function isAdmin(address sender_) external view returns (bool); // Public transactions. /// @notice Saves new holdings addresses for DAO. /// @param tokens_ token addresses that DAO has holdings of. function addHoldingsAddresses(address[] calldata tokens_) external; /// @notice Saves new liquidity addresses for DAO. /// @param tokens_ token addresses that DAO has liquidities of. function addLiquidityAddresses(address[] calldata tokens_) external; /// @notice Creates new proposal. /// @param proposalAddress_ main address of the proposal, in investment proposals this is the address funds are sent to. /// @param investTokenAddress_ secondary address of the proposal, used in investment proposals to specify token address. /// @param daoFunction_ type of the proposal. /// @param amount_ amount of funds to use in the proposal. /// @param hoursLifetime_ voting lifetime of the proposal. function propose(address proposalAddress_, address investTokenAddress_, DaoFunction daoFunction_, uint256 amount_, uint256 hoursLifetime_) external; /// @notice Removes existing proposal. /// @param id_ id of proposal to remove. function unpropose(uint256 id_) external; /// @notice Voting for multiple proposals. /// @param ids_ ids of proposals to vote for. /// @param votes_ for or against votes for proposals. function vote(uint256[] calldata ids_, bool[] calldata votes_) external; /// @notice Executes a proposal. /// @param id_ id of proposal to be executed. function execute(uint256 id_) external; /// @notice Buying tokens for cloned DAO. function buy() external payable; /// @notice Sell tokens back to cloned DAO. /// @param amount_ amount of tokens to sell. function sell(uint256 amount_) external; // Owner transactions. /// @notice Sets factory address. /// @param factory_ address of TorroFactory. function setFactoryAddress(address factory_) external; /// @notice Sets vote weight divider. /// @param weight_ weight divider for a single vote. function setVoteWeightDivider(uint256 weight_) external; /// @notice Sets new address for router. /// @param router_ address for router. function setRouter(address router_) external; /// @notice Sets divider for BUY, INVEST, WITHDAW proposals. /// @param divider_ divider for BUY, INVEST, WITHDRAW proposals. function setSpendDivider(uint256 divider_) external; /// @notice Migrates balances of current DAO to a new DAO. /// @param newDao_ address of the new DAO to migrate to. function migrate(address newDao_) external; }
/// @title DAO for proposals, voting and execution. /// @notice Interface for creation, voting and execution of proposals. /// @author ORayskiy - @robitnik_TorroDao
NatSpecSingleLine
isAdmin
function isAdmin(address sender_) external view returns (bool);
/// @notice Whether a holder is an admin. /// @param sender_ address of holder. /// @return bool true if holder is an admin (in DAO without admins all holders are treated as such).
NatSpecSingleLine
v0.6.6+commit.6c089d02
Unknown
ipfs://d1c6095fcf143d951c9754f00fe8cd59d29ab460461efe53b91eb289fd0fe5ac
{ "func_code_index": [ 6608, 6674 ] }
57,707
TorroDao
ITorroDao.sol
0x3cf9e9d45380b6ab61bde46b2e6cfcd7d8f6cdc1
Solidity
ITorroDao
interface ITorroDao { // Enums. /// @notice Enum of available proposal functions. enum DaoFunction { BUY, SELL, ADD_LIQUIDITY, REMOVE_LIQUIDITY, ADD_ADMIN, REMOVE_ADMIN, INVEST, WITHDRAW } // Initializer. /// @notice Initializer for DAO clones. /// @param torroToken_ main torro token address. /// @param governingToken_ torro token clone that's governing this dao. /// @param factory_ torro factory address. /// @param creator_ creator of cloned DAO. /// @param maxCost_ maximum cost of all governing tokens for cloned DAO. /// @param executeMinPct_ minimum percentage of votes needed for proposal execution. /// @param votingMinHours_ minimum lifetime of proposal before it closes. /// @param isPublic_ whether cloned DAO has public visibility. /// @param hasAdmins_ whether cloned DAO has admins, otherwise all stakers are treated as admins. function initializeCustom( address torroToken_, address governingToken_, address factory_, address creator_, uint256 maxCost_, uint256 executeMinPct_, uint256 votingMinHours_, bool isPublic_, bool hasAdmins_ ) external; // Public calls. /// @notice Address of DAO creator. /// @return DAO creator address. function daoCreator() external view returns (address); /// @notice Amount of tokens needed for a single vote. /// @return uint256 token amount. function voteWeight() external view returns (uint256); /// @notice Amount of votes that holder has. /// @param sender_ address of the holder. /// @return number of votes. function votesOf(address sender_) external view returns (uint256); /// @notice Address of the governing token. /// @return address of the governing token. function tokenAddress() external view returns (address); /// @notice Saved addresses of tokens that DAO is holding. /// @return array of holdings addresses. function holdings() external view returns (address[] memory); /// @notice Saved addresses of liquidity tokens that DAO is holding. /// @return array of liquidity addresses. function liquidities() external view returns (address[] memory); /// @notice Calculates address of liquidity token from ERC-20 token address. /// @param token_ token address to calculate liquidity address from. /// @return address of liquidity token. function liquidityToken(address token_) external view returns (address); /// @notice Gets tokens and liquidity token addresses of DAO's liquidity holdings. /// @return Arrays of tokens and liquidity tokens, should have the same length. function liquidityHoldings() external view returns (address[] memory, address[] memory); /// @notice DAO admins. /// @return Array of admin addresses. function admins() external view returns (address[] memory); /// @notice DAO balance for specified token. /// @param token_ token address to get balance for. /// @return uint256 token balance. function tokenBalance(address token_) external view returns (uint256); /// @notice DAO balance for liquidity token. /// @param token_ token address to get liquidity balance for. /// @return uin256 token liquidity balance. function liquidityBalance(address token_) external view returns (uint256); /// @notice DAO ethereum balance. /// @return uint256 wei balance. function availableBalance() external view returns (uint256); /// @notice Maximum cost for all tokens of cloned DAO. /// @return uint256 maximum cost in wei. function maxCost() external view returns (uint256); /// @notice Minimum percentage of votes needed to execute a proposal. /// @return uint256 minimum percentage of votes. function executeMinPct() external view returns (uint256); /// @notice Minimum lifetime of proposal before it closes. /// @return uint256 minimum number of hours for proposal lifetime. function votingMinHours() external view returns (uint256); /// @notice Whether DAO is public or private. /// @return bool true if public. function isPublic() external view returns (bool); /// @notice Whether DAO has admins. /// @return bool true if DAO has admins. function hasAdmins() external view returns (bool); /// @notice Proposal ids of DAO. /// @return array of proposal ids. function getProposalIds() external view returns (uint256[] memory); /// @notice Gets proposal info for proposal id. /// @param id_ id of proposal to get info for. /// @return proposalAddress address for proposal execution. /// @return investTokenAddress secondary address for proposal execution, used for investment proposals if ICO and token addresses differ. /// @return daoFunction proposal type. /// @return amount proposal amount eth/token to use during execution. /// @return creator address of proposal creator. /// @return endLifetime epoch time when proposal voting ends. /// @return votesFor amount of votes for the proposal. /// @return votesAgainst amount of votes against the proposal. /// @return executed whether proposal has been executed or not. function getProposal(uint256 id_) external view returns ( address proposalAddress, address investTokenAddress, DaoFunction daoFunction, uint256 amount, address creator, uint256 endLifetime, uint256 votesFor, uint256 votesAgainst, bool executed ); /// @notice Whether a holder is allowed to vote for a proposal. /// @param id_ proposal id to check whether holder is allowed to vote for. /// @param sender_ address of the holder. /// @return bool true if voting is allowed. function canVote(uint256 id_, address sender_) external view returns (bool); /// @notice Whether a holder is allowed to remove a proposal. /// @param id_ proposal id to check whether holder is allowed to remove. /// @param sender_ address of the holder. /// @return bool true if removal is allowed. function canRemove(uint256 id_, address sender_) external view returns (bool); /// @notice Whether a holder is allowed to execute a proposal. /// @param id_ proposal id to check whether holder is allowed to execute. /// @param sender_ address of the holder. /// @return bool true if execution is allowed. function canExecute(uint256 id_, address sender_) external view returns (bool); /// @notice Whether a holder is an admin. /// @param sender_ address of holder. /// @return bool true if holder is an admin (in DAO without admins all holders are treated as such). function isAdmin(address sender_) external view returns (bool); // Public transactions. /// @notice Saves new holdings addresses for DAO. /// @param tokens_ token addresses that DAO has holdings of. function addHoldingsAddresses(address[] calldata tokens_) external; /// @notice Saves new liquidity addresses for DAO. /// @param tokens_ token addresses that DAO has liquidities of. function addLiquidityAddresses(address[] calldata tokens_) external; /// @notice Creates new proposal. /// @param proposalAddress_ main address of the proposal, in investment proposals this is the address funds are sent to. /// @param investTokenAddress_ secondary address of the proposal, used in investment proposals to specify token address. /// @param daoFunction_ type of the proposal. /// @param amount_ amount of funds to use in the proposal. /// @param hoursLifetime_ voting lifetime of the proposal. function propose(address proposalAddress_, address investTokenAddress_, DaoFunction daoFunction_, uint256 amount_, uint256 hoursLifetime_) external; /// @notice Removes existing proposal. /// @param id_ id of proposal to remove. function unpropose(uint256 id_) external; /// @notice Voting for multiple proposals. /// @param ids_ ids of proposals to vote for. /// @param votes_ for or against votes for proposals. function vote(uint256[] calldata ids_, bool[] calldata votes_) external; /// @notice Executes a proposal. /// @param id_ id of proposal to be executed. function execute(uint256 id_) external; /// @notice Buying tokens for cloned DAO. function buy() external payable; /// @notice Sell tokens back to cloned DAO. /// @param amount_ amount of tokens to sell. function sell(uint256 amount_) external; // Owner transactions. /// @notice Sets factory address. /// @param factory_ address of TorroFactory. function setFactoryAddress(address factory_) external; /// @notice Sets vote weight divider. /// @param weight_ weight divider for a single vote. function setVoteWeightDivider(uint256 weight_) external; /// @notice Sets new address for router. /// @param router_ address for router. function setRouter(address router_) external; /// @notice Sets divider for BUY, INVEST, WITHDAW proposals. /// @param divider_ divider for BUY, INVEST, WITHDRAW proposals. function setSpendDivider(uint256 divider_) external; /// @notice Migrates balances of current DAO to a new DAO. /// @param newDao_ address of the new DAO to migrate to. function migrate(address newDao_) external; }
/// @title DAO for proposals, voting and execution. /// @notice Interface for creation, voting and execution of proposals. /// @author ORayskiy - @robitnik_TorroDao
NatSpecSingleLine
addHoldingsAddresses
function addHoldingsAddresses(address[] calldata tokens_) external;
/// @notice Saves new holdings addresses for DAO. /// @param tokens_ token addresses that DAO has holdings of.
NatSpecSingleLine
v0.6.6+commit.6c089d02
Unknown
ipfs://d1c6095fcf143d951c9754f00fe8cd59d29ab460461efe53b91eb289fd0fe5ac
{ "func_code_index": [ 6823, 6893 ] }
57,708
TorroDao
ITorroDao.sol
0x3cf9e9d45380b6ab61bde46b2e6cfcd7d8f6cdc1
Solidity
ITorroDao
interface ITorroDao { // Enums. /// @notice Enum of available proposal functions. enum DaoFunction { BUY, SELL, ADD_LIQUIDITY, REMOVE_LIQUIDITY, ADD_ADMIN, REMOVE_ADMIN, INVEST, WITHDRAW } // Initializer. /// @notice Initializer for DAO clones. /// @param torroToken_ main torro token address. /// @param governingToken_ torro token clone that's governing this dao. /// @param factory_ torro factory address. /// @param creator_ creator of cloned DAO. /// @param maxCost_ maximum cost of all governing tokens for cloned DAO. /// @param executeMinPct_ minimum percentage of votes needed for proposal execution. /// @param votingMinHours_ minimum lifetime of proposal before it closes. /// @param isPublic_ whether cloned DAO has public visibility. /// @param hasAdmins_ whether cloned DAO has admins, otherwise all stakers are treated as admins. function initializeCustom( address torroToken_, address governingToken_, address factory_, address creator_, uint256 maxCost_, uint256 executeMinPct_, uint256 votingMinHours_, bool isPublic_, bool hasAdmins_ ) external; // Public calls. /// @notice Address of DAO creator. /// @return DAO creator address. function daoCreator() external view returns (address); /// @notice Amount of tokens needed for a single vote. /// @return uint256 token amount. function voteWeight() external view returns (uint256); /// @notice Amount of votes that holder has. /// @param sender_ address of the holder. /// @return number of votes. function votesOf(address sender_) external view returns (uint256); /// @notice Address of the governing token. /// @return address of the governing token. function tokenAddress() external view returns (address); /// @notice Saved addresses of tokens that DAO is holding. /// @return array of holdings addresses. function holdings() external view returns (address[] memory); /// @notice Saved addresses of liquidity tokens that DAO is holding. /// @return array of liquidity addresses. function liquidities() external view returns (address[] memory); /// @notice Calculates address of liquidity token from ERC-20 token address. /// @param token_ token address to calculate liquidity address from. /// @return address of liquidity token. function liquidityToken(address token_) external view returns (address); /// @notice Gets tokens and liquidity token addresses of DAO's liquidity holdings. /// @return Arrays of tokens and liquidity tokens, should have the same length. function liquidityHoldings() external view returns (address[] memory, address[] memory); /// @notice DAO admins. /// @return Array of admin addresses. function admins() external view returns (address[] memory); /// @notice DAO balance for specified token. /// @param token_ token address to get balance for. /// @return uint256 token balance. function tokenBalance(address token_) external view returns (uint256); /// @notice DAO balance for liquidity token. /// @param token_ token address to get liquidity balance for. /// @return uin256 token liquidity balance. function liquidityBalance(address token_) external view returns (uint256); /// @notice DAO ethereum balance. /// @return uint256 wei balance. function availableBalance() external view returns (uint256); /// @notice Maximum cost for all tokens of cloned DAO. /// @return uint256 maximum cost in wei. function maxCost() external view returns (uint256); /// @notice Minimum percentage of votes needed to execute a proposal. /// @return uint256 minimum percentage of votes. function executeMinPct() external view returns (uint256); /// @notice Minimum lifetime of proposal before it closes. /// @return uint256 minimum number of hours for proposal lifetime. function votingMinHours() external view returns (uint256); /// @notice Whether DAO is public or private. /// @return bool true if public. function isPublic() external view returns (bool); /// @notice Whether DAO has admins. /// @return bool true if DAO has admins. function hasAdmins() external view returns (bool); /// @notice Proposal ids of DAO. /// @return array of proposal ids. function getProposalIds() external view returns (uint256[] memory); /// @notice Gets proposal info for proposal id. /// @param id_ id of proposal to get info for. /// @return proposalAddress address for proposal execution. /// @return investTokenAddress secondary address for proposal execution, used for investment proposals if ICO and token addresses differ. /// @return daoFunction proposal type. /// @return amount proposal amount eth/token to use during execution. /// @return creator address of proposal creator. /// @return endLifetime epoch time when proposal voting ends. /// @return votesFor amount of votes for the proposal. /// @return votesAgainst amount of votes against the proposal. /// @return executed whether proposal has been executed or not. function getProposal(uint256 id_) external view returns ( address proposalAddress, address investTokenAddress, DaoFunction daoFunction, uint256 amount, address creator, uint256 endLifetime, uint256 votesFor, uint256 votesAgainst, bool executed ); /// @notice Whether a holder is allowed to vote for a proposal. /// @param id_ proposal id to check whether holder is allowed to vote for. /// @param sender_ address of the holder. /// @return bool true if voting is allowed. function canVote(uint256 id_, address sender_) external view returns (bool); /// @notice Whether a holder is allowed to remove a proposal. /// @param id_ proposal id to check whether holder is allowed to remove. /// @param sender_ address of the holder. /// @return bool true if removal is allowed. function canRemove(uint256 id_, address sender_) external view returns (bool); /// @notice Whether a holder is allowed to execute a proposal. /// @param id_ proposal id to check whether holder is allowed to execute. /// @param sender_ address of the holder. /// @return bool true if execution is allowed. function canExecute(uint256 id_, address sender_) external view returns (bool); /// @notice Whether a holder is an admin. /// @param sender_ address of holder. /// @return bool true if holder is an admin (in DAO without admins all holders are treated as such). function isAdmin(address sender_) external view returns (bool); // Public transactions. /// @notice Saves new holdings addresses for DAO. /// @param tokens_ token addresses that DAO has holdings of. function addHoldingsAddresses(address[] calldata tokens_) external; /// @notice Saves new liquidity addresses for DAO. /// @param tokens_ token addresses that DAO has liquidities of. function addLiquidityAddresses(address[] calldata tokens_) external; /// @notice Creates new proposal. /// @param proposalAddress_ main address of the proposal, in investment proposals this is the address funds are sent to. /// @param investTokenAddress_ secondary address of the proposal, used in investment proposals to specify token address. /// @param daoFunction_ type of the proposal. /// @param amount_ amount of funds to use in the proposal. /// @param hoursLifetime_ voting lifetime of the proposal. function propose(address proposalAddress_, address investTokenAddress_, DaoFunction daoFunction_, uint256 amount_, uint256 hoursLifetime_) external; /// @notice Removes existing proposal. /// @param id_ id of proposal to remove. function unpropose(uint256 id_) external; /// @notice Voting for multiple proposals. /// @param ids_ ids of proposals to vote for. /// @param votes_ for or against votes for proposals. function vote(uint256[] calldata ids_, bool[] calldata votes_) external; /// @notice Executes a proposal. /// @param id_ id of proposal to be executed. function execute(uint256 id_) external; /// @notice Buying tokens for cloned DAO. function buy() external payable; /// @notice Sell tokens back to cloned DAO. /// @param amount_ amount of tokens to sell. function sell(uint256 amount_) external; // Owner transactions. /// @notice Sets factory address. /// @param factory_ address of TorroFactory. function setFactoryAddress(address factory_) external; /// @notice Sets vote weight divider. /// @param weight_ weight divider for a single vote. function setVoteWeightDivider(uint256 weight_) external; /// @notice Sets new address for router. /// @param router_ address for router. function setRouter(address router_) external; /// @notice Sets divider for BUY, INVEST, WITHDAW proposals. /// @param divider_ divider for BUY, INVEST, WITHDRAW proposals. function setSpendDivider(uint256 divider_) external; /// @notice Migrates balances of current DAO to a new DAO. /// @param newDao_ address of the new DAO to migrate to. function migrate(address newDao_) external; }
/// @title DAO for proposals, voting and execution. /// @notice Interface for creation, voting and execution of proposals. /// @author ORayskiy - @robitnik_TorroDao
NatSpecSingleLine
addLiquidityAddresses
function addLiquidityAddresses(address[] calldata tokens_) external;
/// @notice Saves new liquidity addresses for DAO. /// @param tokens_ token addresses that DAO has liquidities of.
NatSpecSingleLine
v0.6.6+commit.6c089d02
Unknown
ipfs://d1c6095fcf143d951c9754f00fe8cd59d29ab460461efe53b91eb289fd0fe5ac
{ "func_code_index": [ 7017, 7088 ] }
57,709
TorroDao
ITorroDao.sol
0x3cf9e9d45380b6ab61bde46b2e6cfcd7d8f6cdc1
Solidity
ITorroDao
interface ITorroDao { // Enums. /// @notice Enum of available proposal functions. enum DaoFunction { BUY, SELL, ADD_LIQUIDITY, REMOVE_LIQUIDITY, ADD_ADMIN, REMOVE_ADMIN, INVEST, WITHDRAW } // Initializer. /// @notice Initializer for DAO clones. /// @param torroToken_ main torro token address. /// @param governingToken_ torro token clone that's governing this dao. /// @param factory_ torro factory address. /// @param creator_ creator of cloned DAO. /// @param maxCost_ maximum cost of all governing tokens for cloned DAO. /// @param executeMinPct_ minimum percentage of votes needed for proposal execution. /// @param votingMinHours_ minimum lifetime of proposal before it closes. /// @param isPublic_ whether cloned DAO has public visibility. /// @param hasAdmins_ whether cloned DAO has admins, otherwise all stakers are treated as admins. function initializeCustom( address torroToken_, address governingToken_, address factory_, address creator_, uint256 maxCost_, uint256 executeMinPct_, uint256 votingMinHours_, bool isPublic_, bool hasAdmins_ ) external; // Public calls. /// @notice Address of DAO creator. /// @return DAO creator address. function daoCreator() external view returns (address); /// @notice Amount of tokens needed for a single vote. /// @return uint256 token amount. function voteWeight() external view returns (uint256); /// @notice Amount of votes that holder has. /// @param sender_ address of the holder. /// @return number of votes. function votesOf(address sender_) external view returns (uint256); /// @notice Address of the governing token. /// @return address of the governing token. function tokenAddress() external view returns (address); /// @notice Saved addresses of tokens that DAO is holding. /// @return array of holdings addresses. function holdings() external view returns (address[] memory); /// @notice Saved addresses of liquidity tokens that DAO is holding. /// @return array of liquidity addresses. function liquidities() external view returns (address[] memory); /// @notice Calculates address of liquidity token from ERC-20 token address. /// @param token_ token address to calculate liquidity address from. /// @return address of liquidity token. function liquidityToken(address token_) external view returns (address); /// @notice Gets tokens and liquidity token addresses of DAO's liquidity holdings. /// @return Arrays of tokens and liquidity tokens, should have the same length. function liquidityHoldings() external view returns (address[] memory, address[] memory); /// @notice DAO admins. /// @return Array of admin addresses. function admins() external view returns (address[] memory); /// @notice DAO balance for specified token. /// @param token_ token address to get balance for. /// @return uint256 token balance. function tokenBalance(address token_) external view returns (uint256); /// @notice DAO balance for liquidity token. /// @param token_ token address to get liquidity balance for. /// @return uin256 token liquidity balance. function liquidityBalance(address token_) external view returns (uint256); /// @notice DAO ethereum balance. /// @return uint256 wei balance. function availableBalance() external view returns (uint256); /// @notice Maximum cost for all tokens of cloned DAO. /// @return uint256 maximum cost in wei. function maxCost() external view returns (uint256); /// @notice Minimum percentage of votes needed to execute a proposal. /// @return uint256 minimum percentage of votes. function executeMinPct() external view returns (uint256); /// @notice Minimum lifetime of proposal before it closes. /// @return uint256 minimum number of hours for proposal lifetime. function votingMinHours() external view returns (uint256); /// @notice Whether DAO is public or private. /// @return bool true if public. function isPublic() external view returns (bool); /// @notice Whether DAO has admins. /// @return bool true if DAO has admins. function hasAdmins() external view returns (bool); /// @notice Proposal ids of DAO. /// @return array of proposal ids. function getProposalIds() external view returns (uint256[] memory); /// @notice Gets proposal info for proposal id. /// @param id_ id of proposal to get info for. /// @return proposalAddress address for proposal execution. /// @return investTokenAddress secondary address for proposal execution, used for investment proposals if ICO and token addresses differ. /// @return daoFunction proposal type. /// @return amount proposal amount eth/token to use during execution. /// @return creator address of proposal creator. /// @return endLifetime epoch time when proposal voting ends. /// @return votesFor amount of votes for the proposal. /// @return votesAgainst amount of votes against the proposal. /// @return executed whether proposal has been executed or not. function getProposal(uint256 id_) external view returns ( address proposalAddress, address investTokenAddress, DaoFunction daoFunction, uint256 amount, address creator, uint256 endLifetime, uint256 votesFor, uint256 votesAgainst, bool executed ); /// @notice Whether a holder is allowed to vote for a proposal. /// @param id_ proposal id to check whether holder is allowed to vote for. /// @param sender_ address of the holder. /// @return bool true if voting is allowed. function canVote(uint256 id_, address sender_) external view returns (bool); /// @notice Whether a holder is allowed to remove a proposal. /// @param id_ proposal id to check whether holder is allowed to remove. /// @param sender_ address of the holder. /// @return bool true if removal is allowed. function canRemove(uint256 id_, address sender_) external view returns (bool); /// @notice Whether a holder is allowed to execute a proposal. /// @param id_ proposal id to check whether holder is allowed to execute. /// @param sender_ address of the holder. /// @return bool true if execution is allowed. function canExecute(uint256 id_, address sender_) external view returns (bool); /// @notice Whether a holder is an admin. /// @param sender_ address of holder. /// @return bool true if holder is an admin (in DAO without admins all holders are treated as such). function isAdmin(address sender_) external view returns (bool); // Public transactions. /// @notice Saves new holdings addresses for DAO. /// @param tokens_ token addresses that DAO has holdings of. function addHoldingsAddresses(address[] calldata tokens_) external; /// @notice Saves new liquidity addresses for DAO. /// @param tokens_ token addresses that DAO has liquidities of. function addLiquidityAddresses(address[] calldata tokens_) external; /// @notice Creates new proposal. /// @param proposalAddress_ main address of the proposal, in investment proposals this is the address funds are sent to. /// @param investTokenAddress_ secondary address of the proposal, used in investment proposals to specify token address. /// @param daoFunction_ type of the proposal. /// @param amount_ amount of funds to use in the proposal. /// @param hoursLifetime_ voting lifetime of the proposal. function propose(address proposalAddress_, address investTokenAddress_, DaoFunction daoFunction_, uint256 amount_, uint256 hoursLifetime_) external; /// @notice Removes existing proposal. /// @param id_ id of proposal to remove. function unpropose(uint256 id_) external; /// @notice Voting for multiple proposals. /// @param ids_ ids of proposals to vote for. /// @param votes_ for or against votes for proposals. function vote(uint256[] calldata ids_, bool[] calldata votes_) external; /// @notice Executes a proposal. /// @param id_ id of proposal to be executed. function execute(uint256 id_) external; /// @notice Buying tokens for cloned DAO. function buy() external payable; /// @notice Sell tokens back to cloned DAO. /// @param amount_ amount of tokens to sell. function sell(uint256 amount_) external; // Owner transactions. /// @notice Sets factory address. /// @param factory_ address of TorroFactory. function setFactoryAddress(address factory_) external; /// @notice Sets vote weight divider. /// @param weight_ weight divider for a single vote. function setVoteWeightDivider(uint256 weight_) external; /// @notice Sets new address for router. /// @param router_ address for router. function setRouter(address router_) external; /// @notice Sets divider for BUY, INVEST, WITHDAW proposals. /// @param divider_ divider for BUY, INVEST, WITHDRAW proposals. function setSpendDivider(uint256 divider_) external; /// @notice Migrates balances of current DAO to a new DAO. /// @param newDao_ address of the new DAO to migrate to. function migrate(address newDao_) external; }
/// @title DAO for proposals, voting and execution. /// @notice Interface for creation, voting and execution of proposals. /// @author ORayskiy - @robitnik_TorroDao
NatSpecSingleLine
propose
function propose(address proposalAddress_, address investTokenAddress_, DaoFunction daoFunction_, uint256 amount_, uint256 hoursLifetime_) external;
/// @notice Creates new proposal. /// @param proposalAddress_ main address of the proposal, in investment proposals this is the address funds are sent to. /// @param investTokenAddress_ secondary address of the proposal, used in investment proposals to specify token address. /// @param daoFunction_ type of the proposal. /// @param amount_ amount of funds to use in the proposal. /// @param hoursLifetime_ voting lifetime of the proposal.
NatSpecSingleLine
v0.6.6+commit.6c089d02
Unknown
ipfs://d1c6095fcf143d951c9754f00fe8cd59d29ab460461efe53b91eb289fd0fe5ac
{ "func_code_index": [ 7549, 7700 ] }
57,710
TorroDao
ITorroDao.sol
0x3cf9e9d45380b6ab61bde46b2e6cfcd7d8f6cdc1
Solidity
ITorroDao
interface ITorroDao { // Enums. /// @notice Enum of available proposal functions. enum DaoFunction { BUY, SELL, ADD_LIQUIDITY, REMOVE_LIQUIDITY, ADD_ADMIN, REMOVE_ADMIN, INVEST, WITHDRAW } // Initializer. /// @notice Initializer for DAO clones. /// @param torroToken_ main torro token address. /// @param governingToken_ torro token clone that's governing this dao. /// @param factory_ torro factory address. /// @param creator_ creator of cloned DAO. /// @param maxCost_ maximum cost of all governing tokens for cloned DAO. /// @param executeMinPct_ minimum percentage of votes needed for proposal execution. /// @param votingMinHours_ minimum lifetime of proposal before it closes. /// @param isPublic_ whether cloned DAO has public visibility. /// @param hasAdmins_ whether cloned DAO has admins, otherwise all stakers are treated as admins. function initializeCustom( address torroToken_, address governingToken_, address factory_, address creator_, uint256 maxCost_, uint256 executeMinPct_, uint256 votingMinHours_, bool isPublic_, bool hasAdmins_ ) external; // Public calls. /// @notice Address of DAO creator. /// @return DAO creator address. function daoCreator() external view returns (address); /// @notice Amount of tokens needed for a single vote. /// @return uint256 token amount. function voteWeight() external view returns (uint256); /// @notice Amount of votes that holder has. /// @param sender_ address of the holder. /// @return number of votes. function votesOf(address sender_) external view returns (uint256); /// @notice Address of the governing token. /// @return address of the governing token. function tokenAddress() external view returns (address); /// @notice Saved addresses of tokens that DAO is holding. /// @return array of holdings addresses. function holdings() external view returns (address[] memory); /// @notice Saved addresses of liquidity tokens that DAO is holding. /// @return array of liquidity addresses. function liquidities() external view returns (address[] memory); /// @notice Calculates address of liquidity token from ERC-20 token address. /// @param token_ token address to calculate liquidity address from. /// @return address of liquidity token. function liquidityToken(address token_) external view returns (address); /// @notice Gets tokens and liquidity token addresses of DAO's liquidity holdings. /// @return Arrays of tokens and liquidity tokens, should have the same length. function liquidityHoldings() external view returns (address[] memory, address[] memory); /// @notice DAO admins. /// @return Array of admin addresses. function admins() external view returns (address[] memory); /// @notice DAO balance for specified token. /// @param token_ token address to get balance for. /// @return uint256 token balance. function tokenBalance(address token_) external view returns (uint256); /// @notice DAO balance for liquidity token. /// @param token_ token address to get liquidity balance for. /// @return uin256 token liquidity balance. function liquidityBalance(address token_) external view returns (uint256); /// @notice DAO ethereum balance. /// @return uint256 wei balance. function availableBalance() external view returns (uint256); /// @notice Maximum cost for all tokens of cloned DAO. /// @return uint256 maximum cost in wei. function maxCost() external view returns (uint256); /// @notice Minimum percentage of votes needed to execute a proposal. /// @return uint256 minimum percentage of votes. function executeMinPct() external view returns (uint256); /// @notice Minimum lifetime of proposal before it closes. /// @return uint256 minimum number of hours for proposal lifetime. function votingMinHours() external view returns (uint256); /// @notice Whether DAO is public or private. /// @return bool true if public. function isPublic() external view returns (bool); /// @notice Whether DAO has admins. /// @return bool true if DAO has admins. function hasAdmins() external view returns (bool); /// @notice Proposal ids of DAO. /// @return array of proposal ids. function getProposalIds() external view returns (uint256[] memory); /// @notice Gets proposal info for proposal id. /// @param id_ id of proposal to get info for. /// @return proposalAddress address for proposal execution. /// @return investTokenAddress secondary address for proposal execution, used for investment proposals if ICO and token addresses differ. /// @return daoFunction proposal type. /// @return amount proposal amount eth/token to use during execution. /// @return creator address of proposal creator. /// @return endLifetime epoch time when proposal voting ends. /// @return votesFor amount of votes for the proposal. /// @return votesAgainst amount of votes against the proposal. /// @return executed whether proposal has been executed or not. function getProposal(uint256 id_) external view returns ( address proposalAddress, address investTokenAddress, DaoFunction daoFunction, uint256 amount, address creator, uint256 endLifetime, uint256 votesFor, uint256 votesAgainst, bool executed ); /// @notice Whether a holder is allowed to vote for a proposal. /// @param id_ proposal id to check whether holder is allowed to vote for. /// @param sender_ address of the holder. /// @return bool true if voting is allowed. function canVote(uint256 id_, address sender_) external view returns (bool); /// @notice Whether a holder is allowed to remove a proposal. /// @param id_ proposal id to check whether holder is allowed to remove. /// @param sender_ address of the holder. /// @return bool true if removal is allowed. function canRemove(uint256 id_, address sender_) external view returns (bool); /// @notice Whether a holder is allowed to execute a proposal. /// @param id_ proposal id to check whether holder is allowed to execute. /// @param sender_ address of the holder. /// @return bool true if execution is allowed. function canExecute(uint256 id_, address sender_) external view returns (bool); /// @notice Whether a holder is an admin. /// @param sender_ address of holder. /// @return bool true if holder is an admin (in DAO without admins all holders are treated as such). function isAdmin(address sender_) external view returns (bool); // Public transactions. /// @notice Saves new holdings addresses for DAO. /// @param tokens_ token addresses that DAO has holdings of. function addHoldingsAddresses(address[] calldata tokens_) external; /// @notice Saves new liquidity addresses for DAO. /// @param tokens_ token addresses that DAO has liquidities of. function addLiquidityAddresses(address[] calldata tokens_) external; /// @notice Creates new proposal. /// @param proposalAddress_ main address of the proposal, in investment proposals this is the address funds are sent to. /// @param investTokenAddress_ secondary address of the proposal, used in investment proposals to specify token address. /// @param daoFunction_ type of the proposal. /// @param amount_ amount of funds to use in the proposal. /// @param hoursLifetime_ voting lifetime of the proposal. function propose(address proposalAddress_, address investTokenAddress_, DaoFunction daoFunction_, uint256 amount_, uint256 hoursLifetime_) external; /// @notice Removes existing proposal. /// @param id_ id of proposal to remove. function unpropose(uint256 id_) external; /// @notice Voting for multiple proposals. /// @param ids_ ids of proposals to vote for. /// @param votes_ for or against votes for proposals. function vote(uint256[] calldata ids_, bool[] calldata votes_) external; /// @notice Executes a proposal. /// @param id_ id of proposal to be executed. function execute(uint256 id_) external; /// @notice Buying tokens for cloned DAO. function buy() external payable; /// @notice Sell tokens back to cloned DAO. /// @param amount_ amount of tokens to sell. function sell(uint256 amount_) external; // Owner transactions. /// @notice Sets factory address. /// @param factory_ address of TorroFactory. function setFactoryAddress(address factory_) external; /// @notice Sets vote weight divider. /// @param weight_ weight divider for a single vote. function setVoteWeightDivider(uint256 weight_) external; /// @notice Sets new address for router. /// @param router_ address for router. function setRouter(address router_) external; /// @notice Sets divider for BUY, INVEST, WITHDAW proposals. /// @param divider_ divider for BUY, INVEST, WITHDRAW proposals. function setSpendDivider(uint256 divider_) external; /// @notice Migrates balances of current DAO to a new DAO. /// @param newDao_ address of the new DAO to migrate to. function migrate(address newDao_) external; }
/// @title DAO for proposals, voting and execution. /// @notice Interface for creation, voting and execution of proposals. /// @author ORayskiy - @robitnik_TorroDao
NatSpecSingleLine
unpropose
function unpropose(uint256 id_) external;
/// @notice Removes existing proposal. /// @param id_ id of proposal to remove.
NatSpecSingleLine
v0.6.6+commit.6c089d02
Unknown
ipfs://d1c6095fcf143d951c9754f00fe8cd59d29ab460461efe53b91eb289fd0fe5ac
{ "func_code_index": [ 7789, 7833 ] }
57,711
TorroDao
ITorroDao.sol
0x3cf9e9d45380b6ab61bde46b2e6cfcd7d8f6cdc1
Solidity
ITorroDao
interface ITorroDao { // Enums. /// @notice Enum of available proposal functions. enum DaoFunction { BUY, SELL, ADD_LIQUIDITY, REMOVE_LIQUIDITY, ADD_ADMIN, REMOVE_ADMIN, INVEST, WITHDRAW } // Initializer. /// @notice Initializer for DAO clones. /// @param torroToken_ main torro token address. /// @param governingToken_ torro token clone that's governing this dao. /// @param factory_ torro factory address. /// @param creator_ creator of cloned DAO. /// @param maxCost_ maximum cost of all governing tokens for cloned DAO. /// @param executeMinPct_ minimum percentage of votes needed for proposal execution. /// @param votingMinHours_ minimum lifetime of proposal before it closes. /// @param isPublic_ whether cloned DAO has public visibility. /// @param hasAdmins_ whether cloned DAO has admins, otherwise all stakers are treated as admins. function initializeCustom( address torroToken_, address governingToken_, address factory_, address creator_, uint256 maxCost_, uint256 executeMinPct_, uint256 votingMinHours_, bool isPublic_, bool hasAdmins_ ) external; // Public calls. /// @notice Address of DAO creator. /// @return DAO creator address. function daoCreator() external view returns (address); /// @notice Amount of tokens needed for a single vote. /// @return uint256 token amount. function voteWeight() external view returns (uint256); /// @notice Amount of votes that holder has. /// @param sender_ address of the holder. /// @return number of votes. function votesOf(address sender_) external view returns (uint256); /// @notice Address of the governing token. /// @return address of the governing token. function tokenAddress() external view returns (address); /// @notice Saved addresses of tokens that DAO is holding. /// @return array of holdings addresses. function holdings() external view returns (address[] memory); /// @notice Saved addresses of liquidity tokens that DAO is holding. /// @return array of liquidity addresses. function liquidities() external view returns (address[] memory); /// @notice Calculates address of liquidity token from ERC-20 token address. /// @param token_ token address to calculate liquidity address from. /// @return address of liquidity token. function liquidityToken(address token_) external view returns (address); /// @notice Gets tokens and liquidity token addresses of DAO's liquidity holdings. /// @return Arrays of tokens and liquidity tokens, should have the same length. function liquidityHoldings() external view returns (address[] memory, address[] memory); /// @notice DAO admins. /// @return Array of admin addresses. function admins() external view returns (address[] memory); /// @notice DAO balance for specified token. /// @param token_ token address to get balance for. /// @return uint256 token balance. function tokenBalance(address token_) external view returns (uint256); /// @notice DAO balance for liquidity token. /// @param token_ token address to get liquidity balance for. /// @return uin256 token liquidity balance. function liquidityBalance(address token_) external view returns (uint256); /// @notice DAO ethereum balance. /// @return uint256 wei balance. function availableBalance() external view returns (uint256); /// @notice Maximum cost for all tokens of cloned DAO. /// @return uint256 maximum cost in wei. function maxCost() external view returns (uint256); /// @notice Minimum percentage of votes needed to execute a proposal. /// @return uint256 minimum percentage of votes. function executeMinPct() external view returns (uint256); /// @notice Minimum lifetime of proposal before it closes. /// @return uint256 minimum number of hours for proposal lifetime. function votingMinHours() external view returns (uint256); /// @notice Whether DAO is public or private. /// @return bool true if public. function isPublic() external view returns (bool); /// @notice Whether DAO has admins. /// @return bool true if DAO has admins. function hasAdmins() external view returns (bool); /// @notice Proposal ids of DAO. /// @return array of proposal ids. function getProposalIds() external view returns (uint256[] memory); /// @notice Gets proposal info for proposal id. /// @param id_ id of proposal to get info for. /// @return proposalAddress address for proposal execution. /// @return investTokenAddress secondary address for proposal execution, used for investment proposals if ICO and token addresses differ. /// @return daoFunction proposal type. /// @return amount proposal amount eth/token to use during execution. /// @return creator address of proposal creator. /// @return endLifetime epoch time when proposal voting ends. /// @return votesFor amount of votes for the proposal. /// @return votesAgainst amount of votes against the proposal. /// @return executed whether proposal has been executed or not. function getProposal(uint256 id_) external view returns ( address proposalAddress, address investTokenAddress, DaoFunction daoFunction, uint256 amount, address creator, uint256 endLifetime, uint256 votesFor, uint256 votesAgainst, bool executed ); /// @notice Whether a holder is allowed to vote for a proposal. /// @param id_ proposal id to check whether holder is allowed to vote for. /// @param sender_ address of the holder. /// @return bool true if voting is allowed. function canVote(uint256 id_, address sender_) external view returns (bool); /// @notice Whether a holder is allowed to remove a proposal. /// @param id_ proposal id to check whether holder is allowed to remove. /// @param sender_ address of the holder. /// @return bool true if removal is allowed. function canRemove(uint256 id_, address sender_) external view returns (bool); /// @notice Whether a holder is allowed to execute a proposal. /// @param id_ proposal id to check whether holder is allowed to execute. /// @param sender_ address of the holder. /// @return bool true if execution is allowed. function canExecute(uint256 id_, address sender_) external view returns (bool); /// @notice Whether a holder is an admin. /// @param sender_ address of holder. /// @return bool true if holder is an admin (in DAO without admins all holders are treated as such). function isAdmin(address sender_) external view returns (bool); // Public transactions. /// @notice Saves new holdings addresses for DAO. /// @param tokens_ token addresses that DAO has holdings of. function addHoldingsAddresses(address[] calldata tokens_) external; /// @notice Saves new liquidity addresses for DAO. /// @param tokens_ token addresses that DAO has liquidities of. function addLiquidityAddresses(address[] calldata tokens_) external; /// @notice Creates new proposal. /// @param proposalAddress_ main address of the proposal, in investment proposals this is the address funds are sent to. /// @param investTokenAddress_ secondary address of the proposal, used in investment proposals to specify token address. /// @param daoFunction_ type of the proposal. /// @param amount_ amount of funds to use in the proposal. /// @param hoursLifetime_ voting lifetime of the proposal. function propose(address proposalAddress_, address investTokenAddress_, DaoFunction daoFunction_, uint256 amount_, uint256 hoursLifetime_) external; /// @notice Removes existing proposal. /// @param id_ id of proposal to remove. function unpropose(uint256 id_) external; /// @notice Voting for multiple proposals. /// @param ids_ ids of proposals to vote for. /// @param votes_ for or against votes for proposals. function vote(uint256[] calldata ids_, bool[] calldata votes_) external; /// @notice Executes a proposal. /// @param id_ id of proposal to be executed. function execute(uint256 id_) external; /// @notice Buying tokens for cloned DAO. function buy() external payable; /// @notice Sell tokens back to cloned DAO. /// @param amount_ amount of tokens to sell. function sell(uint256 amount_) external; // Owner transactions. /// @notice Sets factory address. /// @param factory_ address of TorroFactory. function setFactoryAddress(address factory_) external; /// @notice Sets vote weight divider. /// @param weight_ weight divider for a single vote. function setVoteWeightDivider(uint256 weight_) external; /// @notice Sets new address for router. /// @param router_ address for router. function setRouter(address router_) external; /// @notice Sets divider for BUY, INVEST, WITHDAW proposals. /// @param divider_ divider for BUY, INVEST, WITHDRAW proposals. function setSpendDivider(uint256 divider_) external; /// @notice Migrates balances of current DAO to a new DAO. /// @param newDao_ address of the new DAO to migrate to. function migrate(address newDao_) external; }
/// @title DAO for proposals, voting and execution. /// @notice Interface for creation, voting and execution of proposals. /// @author ORayskiy - @robitnik_TorroDao
NatSpecSingleLine
vote
function vote(uint256[] calldata ids_, bool[] calldata votes_) external;
/// @notice Voting for multiple proposals. /// @param ids_ ids of proposals to vote for. /// @param votes_ for or against votes for proposals.
NatSpecSingleLine
v0.6.6+commit.6c089d02
Unknown
ipfs://d1c6095fcf143d951c9754f00fe8cd59d29ab460461efe53b91eb289fd0fe5ac
{ "func_code_index": [ 7988, 8063 ] }
57,712
TorroDao
ITorroDao.sol
0x3cf9e9d45380b6ab61bde46b2e6cfcd7d8f6cdc1
Solidity
ITorroDao
interface ITorroDao { // Enums. /// @notice Enum of available proposal functions. enum DaoFunction { BUY, SELL, ADD_LIQUIDITY, REMOVE_LIQUIDITY, ADD_ADMIN, REMOVE_ADMIN, INVEST, WITHDRAW } // Initializer. /// @notice Initializer for DAO clones. /// @param torroToken_ main torro token address. /// @param governingToken_ torro token clone that's governing this dao. /// @param factory_ torro factory address. /// @param creator_ creator of cloned DAO. /// @param maxCost_ maximum cost of all governing tokens for cloned DAO. /// @param executeMinPct_ minimum percentage of votes needed for proposal execution. /// @param votingMinHours_ minimum lifetime of proposal before it closes. /// @param isPublic_ whether cloned DAO has public visibility. /// @param hasAdmins_ whether cloned DAO has admins, otherwise all stakers are treated as admins. function initializeCustom( address torroToken_, address governingToken_, address factory_, address creator_, uint256 maxCost_, uint256 executeMinPct_, uint256 votingMinHours_, bool isPublic_, bool hasAdmins_ ) external; // Public calls. /// @notice Address of DAO creator. /// @return DAO creator address. function daoCreator() external view returns (address); /// @notice Amount of tokens needed for a single vote. /// @return uint256 token amount. function voteWeight() external view returns (uint256); /// @notice Amount of votes that holder has. /// @param sender_ address of the holder. /// @return number of votes. function votesOf(address sender_) external view returns (uint256); /// @notice Address of the governing token. /// @return address of the governing token. function tokenAddress() external view returns (address); /// @notice Saved addresses of tokens that DAO is holding. /// @return array of holdings addresses. function holdings() external view returns (address[] memory); /// @notice Saved addresses of liquidity tokens that DAO is holding. /// @return array of liquidity addresses. function liquidities() external view returns (address[] memory); /// @notice Calculates address of liquidity token from ERC-20 token address. /// @param token_ token address to calculate liquidity address from. /// @return address of liquidity token. function liquidityToken(address token_) external view returns (address); /// @notice Gets tokens and liquidity token addresses of DAO's liquidity holdings. /// @return Arrays of tokens and liquidity tokens, should have the same length. function liquidityHoldings() external view returns (address[] memory, address[] memory); /// @notice DAO admins. /// @return Array of admin addresses. function admins() external view returns (address[] memory); /// @notice DAO balance for specified token. /// @param token_ token address to get balance for. /// @return uint256 token balance. function tokenBalance(address token_) external view returns (uint256); /// @notice DAO balance for liquidity token. /// @param token_ token address to get liquidity balance for. /// @return uin256 token liquidity balance. function liquidityBalance(address token_) external view returns (uint256); /// @notice DAO ethereum balance. /// @return uint256 wei balance. function availableBalance() external view returns (uint256); /// @notice Maximum cost for all tokens of cloned DAO. /// @return uint256 maximum cost in wei. function maxCost() external view returns (uint256); /// @notice Minimum percentage of votes needed to execute a proposal. /// @return uint256 minimum percentage of votes. function executeMinPct() external view returns (uint256); /// @notice Minimum lifetime of proposal before it closes. /// @return uint256 minimum number of hours for proposal lifetime. function votingMinHours() external view returns (uint256); /// @notice Whether DAO is public or private. /// @return bool true if public. function isPublic() external view returns (bool); /// @notice Whether DAO has admins. /// @return bool true if DAO has admins. function hasAdmins() external view returns (bool); /// @notice Proposal ids of DAO. /// @return array of proposal ids. function getProposalIds() external view returns (uint256[] memory); /// @notice Gets proposal info for proposal id. /// @param id_ id of proposal to get info for. /// @return proposalAddress address for proposal execution. /// @return investTokenAddress secondary address for proposal execution, used for investment proposals if ICO and token addresses differ. /// @return daoFunction proposal type. /// @return amount proposal amount eth/token to use during execution. /// @return creator address of proposal creator. /// @return endLifetime epoch time when proposal voting ends. /// @return votesFor amount of votes for the proposal. /// @return votesAgainst amount of votes against the proposal. /// @return executed whether proposal has been executed or not. function getProposal(uint256 id_) external view returns ( address proposalAddress, address investTokenAddress, DaoFunction daoFunction, uint256 amount, address creator, uint256 endLifetime, uint256 votesFor, uint256 votesAgainst, bool executed ); /// @notice Whether a holder is allowed to vote for a proposal. /// @param id_ proposal id to check whether holder is allowed to vote for. /// @param sender_ address of the holder. /// @return bool true if voting is allowed. function canVote(uint256 id_, address sender_) external view returns (bool); /// @notice Whether a holder is allowed to remove a proposal. /// @param id_ proposal id to check whether holder is allowed to remove. /// @param sender_ address of the holder. /// @return bool true if removal is allowed. function canRemove(uint256 id_, address sender_) external view returns (bool); /// @notice Whether a holder is allowed to execute a proposal. /// @param id_ proposal id to check whether holder is allowed to execute. /// @param sender_ address of the holder. /// @return bool true if execution is allowed. function canExecute(uint256 id_, address sender_) external view returns (bool); /// @notice Whether a holder is an admin. /// @param sender_ address of holder. /// @return bool true if holder is an admin (in DAO without admins all holders are treated as such). function isAdmin(address sender_) external view returns (bool); // Public transactions. /// @notice Saves new holdings addresses for DAO. /// @param tokens_ token addresses that DAO has holdings of. function addHoldingsAddresses(address[] calldata tokens_) external; /// @notice Saves new liquidity addresses for DAO. /// @param tokens_ token addresses that DAO has liquidities of. function addLiquidityAddresses(address[] calldata tokens_) external; /// @notice Creates new proposal. /// @param proposalAddress_ main address of the proposal, in investment proposals this is the address funds are sent to. /// @param investTokenAddress_ secondary address of the proposal, used in investment proposals to specify token address. /// @param daoFunction_ type of the proposal. /// @param amount_ amount of funds to use in the proposal. /// @param hoursLifetime_ voting lifetime of the proposal. function propose(address proposalAddress_, address investTokenAddress_, DaoFunction daoFunction_, uint256 amount_, uint256 hoursLifetime_) external; /// @notice Removes existing proposal. /// @param id_ id of proposal to remove. function unpropose(uint256 id_) external; /// @notice Voting for multiple proposals. /// @param ids_ ids of proposals to vote for. /// @param votes_ for or against votes for proposals. function vote(uint256[] calldata ids_, bool[] calldata votes_) external; /// @notice Executes a proposal. /// @param id_ id of proposal to be executed. function execute(uint256 id_) external; /// @notice Buying tokens for cloned DAO. function buy() external payable; /// @notice Sell tokens back to cloned DAO. /// @param amount_ amount of tokens to sell. function sell(uint256 amount_) external; // Owner transactions. /// @notice Sets factory address. /// @param factory_ address of TorroFactory. function setFactoryAddress(address factory_) external; /// @notice Sets vote weight divider. /// @param weight_ weight divider for a single vote. function setVoteWeightDivider(uint256 weight_) external; /// @notice Sets new address for router. /// @param router_ address for router. function setRouter(address router_) external; /// @notice Sets divider for BUY, INVEST, WITHDAW proposals. /// @param divider_ divider for BUY, INVEST, WITHDRAW proposals. function setSpendDivider(uint256 divider_) external; /// @notice Migrates balances of current DAO to a new DAO. /// @param newDao_ address of the new DAO to migrate to. function migrate(address newDao_) external; }
/// @title DAO for proposals, voting and execution. /// @notice Interface for creation, voting and execution of proposals. /// @author ORayskiy - @robitnik_TorroDao
NatSpecSingleLine
execute
function execute(uint256 id_) external;
/// @notice Executes a proposal. /// @param id_ id of proposal to be executed.
NatSpecSingleLine
v0.6.6+commit.6c089d02
Unknown
ipfs://d1c6095fcf143d951c9754f00fe8cd59d29ab460461efe53b91eb289fd0fe5ac
{ "func_code_index": [ 8151, 8193 ] }
57,713
TorroDao
ITorroDao.sol
0x3cf9e9d45380b6ab61bde46b2e6cfcd7d8f6cdc1
Solidity
ITorroDao
interface ITorroDao { // Enums. /// @notice Enum of available proposal functions. enum DaoFunction { BUY, SELL, ADD_LIQUIDITY, REMOVE_LIQUIDITY, ADD_ADMIN, REMOVE_ADMIN, INVEST, WITHDRAW } // Initializer. /// @notice Initializer for DAO clones. /// @param torroToken_ main torro token address. /// @param governingToken_ torro token clone that's governing this dao. /// @param factory_ torro factory address. /// @param creator_ creator of cloned DAO. /// @param maxCost_ maximum cost of all governing tokens for cloned DAO. /// @param executeMinPct_ minimum percentage of votes needed for proposal execution. /// @param votingMinHours_ minimum lifetime of proposal before it closes. /// @param isPublic_ whether cloned DAO has public visibility. /// @param hasAdmins_ whether cloned DAO has admins, otherwise all stakers are treated as admins. function initializeCustom( address torroToken_, address governingToken_, address factory_, address creator_, uint256 maxCost_, uint256 executeMinPct_, uint256 votingMinHours_, bool isPublic_, bool hasAdmins_ ) external; // Public calls. /// @notice Address of DAO creator. /// @return DAO creator address. function daoCreator() external view returns (address); /// @notice Amount of tokens needed for a single vote. /// @return uint256 token amount. function voteWeight() external view returns (uint256); /// @notice Amount of votes that holder has. /// @param sender_ address of the holder. /// @return number of votes. function votesOf(address sender_) external view returns (uint256); /// @notice Address of the governing token. /// @return address of the governing token. function tokenAddress() external view returns (address); /// @notice Saved addresses of tokens that DAO is holding. /// @return array of holdings addresses. function holdings() external view returns (address[] memory); /// @notice Saved addresses of liquidity tokens that DAO is holding. /// @return array of liquidity addresses. function liquidities() external view returns (address[] memory); /// @notice Calculates address of liquidity token from ERC-20 token address. /// @param token_ token address to calculate liquidity address from. /// @return address of liquidity token. function liquidityToken(address token_) external view returns (address); /// @notice Gets tokens and liquidity token addresses of DAO's liquidity holdings. /// @return Arrays of tokens and liquidity tokens, should have the same length. function liquidityHoldings() external view returns (address[] memory, address[] memory); /// @notice DAO admins. /// @return Array of admin addresses. function admins() external view returns (address[] memory); /// @notice DAO balance for specified token. /// @param token_ token address to get balance for. /// @return uint256 token balance. function tokenBalance(address token_) external view returns (uint256); /// @notice DAO balance for liquidity token. /// @param token_ token address to get liquidity balance for. /// @return uin256 token liquidity balance. function liquidityBalance(address token_) external view returns (uint256); /// @notice DAO ethereum balance. /// @return uint256 wei balance. function availableBalance() external view returns (uint256); /// @notice Maximum cost for all tokens of cloned DAO. /// @return uint256 maximum cost in wei. function maxCost() external view returns (uint256); /// @notice Minimum percentage of votes needed to execute a proposal. /// @return uint256 minimum percentage of votes. function executeMinPct() external view returns (uint256); /// @notice Minimum lifetime of proposal before it closes. /// @return uint256 minimum number of hours for proposal lifetime. function votingMinHours() external view returns (uint256); /// @notice Whether DAO is public or private. /// @return bool true if public. function isPublic() external view returns (bool); /// @notice Whether DAO has admins. /// @return bool true if DAO has admins. function hasAdmins() external view returns (bool); /// @notice Proposal ids of DAO. /// @return array of proposal ids. function getProposalIds() external view returns (uint256[] memory); /// @notice Gets proposal info for proposal id. /// @param id_ id of proposal to get info for. /// @return proposalAddress address for proposal execution. /// @return investTokenAddress secondary address for proposal execution, used for investment proposals if ICO and token addresses differ. /// @return daoFunction proposal type. /// @return amount proposal amount eth/token to use during execution. /// @return creator address of proposal creator. /// @return endLifetime epoch time when proposal voting ends. /// @return votesFor amount of votes for the proposal. /// @return votesAgainst amount of votes against the proposal. /// @return executed whether proposal has been executed or not. function getProposal(uint256 id_) external view returns ( address proposalAddress, address investTokenAddress, DaoFunction daoFunction, uint256 amount, address creator, uint256 endLifetime, uint256 votesFor, uint256 votesAgainst, bool executed ); /// @notice Whether a holder is allowed to vote for a proposal. /// @param id_ proposal id to check whether holder is allowed to vote for. /// @param sender_ address of the holder. /// @return bool true if voting is allowed. function canVote(uint256 id_, address sender_) external view returns (bool); /// @notice Whether a holder is allowed to remove a proposal. /// @param id_ proposal id to check whether holder is allowed to remove. /// @param sender_ address of the holder. /// @return bool true if removal is allowed. function canRemove(uint256 id_, address sender_) external view returns (bool); /// @notice Whether a holder is allowed to execute a proposal. /// @param id_ proposal id to check whether holder is allowed to execute. /// @param sender_ address of the holder. /// @return bool true if execution is allowed. function canExecute(uint256 id_, address sender_) external view returns (bool); /// @notice Whether a holder is an admin. /// @param sender_ address of holder. /// @return bool true if holder is an admin (in DAO without admins all holders are treated as such). function isAdmin(address sender_) external view returns (bool); // Public transactions. /// @notice Saves new holdings addresses for DAO. /// @param tokens_ token addresses that DAO has holdings of. function addHoldingsAddresses(address[] calldata tokens_) external; /// @notice Saves new liquidity addresses for DAO. /// @param tokens_ token addresses that DAO has liquidities of. function addLiquidityAddresses(address[] calldata tokens_) external; /// @notice Creates new proposal. /// @param proposalAddress_ main address of the proposal, in investment proposals this is the address funds are sent to. /// @param investTokenAddress_ secondary address of the proposal, used in investment proposals to specify token address. /// @param daoFunction_ type of the proposal. /// @param amount_ amount of funds to use in the proposal. /// @param hoursLifetime_ voting lifetime of the proposal. function propose(address proposalAddress_, address investTokenAddress_, DaoFunction daoFunction_, uint256 amount_, uint256 hoursLifetime_) external; /// @notice Removes existing proposal. /// @param id_ id of proposal to remove. function unpropose(uint256 id_) external; /// @notice Voting for multiple proposals. /// @param ids_ ids of proposals to vote for. /// @param votes_ for or against votes for proposals. function vote(uint256[] calldata ids_, bool[] calldata votes_) external; /// @notice Executes a proposal. /// @param id_ id of proposal to be executed. function execute(uint256 id_) external; /// @notice Buying tokens for cloned DAO. function buy() external payable; /// @notice Sell tokens back to cloned DAO. /// @param amount_ amount of tokens to sell. function sell(uint256 amount_) external; // Owner transactions. /// @notice Sets factory address. /// @param factory_ address of TorroFactory. function setFactoryAddress(address factory_) external; /// @notice Sets vote weight divider. /// @param weight_ weight divider for a single vote. function setVoteWeightDivider(uint256 weight_) external; /// @notice Sets new address for router. /// @param router_ address for router. function setRouter(address router_) external; /// @notice Sets divider for BUY, INVEST, WITHDAW proposals. /// @param divider_ divider for BUY, INVEST, WITHDRAW proposals. function setSpendDivider(uint256 divider_) external; /// @notice Migrates balances of current DAO to a new DAO. /// @param newDao_ address of the new DAO to migrate to. function migrate(address newDao_) external; }
/// @title DAO for proposals, voting and execution. /// @notice Interface for creation, voting and execution of proposals. /// @author ORayskiy - @robitnik_TorroDao
NatSpecSingleLine
buy
function buy() external payable;
/// @notice Buying tokens for cloned DAO.
NatSpecSingleLine
v0.6.6+commit.6c089d02
Unknown
ipfs://d1c6095fcf143d951c9754f00fe8cd59d29ab460461efe53b91eb289fd0fe5ac
{ "func_code_index": [ 8241, 8276 ] }
57,714
TorroDao
ITorroDao.sol
0x3cf9e9d45380b6ab61bde46b2e6cfcd7d8f6cdc1
Solidity
ITorroDao
interface ITorroDao { // Enums. /// @notice Enum of available proposal functions. enum DaoFunction { BUY, SELL, ADD_LIQUIDITY, REMOVE_LIQUIDITY, ADD_ADMIN, REMOVE_ADMIN, INVEST, WITHDRAW } // Initializer. /// @notice Initializer for DAO clones. /// @param torroToken_ main torro token address. /// @param governingToken_ torro token clone that's governing this dao. /// @param factory_ torro factory address. /// @param creator_ creator of cloned DAO. /// @param maxCost_ maximum cost of all governing tokens for cloned DAO. /// @param executeMinPct_ minimum percentage of votes needed for proposal execution. /// @param votingMinHours_ minimum lifetime of proposal before it closes. /// @param isPublic_ whether cloned DAO has public visibility. /// @param hasAdmins_ whether cloned DAO has admins, otherwise all stakers are treated as admins. function initializeCustom( address torroToken_, address governingToken_, address factory_, address creator_, uint256 maxCost_, uint256 executeMinPct_, uint256 votingMinHours_, bool isPublic_, bool hasAdmins_ ) external; // Public calls. /// @notice Address of DAO creator. /// @return DAO creator address. function daoCreator() external view returns (address); /// @notice Amount of tokens needed for a single vote. /// @return uint256 token amount. function voteWeight() external view returns (uint256); /// @notice Amount of votes that holder has. /// @param sender_ address of the holder. /// @return number of votes. function votesOf(address sender_) external view returns (uint256); /// @notice Address of the governing token. /// @return address of the governing token. function tokenAddress() external view returns (address); /// @notice Saved addresses of tokens that DAO is holding. /// @return array of holdings addresses. function holdings() external view returns (address[] memory); /// @notice Saved addresses of liquidity tokens that DAO is holding. /// @return array of liquidity addresses. function liquidities() external view returns (address[] memory); /// @notice Calculates address of liquidity token from ERC-20 token address. /// @param token_ token address to calculate liquidity address from. /// @return address of liquidity token. function liquidityToken(address token_) external view returns (address); /// @notice Gets tokens and liquidity token addresses of DAO's liquidity holdings. /// @return Arrays of tokens and liquidity tokens, should have the same length. function liquidityHoldings() external view returns (address[] memory, address[] memory); /// @notice DAO admins. /// @return Array of admin addresses. function admins() external view returns (address[] memory); /// @notice DAO balance for specified token. /// @param token_ token address to get balance for. /// @return uint256 token balance. function tokenBalance(address token_) external view returns (uint256); /// @notice DAO balance for liquidity token. /// @param token_ token address to get liquidity balance for. /// @return uin256 token liquidity balance. function liquidityBalance(address token_) external view returns (uint256); /// @notice DAO ethereum balance. /// @return uint256 wei balance. function availableBalance() external view returns (uint256); /// @notice Maximum cost for all tokens of cloned DAO. /// @return uint256 maximum cost in wei. function maxCost() external view returns (uint256); /// @notice Minimum percentage of votes needed to execute a proposal. /// @return uint256 minimum percentage of votes. function executeMinPct() external view returns (uint256); /// @notice Minimum lifetime of proposal before it closes. /// @return uint256 minimum number of hours for proposal lifetime. function votingMinHours() external view returns (uint256); /// @notice Whether DAO is public or private. /// @return bool true if public. function isPublic() external view returns (bool); /// @notice Whether DAO has admins. /// @return bool true if DAO has admins. function hasAdmins() external view returns (bool); /// @notice Proposal ids of DAO. /// @return array of proposal ids. function getProposalIds() external view returns (uint256[] memory); /// @notice Gets proposal info for proposal id. /// @param id_ id of proposal to get info for. /// @return proposalAddress address for proposal execution. /// @return investTokenAddress secondary address for proposal execution, used for investment proposals if ICO and token addresses differ. /// @return daoFunction proposal type. /// @return amount proposal amount eth/token to use during execution. /// @return creator address of proposal creator. /// @return endLifetime epoch time when proposal voting ends. /// @return votesFor amount of votes for the proposal. /// @return votesAgainst amount of votes against the proposal. /// @return executed whether proposal has been executed or not. function getProposal(uint256 id_) external view returns ( address proposalAddress, address investTokenAddress, DaoFunction daoFunction, uint256 amount, address creator, uint256 endLifetime, uint256 votesFor, uint256 votesAgainst, bool executed ); /// @notice Whether a holder is allowed to vote for a proposal. /// @param id_ proposal id to check whether holder is allowed to vote for. /// @param sender_ address of the holder. /// @return bool true if voting is allowed. function canVote(uint256 id_, address sender_) external view returns (bool); /// @notice Whether a holder is allowed to remove a proposal. /// @param id_ proposal id to check whether holder is allowed to remove. /// @param sender_ address of the holder. /// @return bool true if removal is allowed. function canRemove(uint256 id_, address sender_) external view returns (bool); /// @notice Whether a holder is allowed to execute a proposal. /// @param id_ proposal id to check whether holder is allowed to execute. /// @param sender_ address of the holder. /// @return bool true if execution is allowed. function canExecute(uint256 id_, address sender_) external view returns (bool); /// @notice Whether a holder is an admin. /// @param sender_ address of holder. /// @return bool true if holder is an admin (in DAO without admins all holders are treated as such). function isAdmin(address sender_) external view returns (bool); // Public transactions. /// @notice Saves new holdings addresses for DAO. /// @param tokens_ token addresses that DAO has holdings of. function addHoldingsAddresses(address[] calldata tokens_) external; /// @notice Saves new liquidity addresses for DAO. /// @param tokens_ token addresses that DAO has liquidities of. function addLiquidityAddresses(address[] calldata tokens_) external; /// @notice Creates new proposal. /// @param proposalAddress_ main address of the proposal, in investment proposals this is the address funds are sent to. /// @param investTokenAddress_ secondary address of the proposal, used in investment proposals to specify token address. /// @param daoFunction_ type of the proposal. /// @param amount_ amount of funds to use in the proposal. /// @param hoursLifetime_ voting lifetime of the proposal. function propose(address proposalAddress_, address investTokenAddress_, DaoFunction daoFunction_, uint256 amount_, uint256 hoursLifetime_) external; /// @notice Removes existing proposal. /// @param id_ id of proposal to remove. function unpropose(uint256 id_) external; /// @notice Voting for multiple proposals. /// @param ids_ ids of proposals to vote for. /// @param votes_ for or against votes for proposals. function vote(uint256[] calldata ids_, bool[] calldata votes_) external; /// @notice Executes a proposal. /// @param id_ id of proposal to be executed. function execute(uint256 id_) external; /// @notice Buying tokens for cloned DAO. function buy() external payable; /// @notice Sell tokens back to cloned DAO. /// @param amount_ amount of tokens to sell. function sell(uint256 amount_) external; // Owner transactions. /// @notice Sets factory address. /// @param factory_ address of TorroFactory. function setFactoryAddress(address factory_) external; /// @notice Sets vote weight divider. /// @param weight_ weight divider for a single vote. function setVoteWeightDivider(uint256 weight_) external; /// @notice Sets new address for router. /// @param router_ address for router. function setRouter(address router_) external; /// @notice Sets divider for BUY, INVEST, WITHDAW proposals. /// @param divider_ divider for BUY, INVEST, WITHDRAW proposals. function setSpendDivider(uint256 divider_) external; /// @notice Migrates balances of current DAO to a new DAO. /// @param newDao_ address of the new DAO to migrate to. function migrate(address newDao_) external; }
/// @title DAO for proposals, voting and execution. /// @notice Interface for creation, voting and execution of proposals. /// @author ORayskiy - @robitnik_TorroDao
NatSpecSingleLine
sell
function sell(uint256 amount_) external;
/// @notice Sell tokens back to cloned DAO. /// @param amount_ amount of tokens to sell.
NatSpecSingleLine
v0.6.6+commit.6c089d02
Unknown
ipfs://d1c6095fcf143d951c9754f00fe8cd59d29ab460461efe53b91eb289fd0fe5ac
{ "func_code_index": [ 8374, 8417 ] }
57,715
TorroDao
ITorroDao.sol
0x3cf9e9d45380b6ab61bde46b2e6cfcd7d8f6cdc1
Solidity
ITorroDao
interface ITorroDao { // Enums. /// @notice Enum of available proposal functions. enum DaoFunction { BUY, SELL, ADD_LIQUIDITY, REMOVE_LIQUIDITY, ADD_ADMIN, REMOVE_ADMIN, INVEST, WITHDRAW } // Initializer. /// @notice Initializer for DAO clones. /// @param torroToken_ main torro token address. /// @param governingToken_ torro token clone that's governing this dao. /// @param factory_ torro factory address. /// @param creator_ creator of cloned DAO. /// @param maxCost_ maximum cost of all governing tokens for cloned DAO. /// @param executeMinPct_ minimum percentage of votes needed for proposal execution. /// @param votingMinHours_ minimum lifetime of proposal before it closes. /// @param isPublic_ whether cloned DAO has public visibility. /// @param hasAdmins_ whether cloned DAO has admins, otherwise all stakers are treated as admins. function initializeCustom( address torroToken_, address governingToken_, address factory_, address creator_, uint256 maxCost_, uint256 executeMinPct_, uint256 votingMinHours_, bool isPublic_, bool hasAdmins_ ) external; // Public calls. /// @notice Address of DAO creator. /// @return DAO creator address. function daoCreator() external view returns (address); /// @notice Amount of tokens needed for a single vote. /// @return uint256 token amount. function voteWeight() external view returns (uint256); /// @notice Amount of votes that holder has. /// @param sender_ address of the holder. /// @return number of votes. function votesOf(address sender_) external view returns (uint256); /// @notice Address of the governing token. /// @return address of the governing token. function tokenAddress() external view returns (address); /// @notice Saved addresses of tokens that DAO is holding. /// @return array of holdings addresses. function holdings() external view returns (address[] memory); /// @notice Saved addresses of liquidity tokens that DAO is holding. /// @return array of liquidity addresses. function liquidities() external view returns (address[] memory); /// @notice Calculates address of liquidity token from ERC-20 token address. /// @param token_ token address to calculate liquidity address from. /// @return address of liquidity token. function liquidityToken(address token_) external view returns (address); /// @notice Gets tokens and liquidity token addresses of DAO's liquidity holdings. /// @return Arrays of tokens and liquidity tokens, should have the same length. function liquidityHoldings() external view returns (address[] memory, address[] memory); /// @notice DAO admins. /// @return Array of admin addresses. function admins() external view returns (address[] memory); /// @notice DAO balance for specified token. /// @param token_ token address to get balance for. /// @return uint256 token balance. function tokenBalance(address token_) external view returns (uint256); /// @notice DAO balance for liquidity token. /// @param token_ token address to get liquidity balance for. /// @return uin256 token liquidity balance. function liquidityBalance(address token_) external view returns (uint256); /// @notice DAO ethereum balance. /// @return uint256 wei balance. function availableBalance() external view returns (uint256); /// @notice Maximum cost for all tokens of cloned DAO. /// @return uint256 maximum cost in wei. function maxCost() external view returns (uint256); /// @notice Minimum percentage of votes needed to execute a proposal. /// @return uint256 minimum percentage of votes. function executeMinPct() external view returns (uint256); /// @notice Minimum lifetime of proposal before it closes. /// @return uint256 minimum number of hours for proposal lifetime. function votingMinHours() external view returns (uint256); /// @notice Whether DAO is public or private. /// @return bool true if public. function isPublic() external view returns (bool); /// @notice Whether DAO has admins. /// @return bool true if DAO has admins. function hasAdmins() external view returns (bool); /// @notice Proposal ids of DAO. /// @return array of proposal ids. function getProposalIds() external view returns (uint256[] memory); /// @notice Gets proposal info for proposal id. /// @param id_ id of proposal to get info for. /// @return proposalAddress address for proposal execution. /// @return investTokenAddress secondary address for proposal execution, used for investment proposals if ICO and token addresses differ. /// @return daoFunction proposal type. /// @return amount proposal amount eth/token to use during execution. /// @return creator address of proposal creator. /// @return endLifetime epoch time when proposal voting ends. /// @return votesFor amount of votes for the proposal. /// @return votesAgainst amount of votes against the proposal. /// @return executed whether proposal has been executed or not. function getProposal(uint256 id_) external view returns ( address proposalAddress, address investTokenAddress, DaoFunction daoFunction, uint256 amount, address creator, uint256 endLifetime, uint256 votesFor, uint256 votesAgainst, bool executed ); /// @notice Whether a holder is allowed to vote for a proposal. /// @param id_ proposal id to check whether holder is allowed to vote for. /// @param sender_ address of the holder. /// @return bool true if voting is allowed. function canVote(uint256 id_, address sender_) external view returns (bool); /// @notice Whether a holder is allowed to remove a proposal. /// @param id_ proposal id to check whether holder is allowed to remove. /// @param sender_ address of the holder. /// @return bool true if removal is allowed. function canRemove(uint256 id_, address sender_) external view returns (bool); /// @notice Whether a holder is allowed to execute a proposal. /// @param id_ proposal id to check whether holder is allowed to execute. /// @param sender_ address of the holder. /// @return bool true if execution is allowed. function canExecute(uint256 id_, address sender_) external view returns (bool); /// @notice Whether a holder is an admin. /// @param sender_ address of holder. /// @return bool true if holder is an admin (in DAO without admins all holders are treated as such). function isAdmin(address sender_) external view returns (bool); // Public transactions. /// @notice Saves new holdings addresses for DAO. /// @param tokens_ token addresses that DAO has holdings of. function addHoldingsAddresses(address[] calldata tokens_) external; /// @notice Saves new liquidity addresses for DAO. /// @param tokens_ token addresses that DAO has liquidities of. function addLiquidityAddresses(address[] calldata tokens_) external; /// @notice Creates new proposal. /// @param proposalAddress_ main address of the proposal, in investment proposals this is the address funds are sent to. /// @param investTokenAddress_ secondary address of the proposal, used in investment proposals to specify token address. /// @param daoFunction_ type of the proposal. /// @param amount_ amount of funds to use in the proposal. /// @param hoursLifetime_ voting lifetime of the proposal. function propose(address proposalAddress_, address investTokenAddress_, DaoFunction daoFunction_, uint256 amount_, uint256 hoursLifetime_) external; /// @notice Removes existing proposal. /// @param id_ id of proposal to remove. function unpropose(uint256 id_) external; /// @notice Voting for multiple proposals. /// @param ids_ ids of proposals to vote for. /// @param votes_ for or against votes for proposals. function vote(uint256[] calldata ids_, bool[] calldata votes_) external; /// @notice Executes a proposal. /// @param id_ id of proposal to be executed. function execute(uint256 id_) external; /// @notice Buying tokens for cloned DAO. function buy() external payable; /// @notice Sell tokens back to cloned DAO. /// @param amount_ amount of tokens to sell. function sell(uint256 amount_) external; // Owner transactions. /// @notice Sets factory address. /// @param factory_ address of TorroFactory. function setFactoryAddress(address factory_) external; /// @notice Sets vote weight divider. /// @param weight_ weight divider for a single vote. function setVoteWeightDivider(uint256 weight_) external; /// @notice Sets new address for router. /// @param router_ address for router. function setRouter(address router_) external; /// @notice Sets divider for BUY, INVEST, WITHDAW proposals. /// @param divider_ divider for BUY, INVEST, WITHDRAW proposals. function setSpendDivider(uint256 divider_) external; /// @notice Migrates balances of current DAO to a new DAO. /// @param newDao_ address of the new DAO to migrate to. function migrate(address newDao_) external; }
/// @title DAO for proposals, voting and execution. /// @notice Interface for creation, voting and execution of proposals. /// @author ORayskiy - @robitnik_TorroDao
NatSpecSingleLine
setFactoryAddress
function setFactoryAddress(address factory_) external;
/// @notice Sets factory address. /// @param factory_ address of TorroFactory.
NatSpecSingleLine
v0.6.6+commit.6c089d02
Unknown
ipfs://d1c6095fcf143d951c9754f00fe8cd59d29ab460461efe53b91eb289fd0fe5ac
{ "func_code_index": [ 8533, 8590 ] }
57,716
TorroDao
ITorroDao.sol
0x3cf9e9d45380b6ab61bde46b2e6cfcd7d8f6cdc1
Solidity
ITorroDao
interface ITorroDao { // Enums. /// @notice Enum of available proposal functions. enum DaoFunction { BUY, SELL, ADD_LIQUIDITY, REMOVE_LIQUIDITY, ADD_ADMIN, REMOVE_ADMIN, INVEST, WITHDRAW } // Initializer. /// @notice Initializer for DAO clones. /// @param torroToken_ main torro token address. /// @param governingToken_ torro token clone that's governing this dao. /// @param factory_ torro factory address. /// @param creator_ creator of cloned DAO. /// @param maxCost_ maximum cost of all governing tokens for cloned DAO. /// @param executeMinPct_ minimum percentage of votes needed for proposal execution. /// @param votingMinHours_ minimum lifetime of proposal before it closes. /// @param isPublic_ whether cloned DAO has public visibility. /// @param hasAdmins_ whether cloned DAO has admins, otherwise all stakers are treated as admins. function initializeCustom( address torroToken_, address governingToken_, address factory_, address creator_, uint256 maxCost_, uint256 executeMinPct_, uint256 votingMinHours_, bool isPublic_, bool hasAdmins_ ) external; // Public calls. /// @notice Address of DAO creator. /// @return DAO creator address. function daoCreator() external view returns (address); /// @notice Amount of tokens needed for a single vote. /// @return uint256 token amount. function voteWeight() external view returns (uint256); /// @notice Amount of votes that holder has. /// @param sender_ address of the holder. /// @return number of votes. function votesOf(address sender_) external view returns (uint256); /// @notice Address of the governing token. /// @return address of the governing token. function tokenAddress() external view returns (address); /// @notice Saved addresses of tokens that DAO is holding. /// @return array of holdings addresses. function holdings() external view returns (address[] memory); /// @notice Saved addresses of liquidity tokens that DAO is holding. /// @return array of liquidity addresses. function liquidities() external view returns (address[] memory); /// @notice Calculates address of liquidity token from ERC-20 token address. /// @param token_ token address to calculate liquidity address from. /// @return address of liquidity token. function liquidityToken(address token_) external view returns (address); /// @notice Gets tokens and liquidity token addresses of DAO's liquidity holdings. /// @return Arrays of tokens and liquidity tokens, should have the same length. function liquidityHoldings() external view returns (address[] memory, address[] memory); /// @notice DAO admins. /// @return Array of admin addresses. function admins() external view returns (address[] memory); /// @notice DAO balance for specified token. /// @param token_ token address to get balance for. /// @return uint256 token balance. function tokenBalance(address token_) external view returns (uint256); /// @notice DAO balance for liquidity token. /// @param token_ token address to get liquidity balance for. /// @return uin256 token liquidity balance. function liquidityBalance(address token_) external view returns (uint256); /// @notice DAO ethereum balance. /// @return uint256 wei balance. function availableBalance() external view returns (uint256); /// @notice Maximum cost for all tokens of cloned DAO. /// @return uint256 maximum cost in wei. function maxCost() external view returns (uint256); /// @notice Minimum percentage of votes needed to execute a proposal. /// @return uint256 minimum percentage of votes. function executeMinPct() external view returns (uint256); /// @notice Minimum lifetime of proposal before it closes. /// @return uint256 minimum number of hours for proposal lifetime. function votingMinHours() external view returns (uint256); /// @notice Whether DAO is public or private. /// @return bool true if public. function isPublic() external view returns (bool); /// @notice Whether DAO has admins. /// @return bool true if DAO has admins. function hasAdmins() external view returns (bool); /// @notice Proposal ids of DAO. /// @return array of proposal ids. function getProposalIds() external view returns (uint256[] memory); /// @notice Gets proposal info for proposal id. /// @param id_ id of proposal to get info for. /// @return proposalAddress address for proposal execution. /// @return investTokenAddress secondary address for proposal execution, used for investment proposals if ICO and token addresses differ. /// @return daoFunction proposal type. /// @return amount proposal amount eth/token to use during execution. /// @return creator address of proposal creator. /// @return endLifetime epoch time when proposal voting ends. /// @return votesFor amount of votes for the proposal. /// @return votesAgainst amount of votes against the proposal. /// @return executed whether proposal has been executed or not. function getProposal(uint256 id_) external view returns ( address proposalAddress, address investTokenAddress, DaoFunction daoFunction, uint256 amount, address creator, uint256 endLifetime, uint256 votesFor, uint256 votesAgainst, bool executed ); /// @notice Whether a holder is allowed to vote for a proposal. /// @param id_ proposal id to check whether holder is allowed to vote for. /// @param sender_ address of the holder. /// @return bool true if voting is allowed. function canVote(uint256 id_, address sender_) external view returns (bool); /// @notice Whether a holder is allowed to remove a proposal. /// @param id_ proposal id to check whether holder is allowed to remove. /// @param sender_ address of the holder. /// @return bool true if removal is allowed. function canRemove(uint256 id_, address sender_) external view returns (bool); /// @notice Whether a holder is allowed to execute a proposal. /// @param id_ proposal id to check whether holder is allowed to execute. /// @param sender_ address of the holder. /// @return bool true if execution is allowed. function canExecute(uint256 id_, address sender_) external view returns (bool); /// @notice Whether a holder is an admin. /// @param sender_ address of holder. /// @return bool true if holder is an admin (in DAO without admins all holders are treated as such). function isAdmin(address sender_) external view returns (bool); // Public transactions. /// @notice Saves new holdings addresses for DAO. /// @param tokens_ token addresses that DAO has holdings of. function addHoldingsAddresses(address[] calldata tokens_) external; /// @notice Saves new liquidity addresses for DAO. /// @param tokens_ token addresses that DAO has liquidities of. function addLiquidityAddresses(address[] calldata tokens_) external; /// @notice Creates new proposal. /// @param proposalAddress_ main address of the proposal, in investment proposals this is the address funds are sent to. /// @param investTokenAddress_ secondary address of the proposal, used in investment proposals to specify token address. /// @param daoFunction_ type of the proposal. /// @param amount_ amount of funds to use in the proposal. /// @param hoursLifetime_ voting lifetime of the proposal. function propose(address proposalAddress_, address investTokenAddress_, DaoFunction daoFunction_, uint256 amount_, uint256 hoursLifetime_) external; /// @notice Removes existing proposal. /// @param id_ id of proposal to remove. function unpropose(uint256 id_) external; /// @notice Voting for multiple proposals. /// @param ids_ ids of proposals to vote for. /// @param votes_ for or against votes for proposals. function vote(uint256[] calldata ids_, bool[] calldata votes_) external; /// @notice Executes a proposal. /// @param id_ id of proposal to be executed. function execute(uint256 id_) external; /// @notice Buying tokens for cloned DAO. function buy() external payable; /// @notice Sell tokens back to cloned DAO. /// @param amount_ amount of tokens to sell. function sell(uint256 amount_) external; // Owner transactions. /// @notice Sets factory address. /// @param factory_ address of TorroFactory. function setFactoryAddress(address factory_) external; /// @notice Sets vote weight divider. /// @param weight_ weight divider for a single vote. function setVoteWeightDivider(uint256 weight_) external; /// @notice Sets new address for router. /// @param router_ address for router. function setRouter(address router_) external; /// @notice Sets divider for BUY, INVEST, WITHDAW proposals. /// @param divider_ divider for BUY, INVEST, WITHDRAW proposals. function setSpendDivider(uint256 divider_) external; /// @notice Migrates balances of current DAO to a new DAO. /// @param newDao_ address of the new DAO to migrate to. function migrate(address newDao_) external; }
/// @title DAO for proposals, voting and execution. /// @notice Interface for creation, voting and execution of proposals. /// @author ORayskiy - @robitnik_TorroDao
NatSpecSingleLine
setVoteWeightDivider
function setVoteWeightDivider(uint256 weight_) external;
/// @notice Sets vote weight divider. /// @param weight_ weight divider for a single vote.
NatSpecSingleLine
v0.6.6+commit.6c089d02
Unknown
ipfs://d1c6095fcf143d951c9754f00fe8cd59d29ab460461efe53b91eb289fd0fe5ac
{ "func_code_index": [ 8690, 8749 ] }
57,717
TorroDao
ITorroDao.sol
0x3cf9e9d45380b6ab61bde46b2e6cfcd7d8f6cdc1
Solidity
ITorroDao
interface ITorroDao { // Enums. /// @notice Enum of available proposal functions. enum DaoFunction { BUY, SELL, ADD_LIQUIDITY, REMOVE_LIQUIDITY, ADD_ADMIN, REMOVE_ADMIN, INVEST, WITHDRAW } // Initializer. /// @notice Initializer for DAO clones. /// @param torroToken_ main torro token address. /// @param governingToken_ torro token clone that's governing this dao. /// @param factory_ torro factory address. /// @param creator_ creator of cloned DAO. /// @param maxCost_ maximum cost of all governing tokens for cloned DAO. /// @param executeMinPct_ minimum percentage of votes needed for proposal execution. /// @param votingMinHours_ minimum lifetime of proposal before it closes. /// @param isPublic_ whether cloned DAO has public visibility. /// @param hasAdmins_ whether cloned DAO has admins, otherwise all stakers are treated as admins. function initializeCustom( address torroToken_, address governingToken_, address factory_, address creator_, uint256 maxCost_, uint256 executeMinPct_, uint256 votingMinHours_, bool isPublic_, bool hasAdmins_ ) external; // Public calls. /// @notice Address of DAO creator. /// @return DAO creator address. function daoCreator() external view returns (address); /// @notice Amount of tokens needed for a single vote. /// @return uint256 token amount. function voteWeight() external view returns (uint256); /// @notice Amount of votes that holder has. /// @param sender_ address of the holder. /// @return number of votes. function votesOf(address sender_) external view returns (uint256); /// @notice Address of the governing token. /// @return address of the governing token. function tokenAddress() external view returns (address); /// @notice Saved addresses of tokens that DAO is holding. /// @return array of holdings addresses. function holdings() external view returns (address[] memory); /// @notice Saved addresses of liquidity tokens that DAO is holding. /// @return array of liquidity addresses. function liquidities() external view returns (address[] memory); /// @notice Calculates address of liquidity token from ERC-20 token address. /// @param token_ token address to calculate liquidity address from. /// @return address of liquidity token. function liquidityToken(address token_) external view returns (address); /// @notice Gets tokens and liquidity token addresses of DAO's liquidity holdings. /// @return Arrays of tokens and liquidity tokens, should have the same length. function liquidityHoldings() external view returns (address[] memory, address[] memory); /// @notice DAO admins. /// @return Array of admin addresses. function admins() external view returns (address[] memory); /// @notice DAO balance for specified token. /// @param token_ token address to get balance for. /// @return uint256 token balance. function tokenBalance(address token_) external view returns (uint256); /// @notice DAO balance for liquidity token. /// @param token_ token address to get liquidity balance for. /// @return uin256 token liquidity balance. function liquidityBalance(address token_) external view returns (uint256); /// @notice DAO ethereum balance. /// @return uint256 wei balance. function availableBalance() external view returns (uint256); /// @notice Maximum cost for all tokens of cloned DAO. /// @return uint256 maximum cost in wei. function maxCost() external view returns (uint256); /// @notice Minimum percentage of votes needed to execute a proposal. /// @return uint256 minimum percentage of votes. function executeMinPct() external view returns (uint256); /// @notice Minimum lifetime of proposal before it closes. /// @return uint256 minimum number of hours for proposal lifetime. function votingMinHours() external view returns (uint256); /// @notice Whether DAO is public or private. /// @return bool true if public. function isPublic() external view returns (bool); /// @notice Whether DAO has admins. /// @return bool true if DAO has admins. function hasAdmins() external view returns (bool); /// @notice Proposal ids of DAO. /// @return array of proposal ids. function getProposalIds() external view returns (uint256[] memory); /// @notice Gets proposal info for proposal id. /// @param id_ id of proposal to get info for. /// @return proposalAddress address for proposal execution. /// @return investTokenAddress secondary address for proposal execution, used for investment proposals if ICO and token addresses differ. /// @return daoFunction proposal type. /// @return amount proposal amount eth/token to use during execution. /// @return creator address of proposal creator. /// @return endLifetime epoch time when proposal voting ends. /// @return votesFor amount of votes for the proposal. /// @return votesAgainst amount of votes against the proposal. /// @return executed whether proposal has been executed or not. function getProposal(uint256 id_) external view returns ( address proposalAddress, address investTokenAddress, DaoFunction daoFunction, uint256 amount, address creator, uint256 endLifetime, uint256 votesFor, uint256 votesAgainst, bool executed ); /// @notice Whether a holder is allowed to vote for a proposal. /// @param id_ proposal id to check whether holder is allowed to vote for. /// @param sender_ address of the holder. /// @return bool true if voting is allowed. function canVote(uint256 id_, address sender_) external view returns (bool); /// @notice Whether a holder is allowed to remove a proposal. /// @param id_ proposal id to check whether holder is allowed to remove. /// @param sender_ address of the holder. /// @return bool true if removal is allowed. function canRemove(uint256 id_, address sender_) external view returns (bool); /// @notice Whether a holder is allowed to execute a proposal. /// @param id_ proposal id to check whether holder is allowed to execute. /// @param sender_ address of the holder. /// @return bool true if execution is allowed. function canExecute(uint256 id_, address sender_) external view returns (bool); /// @notice Whether a holder is an admin. /// @param sender_ address of holder. /// @return bool true if holder is an admin (in DAO without admins all holders are treated as such). function isAdmin(address sender_) external view returns (bool); // Public transactions. /// @notice Saves new holdings addresses for DAO. /// @param tokens_ token addresses that DAO has holdings of. function addHoldingsAddresses(address[] calldata tokens_) external; /// @notice Saves new liquidity addresses for DAO. /// @param tokens_ token addresses that DAO has liquidities of. function addLiquidityAddresses(address[] calldata tokens_) external; /// @notice Creates new proposal. /// @param proposalAddress_ main address of the proposal, in investment proposals this is the address funds are sent to. /// @param investTokenAddress_ secondary address of the proposal, used in investment proposals to specify token address. /// @param daoFunction_ type of the proposal. /// @param amount_ amount of funds to use in the proposal. /// @param hoursLifetime_ voting lifetime of the proposal. function propose(address proposalAddress_, address investTokenAddress_, DaoFunction daoFunction_, uint256 amount_, uint256 hoursLifetime_) external; /// @notice Removes existing proposal. /// @param id_ id of proposal to remove. function unpropose(uint256 id_) external; /// @notice Voting for multiple proposals. /// @param ids_ ids of proposals to vote for. /// @param votes_ for or against votes for proposals. function vote(uint256[] calldata ids_, bool[] calldata votes_) external; /// @notice Executes a proposal. /// @param id_ id of proposal to be executed. function execute(uint256 id_) external; /// @notice Buying tokens for cloned DAO. function buy() external payable; /// @notice Sell tokens back to cloned DAO. /// @param amount_ amount of tokens to sell. function sell(uint256 amount_) external; // Owner transactions. /// @notice Sets factory address. /// @param factory_ address of TorroFactory. function setFactoryAddress(address factory_) external; /// @notice Sets vote weight divider. /// @param weight_ weight divider for a single vote. function setVoteWeightDivider(uint256 weight_) external; /// @notice Sets new address for router. /// @param router_ address for router. function setRouter(address router_) external; /// @notice Sets divider for BUY, INVEST, WITHDAW proposals. /// @param divider_ divider for BUY, INVEST, WITHDRAW proposals. function setSpendDivider(uint256 divider_) external; /// @notice Migrates balances of current DAO to a new DAO. /// @param newDao_ address of the new DAO to migrate to. function migrate(address newDao_) external; }
/// @title DAO for proposals, voting and execution. /// @notice Interface for creation, voting and execution of proposals. /// @author ORayskiy - @robitnik_TorroDao
NatSpecSingleLine
setRouter
function setRouter(address router_) external;
/// @notice Sets new address for router. /// @param router_ address for router.
NatSpecSingleLine
v0.6.6+commit.6c089d02
Unknown
ipfs://d1c6095fcf143d951c9754f00fe8cd59d29ab460461efe53b91eb289fd0fe5ac
{ "func_code_index": [ 8838, 8886 ] }
57,718
TorroDao
ITorroDao.sol
0x3cf9e9d45380b6ab61bde46b2e6cfcd7d8f6cdc1
Solidity
ITorroDao
interface ITorroDao { // Enums. /// @notice Enum of available proposal functions. enum DaoFunction { BUY, SELL, ADD_LIQUIDITY, REMOVE_LIQUIDITY, ADD_ADMIN, REMOVE_ADMIN, INVEST, WITHDRAW } // Initializer. /// @notice Initializer for DAO clones. /// @param torroToken_ main torro token address. /// @param governingToken_ torro token clone that's governing this dao. /// @param factory_ torro factory address. /// @param creator_ creator of cloned DAO. /// @param maxCost_ maximum cost of all governing tokens for cloned DAO. /// @param executeMinPct_ minimum percentage of votes needed for proposal execution. /// @param votingMinHours_ minimum lifetime of proposal before it closes. /// @param isPublic_ whether cloned DAO has public visibility. /// @param hasAdmins_ whether cloned DAO has admins, otherwise all stakers are treated as admins. function initializeCustom( address torroToken_, address governingToken_, address factory_, address creator_, uint256 maxCost_, uint256 executeMinPct_, uint256 votingMinHours_, bool isPublic_, bool hasAdmins_ ) external; // Public calls. /// @notice Address of DAO creator. /// @return DAO creator address. function daoCreator() external view returns (address); /// @notice Amount of tokens needed for a single vote. /// @return uint256 token amount. function voteWeight() external view returns (uint256); /// @notice Amount of votes that holder has. /// @param sender_ address of the holder. /// @return number of votes. function votesOf(address sender_) external view returns (uint256); /// @notice Address of the governing token. /// @return address of the governing token. function tokenAddress() external view returns (address); /// @notice Saved addresses of tokens that DAO is holding. /// @return array of holdings addresses. function holdings() external view returns (address[] memory); /// @notice Saved addresses of liquidity tokens that DAO is holding. /// @return array of liquidity addresses. function liquidities() external view returns (address[] memory); /// @notice Calculates address of liquidity token from ERC-20 token address. /// @param token_ token address to calculate liquidity address from. /// @return address of liquidity token. function liquidityToken(address token_) external view returns (address); /// @notice Gets tokens and liquidity token addresses of DAO's liquidity holdings. /// @return Arrays of tokens and liquidity tokens, should have the same length. function liquidityHoldings() external view returns (address[] memory, address[] memory); /// @notice DAO admins. /// @return Array of admin addresses. function admins() external view returns (address[] memory); /// @notice DAO balance for specified token. /// @param token_ token address to get balance for. /// @return uint256 token balance. function tokenBalance(address token_) external view returns (uint256); /// @notice DAO balance for liquidity token. /// @param token_ token address to get liquidity balance for. /// @return uin256 token liquidity balance. function liquidityBalance(address token_) external view returns (uint256); /// @notice DAO ethereum balance. /// @return uint256 wei balance. function availableBalance() external view returns (uint256); /// @notice Maximum cost for all tokens of cloned DAO. /// @return uint256 maximum cost in wei. function maxCost() external view returns (uint256); /// @notice Minimum percentage of votes needed to execute a proposal. /// @return uint256 minimum percentage of votes. function executeMinPct() external view returns (uint256); /// @notice Minimum lifetime of proposal before it closes. /// @return uint256 minimum number of hours for proposal lifetime. function votingMinHours() external view returns (uint256); /// @notice Whether DAO is public or private. /// @return bool true if public. function isPublic() external view returns (bool); /// @notice Whether DAO has admins. /// @return bool true if DAO has admins. function hasAdmins() external view returns (bool); /// @notice Proposal ids of DAO. /// @return array of proposal ids. function getProposalIds() external view returns (uint256[] memory); /// @notice Gets proposal info for proposal id. /// @param id_ id of proposal to get info for. /// @return proposalAddress address for proposal execution. /// @return investTokenAddress secondary address for proposal execution, used for investment proposals if ICO and token addresses differ. /// @return daoFunction proposal type. /// @return amount proposal amount eth/token to use during execution. /// @return creator address of proposal creator. /// @return endLifetime epoch time when proposal voting ends. /// @return votesFor amount of votes for the proposal. /// @return votesAgainst amount of votes against the proposal. /// @return executed whether proposal has been executed or not. function getProposal(uint256 id_) external view returns ( address proposalAddress, address investTokenAddress, DaoFunction daoFunction, uint256 amount, address creator, uint256 endLifetime, uint256 votesFor, uint256 votesAgainst, bool executed ); /// @notice Whether a holder is allowed to vote for a proposal. /// @param id_ proposal id to check whether holder is allowed to vote for. /// @param sender_ address of the holder. /// @return bool true if voting is allowed. function canVote(uint256 id_, address sender_) external view returns (bool); /// @notice Whether a holder is allowed to remove a proposal. /// @param id_ proposal id to check whether holder is allowed to remove. /// @param sender_ address of the holder. /// @return bool true if removal is allowed. function canRemove(uint256 id_, address sender_) external view returns (bool); /// @notice Whether a holder is allowed to execute a proposal. /// @param id_ proposal id to check whether holder is allowed to execute. /// @param sender_ address of the holder. /// @return bool true if execution is allowed. function canExecute(uint256 id_, address sender_) external view returns (bool); /// @notice Whether a holder is an admin. /// @param sender_ address of holder. /// @return bool true if holder is an admin (in DAO without admins all holders are treated as such). function isAdmin(address sender_) external view returns (bool); // Public transactions. /// @notice Saves new holdings addresses for DAO. /// @param tokens_ token addresses that DAO has holdings of. function addHoldingsAddresses(address[] calldata tokens_) external; /// @notice Saves new liquidity addresses for DAO. /// @param tokens_ token addresses that DAO has liquidities of. function addLiquidityAddresses(address[] calldata tokens_) external; /// @notice Creates new proposal. /// @param proposalAddress_ main address of the proposal, in investment proposals this is the address funds are sent to. /// @param investTokenAddress_ secondary address of the proposal, used in investment proposals to specify token address. /// @param daoFunction_ type of the proposal. /// @param amount_ amount of funds to use in the proposal. /// @param hoursLifetime_ voting lifetime of the proposal. function propose(address proposalAddress_, address investTokenAddress_, DaoFunction daoFunction_, uint256 amount_, uint256 hoursLifetime_) external; /// @notice Removes existing proposal. /// @param id_ id of proposal to remove. function unpropose(uint256 id_) external; /// @notice Voting for multiple proposals. /// @param ids_ ids of proposals to vote for. /// @param votes_ for or against votes for proposals. function vote(uint256[] calldata ids_, bool[] calldata votes_) external; /// @notice Executes a proposal. /// @param id_ id of proposal to be executed. function execute(uint256 id_) external; /// @notice Buying tokens for cloned DAO. function buy() external payable; /// @notice Sell tokens back to cloned DAO. /// @param amount_ amount of tokens to sell. function sell(uint256 amount_) external; // Owner transactions. /// @notice Sets factory address. /// @param factory_ address of TorroFactory. function setFactoryAddress(address factory_) external; /// @notice Sets vote weight divider. /// @param weight_ weight divider for a single vote. function setVoteWeightDivider(uint256 weight_) external; /// @notice Sets new address for router. /// @param router_ address for router. function setRouter(address router_) external; /// @notice Sets divider for BUY, INVEST, WITHDAW proposals. /// @param divider_ divider for BUY, INVEST, WITHDRAW proposals. function setSpendDivider(uint256 divider_) external; /// @notice Migrates balances of current DAO to a new DAO. /// @param newDao_ address of the new DAO to migrate to. function migrate(address newDao_) external; }
/// @title DAO for proposals, voting and execution. /// @notice Interface for creation, voting and execution of proposals. /// @author ORayskiy - @robitnik_TorroDao
NatSpecSingleLine
setSpendDivider
function setSpendDivider(uint256 divider_) external;
/// @notice Sets divider for BUY, INVEST, WITHDAW proposals. /// @param divider_ divider for BUY, INVEST, WITHDRAW proposals.
NatSpecSingleLine
v0.6.6+commit.6c089d02
Unknown
ipfs://d1c6095fcf143d951c9754f00fe8cd59d29ab460461efe53b91eb289fd0fe5ac
{ "func_code_index": [ 9021, 9076 ] }
57,719
TorroDao
ITorroDao.sol
0x3cf9e9d45380b6ab61bde46b2e6cfcd7d8f6cdc1
Solidity
ITorroDao
interface ITorroDao { // Enums. /// @notice Enum of available proposal functions. enum DaoFunction { BUY, SELL, ADD_LIQUIDITY, REMOVE_LIQUIDITY, ADD_ADMIN, REMOVE_ADMIN, INVEST, WITHDRAW } // Initializer. /// @notice Initializer for DAO clones. /// @param torroToken_ main torro token address. /// @param governingToken_ torro token clone that's governing this dao. /// @param factory_ torro factory address. /// @param creator_ creator of cloned DAO. /// @param maxCost_ maximum cost of all governing tokens for cloned DAO. /// @param executeMinPct_ minimum percentage of votes needed for proposal execution. /// @param votingMinHours_ minimum lifetime of proposal before it closes. /// @param isPublic_ whether cloned DAO has public visibility. /// @param hasAdmins_ whether cloned DAO has admins, otherwise all stakers are treated as admins. function initializeCustom( address torroToken_, address governingToken_, address factory_, address creator_, uint256 maxCost_, uint256 executeMinPct_, uint256 votingMinHours_, bool isPublic_, bool hasAdmins_ ) external; // Public calls. /// @notice Address of DAO creator. /// @return DAO creator address. function daoCreator() external view returns (address); /// @notice Amount of tokens needed for a single vote. /// @return uint256 token amount. function voteWeight() external view returns (uint256); /// @notice Amount of votes that holder has. /// @param sender_ address of the holder. /// @return number of votes. function votesOf(address sender_) external view returns (uint256); /// @notice Address of the governing token. /// @return address of the governing token. function tokenAddress() external view returns (address); /// @notice Saved addresses of tokens that DAO is holding. /// @return array of holdings addresses. function holdings() external view returns (address[] memory); /// @notice Saved addresses of liquidity tokens that DAO is holding. /// @return array of liquidity addresses. function liquidities() external view returns (address[] memory); /// @notice Calculates address of liquidity token from ERC-20 token address. /// @param token_ token address to calculate liquidity address from. /// @return address of liquidity token. function liquidityToken(address token_) external view returns (address); /// @notice Gets tokens and liquidity token addresses of DAO's liquidity holdings. /// @return Arrays of tokens and liquidity tokens, should have the same length. function liquidityHoldings() external view returns (address[] memory, address[] memory); /// @notice DAO admins. /// @return Array of admin addresses. function admins() external view returns (address[] memory); /// @notice DAO balance for specified token. /// @param token_ token address to get balance for. /// @return uint256 token balance. function tokenBalance(address token_) external view returns (uint256); /// @notice DAO balance for liquidity token. /// @param token_ token address to get liquidity balance for. /// @return uin256 token liquidity balance. function liquidityBalance(address token_) external view returns (uint256); /// @notice DAO ethereum balance. /// @return uint256 wei balance. function availableBalance() external view returns (uint256); /// @notice Maximum cost for all tokens of cloned DAO. /// @return uint256 maximum cost in wei. function maxCost() external view returns (uint256); /// @notice Minimum percentage of votes needed to execute a proposal. /// @return uint256 minimum percentage of votes. function executeMinPct() external view returns (uint256); /// @notice Minimum lifetime of proposal before it closes. /// @return uint256 minimum number of hours for proposal lifetime. function votingMinHours() external view returns (uint256); /// @notice Whether DAO is public or private. /// @return bool true if public. function isPublic() external view returns (bool); /// @notice Whether DAO has admins. /// @return bool true if DAO has admins. function hasAdmins() external view returns (bool); /// @notice Proposal ids of DAO. /// @return array of proposal ids. function getProposalIds() external view returns (uint256[] memory); /// @notice Gets proposal info for proposal id. /// @param id_ id of proposal to get info for. /// @return proposalAddress address for proposal execution. /// @return investTokenAddress secondary address for proposal execution, used for investment proposals if ICO and token addresses differ. /// @return daoFunction proposal type. /// @return amount proposal amount eth/token to use during execution. /// @return creator address of proposal creator. /// @return endLifetime epoch time when proposal voting ends. /// @return votesFor amount of votes for the proposal. /// @return votesAgainst amount of votes against the proposal. /// @return executed whether proposal has been executed or not. function getProposal(uint256 id_) external view returns ( address proposalAddress, address investTokenAddress, DaoFunction daoFunction, uint256 amount, address creator, uint256 endLifetime, uint256 votesFor, uint256 votesAgainst, bool executed ); /// @notice Whether a holder is allowed to vote for a proposal. /// @param id_ proposal id to check whether holder is allowed to vote for. /// @param sender_ address of the holder. /// @return bool true if voting is allowed. function canVote(uint256 id_, address sender_) external view returns (bool); /// @notice Whether a holder is allowed to remove a proposal. /// @param id_ proposal id to check whether holder is allowed to remove. /// @param sender_ address of the holder. /// @return bool true if removal is allowed. function canRemove(uint256 id_, address sender_) external view returns (bool); /// @notice Whether a holder is allowed to execute a proposal. /// @param id_ proposal id to check whether holder is allowed to execute. /// @param sender_ address of the holder. /// @return bool true if execution is allowed. function canExecute(uint256 id_, address sender_) external view returns (bool); /// @notice Whether a holder is an admin. /// @param sender_ address of holder. /// @return bool true if holder is an admin (in DAO without admins all holders are treated as such). function isAdmin(address sender_) external view returns (bool); // Public transactions. /// @notice Saves new holdings addresses for DAO. /// @param tokens_ token addresses that DAO has holdings of. function addHoldingsAddresses(address[] calldata tokens_) external; /// @notice Saves new liquidity addresses for DAO. /// @param tokens_ token addresses that DAO has liquidities of. function addLiquidityAddresses(address[] calldata tokens_) external; /// @notice Creates new proposal. /// @param proposalAddress_ main address of the proposal, in investment proposals this is the address funds are sent to. /// @param investTokenAddress_ secondary address of the proposal, used in investment proposals to specify token address. /// @param daoFunction_ type of the proposal. /// @param amount_ amount of funds to use in the proposal. /// @param hoursLifetime_ voting lifetime of the proposal. function propose(address proposalAddress_, address investTokenAddress_, DaoFunction daoFunction_, uint256 amount_, uint256 hoursLifetime_) external; /// @notice Removes existing proposal. /// @param id_ id of proposal to remove. function unpropose(uint256 id_) external; /// @notice Voting for multiple proposals. /// @param ids_ ids of proposals to vote for. /// @param votes_ for or against votes for proposals. function vote(uint256[] calldata ids_, bool[] calldata votes_) external; /// @notice Executes a proposal. /// @param id_ id of proposal to be executed. function execute(uint256 id_) external; /// @notice Buying tokens for cloned DAO. function buy() external payable; /// @notice Sell tokens back to cloned DAO. /// @param amount_ amount of tokens to sell. function sell(uint256 amount_) external; // Owner transactions. /// @notice Sets factory address. /// @param factory_ address of TorroFactory. function setFactoryAddress(address factory_) external; /// @notice Sets vote weight divider. /// @param weight_ weight divider for a single vote. function setVoteWeightDivider(uint256 weight_) external; /// @notice Sets new address for router. /// @param router_ address for router. function setRouter(address router_) external; /// @notice Sets divider for BUY, INVEST, WITHDAW proposals. /// @param divider_ divider for BUY, INVEST, WITHDRAW proposals. function setSpendDivider(uint256 divider_) external; /// @notice Migrates balances of current DAO to a new DAO. /// @param newDao_ address of the new DAO to migrate to. function migrate(address newDao_) external; }
/// @title DAO for proposals, voting and execution. /// @notice Interface for creation, voting and execution of proposals. /// @author ORayskiy - @robitnik_TorroDao
NatSpecSingleLine
migrate
function migrate(address newDao_) external;
/// @notice Migrates balances of current DAO to a new DAO. /// @param newDao_ address of the new DAO to migrate to.
NatSpecSingleLine
v0.6.6+commit.6c089d02
Unknown
ipfs://d1c6095fcf143d951c9754f00fe8cd59d29ab460461efe53b91eb289fd0fe5ac
{ "func_code_index": [ 9201, 9247 ] }
57,720
SlammaJamma
SlammaJamma.sol
0x2aa1c5306f0212e23f2950ecb8464eefb169456d
Solidity
IERC165
interface IERC165 { /** * @dev Returns true if this contract implements the interface defined by * `interfaceId`. See the corresponding * https://eips.ethereum.org/EIPS/eip-165#how-interfaces-are-identified[EIP section] * to learn more about how these ids are created. * * This function call must use less than 30 000 gas. */ function supportsInterface(bytes4 interfaceId) external view returns (bool); }
/** * @dev Interface of the ERC165 standard, as defined in the * https://eips.ethereum.org/EIPS/eip-165[EIP]. * * Implementers can declare support of contract interfaces, which can then be * queried by others ({ERC165Checker}). * * For an implementation, see {ERC165}. */
NatSpecMultiLine
supportsInterface
function supportsInterface(bytes4 interfaceId) external view returns (bool);
/** * @dev Returns true if this contract implements the interface defined by * `interfaceId`. See the corresponding * https://eips.ethereum.org/EIPS/eip-165#how-interfaces-are-identified[EIP section] * to learn more about how these ids are created. * * This function call must use less than 30 000 gas. */
NatSpecMultiLine
v0.8.3+commit.8d00100c
MIT
ipfs://1f710d8bcd8966b315557e51d40efc2bd775afde93afea26f8386cf10b49aa6f
{ "func_code_index": [ 374, 455 ] }
57,721
SlammaJamma
SlammaJamma.sol
0x2aa1c5306f0212e23f2950ecb8464eefb169456d
Solidity
IERC721
interface IERC721 is IERC165 { /** * @dev Emitted when `tokenId` token is transferred from `from` to `to`. */ event Transfer(address indexed from, address indexed to, uint256 indexed tokenId); /** * @dev Emitted when `owner` enables `approved` to manage the `tokenId` token. */ event Approval(address indexed owner, address indexed approved, uint256 indexed tokenId); /** * @dev Emitted when `owner` enables or disables (`approved`) `operator` to manage all of its assets. */ event ApprovalForAll(address indexed owner, address indexed operator, bool approved); /** * @dev Returns the number of tokens in ``owner``'s account. */ function balanceOf(address owner) external view returns (uint256 balance); /** * @dev Returns the owner of the `tokenId` token. * * Requirements: * * - `tokenId` must exist. */ function ownerOf(uint256 tokenId) external view returns (address owner); /** * @dev Safely transfers `tokenId` token from `from` to `to`, checking first that contract recipients * are aware of the ERC721 protocol to prevent tokens from being forever locked. * * Requirements: * * - `from` cannot be the zero address. * - `to` cannot be the zero address. * - `tokenId` token must exist and be owned by `from`. * - If the caller is not `from`, it must be have been allowed to move this token by either {approve} or {setApprovalForAll}. * - If `to` refers to a smart contract, it must implement {IERC721Receiver-onERC721Received}, which is called upon a safe transfer. * * Emits a {Transfer} event. */ function safeTransferFrom( address from, address to, uint256 tokenId ) external; /** * @dev Transfers `tokenId` token from `from` to `to`. * * WARNING: Usage of this method is discouraged, use {safeTransferFrom} whenever possible. * * Requirements: * * - `from` cannot be the zero address. * - `to` cannot be the zero address. * - `tokenId` token must be owned by `from`. * - If the caller is not `from`, it must be approved to move this token by either {approve} or {setApprovalForAll}. * * Emits a {Transfer} event. */ function transferFrom( address from, address to, uint256 tokenId ) external; /** * @dev Gives permission to `to` to transfer `tokenId` token to another account. * The approval is cleared when the token is transferred. * * Only a single account can be approved at a time, so approving the zero address clears previous approvals. * * Requirements: * * - The caller must own the token or be an approved operator. * - `tokenId` must exist. * * Emits an {Approval} event. */ function approve(address to, uint256 tokenId) external; /** * @dev Returns the account approved for `tokenId` token. * * Requirements: * * - `tokenId` must exist. */ function getApproved(uint256 tokenId) external view returns (address operator); /** * @dev Approve or remove `operator` as an operator for the caller. * Operators can call {transferFrom} or {safeTransferFrom} for any token owned by the caller. * * Requirements: * * - The `operator` cannot be the caller. * * Emits an {ApprovalForAll} event. */ function setApprovalForAll(address operator, bool _approved) external; /** * @dev Returns if the `operator` is allowed to manage all of the assets of `owner`. * * See {setApprovalForAll} */ function isApprovedForAll(address owner, address operator) external view returns (bool); /** * @dev Safely transfers `tokenId` token from `from` to `to`. * * Requirements: * * - `from` cannot be the zero address. * - `to` cannot be the zero address. * - `tokenId` token must exist and be owned by `from`. * - If the caller is not `from`, it must be approved to move this token by either {approve} or {setApprovalForAll}. * - If `to` refers to a smart contract, it must implement {IERC721Receiver-onERC721Received}, which is called upon a safe transfer. * * Emits a {Transfer} event. */ function safeTransferFrom( address from, address to, uint256 tokenId, bytes calldata data ) external; }
/** * @dev Required interface of an ERC721 compliant contract. */
NatSpecMultiLine
balanceOf
function balanceOf(address owner) external view returns (uint256 balance);
/** * @dev Returns the number of tokens in ``owner``'s account. */
NatSpecMultiLine
v0.8.3+commit.8d00100c
MIT
ipfs://1f710d8bcd8966b315557e51d40efc2bd775afde93afea26f8386cf10b49aa6f
{ "func_code_index": [ 719, 798 ] }
57,722
SlammaJamma
SlammaJamma.sol
0x2aa1c5306f0212e23f2950ecb8464eefb169456d
Solidity
IERC721
interface IERC721 is IERC165 { /** * @dev Emitted when `tokenId` token is transferred from `from` to `to`. */ event Transfer(address indexed from, address indexed to, uint256 indexed tokenId); /** * @dev Emitted when `owner` enables `approved` to manage the `tokenId` token. */ event Approval(address indexed owner, address indexed approved, uint256 indexed tokenId); /** * @dev Emitted when `owner` enables or disables (`approved`) `operator` to manage all of its assets. */ event ApprovalForAll(address indexed owner, address indexed operator, bool approved); /** * @dev Returns the number of tokens in ``owner``'s account. */ function balanceOf(address owner) external view returns (uint256 balance); /** * @dev Returns the owner of the `tokenId` token. * * Requirements: * * - `tokenId` must exist. */ function ownerOf(uint256 tokenId) external view returns (address owner); /** * @dev Safely transfers `tokenId` token from `from` to `to`, checking first that contract recipients * are aware of the ERC721 protocol to prevent tokens from being forever locked. * * Requirements: * * - `from` cannot be the zero address. * - `to` cannot be the zero address. * - `tokenId` token must exist and be owned by `from`. * - If the caller is not `from`, it must be have been allowed to move this token by either {approve} or {setApprovalForAll}. * - If `to` refers to a smart contract, it must implement {IERC721Receiver-onERC721Received}, which is called upon a safe transfer. * * Emits a {Transfer} event. */ function safeTransferFrom( address from, address to, uint256 tokenId ) external; /** * @dev Transfers `tokenId` token from `from` to `to`. * * WARNING: Usage of this method is discouraged, use {safeTransferFrom} whenever possible. * * Requirements: * * - `from` cannot be the zero address. * - `to` cannot be the zero address. * - `tokenId` token must be owned by `from`. * - If the caller is not `from`, it must be approved to move this token by either {approve} or {setApprovalForAll}. * * Emits a {Transfer} event. */ function transferFrom( address from, address to, uint256 tokenId ) external; /** * @dev Gives permission to `to` to transfer `tokenId` token to another account. * The approval is cleared when the token is transferred. * * Only a single account can be approved at a time, so approving the zero address clears previous approvals. * * Requirements: * * - The caller must own the token or be an approved operator. * - `tokenId` must exist. * * Emits an {Approval} event. */ function approve(address to, uint256 tokenId) external; /** * @dev Returns the account approved for `tokenId` token. * * Requirements: * * - `tokenId` must exist. */ function getApproved(uint256 tokenId) external view returns (address operator); /** * @dev Approve or remove `operator` as an operator for the caller. * Operators can call {transferFrom} or {safeTransferFrom} for any token owned by the caller. * * Requirements: * * - The `operator` cannot be the caller. * * Emits an {ApprovalForAll} event. */ function setApprovalForAll(address operator, bool _approved) external; /** * @dev Returns if the `operator` is allowed to manage all of the assets of `owner`. * * See {setApprovalForAll} */ function isApprovedForAll(address owner, address operator) external view returns (bool); /** * @dev Safely transfers `tokenId` token from `from` to `to`. * * Requirements: * * - `from` cannot be the zero address. * - `to` cannot be the zero address. * - `tokenId` token must exist and be owned by `from`. * - If the caller is not `from`, it must be approved to move this token by either {approve} or {setApprovalForAll}. * - If `to` refers to a smart contract, it must implement {IERC721Receiver-onERC721Received}, which is called upon a safe transfer. * * Emits a {Transfer} event. */ function safeTransferFrom( address from, address to, uint256 tokenId, bytes calldata data ) external; }
/** * @dev Required interface of an ERC721 compliant contract. */
NatSpecMultiLine
ownerOf
function ownerOf(uint256 tokenId) external view returns (address owner);
/** * @dev Returns the owner of the `tokenId` token. * * Requirements: * * - `tokenId` must exist. */
NatSpecMultiLine
v0.8.3+commit.8d00100c
MIT
ipfs://1f710d8bcd8966b315557e51d40efc2bd775afde93afea26f8386cf10b49aa6f
{ "func_code_index": [ 944, 1021 ] }
57,723
SlammaJamma
SlammaJamma.sol
0x2aa1c5306f0212e23f2950ecb8464eefb169456d
Solidity
IERC721
interface IERC721 is IERC165 { /** * @dev Emitted when `tokenId` token is transferred from `from` to `to`. */ event Transfer(address indexed from, address indexed to, uint256 indexed tokenId); /** * @dev Emitted when `owner` enables `approved` to manage the `tokenId` token. */ event Approval(address indexed owner, address indexed approved, uint256 indexed tokenId); /** * @dev Emitted when `owner` enables or disables (`approved`) `operator` to manage all of its assets. */ event ApprovalForAll(address indexed owner, address indexed operator, bool approved); /** * @dev Returns the number of tokens in ``owner``'s account. */ function balanceOf(address owner) external view returns (uint256 balance); /** * @dev Returns the owner of the `tokenId` token. * * Requirements: * * - `tokenId` must exist. */ function ownerOf(uint256 tokenId) external view returns (address owner); /** * @dev Safely transfers `tokenId` token from `from` to `to`, checking first that contract recipients * are aware of the ERC721 protocol to prevent tokens from being forever locked. * * Requirements: * * - `from` cannot be the zero address. * - `to` cannot be the zero address. * - `tokenId` token must exist and be owned by `from`. * - If the caller is not `from`, it must be have been allowed to move this token by either {approve} or {setApprovalForAll}. * - If `to` refers to a smart contract, it must implement {IERC721Receiver-onERC721Received}, which is called upon a safe transfer. * * Emits a {Transfer} event. */ function safeTransferFrom( address from, address to, uint256 tokenId ) external; /** * @dev Transfers `tokenId` token from `from` to `to`. * * WARNING: Usage of this method is discouraged, use {safeTransferFrom} whenever possible. * * Requirements: * * - `from` cannot be the zero address. * - `to` cannot be the zero address. * - `tokenId` token must be owned by `from`. * - If the caller is not `from`, it must be approved to move this token by either {approve} or {setApprovalForAll}. * * Emits a {Transfer} event. */ function transferFrom( address from, address to, uint256 tokenId ) external; /** * @dev Gives permission to `to` to transfer `tokenId` token to another account. * The approval is cleared when the token is transferred. * * Only a single account can be approved at a time, so approving the zero address clears previous approvals. * * Requirements: * * - The caller must own the token or be an approved operator. * - `tokenId` must exist. * * Emits an {Approval} event. */ function approve(address to, uint256 tokenId) external; /** * @dev Returns the account approved for `tokenId` token. * * Requirements: * * - `tokenId` must exist. */ function getApproved(uint256 tokenId) external view returns (address operator); /** * @dev Approve or remove `operator` as an operator for the caller. * Operators can call {transferFrom} or {safeTransferFrom} for any token owned by the caller. * * Requirements: * * - The `operator` cannot be the caller. * * Emits an {ApprovalForAll} event. */ function setApprovalForAll(address operator, bool _approved) external; /** * @dev Returns if the `operator` is allowed to manage all of the assets of `owner`. * * See {setApprovalForAll} */ function isApprovedForAll(address owner, address operator) external view returns (bool); /** * @dev Safely transfers `tokenId` token from `from` to `to`. * * Requirements: * * - `from` cannot be the zero address. * - `to` cannot be the zero address. * - `tokenId` token must exist and be owned by `from`. * - If the caller is not `from`, it must be approved to move this token by either {approve} or {setApprovalForAll}. * - If `to` refers to a smart contract, it must implement {IERC721Receiver-onERC721Received}, which is called upon a safe transfer. * * Emits a {Transfer} event. */ function safeTransferFrom( address from, address to, uint256 tokenId, bytes calldata data ) external; }
/** * @dev Required interface of an ERC721 compliant contract. */
NatSpecMultiLine
safeTransferFrom
function safeTransferFrom( address from, address to, uint256 tokenId ) external;
/** * @dev Safely transfers `tokenId` token from `from` to `to`, checking first that contract recipients * are aware of the ERC721 protocol to prevent tokens from being forever locked. * * Requirements: * * - `from` cannot be the zero address. * - `to` cannot be the zero address. * - `tokenId` token must exist and be owned by `from`. * - If the caller is not `from`, it must be have been allowed to move this token by either {approve} or {setApprovalForAll}. * - If `to` refers to a smart contract, it must implement {IERC721Receiver-onERC721Received}, which is called upon a safe transfer. * * Emits a {Transfer} event. */
NatSpecMultiLine
v0.8.3+commit.8d00100c
MIT
ipfs://1f710d8bcd8966b315557e51d40efc2bd775afde93afea26f8386cf10b49aa6f
{ "func_code_index": [ 1733, 1850 ] }
57,724
SlammaJamma
SlammaJamma.sol
0x2aa1c5306f0212e23f2950ecb8464eefb169456d
Solidity
IERC721
interface IERC721 is IERC165 { /** * @dev Emitted when `tokenId` token is transferred from `from` to `to`. */ event Transfer(address indexed from, address indexed to, uint256 indexed tokenId); /** * @dev Emitted when `owner` enables `approved` to manage the `tokenId` token. */ event Approval(address indexed owner, address indexed approved, uint256 indexed tokenId); /** * @dev Emitted when `owner` enables or disables (`approved`) `operator` to manage all of its assets. */ event ApprovalForAll(address indexed owner, address indexed operator, bool approved); /** * @dev Returns the number of tokens in ``owner``'s account. */ function balanceOf(address owner) external view returns (uint256 balance); /** * @dev Returns the owner of the `tokenId` token. * * Requirements: * * - `tokenId` must exist. */ function ownerOf(uint256 tokenId) external view returns (address owner); /** * @dev Safely transfers `tokenId` token from `from` to `to`, checking first that contract recipients * are aware of the ERC721 protocol to prevent tokens from being forever locked. * * Requirements: * * - `from` cannot be the zero address. * - `to` cannot be the zero address. * - `tokenId` token must exist and be owned by `from`. * - If the caller is not `from`, it must be have been allowed to move this token by either {approve} or {setApprovalForAll}. * - If `to` refers to a smart contract, it must implement {IERC721Receiver-onERC721Received}, which is called upon a safe transfer. * * Emits a {Transfer} event. */ function safeTransferFrom( address from, address to, uint256 tokenId ) external; /** * @dev Transfers `tokenId` token from `from` to `to`. * * WARNING: Usage of this method is discouraged, use {safeTransferFrom} whenever possible. * * Requirements: * * - `from` cannot be the zero address. * - `to` cannot be the zero address. * - `tokenId` token must be owned by `from`. * - If the caller is not `from`, it must be approved to move this token by either {approve} or {setApprovalForAll}. * * Emits a {Transfer} event. */ function transferFrom( address from, address to, uint256 tokenId ) external; /** * @dev Gives permission to `to` to transfer `tokenId` token to another account. * The approval is cleared when the token is transferred. * * Only a single account can be approved at a time, so approving the zero address clears previous approvals. * * Requirements: * * - The caller must own the token or be an approved operator. * - `tokenId` must exist. * * Emits an {Approval} event. */ function approve(address to, uint256 tokenId) external; /** * @dev Returns the account approved for `tokenId` token. * * Requirements: * * - `tokenId` must exist. */ function getApproved(uint256 tokenId) external view returns (address operator); /** * @dev Approve or remove `operator` as an operator for the caller. * Operators can call {transferFrom} or {safeTransferFrom} for any token owned by the caller. * * Requirements: * * - The `operator` cannot be the caller. * * Emits an {ApprovalForAll} event. */ function setApprovalForAll(address operator, bool _approved) external; /** * @dev Returns if the `operator` is allowed to manage all of the assets of `owner`. * * See {setApprovalForAll} */ function isApprovedForAll(address owner, address operator) external view returns (bool); /** * @dev Safely transfers `tokenId` token from `from` to `to`. * * Requirements: * * - `from` cannot be the zero address. * - `to` cannot be the zero address. * - `tokenId` token must exist and be owned by `from`. * - If the caller is not `from`, it must be approved to move this token by either {approve} or {setApprovalForAll}. * - If `to` refers to a smart contract, it must implement {IERC721Receiver-onERC721Received}, which is called upon a safe transfer. * * Emits a {Transfer} event. */ function safeTransferFrom( address from, address to, uint256 tokenId, bytes calldata data ) external; }
/** * @dev Required interface of an ERC721 compliant contract. */
NatSpecMultiLine
transferFrom
function transferFrom( address from, address to, uint256 tokenId ) external;
/** * @dev Transfers `tokenId` token from `from` to `to`. * * WARNING: Usage of this method is discouraged, use {safeTransferFrom} whenever possible. * * Requirements: * * - `from` cannot be the zero address. * - `to` cannot be the zero address. * - `tokenId` token must be owned by `from`. * - If the caller is not `from`, it must be approved to move this token by either {approve} or {setApprovalForAll}. * * Emits a {Transfer} event. */
NatSpecMultiLine
v0.8.3+commit.8d00100c
MIT
ipfs://1f710d8bcd8966b315557e51d40efc2bd775afde93afea26f8386cf10b49aa6f
{ "func_code_index": [ 2376, 2489 ] }
57,725
SlammaJamma
SlammaJamma.sol
0x2aa1c5306f0212e23f2950ecb8464eefb169456d
Solidity
IERC721
interface IERC721 is IERC165 { /** * @dev Emitted when `tokenId` token is transferred from `from` to `to`. */ event Transfer(address indexed from, address indexed to, uint256 indexed tokenId); /** * @dev Emitted when `owner` enables `approved` to manage the `tokenId` token. */ event Approval(address indexed owner, address indexed approved, uint256 indexed tokenId); /** * @dev Emitted when `owner` enables or disables (`approved`) `operator` to manage all of its assets. */ event ApprovalForAll(address indexed owner, address indexed operator, bool approved); /** * @dev Returns the number of tokens in ``owner``'s account. */ function balanceOf(address owner) external view returns (uint256 balance); /** * @dev Returns the owner of the `tokenId` token. * * Requirements: * * - `tokenId` must exist. */ function ownerOf(uint256 tokenId) external view returns (address owner); /** * @dev Safely transfers `tokenId` token from `from` to `to`, checking first that contract recipients * are aware of the ERC721 protocol to prevent tokens from being forever locked. * * Requirements: * * - `from` cannot be the zero address. * - `to` cannot be the zero address. * - `tokenId` token must exist and be owned by `from`. * - If the caller is not `from`, it must be have been allowed to move this token by either {approve} or {setApprovalForAll}. * - If `to` refers to a smart contract, it must implement {IERC721Receiver-onERC721Received}, which is called upon a safe transfer. * * Emits a {Transfer} event. */ function safeTransferFrom( address from, address to, uint256 tokenId ) external; /** * @dev Transfers `tokenId` token from `from` to `to`. * * WARNING: Usage of this method is discouraged, use {safeTransferFrom} whenever possible. * * Requirements: * * - `from` cannot be the zero address. * - `to` cannot be the zero address. * - `tokenId` token must be owned by `from`. * - If the caller is not `from`, it must be approved to move this token by either {approve} or {setApprovalForAll}. * * Emits a {Transfer} event. */ function transferFrom( address from, address to, uint256 tokenId ) external; /** * @dev Gives permission to `to` to transfer `tokenId` token to another account. * The approval is cleared when the token is transferred. * * Only a single account can be approved at a time, so approving the zero address clears previous approvals. * * Requirements: * * - The caller must own the token or be an approved operator. * - `tokenId` must exist. * * Emits an {Approval} event. */ function approve(address to, uint256 tokenId) external; /** * @dev Returns the account approved for `tokenId` token. * * Requirements: * * - `tokenId` must exist. */ function getApproved(uint256 tokenId) external view returns (address operator); /** * @dev Approve or remove `operator` as an operator for the caller. * Operators can call {transferFrom} or {safeTransferFrom} for any token owned by the caller. * * Requirements: * * - The `operator` cannot be the caller. * * Emits an {ApprovalForAll} event. */ function setApprovalForAll(address operator, bool _approved) external; /** * @dev Returns if the `operator` is allowed to manage all of the assets of `owner`. * * See {setApprovalForAll} */ function isApprovedForAll(address owner, address operator) external view returns (bool); /** * @dev Safely transfers `tokenId` token from `from` to `to`. * * Requirements: * * - `from` cannot be the zero address. * - `to` cannot be the zero address. * - `tokenId` token must exist and be owned by `from`. * - If the caller is not `from`, it must be approved to move this token by either {approve} or {setApprovalForAll}. * - If `to` refers to a smart contract, it must implement {IERC721Receiver-onERC721Received}, which is called upon a safe transfer. * * Emits a {Transfer} event. */ function safeTransferFrom( address from, address to, uint256 tokenId, bytes calldata data ) external; }
/** * @dev Required interface of an ERC721 compliant contract. */
NatSpecMultiLine
approve
function approve(address to, uint256 tokenId) external;
/** * @dev Gives permission to `to` to transfer `tokenId` token to another account. * The approval is cleared when the token is transferred. * * Only a single account can be approved at a time, so approving the zero address clears previous approvals. * * Requirements: * * - The caller must own the token or be an approved operator. * - `tokenId` must exist. * * Emits an {Approval} event. */
NatSpecMultiLine
v0.8.3+commit.8d00100c
MIT
ipfs://1f710d8bcd8966b315557e51d40efc2bd775afde93afea26f8386cf10b49aa6f
{ "func_code_index": [ 2962, 3022 ] }
57,726
SlammaJamma
SlammaJamma.sol
0x2aa1c5306f0212e23f2950ecb8464eefb169456d
Solidity
IERC721
interface IERC721 is IERC165 { /** * @dev Emitted when `tokenId` token is transferred from `from` to `to`. */ event Transfer(address indexed from, address indexed to, uint256 indexed tokenId); /** * @dev Emitted when `owner` enables `approved` to manage the `tokenId` token. */ event Approval(address indexed owner, address indexed approved, uint256 indexed tokenId); /** * @dev Emitted when `owner` enables or disables (`approved`) `operator` to manage all of its assets. */ event ApprovalForAll(address indexed owner, address indexed operator, bool approved); /** * @dev Returns the number of tokens in ``owner``'s account. */ function balanceOf(address owner) external view returns (uint256 balance); /** * @dev Returns the owner of the `tokenId` token. * * Requirements: * * - `tokenId` must exist. */ function ownerOf(uint256 tokenId) external view returns (address owner); /** * @dev Safely transfers `tokenId` token from `from` to `to`, checking first that contract recipients * are aware of the ERC721 protocol to prevent tokens from being forever locked. * * Requirements: * * - `from` cannot be the zero address. * - `to` cannot be the zero address. * - `tokenId` token must exist and be owned by `from`. * - If the caller is not `from`, it must be have been allowed to move this token by either {approve} or {setApprovalForAll}. * - If `to` refers to a smart contract, it must implement {IERC721Receiver-onERC721Received}, which is called upon a safe transfer. * * Emits a {Transfer} event. */ function safeTransferFrom( address from, address to, uint256 tokenId ) external; /** * @dev Transfers `tokenId` token from `from` to `to`. * * WARNING: Usage of this method is discouraged, use {safeTransferFrom} whenever possible. * * Requirements: * * - `from` cannot be the zero address. * - `to` cannot be the zero address. * - `tokenId` token must be owned by `from`. * - If the caller is not `from`, it must be approved to move this token by either {approve} or {setApprovalForAll}. * * Emits a {Transfer} event. */ function transferFrom( address from, address to, uint256 tokenId ) external; /** * @dev Gives permission to `to` to transfer `tokenId` token to another account. * The approval is cleared when the token is transferred. * * Only a single account can be approved at a time, so approving the zero address clears previous approvals. * * Requirements: * * - The caller must own the token or be an approved operator. * - `tokenId` must exist. * * Emits an {Approval} event. */ function approve(address to, uint256 tokenId) external; /** * @dev Returns the account approved for `tokenId` token. * * Requirements: * * - `tokenId` must exist. */ function getApproved(uint256 tokenId) external view returns (address operator); /** * @dev Approve or remove `operator` as an operator for the caller. * Operators can call {transferFrom} or {safeTransferFrom} for any token owned by the caller. * * Requirements: * * - The `operator` cannot be the caller. * * Emits an {ApprovalForAll} event. */ function setApprovalForAll(address operator, bool _approved) external; /** * @dev Returns if the `operator` is allowed to manage all of the assets of `owner`. * * See {setApprovalForAll} */ function isApprovedForAll(address owner, address operator) external view returns (bool); /** * @dev Safely transfers `tokenId` token from `from` to `to`. * * Requirements: * * - `from` cannot be the zero address. * - `to` cannot be the zero address. * - `tokenId` token must exist and be owned by `from`. * - If the caller is not `from`, it must be approved to move this token by either {approve} or {setApprovalForAll}. * - If `to` refers to a smart contract, it must implement {IERC721Receiver-onERC721Received}, which is called upon a safe transfer. * * Emits a {Transfer} event. */ function safeTransferFrom( address from, address to, uint256 tokenId, bytes calldata data ) external; }
/** * @dev Required interface of an ERC721 compliant contract. */
NatSpecMultiLine
getApproved
function getApproved(uint256 tokenId) external view returns (address operator);
/** * @dev Returns the account approved for `tokenId` token. * * Requirements: * * - `tokenId` must exist. */
NatSpecMultiLine
v0.8.3+commit.8d00100c
MIT
ipfs://1f710d8bcd8966b315557e51d40efc2bd775afde93afea26f8386cf10b49aa6f
{ "func_code_index": [ 3176, 3260 ] }
57,727
SlammaJamma
SlammaJamma.sol
0x2aa1c5306f0212e23f2950ecb8464eefb169456d
Solidity
IERC721
interface IERC721 is IERC165 { /** * @dev Emitted when `tokenId` token is transferred from `from` to `to`. */ event Transfer(address indexed from, address indexed to, uint256 indexed tokenId); /** * @dev Emitted when `owner` enables `approved` to manage the `tokenId` token. */ event Approval(address indexed owner, address indexed approved, uint256 indexed tokenId); /** * @dev Emitted when `owner` enables or disables (`approved`) `operator` to manage all of its assets. */ event ApprovalForAll(address indexed owner, address indexed operator, bool approved); /** * @dev Returns the number of tokens in ``owner``'s account. */ function balanceOf(address owner) external view returns (uint256 balance); /** * @dev Returns the owner of the `tokenId` token. * * Requirements: * * - `tokenId` must exist. */ function ownerOf(uint256 tokenId) external view returns (address owner); /** * @dev Safely transfers `tokenId` token from `from` to `to`, checking first that contract recipients * are aware of the ERC721 protocol to prevent tokens from being forever locked. * * Requirements: * * - `from` cannot be the zero address. * - `to` cannot be the zero address. * - `tokenId` token must exist and be owned by `from`. * - If the caller is not `from`, it must be have been allowed to move this token by either {approve} or {setApprovalForAll}. * - If `to` refers to a smart contract, it must implement {IERC721Receiver-onERC721Received}, which is called upon a safe transfer. * * Emits a {Transfer} event. */ function safeTransferFrom( address from, address to, uint256 tokenId ) external; /** * @dev Transfers `tokenId` token from `from` to `to`. * * WARNING: Usage of this method is discouraged, use {safeTransferFrom} whenever possible. * * Requirements: * * - `from` cannot be the zero address. * - `to` cannot be the zero address. * - `tokenId` token must be owned by `from`. * - If the caller is not `from`, it must be approved to move this token by either {approve} or {setApprovalForAll}. * * Emits a {Transfer} event. */ function transferFrom( address from, address to, uint256 tokenId ) external; /** * @dev Gives permission to `to` to transfer `tokenId` token to another account. * The approval is cleared when the token is transferred. * * Only a single account can be approved at a time, so approving the zero address clears previous approvals. * * Requirements: * * - The caller must own the token or be an approved operator. * - `tokenId` must exist. * * Emits an {Approval} event. */ function approve(address to, uint256 tokenId) external; /** * @dev Returns the account approved for `tokenId` token. * * Requirements: * * - `tokenId` must exist. */ function getApproved(uint256 tokenId) external view returns (address operator); /** * @dev Approve or remove `operator` as an operator for the caller. * Operators can call {transferFrom} or {safeTransferFrom} for any token owned by the caller. * * Requirements: * * - The `operator` cannot be the caller. * * Emits an {ApprovalForAll} event. */ function setApprovalForAll(address operator, bool _approved) external; /** * @dev Returns if the `operator` is allowed to manage all of the assets of `owner`. * * See {setApprovalForAll} */ function isApprovedForAll(address owner, address operator) external view returns (bool); /** * @dev Safely transfers `tokenId` token from `from` to `to`. * * Requirements: * * - `from` cannot be the zero address. * - `to` cannot be the zero address. * - `tokenId` token must exist and be owned by `from`. * - If the caller is not `from`, it must be approved to move this token by either {approve} or {setApprovalForAll}. * - If `to` refers to a smart contract, it must implement {IERC721Receiver-onERC721Received}, which is called upon a safe transfer. * * Emits a {Transfer} event. */ function safeTransferFrom( address from, address to, uint256 tokenId, bytes calldata data ) external; }
/** * @dev Required interface of an ERC721 compliant contract. */
NatSpecMultiLine
setApprovalForAll
function setApprovalForAll(address operator, bool _approved) external;
/** * @dev Approve or remove `operator` as an operator for the caller. * Operators can call {transferFrom} or {safeTransferFrom} for any token owned by the caller. * * Requirements: * * - The `operator` cannot be the caller. * * Emits an {ApprovalForAll} event. */
NatSpecMultiLine
v0.8.3+commit.8d00100c
MIT
ipfs://1f710d8bcd8966b315557e51d40efc2bd775afde93afea26f8386cf10b49aa6f
{ "func_code_index": [ 3587, 3662 ] }
57,728
SlammaJamma
SlammaJamma.sol
0x2aa1c5306f0212e23f2950ecb8464eefb169456d
Solidity
IERC721
interface IERC721 is IERC165 { /** * @dev Emitted when `tokenId` token is transferred from `from` to `to`. */ event Transfer(address indexed from, address indexed to, uint256 indexed tokenId); /** * @dev Emitted when `owner` enables `approved` to manage the `tokenId` token. */ event Approval(address indexed owner, address indexed approved, uint256 indexed tokenId); /** * @dev Emitted when `owner` enables or disables (`approved`) `operator` to manage all of its assets. */ event ApprovalForAll(address indexed owner, address indexed operator, bool approved); /** * @dev Returns the number of tokens in ``owner``'s account. */ function balanceOf(address owner) external view returns (uint256 balance); /** * @dev Returns the owner of the `tokenId` token. * * Requirements: * * - `tokenId` must exist. */ function ownerOf(uint256 tokenId) external view returns (address owner); /** * @dev Safely transfers `tokenId` token from `from` to `to`, checking first that contract recipients * are aware of the ERC721 protocol to prevent tokens from being forever locked. * * Requirements: * * - `from` cannot be the zero address. * - `to` cannot be the zero address. * - `tokenId` token must exist and be owned by `from`. * - If the caller is not `from`, it must be have been allowed to move this token by either {approve} or {setApprovalForAll}. * - If `to` refers to a smart contract, it must implement {IERC721Receiver-onERC721Received}, which is called upon a safe transfer. * * Emits a {Transfer} event. */ function safeTransferFrom( address from, address to, uint256 tokenId ) external; /** * @dev Transfers `tokenId` token from `from` to `to`. * * WARNING: Usage of this method is discouraged, use {safeTransferFrom} whenever possible. * * Requirements: * * - `from` cannot be the zero address. * - `to` cannot be the zero address. * - `tokenId` token must be owned by `from`. * - If the caller is not `from`, it must be approved to move this token by either {approve} or {setApprovalForAll}. * * Emits a {Transfer} event. */ function transferFrom( address from, address to, uint256 tokenId ) external; /** * @dev Gives permission to `to` to transfer `tokenId` token to another account. * The approval is cleared when the token is transferred. * * Only a single account can be approved at a time, so approving the zero address clears previous approvals. * * Requirements: * * - The caller must own the token or be an approved operator. * - `tokenId` must exist. * * Emits an {Approval} event. */ function approve(address to, uint256 tokenId) external; /** * @dev Returns the account approved for `tokenId` token. * * Requirements: * * - `tokenId` must exist. */ function getApproved(uint256 tokenId) external view returns (address operator); /** * @dev Approve or remove `operator` as an operator for the caller. * Operators can call {transferFrom} or {safeTransferFrom} for any token owned by the caller. * * Requirements: * * - The `operator` cannot be the caller. * * Emits an {ApprovalForAll} event. */ function setApprovalForAll(address operator, bool _approved) external; /** * @dev Returns if the `operator` is allowed to manage all of the assets of `owner`. * * See {setApprovalForAll} */ function isApprovedForAll(address owner, address operator) external view returns (bool); /** * @dev Safely transfers `tokenId` token from `from` to `to`. * * Requirements: * * - `from` cannot be the zero address. * - `to` cannot be the zero address. * - `tokenId` token must exist and be owned by `from`. * - If the caller is not `from`, it must be approved to move this token by either {approve} or {setApprovalForAll}. * - If `to` refers to a smart contract, it must implement {IERC721Receiver-onERC721Received}, which is called upon a safe transfer. * * Emits a {Transfer} event. */ function safeTransferFrom( address from, address to, uint256 tokenId, bytes calldata data ) external; }
/** * @dev Required interface of an ERC721 compliant contract. */
NatSpecMultiLine
isApprovedForAll
function isApprovedForAll(address owner, address operator) external view returns (bool);
/** * @dev Returns if the `operator` is allowed to manage all of the assets of `owner`. * * See {setApprovalForAll} */
NatSpecMultiLine
v0.8.3+commit.8d00100c
MIT
ipfs://1f710d8bcd8966b315557e51d40efc2bd775afde93afea26f8386cf10b49aa6f
{ "func_code_index": [ 3813, 3906 ] }
57,729
SlammaJamma
SlammaJamma.sol
0x2aa1c5306f0212e23f2950ecb8464eefb169456d
Solidity
IERC721
interface IERC721 is IERC165 { /** * @dev Emitted when `tokenId` token is transferred from `from` to `to`. */ event Transfer(address indexed from, address indexed to, uint256 indexed tokenId); /** * @dev Emitted when `owner` enables `approved` to manage the `tokenId` token. */ event Approval(address indexed owner, address indexed approved, uint256 indexed tokenId); /** * @dev Emitted when `owner` enables or disables (`approved`) `operator` to manage all of its assets. */ event ApprovalForAll(address indexed owner, address indexed operator, bool approved); /** * @dev Returns the number of tokens in ``owner``'s account. */ function balanceOf(address owner) external view returns (uint256 balance); /** * @dev Returns the owner of the `tokenId` token. * * Requirements: * * - `tokenId` must exist. */ function ownerOf(uint256 tokenId) external view returns (address owner); /** * @dev Safely transfers `tokenId` token from `from` to `to`, checking first that contract recipients * are aware of the ERC721 protocol to prevent tokens from being forever locked. * * Requirements: * * - `from` cannot be the zero address. * - `to` cannot be the zero address. * - `tokenId` token must exist and be owned by `from`. * - If the caller is not `from`, it must be have been allowed to move this token by either {approve} or {setApprovalForAll}. * - If `to` refers to a smart contract, it must implement {IERC721Receiver-onERC721Received}, which is called upon a safe transfer. * * Emits a {Transfer} event. */ function safeTransferFrom( address from, address to, uint256 tokenId ) external; /** * @dev Transfers `tokenId` token from `from` to `to`. * * WARNING: Usage of this method is discouraged, use {safeTransferFrom} whenever possible. * * Requirements: * * - `from` cannot be the zero address. * - `to` cannot be the zero address. * - `tokenId` token must be owned by `from`. * - If the caller is not `from`, it must be approved to move this token by either {approve} or {setApprovalForAll}. * * Emits a {Transfer} event. */ function transferFrom( address from, address to, uint256 tokenId ) external; /** * @dev Gives permission to `to` to transfer `tokenId` token to another account. * The approval is cleared when the token is transferred. * * Only a single account can be approved at a time, so approving the zero address clears previous approvals. * * Requirements: * * - The caller must own the token or be an approved operator. * - `tokenId` must exist. * * Emits an {Approval} event. */ function approve(address to, uint256 tokenId) external; /** * @dev Returns the account approved for `tokenId` token. * * Requirements: * * - `tokenId` must exist. */ function getApproved(uint256 tokenId) external view returns (address operator); /** * @dev Approve or remove `operator` as an operator for the caller. * Operators can call {transferFrom} or {safeTransferFrom} for any token owned by the caller. * * Requirements: * * - The `operator` cannot be the caller. * * Emits an {ApprovalForAll} event. */ function setApprovalForAll(address operator, bool _approved) external; /** * @dev Returns if the `operator` is allowed to manage all of the assets of `owner`. * * See {setApprovalForAll} */ function isApprovedForAll(address owner, address operator) external view returns (bool); /** * @dev Safely transfers `tokenId` token from `from` to `to`. * * Requirements: * * - `from` cannot be the zero address. * - `to` cannot be the zero address. * - `tokenId` token must exist and be owned by `from`. * - If the caller is not `from`, it must be approved to move this token by either {approve} or {setApprovalForAll}. * - If `to` refers to a smart contract, it must implement {IERC721Receiver-onERC721Received}, which is called upon a safe transfer. * * Emits a {Transfer} event. */ function safeTransferFrom( address from, address to, uint256 tokenId, bytes calldata data ) external; }
/** * @dev Required interface of an ERC721 compliant contract. */
NatSpecMultiLine
safeTransferFrom
function safeTransferFrom( address from, address to, uint256 tokenId, bytes calldata data ) external;
/** * @dev Safely transfers `tokenId` token from `from` to `to`. * * Requirements: * * - `from` cannot be the zero address. * - `to` cannot be the zero address. * - `tokenId` token must exist and be owned by `from`. * - If the caller is not `from`, it must be approved to move this token by either {approve} or {setApprovalForAll}. * - If `to` refers to a smart contract, it must implement {IERC721Receiver-onERC721Received}, which is called upon a safe transfer. * * Emits a {Transfer} event. */
NatSpecMultiLine
v0.8.3+commit.8d00100c
MIT
ipfs://1f710d8bcd8966b315557e51d40efc2bd775afde93afea26f8386cf10b49aa6f
{ "func_code_index": [ 4483, 4630 ] }
57,730
SlammaJamma
SlammaJamma.sol
0x2aa1c5306f0212e23f2950ecb8464eefb169456d
Solidity
Strings
library Strings { bytes16 private constant _HEX_SYMBOLS = "0123456789abcdef"; /** * @dev Converts a `uint256` to its ASCII `string` decimal representation. */ function toString(uint256 value) internal pure returns (string memory) { // Inspired by OraclizeAPI's implementation - MIT licence // https://github.com/oraclize/ethereum-api/blob/b42146b063c7d6ee1358846c198246239e9360e8/oraclizeAPI_0.4.25.sol if (value == 0) { return "0"; } uint256 temp = value; uint256 digits; while (temp != 0) { digits++; temp /= 10; } bytes memory buffer = new bytes(digits); while (value != 0) { digits -= 1; buffer[digits] = bytes1(uint8(48 + uint256(value % 10))); value /= 10; } return string(buffer); } /** * @dev Converts a `uint256` to its ASCII `string` hexadecimal representation. */ function toHexString(uint256 value) internal pure returns (string memory) { if (value == 0) { return "0x00"; } uint256 temp = value; uint256 length = 0; while (temp != 0) { length++; temp >>= 8; } return toHexString(value, length); } /** * @dev Converts a `uint256` to its ASCII `string` hexadecimal representation with fixed length. */ function toHexString(uint256 value, uint256 length) internal pure returns (string memory) { bytes memory buffer = new bytes(2 * length + 2); buffer[0] = "0"; buffer[1] = "x"; for (uint256 i = 2 * length + 1; i > 1; --i) { buffer[i] = _HEX_SYMBOLS[value & 0xf]; value >>= 4; } require(value == 0, "Strings: hex length insufficient"); return string(buffer); } }
/** * @dev String operations. */
NatSpecMultiLine
toString
function toString(uint256 value) internal pure returns (string memory) { // Inspired by OraclizeAPI's implementation - MIT licence // https://github.com/oraclize/ethereum-api/blob/b42146b063c7d6ee1358846c198246239e9360e8/oraclizeAPI_0.4.25.sol if (value == 0) { return "0"; } uint256 temp = value; uint256 digits; while (temp != 0) { digits++; temp /= 10; } bytes memory buffer = new bytes(digits); while (value != 0) { digits -= 1; buffer[digits] = bytes1(uint8(48 + uint256(value % 10))); value /= 10; } return string(buffer); }
/** * @dev Converts a `uint256` to its ASCII `string` decimal representation. */
NatSpecMultiLine
v0.8.3+commit.8d00100c
MIT
ipfs://1f710d8bcd8966b315557e51d40efc2bd775afde93afea26f8386cf10b49aa6f
{ "func_code_index": [ 184, 912 ] }
57,731
SlammaJamma
SlammaJamma.sol
0x2aa1c5306f0212e23f2950ecb8464eefb169456d
Solidity
Strings
library Strings { bytes16 private constant _HEX_SYMBOLS = "0123456789abcdef"; /** * @dev Converts a `uint256` to its ASCII `string` decimal representation. */ function toString(uint256 value) internal pure returns (string memory) { // Inspired by OraclizeAPI's implementation - MIT licence // https://github.com/oraclize/ethereum-api/blob/b42146b063c7d6ee1358846c198246239e9360e8/oraclizeAPI_0.4.25.sol if (value == 0) { return "0"; } uint256 temp = value; uint256 digits; while (temp != 0) { digits++; temp /= 10; } bytes memory buffer = new bytes(digits); while (value != 0) { digits -= 1; buffer[digits] = bytes1(uint8(48 + uint256(value % 10))); value /= 10; } return string(buffer); } /** * @dev Converts a `uint256` to its ASCII `string` hexadecimal representation. */ function toHexString(uint256 value) internal pure returns (string memory) { if (value == 0) { return "0x00"; } uint256 temp = value; uint256 length = 0; while (temp != 0) { length++; temp >>= 8; } return toHexString(value, length); } /** * @dev Converts a `uint256` to its ASCII `string` hexadecimal representation with fixed length. */ function toHexString(uint256 value, uint256 length) internal pure returns (string memory) { bytes memory buffer = new bytes(2 * length + 2); buffer[0] = "0"; buffer[1] = "x"; for (uint256 i = 2 * length + 1; i > 1; --i) { buffer[i] = _HEX_SYMBOLS[value & 0xf]; value >>= 4; } require(value == 0, "Strings: hex length insufficient"); return string(buffer); } }
/** * @dev String operations. */
NatSpecMultiLine
toHexString
function toHexString(uint256 value) internal pure returns (string memory) { if (value == 0) { return "0x00"; } uint256 temp = value; uint256 length = 0; while (temp != 0) { length++; temp >>= 8; } return toHexString(value, length); }
/** * @dev Converts a `uint256` to its ASCII `string` hexadecimal representation. */
NatSpecMultiLine
v0.8.3+commit.8d00100c
MIT
ipfs://1f710d8bcd8966b315557e51d40efc2bd775afde93afea26f8386cf10b49aa6f
{ "func_code_index": [ 1017, 1362 ] }
57,732
SlammaJamma
SlammaJamma.sol
0x2aa1c5306f0212e23f2950ecb8464eefb169456d
Solidity
Strings
library Strings { bytes16 private constant _HEX_SYMBOLS = "0123456789abcdef"; /** * @dev Converts a `uint256` to its ASCII `string` decimal representation. */ function toString(uint256 value) internal pure returns (string memory) { // Inspired by OraclizeAPI's implementation - MIT licence // https://github.com/oraclize/ethereum-api/blob/b42146b063c7d6ee1358846c198246239e9360e8/oraclizeAPI_0.4.25.sol if (value == 0) { return "0"; } uint256 temp = value; uint256 digits; while (temp != 0) { digits++; temp /= 10; } bytes memory buffer = new bytes(digits); while (value != 0) { digits -= 1; buffer[digits] = bytes1(uint8(48 + uint256(value % 10))); value /= 10; } return string(buffer); } /** * @dev Converts a `uint256` to its ASCII `string` hexadecimal representation. */ function toHexString(uint256 value) internal pure returns (string memory) { if (value == 0) { return "0x00"; } uint256 temp = value; uint256 length = 0; while (temp != 0) { length++; temp >>= 8; } return toHexString(value, length); } /** * @dev Converts a `uint256` to its ASCII `string` hexadecimal representation with fixed length. */ function toHexString(uint256 value, uint256 length) internal pure returns (string memory) { bytes memory buffer = new bytes(2 * length + 2); buffer[0] = "0"; buffer[1] = "x"; for (uint256 i = 2 * length + 1; i > 1; --i) { buffer[i] = _HEX_SYMBOLS[value & 0xf]; value >>= 4; } require(value == 0, "Strings: hex length insufficient"); return string(buffer); } }
/** * @dev String operations. */
NatSpecMultiLine
toHexString
function toHexString(uint256 value, uint256 length) internal pure returns (string memory) { bytes memory buffer = new bytes(2 * length + 2); buffer[0] = "0"; buffer[1] = "x"; for (uint256 i = 2 * length + 1; i > 1; --i) { buffer[i] = _HEX_SYMBOLS[value & 0xf]; value >>= 4; } require(value == 0, "Strings: hex length insufficient"); return string(buffer); }
/** * @dev Converts a `uint256` to its ASCII `string` hexadecimal representation with fixed length. */
NatSpecMultiLine
v0.8.3+commit.8d00100c
MIT
ipfs://1f710d8bcd8966b315557e51d40efc2bd775afde93afea26f8386cf10b49aa6f
{ "func_code_index": [ 1485, 1941 ] }
57,733
SlammaJamma
SlammaJamma.sol
0x2aa1c5306f0212e23f2950ecb8464eefb169456d
Solidity
IERC721Receiver
interface IERC721Receiver { /** * @dev Whenever an {IERC721} `tokenId` token is transferred to this contract via {IERC721-safeTransferFrom} * by `operator` from `from`, this function is called. * * It must return its Solidity selector to confirm the token transfer. * If any other value is returned or the interface is not implemented by the recipient, the transfer will be reverted. * * The selector can be obtained in Solidity with `IERC721.onERC721Received.selector`. */ function onERC721Received( address operator, address from, uint256 tokenId, bytes calldata data ) external returns (bytes4); }
/** * @title ERC721 token receiver interface * @dev Interface for any contract that wants to support safeTransfers * from ERC721 asset contracts. */
NatSpecMultiLine
onERC721Received
function onERC721Received( address operator, address from, uint256 tokenId, bytes calldata data ) external returns (bytes4);
/** * @dev Whenever an {IERC721} `tokenId` token is transferred to this contract via {IERC721-safeTransferFrom} * by `operator` from `from`, this function is called. * * It must return its Solidity selector to confirm the token transfer. * If any other value is returned or the interface is not implemented by the recipient, the transfer will be reverted. * * The selector can be obtained in Solidity with `IERC721.onERC721Received.selector`. */
NatSpecMultiLine
v0.8.3+commit.8d00100c
MIT
ipfs://1f710d8bcd8966b315557e51d40efc2bd775afde93afea26f8386cf10b49aa6f
{ "func_code_index": [ 528, 698 ] }
57,734
SlammaJamma
SlammaJamma.sol
0x2aa1c5306f0212e23f2950ecb8464eefb169456d
Solidity
IERC721Metadata
interface IERC721Metadata is IERC721 { /** * @dev Returns the token collection name. */ function name() external view returns (string memory); /** * @dev Returns the token collection symbol. */ function symbol() external view returns (string memory); /** * @dev Returns the Uniform Resource Identifier (URI) for `tokenId` token. */ function tokenURI(uint256 tokenId) external view returns (string memory); }
/** * @title ERC-721 Non-Fungible Token Standard, optional metadata extension * @dev See https://eips.ethereum.org/EIPS/eip-721 */
NatSpecMultiLine
name
function name() external view returns (string memory);
/** * @dev Returns the token collection name. */
NatSpecMultiLine
v0.8.3+commit.8d00100c
MIT
ipfs://1f710d8bcd8966b315557e51d40efc2bd775afde93afea26f8386cf10b49aa6f
{ "func_code_index": [ 106, 165 ] }
57,735
SlammaJamma
SlammaJamma.sol
0x2aa1c5306f0212e23f2950ecb8464eefb169456d
Solidity
IERC721Metadata
interface IERC721Metadata is IERC721 { /** * @dev Returns the token collection name. */ function name() external view returns (string memory); /** * @dev Returns the token collection symbol. */ function symbol() external view returns (string memory); /** * @dev Returns the Uniform Resource Identifier (URI) for `tokenId` token. */ function tokenURI(uint256 tokenId) external view returns (string memory); }
/** * @title ERC-721 Non-Fungible Token Standard, optional metadata extension * @dev See https://eips.ethereum.org/EIPS/eip-721 */
NatSpecMultiLine
symbol
function symbol() external view returns (string memory);
/** * @dev Returns the token collection symbol. */
NatSpecMultiLine
v0.8.3+commit.8d00100c
MIT
ipfs://1f710d8bcd8966b315557e51d40efc2bd775afde93afea26f8386cf10b49aa6f
{ "func_code_index": [ 236, 297 ] }
57,736
SlammaJamma
SlammaJamma.sol
0x2aa1c5306f0212e23f2950ecb8464eefb169456d
Solidity
IERC721Metadata
interface IERC721Metadata is IERC721 { /** * @dev Returns the token collection name. */ function name() external view returns (string memory); /** * @dev Returns the token collection symbol. */ function symbol() external view returns (string memory); /** * @dev Returns the Uniform Resource Identifier (URI) for `tokenId` token. */ function tokenURI(uint256 tokenId) external view returns (string memory); }
/** * @title ERC-721 Non-Fungible Token Standard, optional metadata extension * @dev See https://eips.ethereum.org/EIPS/eip-721 */
NatSpecMultiLine
tokenURI
function tokenURI(uint256 tokenId) external view returns (string memory);
/** * @dev Returns the Uniform Resource Identifier (URI) for `tokenId` token. */
NatSpecMultiLine
v0.8.3+commit.8d00100c
MIT
ipfs://1f710d8bcd8966b315557e51d40efc2bd775afde93afea26f8386cf10b49aa6f
{ "func_code_index": [ 398, 476 ] }
57,737
SlammaJamma
SlammaJamma.sol
0x2aa1c5306f0212e23f2950ecb8464eefb169456d
Solidity
Address
library Address { /** * @dev Returns true if `account` is a contract. * * [IMPORTANT] * ==== * It is unsafe to assume that an address for which this function returns * false is an externally-owned account (EOA) and not a contract. * * Among others, `isContract` will return false for the following * types of addresses: * * - an externally-owned account * - a contract in construction * - an address where a contract will be created * - an address where a contract lived, but was destroyed * ==== */ function isContract(address account) internal view returns (bool) { // This method relies on extcodesize, which returns 0 for contracts in // construction, since the code is only stored at the end of the // constructor execution. uint256 size; assembly { size := extcodesize(account) } return size > 0; } /** * @dev Replacement for Solidity's `transfer`: sends `amount` wei to * `recipient`, forwarding all available gas and reverting on errors. * * https://eips.ethereum.org/EIPS/eip-1884[EIP1884] increases the gas cost * of certain opcodes, possibly making contracts go over the 2300 gas limit * imposed by `transfer`, making them unable to receive funds via * `transfer`. {sendValue} removes this limitation. * * https://diligence.consensys.net/posts/2019/09/stop-using-soliditys-transfer-now/[Learn more]. * * IMPORTANT: because control is transferred to `recipient`, care must be * taken to not create reentrancy vulnerabilities. Consider using * {ReentrancyGuard} or the * https://solidity.readthedocs.io/en/v0.5.11/security-considerations.html#use-the-checks-effects-interactions-pattern[checks-effects-interactions pattern]. */ function sendValue(address payable recipient, uint256 amount) internal { require(address(this).balance >= amount, "Address: insufficient balance"); (bool success, ) = recipient.call{value: amount}(""); require(success, "Address: unable to send value, recipient may have reverted"); } /** * @dev Performs a Solidity function call using a low level `call`. A * plain `call` is an unsafe replacement for a function call: use this * function instead. * * If `target` reverts with a revert reason, it is bubbled up by this * function (like regular Solidity function calls). * * Returns the raw returned data. To convert to the expected return value, * use https://solidity.readthedocs.io/en/latest/units-and-global-variables.html?highlight=abi.decode#abi-encoding-and-decoding-functions[`abi.decode`]. * * Requirements: * * - `target` must be a contract. * - calling `target` with `data` must not revert. * * _Available since v3.1._ */ function functionCall(address target, bytes memory data) internal returns (bytes memory) { return functionCall(target, data, "Address: low-level call failed"); } /** * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`], but with * `errorMessage` as a fallback revert reason when `target` reverts. * * _Available since v3.1._ */ function functionCall( address target, bytes memory data, string memory errorMessage ) internal returns (bytes memory) { return functionCallWithValue(target, data, 0, errorMessage); } /** * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`], * but also transferring `value` wei to `target`. * * Requirements: * * - the calling contract must have an ETH balance of at least `value`. * - the called Solidity function must be `payable`. * * _Available since v3.1._ */ function functionCallWithValue( address target, bytes memory data, uint256 value ) internal returns (bytes memory) { return functionCallWithValue(target, data, value, "Address: low-level call with value failed"); } /** * @dev Same as {xref-Address-functionCallWithValue-address-bytes-uint256-}[`functionCallWithValue`], but * with `errorMessage` as a fallback revert reason when `target` reverts. * * _Available since v3.1._ */ function functionCallWithValue( address target, bytes memory data, uint256 value, string memory errorMessage ) internal returns (bytes memory) { require(address(this).balance >= value, "Address: insufficient balance for call"); require(isContract(target), "Address: call to non-contract"); (bool success, bytes memory returndata) = target.call{value: value}(data); return verifyCallResult(success, returndata, errorMessage); } /** * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`], * but performing a static call. * * _Available since v3.3._ */ function functionStaticCall(address target, bytes memory data) internal view returns (bytes memory) { return functionStaticCall(target, data, "Address: low-level static call failed"); } /** * @dev Same as {xref-Address-functionCall-address-bytes-string-}[`functionCall`], * but performing a static call. * * _Available since v3.3._ */ function functionStaticCall( address target, bytes memory data, string memory errorMessage ) internal view returns (bytes memory) { require(isContract(target), "Address: static call to non-contract"); (bool success, bytes memory returndata) = target.staticcall(data); return verifyCallResult(success, returndata, errorMessage); } /** * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`], * but performing a delegate call. * * _Available since v3.4._ */ function functionDelegateCall(address target, bytes memory data) internal returns (bytes memory) { return functionDelegateCall(target, data, "Address: low-level delegate call failed"); } /** * @dev Same as {xref-Address-functionCall-address-bytes-string-}[`functionCall`], * but performing a delegate call. * * _Available since v3.4._ */ function functionDelegateCall( address target, bytes memory data, string memory errorMessage ) internal returns (bytes memory) { require(isContract(target), "Address: delegate call to non-contract"); (bool success, bytes memory returndata) = target.delegatecall(data); return verifyCallResult(success, returndata, errorMessage); } /** * @dev Tool to verifies that a low level call was successful, and revert if it wasn't, either by bubbling the * revert reason using the provided one. * * _Available since v4.3._ */ function verifyCallResult( bool success, bytes memory returndata, string memory errorMessage ) internal pure returns (bytes memory) { if (success) { return returndata; } else { // Look for revert reason and bubble it up if present if (returndata.length > 0) { // The easiest way to bubble the revert reason is using memory via assembly assembly { let returndata_size := mload(returndata) revert(add(32, returndata), returndata_size) } } else { revert(errorMessage); } } } }
/** * @dev Collection of functions related to the address type */
NatSpecMultiLine
isContract
function isContract(address account) internal view returns (bool) { // This method relies on extcodesize, which returns 0 for contracts in // construction, since the code is only stored at the end of the // constructor execution. uint256 size; assembly { size := extcodesize(account) } return size > 0; }
/** * @dev Returns true if `account` is a contract. * * [IMPORTANT] * ==== * It is unsafe to assume that an address for which this function returns * false is an externally-owned account (EOA) and not a contract. * * Among others, `isContract` will return false for the following * types of addresses: * * - an externally-owned account * - a contract in construction * - an address where a contract will be created * - an address where a contract lived, but was destroyed * ==== */
NatSpecMultiLine
v0.8.3+commit.8d00100c
MIT
ipfs://1f710d8bcd8966b315557e51d40efc2bd775afde93afea26f8386cf10b49aa6f
{ "func_code_index": [ 606, 998 ] }
57,738
SlammaJamma
SlammaJamma.sol
0x2aa1c5306f0212e23f2950ecb8464eefb169456d
Solidity
Address
library Address { /** * @dev Returns true if `account` is a contract. * * [IMPORTANT] * ==== * It is unsafe to assume that an address for which this function returns * false is an externally-owned account (EOA) and not a contract. * * Among others, `isContract` will return false for the following * types of addresses: * * - an externally-owned account * - a contract in construction * - an address where a contract will be created * - an address where a contract lived, but was destroyed * ==== */ function isContract(address account) internal view returns (bool) { // This method relies on extcodesize, which returns 0 for contracts in // construction, since the code is only stored at the end of the // constructor execution. uint256 size; assembly { size := extcodesize(account) } return size > 0; } /** * @dev Replacement for Solidity's `transfer`: sends `amount` wei to * `recipient`, forwarding all available gas and reverting on errors. * * https://eips.ethereum.org/EIPS/eip-1884[EIP1884] increases the gas cost * of certain opcodes, possibly making contracts go over the 2300 gas limit * imposed by `transfer`, making them unable to receive funds via * `transfer`. {sendValue} removes this limitation. * * https://diligence.consensys.net/posts/2019/09/stop-using-soliditys-transfer-now/[Learn more]. * * IMPORTANT: because control is transferred to `recipient`, care must be * taken to not create reentrancy vulnerabilities. Consider using * {ReentrancyGuard} or the * https://solidity.readthedocs.io/en/v0.5.11/security-considerations.html#use-the-checks-effects-interactions-pattern[checks-effects-interactions pattern]. */ function sendValue(address payable recipient, uint256 amount) internal { require(address(this).balance >= amount, "Address: insufficient balance"); (bool success, ) = recipient.call{value: amount}(""); require(success, "Address: unable to send value, recipient may have reverted"); } /** * @dev Performs a Solidity function call using a low level `call`. A * plain `call` is an unsafe replacement for a function call: use this * function instead. * * If `target` reverts with a revert reason, it is bubbled up by this * function (like regular Solidity function calls). * * Returns the raw returned data. To convert to the expected return value, * use https://solidity.readthedocs.io/en/latest/units-and-global-variables.html?highlight=abi.decode#abi-encoding-and-decoding-functions[`abi.decode`]. * * Requirements: * * - `target` must be a contract. * - calling `target` with `data` must not revert. * * _Available since v3.1._ */ function functionCall(address target, bytes memory data) internal returns (bytes memory) { return functionCall(target, data, "Address: low-level call failed"); } /** * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`], but with * `errorMessage` as a fallback revert reason when `target` reverts. * * _Available since v3.1._ */ function functionCall( address target, bytes memory data, string memory errorMessage ) internal returns (bytes memory) { return functionCallWithValue(target, data, 0, errorMessage); } /** * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`], * but also transferring `value` wei to `target`. * * Requirements: * * - the calling contract must have an ETH balance of at least `value`. * - the called Solidity function must be `payable`. * * _Available since v3.1._ */ function functionCallWithValue( address target, bytes memory data, uint256 value ) internal returns (bytes memory) { return functionCallWithValue(target, data, value, "Address: low-level call with value failed"); } /** * @dev Same as {xref-Address-functionCallWithValue-address-bytes-uint256-}[`functionCallWithValue`], but * with `errorMessage` as a fallback revert reason when `target` reverts. * * _Available since v3.1._ */ function functionCallWithValue( address target, bytes memory data, uint256 value, string memory errorMessage ) internal returns (bytes memory) { require(address(this).balance >= value, "Address: insufficient balance for call"); require(isContract(target), "Address: call to non-contract"); (bool success, bytes memory returndata) = target.call{value: value}(data); return verifyCallResult(success, returndata, errorMessage); } /** * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`], * but performing a static call. * * _Available since v3.3._ */ function functionStaticCall(address target, bytes memory data) internal view returns (bytes memory) { return functionStaticCall(target, data, "Address: low-level static call failed"); } /** * @dev Same as {xref-Address-functionCall-address-bytes-string-}[`functionCall`], * but performing a static call. * * _Available since v3.3._ */ function functionStaticCall( address target, bytes memory data, string memory errorMessage ) internal view returns (bytes memory) { require(isContract(target), "Address: static call to non-contract"); (bool success, bytes memory returndata) = target.staticcall(data); return verifyCallResult(success, returndata, errorMessage); } /** * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`], * but performing a delegate call. * * _Available since v3.4._ */ function functionDelegateCall(address target, bytes memory data) internal returns (bytes memory) { return functionDelegateCall(target, data, "Address: low-level delegate call failed"); } /** * @dev Same as {xref-Address-functionCall-address-bytes-string-}[`functionCall`], * but performing a delegate call. * * _Available since v3.4._ */ function functionDelegateCall( address target, bytes memory data, string memory errorMessage ) internal returns (bytes memory) { require(isContract(target), "Address: delegate call to non-contract"); (bool success, bytes memory returndata) = target.delegatecall(data); return verifyCallResult(success, returndata, errorMessage); } /** * @dev Tool to verifies that a low level call was successful, and revert if it wasn't, either by bubbling the * revert reason using the provided one. * * _Available since v4.3._ */ function verifyCallResult( bool success, bytes memory returndata, string memory errorMessage ) internal pure returns (bytes memory) { if (success) { return returndata; } else { // Look for revert reason and bubble it up if present if (returndata.length > 0) { // The easiest way to bubble the revert reason is using memory via assembly assembly { let returndata_size := mload(returndata) revert(add(32, returndata), returndata_size) } } else { revert(errorMessage); } } } }
/** * @dev Collection of functions related to the address type */
NatSpecMultiLine
sendValue
function sendValue(address payable recipient, uint256 amount) internal { require(address(this).balance >= amount, "Address: insufficient balance"); (bool success, ) = recipient.call{value: amount}(""); require(success, "Address: unable to send value, recipient may have reverted"); }
/** * @dev Replacement for Solidity's `transfer`: sends `amount` wei to * `recipient`, forwarding all available gas and reverting on errors. * * https://eips.ethereum.org/EIPS/eip-1884[EIP1884] increases the gas cost * of certain opcodes, possibly making contracts go over the 2300 gas limit * imposed by `transfer`, making them unable to receive funds via * `transfer`. {sendValue} removes this limitation. * * https://diligence.consensys.net/posts/2019/09/stop-using-soliditys-transfer-now/[Learn more]. * * IMPORTANT: because control is transferred to `recipient`, care must be * taken to not create reentrancy vulnerabilities. Consider using * {ReentrancyGuard} or the * https://solidity.readthedocs.io/en/v0.5.11/security-considerations.html#use-the-checks-effects-interactions-pattern[checks-effects-interactions pattern]. */
NatSpecMultiLine
v0.8.3+commit.8d00100c
MIT
ipfs://1f710d8bcd8966b315557e51d40efc2bd775afde93afea26f8386cf10b49aa6f
{ "func_code_index": [ 1928, 2250 ] }
57,739
SlammaJamma
SlammaJamma.sol
0x2aa1c5306f0212e23f2950ecb8464eefb169456d
Solidity
Address
library Address { /** * @dev Returns true if `account` is a contract. * * [IMPORTANT] * ==== * It is unsafe to assume that an address for which this function returns * false is an externally-owned account (EOA) and not a contract. * * Among others, `isContract` will return false for the following * types of addresses: * * - an externally-owned account * - a contract in construction * - an address where a contract will be created * - an address where a contract lived, but was destroyed * ==== */ function isContract(address account) internal view returns (bool) { // This method relies on extcodesize, which returns 0 for contracts in // construction, since the code is only stored at the end of the // constructor execution. uint256 size; assembly { size := extcodesize(account) } return size > 0; } /** * @dev Replacement for Solidity's `transfer`: sends `amount` wei to * `recipient`, forwarding all available gas and reverting on errors. * * https://eips.ethereum.org/EIPS/eip-1884[EIP1884] increases the gas cost * of certain opcodes, possibly making contracts go over the 2300 gas limit * imposed by `transfer`, making them unable to receive funds via * `transfer`. {sendValue} removes this limitation. * * https://diligence.consensys.net/posts/2019/09/stop-using-soliditys-transfer-now/[Learn more]. * * IMPORTANT: because control is transferred to `recipient`, care must be * taken to not create reentrancy vulnerabilities. Consider using * {ReentrancyGuard} or the * https://solidity.readthedocs.io/en/v0.5.11/security-considerations.html#use-the-checks-effects-interactions-pattern[checks-effects-interactions pattern]. */ function sendValue(address payable recipient, uint256 amount) internal { require(address(this).balance >= amount, "Address: insufficient balance"); (bool success, ) = recipient.call{value: amount}(""); require(success, "Address: unable to send value, recipient may have reverted"); } /** * @dev Performs a Solidity function call using a low level `call`. A * plain `call` is an unsafe replacement for a function call: use this * function instead. * * If `target` reverts with a revert reason, it is bubbled up by this * function (like regular Solidity function calls). * * Returns the raw returned data. To convert to the expected return value, * use https://solidity.readthedocs.io/en/latest/units-and-global-variables.html?highlight=abi.decode#abi-encoding-and-decoding-functions[`abi.decode`]. * * Requirements: * * - `target` must be a contract. * - calling `target` with `data` must not revert. * * _Available since v3.1._ */ function functionCall(address target, bytes memory data) internal returns (bytes memory) { return functionCall(target, data, "Address: low-level call failed"); } /** * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`], but with * `errorMessage` as a fallback revert reason when `target` reverts. * * _Available since v3.1._ */ function functionCall( address target, bytes memory data, string memory errorMessage ) internal returns (bytes memory) { return functionCallWithValue(target, data, 0, errorMessage); } /** * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`], * but also transferring `value` wei to `target`. * * Requirements: * * - the calling contract must have an ETH balance of at least `value`. * - the called Solidity function must be `payable`. * * _Available since v3.1._ */ function functionCallWithValue( address target, bytes memory data, uint256 value ) internal returns (bytes memory) { return functionCallWithValue(target, data, value, "Address: low-level call with value failed"); } /** * @dev Same as {xref-Address-functionCallWithValue-address-bytes-uint256-}[`functionCallWithValue`], but * with `errorMessage` as a fallback revert reason when `target` reverts. * * _Available since v3.1._ */ function functionCallWithValue( address target, bytes memory data, uint256 value, string memory errorMessage ) internal returns (bytes memory) { require(address(this).balance >= value, "Address: insufficient balance for call"); require(isContract(target), "Address: call to non-contract"); (bool success, bytes memory returndata) = target.call{value: value}(data); return verifyCallResult(success, returndata, errorMessage); } /** * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`], * but performing a static call. * * _Available since v3.3._ */ function functionStaticCall(address target, bytes memory data) internal view returns (bytes memory) { return functionStaticCall(target, data, "Address: low-level static call failed"); } /** * @dev Same as {xref-Address-functionCall-address-bytes-string-}[`functionCall`], * but performing a static call. * * _Available since v3.3._ */ function functionStaticCall( address target, bytes memory data, string memory errorMessage ) internal view returns (bytes memory) { require(isContract(target), "Address: static call to non-contract"); (bool success, bytes memory returndata) = target.staticcall(data); return verifyCallResult(success, returndata, errorMessage); } /** * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`], * but performing a delegate call. * * _Available since v3.4._ */ function functionDelegateCall(address target, bytes memory data) internal returns (bytes memory) { return functionDelegateCall(target, data, "Address: low-level delegate call failed"); } /** * @dev Same as {xref-Address-functionCall-address-bytes-string-}[`functionCall`], * but performing a delegate call. * * _Available since v3.4._ */ function functionDelegateCall( address target, bytes memory data, string memory errorMessage ) internal returns (bytes memory) { require(isContract(target), "Address: delegate call to non-contract"); (bool success, bytes memory returndata) = target.delegatecall(data); return verifyCallResult(success, returndata, errorMessage); } /** * @dev Tool to verifies that a low level call was successful, and revert if it wasn't, either by bubbling the * revert reason using the provided one. * * _Available since v4.3._ */ function verifyCallResult( bool success, bytes memory returndata, string memory errorMessage ) internal pure returns (bytes memory) { if (success) { return returndata; } else { // Look for revert reason and bubble it up if present if (returndata.length > 0) { // The easiest way to bubble the revert reason is using memory via assembly assembly { let returndata_size := mload(returndata) revert(add(32, returndata), returndata_size) } } else { revert(errorMessage); } } } }
/** * @dev Collection of functions related to the address type */
NatSpecMultiLine
functionCall
function functionCall(address target, bytes memory data) internal returns (bytes memory) { return functionCall(target, data, "Address: low-level call failed"); }
/** * @dev Performs a Solidity function call using a low level `call`. A * plain `call` is an unsafe replacement for a function call: use this * function instead. * * If `target` reverts with a revert reason, it is bubbled up by this * function (like regular Solidity function calls). * * Returns the raw returned data. To convert to the expected return value, * use https://solidity.readthedocs.io/en/latest/units-and-global-variables.html?highlight=abi.decode#abi-encoding-and-decoding-functions[`abi.decode`]. * * Requirements: * * - `target` must be a contract. * - calling `target` with `data` must not revert. * * _Available since v3.1._ */
NatSpecMultiLine
v0.8.3+commit.8d00100c
MIT
ipfs://1f710d8bcd8966b315557e51d40efc2bd775afde93afea26f8386cf10b49aa6f
{ "func_code_index": [ 3007, 3187 ] }
57,740
SlammaJamma
SlammaJamma.sol
0x2aa1c5306f0212e23f2950ecb8464eefb169456d
Solidity
Address
library Address { /** * @dev Returns true if `account` is a contract. * * [IMPORTANT] * ==== * It is unsafe to assume that an address for which this function returns * false is an externally-owned account (EOA) and not a contract. * * Among others, `isContract` will return false for the following * types of addresses: * * - an externally-owned account * - a contract in construction * - an address where a contract will be created * - an address where a contract lived, but was destroyed * ==== */ function isContract(address account) internal view returns (bool) { // This method relies on extcodesize, which returns 0 for contracts in // construction, since the code is only stored at the end of the // constructor execution. uint256 size; assembly { size := extcodesize(account) } return size > 0; } /** * @dev Replacement for Solidity's `transfer`: sends `amount` wei to * `recipient`, forwarding all available gas and reverting on errors. * * https://eips.ethereum.org/EIPS/eip-1884[EIP1884] increases the gas cost * of certain opcodes, possibly making contracts go over the 2300 gas limit * imposed by `transfer`, making them unable to receive funds via * `transfer`. {sendValue} removes this limitation. * * https://diligence.consensys.net/posts/2019/09/stop-using-soliditys-transfer-now/[Learn more]. * * IMPORTANT: because control is transferred to `recipient`, care must be * taken to not create reentrancy vulnerabilities. Consider using * {ReentrancyGuard} or the * https://solidity.readthedocs.io/en/v0.5.11/security-considerations.html#use-the-checks-effects-interactions-pattern[checks-effects-interactions pattern]. */ function sendValue(address payable recipient, uint256 amount) internal { require(address(this).balance >= amount, "Address: insufficient balance"); (bool success, ) = recipient.call{value: amount}(""); require(success, "Address: unable to send value, recipient may have reverted"); } /** * @dev Performs a Solidity function call using a low level `call`. A * plain `call` is an unsafe replacement for a function call: use this * function instead. * * If `target` reverts with a revert reason, it is bubbled up by this * function (like regular Solidity function calls). * * Returns the raw returned data. To convert to the expected return value, * use https://solidity.readthedocs.io/en/latest/units-and-global-variables.html?highlight=abi.decode#abi-encoding-and-decoding-functions[`abi.decode`]. * * Requirements: * * - `target` must be a contract. * - calling `target` with `data` must not revert. * * _Available since v3.1._ */ function functionCall(address target, bytes memory data) internal returns (bytes memory) { return functionCall(target, data, "Address: low-level call failed"); } /** * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`], but with * `errorMessage` as a fallback revert reason when `target` reverts. * * _Available since v3.1._ */ function functionCall( address target, bytes memory data, string memory errorMessage ) internal returns (bytes memory) { return functionCallWithValue(target, data, 0, errorMessage); } /** * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`], * but also transferring `value` wei to `target`. * * Requirements: * * - the calling contract must have an ETH balance of at least `value`. * - the called Solidity function must be `payable`. * * _Available since v3.1._ */ function functionCallWithValue( address target, bytes memory data, uint256 value ) internal returns (bytes memory) { return functionCallWithValue(target, data, value, "Address: low-level call with value failed"); } /** * @dev Same as {xref-Address-functionCallWithValue-address-bytes-uint256-}[`functionCallWithValue`], but * with `errorMessage` as a fallback revert reason when `target` reverts. * * _Available since v3.1._ */ function functionCallWithValue( address target, bytes memory data, uint256 value, string memory errorMessage ) internal returns (bytes memory) { require(address(this).balance >= value, "Address: insufficient balance for call"); require(isContract(target), "Address: call to non-contract"); (bool success, bytes memory returndata) = target.call{value: value}(data); return verifyCallResult(success, returndata, errorMessage); } /** * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`], * but performing a static call. * * _Available since v3.3._ */ function functionStaticCall(address target, bytes memory data) internal view returns (bytes memory) { return functionStaticCall(target, data, "Address: low-level static call failed"); } /** * @dev Same as {xref-Address-functionCall-address-bytes-string-}[`functionCall`], * but performing a static call. * * _Available since v3.3._ */ function functionStaticCall( address target, bytes memory data, string memory errorMessage ) internal view returns (bytes memory) { require(isContract(target), "Address: static call to non-contract"); (bool success, bytes memory returndata) = target.staticcall(data); return verifyCallResult(success, returndata, errorMessage); } /** * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`], * but performing a delegate call. * * _Available since v3.4._ */ function functionDelegateCall(address target, bytes memory data) internal returns (bytes memory) { return functionDelegateCall(target, data, "Address: low-level delegate call failed"); } /** * @dev Same as {xref-Address-functionCall-address-bytes-string-}[`functionCall`], * but performing a delegate call. * * _Available since v3.4._ */ function functionDelegateCall( address target, bytes memory data, string memory errorMessage ) internal returns (bytes memory) { require(isContract(target), "Address: delegate call to non-contract"); (bool success, bytes memory returndata) = target.delegatecall(data); return verifyCallResult(success, returndata, errorMessage); } /** * @dev Tool to verifies that a low level call was successful, and revert if it wasn't, either by bubbling the * revert reason using the provided one. * * _Available since v4.3._ */ function verifyCallResult( bool success, bytes memory returndata, string memory errorMessage ) internal pure returns (bytes memory) { if (success) { return returndata; } else { // Look for revert reason and bubble it up if present if (returndata.length > 0) { // The easiest way to bubble the revert reason is using memory via assembly assembly { let returndata_size := mload(returndata) revert(add(32, returndata), returndata_size) } } else { revert(errorMessage); } } } }
/** * @dev Collection of functions related to the address type */
NatSpecMultiLine
functionCall
function functionCall( address target, bytes memory data, string memory errorMessage ) internal returns (bytes memory) { return functionCallWithValue(target, data, 0, errorMessage); }
/** * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`], but with * `errorMessage` as a fallback revert reason when `target` reverts. * * _Available since v3.1._ */
NatSpecMultiLine
v0.8.3+commit.8d00100c
MIT
ipfs://1f710d8bcd8966b315557e51d40efc2bd775afde93afea26f8386cf10b49aa6f
{ "func_code_index": [ 3412, 3646 ] }
57,741
SlammaJamma
SlammaJamma.sol
0x2aa1c5306f0212e23f2950ecb8464eefb169456d
Solidity
Address
library Address { /** * @dev Returns true if `account` is a contract. * * [IMPORTANT] * ==== * It is unsafe to assume that an address for which this function returns * false is an externally-owned account (EOA) and not a contract. * * Among others, `isContract` will return false for the following * types of addresses: * * - an externally-owned account * - a contract in construction * - an address where a contract will be created * - an address where a contract lived, but was destroyed * ==== */ function isContract(address account) internal view returns (bool) { // This method relies on extcodesize, which returns 0 for contracts in // construction, since the code is only stored at the end of the // constructor execution. uint256 size; assembly { size := extcodesize(account) } return size > 0; } /** * @dev Replacement for Solidity's `transfer`: sends `amount` wei to * `recipient`, forwarding all available gas and reverting on errors. * * https://eips.ethereum.org/EIPS/eip-1884[EIP1884] increases the gas cost * of certain opcodes, possibly making contracts go over the 2300 gas limit * imposed by `transfer`, making them unable to receive funds via * `transfer`. {sendValue} removes this limitation. * * https://diligence.consensys.net/posts/2019/09/stop-using-soliditys-transfer-now/[Learn more]. * * IMPORTANT: because control is transferred to `recipient`, care must be * taken to not create reentrancy vulnerabilities. Consider using * {ReentrancyGuard} or the * https://solidity.readthedocs.io/en/v0.5.11/security-considerations.html#use-the-checks-effects-interactions-pattern[checks-effects-interactions pattern]. */ function sendValue(address payable recipient, uint256 amount) internal { require(address(this).balance >= amount, "Address: insufficient balance"); (bool success, ) = recipient.call{value: amount}(""); require(success, "Address: unable to send value, recipient may have reverted"); } /** * @dev Performs a Solidity function call using a low level `call`. A * plain `call` is an unsafe replacement for a function call: use this * function instead. * * If `target` reverts with a revert reason, it is bubbled up by this * function (like regular Solidity function calls). * * Returns the raw returned data. To convert to the expected return value, * use https://solidity.readthedocs.io/en/latest/units-and-global-variables.html?highlight=abi.decode#abi-encoding-and-decoding-functions[`abi.decode`]. * * Requirements: * * - `target` must be a contract. * - calling `target` with `data` must not revert. * * _Available since v3.1._ */ function functionCall(address target, bytes memory data) internal returns (bytes memory) { return functionCall(target, data, "Address: low-level call failed"); } /** * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`], but with * `errorMessage` as a fallback revert reason when `target` reverts. * * _Available since v3.1._ */ function functionCall( address target, bytes memory data, string memory errorMessage ) internal returns (bytes memory) { return functionCallWithValue(target, data, 0, errorMessage); } /** * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`], * but also transferring `value` wei to `target`. * * Requirements: * * - the calling contract must have an ETH balance of at least `value`. * - the called Solidity function must be `payable`. * * _Available since v3.1._ */ function functionCallWithValue( address target, bytes memory data, uint256 value ) internal returns (bytes memory) { return functionCallWithValue(target, data, value, "Address: low-level call with value failed"); } /** * @dev Same as {xref-Address-functionCallWithValue-address-bytes-uint256-}[`functionCallWithValue`], but * with `errorMessage` as a fallback revert reason when `target` reverts. * * _Available since v3.1._ */ function functionCallWithValue( address target, bytes memory data, uint256 value, string memory errorMessage ) internal returns (bytes memory) { require(address(this).balance >= value, "Address: insufficient balance for call"); require(isContract(target), "Address: call to non-contract"); (bool success, bytes memory returndata) = target.call{value: value}(data); return verifyCallResult(success, returndata, errorMessage); } /** * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`], * but performing a static call. * * _Available since v3.3._ */ function functionStaticCall(address target, bytes memory data) internal view returns (bytes memory) { return functionStaticCall(target, data, "Address: low-level static call failed"); } /** * @dev Same as {xref-Address-functionCall-address-bytes-string-}[`functionCall`], * but performing a static call. * * _Available since v3.3._ */ function functionStaticCall( address target, bytes memory data, string memory errorMessage ) internal view returns (bytes memory) { require(isContract(target), "Address: static call to non-contract"); (bool success, bytes memory returndata) = target.staticcall(data); return verifyCallResult(success, returndata, errorMessage); } /** * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`], * but performing a delegate call. * * _Available since v3.4._ */ function functionDelegateCall(address target, bytes memory data) internal returns (bytes memory) { return functionDelegateCall(target, data, "Address: low-level delegate call failed"); } /** * @dev Same as {xref-Address-functionCall-address-bytes-string-}[`functionCall`], * but performing a delegate call. * * _Available since v3.4._ */ function functionDelegateCall( address target, bytes memory data, string memory errorMessage ) internal returns (bytes memory) { require(isContract(target), "Address: delegate call to non-contract"); (bool success, bytes memory returndata) = target.delegatecall(data); return verifyCallResult(success, returndata, errorMessage); } /** * @dev Tool to verifies that a low level call was successful, and revert if it wasn't, either by bubbling the * revert reason using the provided one. * * _Available since v4.3._ */ function verifyCallResult( bool success, bytes memory returndata, string memory errorMessage ) internal pure returns (bytes memory) { if (success) { return returndata; } else { // Look for revert reason and bubble it up if present if (returndata.length > 0) { // The easiest way to bubble the revert reason is using memory via assembly assembly { let returndata_size := mload(returndata) revert(add(32, returndata), returndata_size) } } else { revert(errorMessage); } } } }
/** * @dev Collection of functions related to the address type */
NatSpecMultiLine
functionCallWithValue
function functionCallWithValue( address target, bytes memory data, uint256 value ) internal returns (bytes memory) { return functionCallWithValue(target, data, value, "Address: low-level call with value failed"); }
/** * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`], * but also transferring `value` wei to `target`. * * Requirements: * * - the calling contract must have an ETH balance of at least `value`. * - the called Solidity function must be `payable`. * * _Available since v3.1._ */
NatSpecMultiLine
v0.8.3+commit.8d00100c
MIT
ipfs://1f710d8bcd8966b315557e51d40efc2bd775afde93afea26f8386cf10b49aa6f
{ "func_code_index": [ 4016, 4281 ] }
57,742
SlammaJamma
SlammaJamma.sol
0x2aa1c5306f0212e23f2950ecb8464eefb169456d
Solidity
Address
library Address { /** * @dev Returns true if `account` is a contract. * * [IMPORTANT] * ==== * It is unsafe to assume that an address for which this function returns * false is an externally-owned account (EOA) and not a contract. * * Among others, `isContract` will return false for the following * types of addresses: * * - an externally-owned account * - a contract in construction * - an address where a contract will be created * - an address where a contract lived, but was destroyed * ==== */ function isContract(address account) internal view returns (bool) { // This method relies on extcodesize, which returns 0 for contracts in // construction, since the code is only stored at the end of the // constructor execution. uint256 size; assembly { size := extcodesize(account) } return size > 0; } /** * @dev Replacement for Solidity's `transfer`: sends `amount` wei to * `recipient`, forwarding all available gas and reverting on errors. * * https://eips.ethereum.org/EIPS/eip-1884[EIP1884] increases the gas cost * of certain opcodes, possibly making contracts go over the 2300 gas limit * imposed by `transfer`, making them unable to receive funds via * `transfer`. {sendValue} removes this limitation. * * https://diligence.consensys.net/posts/2019/09/stop-using-soliditys-transfer-now/[Learn more]. * * IMPORTANT: because control is transferred to `recipient`, care must be * taken to not create reentrancy vulnerabilities. Consider using * {ReentrancyGuard} or the * https://solidity.readthedocs.io/en/v0.5.11/security-considerations.html#use-the-checks-effects-interactions-pattern[checks-effects-interactions pattern]. */ function sendValue(address payable recipient, uint256 amount) internal { require(address(this).balance >= amount, "Address: insufficient balance"); (bool success, ) = recipient.call{value: amount}(""); require(success, "Address: unable to send value, recipient may have reverted"); } /** * @dev Performs a Solidity function call using a low level `call`. A * plain `call` is an unsafe replacement for a function call: use this * function instead. * * If `target` reverts with a revert reason, it is bubbled up by this * function (like regular Solidity function calls). * * Returns the raw returned data. To convert to the expected return value, * use https://solidity.readthedocs.io/en/latest/units-and-global-variables.html?highlight=abi.decode#abi-encoding-and-decoding-functions[`abi.decode`]. * * Requirements: * * - `target` must be a contract. * - calling `target` with `data` must not revert. * * _Available since v3.1._ */ function functionCall(address target, bytes memory data) internal returns (bytes memory) { return functionCall(target, data, "Address: low-level call failed"); } /** * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`], but with * `errorMessage` as a fallback revert reason when `target` reverts. * * _Available since v3.1._ */ function functionCall( address target, bytes memory data, string memory errorMessage ) internal returns (bytes memory) { return functionCallWithValue(target, data, 0, errorMessage); } /** * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`], * but also transferring `value` wei to `target`. * * Requirements: * * - the calling contract must have an ETH balance of at least `value`. * - the called Solidity function must be `payable`. * * _Available since v3.1._ */ function functionCallWithValue( address target, bytes memory data, uint256 value ) internal returns (bytes memory) { return functionCallWithValue(target, data, value, "Address: low-level call with value failed"); } /** * @dev Same as {xref-Address-functionCallWithValue-address-bytes-uint256-}[`functionCallWithValue`], but * with `errorMessage` as a fallback revert reason when `target` reverts. * * _Available since v3.1._ */ function functionCallWithValue( address target, bytes memory data, uint256 value, string memory errorMessage ) internal returns (bytes memory) { require(address(this).balance >= value, "Address: insufficient balance for call"); require(isContract(target), "Address: call to non-contract"); (bool success, bytes memory returndata) = target.call{value: value}(data); return verifyCallResult(success, returndata, errorMessage); } /** * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`], * but performing a static call. * * _Available since v3.3._ */ function functionStaticCall(address target, bytes memory data) internal view returns (bytes memory) { return functionStaticCall(target, data, "Address: low-level static call failed"); } /** * @dev Same as {xref-Address-functionCall-address-bytes-string-}[`functionCall`], * but performing a static call. * * _Available since v3.3._ */ function functionStaticCall( address target, bytes memory data, string memory errorMessage ) internal view returns (bytes memory) { require(isContract(target), "Address: static call to non-contract"); (bool success, bytes memory returndata) = target.staticcall(data); return verifyCallResult(success, returndata, errorMessage); } /** * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`], * but performing a delegate call. * * _Available since v3.4._ */ function functionDelegateCall(address target, bytes memory data) internal returns (bytes memory) { return functionDelegateCall(target, data, "Address: low-level delegate call failed"); } /** * @dev Same as {xref-Address-functionCall-address-bytes-string-}[`functionCall`], * but performing a delegate call. * * _Available since v3.4._ */ function functionDelegateCall( address target, bytes memory data, string memory errorMessage ) internal returns (bytes memory) { require(isContract(target), "Address: delegate call to non-contract"); (bool success, bytes memory returndata) = target.delegatecall(data); return verifyCallResult(success, returndata, errorMessage); } /** * @dev Tool to verifies that a low level call was successful, and revert if it wasn't, either by bubbling the * revert reason using the provided one. * * _Available since v4.3._ */ function verifyCallResult( bool success, bytes memory returndata, string memory errorMessage ) internal pure returns (bytes memory) { if (success) { return returndata; } else { // Look for revert reason and bubble it up if present if (returndata.length > 0) { // The easiest way to bubble the revert reason is using memory via assembly assembly { let returndata_size := mload(returndata) revert(add(32, returndata), returndata_size) } } else { revert(errorMessage); } } } }
/** * @dev Collection of functions related to the address type */
NatSpecMultiLine
functionCallWithValue
function functionCallWithValue( address target, bytes memory data, uint256 value, string memory errorMessage ) internal returns (bytes memory) { require(address(this).balance >= value, "Address: insufficient balance for call"); require(isContract(target), "Address: call to non-contract"); (bool success, bytes memory returndata) = target.call{value: value}(data); return verifyCallResult(success, returndata, errorMessage); }
/** * @dev Same as {xref-Address-functionCallWithValue-address-bytes-uint256-}[`functionCallWithValue`], but * with `errorMessage` as a fallback revert reason when `target` reverts. * * _Available since v3.1._ */
NatSpecMultiLine
v0.8.3+commit.8d00100c
MIT
ipfs://1f710d8bcd8966b315557e51d40efc2bd775afde93afea26f8386cf10b49aa6f
{ "func_code_index": [ 4532, 5047 ] }
57,743
SlammaJamma
SlammaJamma.sol
0x2aa1c5306f0212e23f2950ecb8464eefb169456d
Solidity
Address
library Address { /** * @dev Returns true if `account` is a contract. * * [IMPORTANT] * ==== * It is unsafe to assume that an address for which this function returns * false is an externally-owned account (EOA) and not a contract. * * Among others, `isContract` will return false for the following * types of addresses: * * - an externally-owned account * - a contract in construction * - an address where a contract will be created * - an address where a contract lived, but was destroyed * ==== */ function isContract(address account) internal view returns (bool) { // This method relies on extcodesize, which returns 0 for contracts in // construction, since the code is only stored at the end of the // constructor execution. uint256 size; assembly { size := extcodesize(account) } return size > 0; } /** * @dev Replacement for Solidity's `transfer`: sends `amount` wei to * `recipient`, forwarding all available gas and reverting on errors. * * https://eips.ethereum.org/EIPS/eip-1884[EIP1884] increases the gas cost * of certain opcodes, possibly making contracts go over the 2300 gas limit * imposed by `transfer`, making them unable to receive funds via * `transfer`. {sendValue} removes this limitation. * * https://diligence.consensys.net/posts/2019/09/stop-using-soliditys-transfer-now/[Learn more]. * * IMPORTANT: because control is transferred to `recipient`, care must be * taken to not create reentrancy vulnerabilities. Consider using * {ReentrancyGuard} or the * https://solidity.readthedocs.io/en/v0.5.11/security-considerations.html#use-the-checks-effects-interactions-pattern[checks-effects-interactions pattern]. */ function sendValue(address payable recipient, uint256 amount) internal { require(address(this).balance >= amount, "Address: insufficient balance"); (bool success, ) = recipient.call{value: amount}(""); require(success, "Address: unable to send value, recipient may have reverted"); } /** * @dev Performs a Solidity function call using a low level `call`. A * plain `call` is an unsafe replacement for a function call: use this * function instead. * * If `target` reverts with a revert reason, it is bubbled up by this * function (like regular Solidity function calls). * * Returns the raw returned data. To convert to the expected return value, * use https://solidity.readthedocs.io/en/latest/units-and-global-variables.html?highlight=abi.decode#abi-encoding-and-decoding-functions[`abi.decode`]. * * Requirements: * * - `target` must be a contract. * - calling `target` with `data` must not revert. * * _Available since v3.1._ */ function functionCall(address target, bytes memory data) internal returns (bytes memory) { return functionCall(target, data, "Address: low-level call failed"); } /** * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`], but with * `errorMessage` as a fallback revert reason when `target` reverts. * * _Available since v3.1._ */ function functionCall( address target, bytes memory data, string memory errorMessage ) internal returns (bytes memory) { return functionCallWithValue(target, data, 0, errorMessage); } /** * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`], * but also transferring `value` wei to `target`. * * Requirements: * * - the calling contract must have an ETH balance of at least `value`. * - the called Solidity function must be `payable`. * * _Available since v3.1._ */ function functionCallWithValue( address target, bytes memory data, uint256 value ) internal returns (bytes memory) { return functionCallWithValue(target, data, value, "Address: low-level call with value failed"); } /** * @dev Same as {xref-Address-functionCallWithValue-address-bytes-uint256-}[`functionCallWithValue`], but * with `errorMessage` as a fallback revert reason when `target` reverts. * * _Available since v3.1._ */ function functionCallWithValue( address target, bytes memory data, uint256 value, string memory errorMessage ) internal returns (bytes memory) { require(address(this).balance >= value, "Address: insufficient balance for call"); require(isContract(target), "Address: call to non-contract"); (bool success, bytes memory returndata) = target.call{value: value}(data); return verifyCallResult(success, returndata, errorMessage); } /** * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`], * but performing a static call. * * _Available since v3.3._ */ function functionStaticCall(address target, bytes memory data) internal view returns (bytes memory) { return functionStaticCall(target, data, "Address: low-level static call failed"); } /** * @dev Same as {xref-Address-functionCall-address-bytes-string-}[`functionCall`], * but performing a static call. * * _Available since v3.3._ */ function functionStaticCall( address target, bytes memory data, string memory errorMessage ) internal view returns (bytes memory) { require(isContract(target), "Address: static call to non-contract"); (bool success, bytes memory returndata) = target.staticcall(data); return verifyCallResult(success, returndata, errorMessage); } /** * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`], * but performing a delegate call. * * _Available since v3.4._ */ function functionDelegateCall(address target, bytes memory data) internal returns (bytes memory) { return functionDelegateCall(target, data, "Address: low-level delegate call failed"); } /** * @dev Same as {xref-Address-functionCall-address-bytes-string-}[`functionCall`], * but performing a delegate call. * * _Available since v3.4._ */ function functionDelegateCall( address target, bytes memory data, string memory errorMessage ) internal returns (bytes memory) { require(isContract(target), "Address: delegate call to non-contract"); (bool success, bytes memory returndata) = target.delegatecall(data); return verifyCallResult(success, returndata, errorMessage); } /** * @dev Tool to verifies that a low level call was successful, and revert if it wasn't, either by bubbling the * revert reason using the provided one. * * _Available since v4.3._ */ function verifyCallResult( bool success, bytes memory returndata, string memory errorMessage ) internal pure returns (bytes memory) { if (success) { return returndata; } else { // Look for revert reason and bubble it up if present if (returndata.length > 0) { // The easiest way to bubble the revert reason is using memory via assembly assembly { let returndata_size := mload(returndata) revert(add(32, returndata), returndata_size) } } else { revert(errorMessage); } } } }
/** * @dev Collection of functions related to the address type */
NatSpecMultiLine
functionStaticCall
function functionStaticCall(address target, bytes memory data) internal view returns (bytes memory) { return functionStaticCall(target, data, "Address: low-level static call failed"); }
/** * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`], * but performing a static call. * * _Available since v3.3._ */
NatSpecMultiLine
v0.8.3+commit.8d00100c
MIT
ipfs://1f710d8bcd8966b315557e51d40efc2bd775afde93afea26f8386cf10b49aa6f
{ "func_code_index": [ 5227, 5431 ] }
57,744
SlammaJamma
SlammaJamma.sol
0x2aa1c5306f0212e23f2950ecb8464eefb169456d
Solidity
Address
library Address { /** * @dev Returns true if `account` is a contract. * * [IMPORTANT] * ==== * It is unsafe to assume that an address for which this function returns * false is an externally-owned account (EOA) and not a contract. * * Among others, `isContract` will return false for the following * types of addresses: * * - an externally-owned account * - a contract in construction * - an address where a contract will be created * - an address where a contract lived, but was destroyed * ==== */ function isContract(address account) internal view returns (bool) { // This method relies on extcodesize, which returns 0 for contracts in // construction, since the code is only stored at the end of the // constructor execution. uint256 size; assembly { size := extcodesize(account) } return size > 0; } /** * @dev Replacement for Solidity's `transfer`: sends `amount` wei to * `recipient`, forwarding all available gas and reverting on errors. * * https://eips.ethereum.org/EIPS/eip-1884[EIP1884] increases the gas cost * of certain opcodes, possibly making contracts go over the 2300 gas limit * imposed by `transfer`, making them unable to receive funds via * `transfer`. {sendValue} removes this limitation. * * https://diligence.consensys.net/posts/2019/09/stop-using-soliditys-transfer-now/[Learn more]. * * IMPORTANT: because control is transferred to `recipient`, care must be * taken to not create reentrancy vulnerabilities. Consider using * {ReentrancyGuard} or the * https://solidity.readthedocs.io/en/v0.5.11/security-considerations.html#use-the-checks-effects-interactions-pattern[checks-effects-interactions pattern]. */ function sendValue(address payable recipient, uint256 amount) internal { require(address(this).balance >= amount, "Address: insufficient balance"); (bool success, ) = recipient.call{value: amount}(""); require(success, "Address: unable to send value, recipient may have reverted"); } /** * @dev Performs a Solidity function call using a low level `call`. A * plain `call` is an unsafe replacement for a function call: use this * function instead. * * If `target` reverts with a revert reason, it is bubbled up by this * function (like regular Solidity function calls). * * Returns the raw returned data. To convert to the expected return value, * use https://solidity.readthedocs.io/en/latest/units-and-global-variables.html?highlight=abi.decode#abi-encoding-and-decoding-functions[`abi.decode`]. * * Requirements: * * - `target` must be a contract. * - calling `target` with `data` must not revert. * * _Available since v3.1._ */ function functionCall(address target, bytes memory data) internal returns (bytes memory) { return functionCall(target, data, "Address: low-level call failed"); } /** * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`], but with * `errorMessage` as a fallback revert reason when `target` reverts. * * _Available since v3.1._ */ function functionCall( address target, bytes memory data, string memory errorMessage ) internal returns (bytes memory) { return functionCallWithValue(target, data, 0, errorMessage); } /** * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`], * but also transferring `value` wei to `target`. * * Requirements: * * - the calling contract must have an ETH balance of at least `value`. * - the called Solidity function must be `payable`. * * _Available since v3.1._ */ function functionCallWithValue( address target, bytes memory data, uint256 value ) internal returns (bytes memory) { return functionCallWithValue(target, data, value, "Address: low-level call with value failed"); } /** * @dev Same as {xref-Address-functionCallWithValue-address-bytes-uint256-}[`functionCallWithValue`], but * with `errorMessage` as a fallback revert reason when `target` reverts. * * _Available since v3.1._ */ function functionCallWithValue( address target, bytes memory data, uint256 value, string memory errorMessage ) internal returns (bytes memory) { require(address(this).balance >= value, "Address: insufficient balance for call"); require(isContract(target), "Address: call to non-contract"); (bool success, bytes memory returndata) = target.call{value: value}(data); return verifyCallResult(success, returndata, errorMessage); } /** * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`], * but performing a static call. * * _Available since v3.3._ */ function functionStaticCall(address target, bytes memory data) internal view returns (bytes memory) { return functionStaticCall(target, data, "Address: low-level static call failed"); } /** * @dev Same as {xref-Address-functionCall-address-bytes-string-}[`functionCall`], * but performing a static call. * * _Available since v3.3._ */ function functionStaticCall( address target, bytes memory data, string memory errorMessage ) internal view returns (bytes memory) { require(isContract(target), "Address: static call to non-contract"); (bool success, bytes memory returndata) = target.staticcall(data); return verifyCallResult(success, returndata, errorMessage); } /** * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`], * but performing a delegate call. * * _Available since v3.4._ */ function functionDelegateCall(address target, bytes memory data) internal returns (bytes memory) { return functionDelegateCall(target, data, "Address: low-level delegate call failed"); } /** * @dev Same as {xref-Address-functionCall-address-bytes-string-}[`functionCall`], * but performing a delegate call. * * _Available since v3.4._ */ function functionDelegateCall( address target, bytes memory data, string memory errorMessage ) internal returns (bytes memory) { require(isContract(target), "Address: delegate call to non-contract"); (bool success, bytes memory returndata) = target.delegatecall(data); return verifyCallResult(success, returndata, errorMessage); } /** * @dev Tool to verifies that a low level call was successful, and revert if it wasn't, either by bubbling the * revert reason using the provided one. * * _Available since v4.3._ */ function verifyCallResult( bool success, bytes memory returndata, string memory errorMessage ) internal pure returns (bytes memory) { if (success) { return returndata; } else { // Look for revert reason and bubble it up if present if (returndata.length > 0) { // The easiest way to bubble the revert reason is using memory via assembly assembly { let returndata_size := mload(returndata) revert(add(32, returndata), returndata_size) } } else { revert(errorMessage); } } } }
/** * @dev Collection of functions related to the address type */
NatSpecMultiLine
functionStaticCall
function functionStaticCall( address target, bytes memory data, string memory errorMessage ) internal view returns (bytes memory) { require(isContract(target), "Address: static call to non-contract"); (bool success, bytes memory returndata) = target.staticcall(data); return verifyCallResult(success, returndata, errorMessage); }
/** * @dev Same as {xref-Address-functionCall-address-bytes-string-}[`functionCall`], * but performing a static call. * * _Available since v3.3._ */
NatSpecMultiLine
v0.8.3+commit.8d00100c
MIT
ipfs://1f710d8bcd8966b315557e51d40efc2bd775afde93afea26f8386cf10b49aa6f
{ "func_code_index": [ 5618, 6018 ] }
57,745
SlammaJamma
SlammaJamma.sol
0x2aa1c5306f0212e23f2950ecb8464eefb169456d
Solidity
Address
library Address { /** * @dev Returns true if `account` is a contract. * * [IMPORTANT] * ==== * It is unsafe to assume that an address for which this function returns * false is an externally-owned account (EOA) and not a contract. * * Among others, `isContract` will return false for the following * types of addresses: * * - an externally-owned account * - a contract in construction * - an address where a contract will be created * - an address where a contract lived, but was destroyed * ==== */ function isContract(address account) internal view returns (bool) { // This method relies on extcodesize, which returns 0 for contracts in // construction, since the code is only stored at the end of the // constructor execution. uint256 size; assembly { size := extcodesize(account) } return size > 0; } /** * @dev Replacement for Solidity's `transfer`: sends `amount` wei to * `recipient`, forwarding all available gas and reverting on errors. * * https://eips.ethereum.org/EIPS/eip-1884[EIP1884] increases the gas cost * of certain opcodes, possibly making contracts go over the 2300 gas limit * imposed by `transfer`, making them unable to receive funds via * `transfer`. {sendValue} removes this limitation. * * https://diligence.consensys.net/posts/2019/09/stop-using-soliditys-transfer-now/[Learn more]. * * IMPORTANT: because control is transferred to `recipient`, care must be * taken to not create reentrancy vulnerabilities. Consider using * {ReentrancyGuard} or the * https://solidity.readthedocs.io/en/v0.5.11/security-considerations.html#use-the-checks-effects-interactions-pattern[checks-effects-interactions pattern]. */ function sendValue(address payable recipient, uint256 amount) internal { require(address(this).balance >= amount, "Address: insufficient balance"); (bool success, ) = recipient.call{value: amount}(""); require(success, "Address: unable to send value, recipient may have reverted"); } /** * @dev Performs a Solidity function call using a low level `call`. A * plain `call` is an unsafe replacement for a function call: use this * function instead. * * If `target` reverts with a revert reason, it is bubbled up by this * function (like regular Solidity function calls). * * Returns the raw returned data. To convert to the expected return value, * use https://solidity.readthedocs.io/en/latest/units-and-global-variables.html?highlight=abi.decode#abi-encoding-and-decoding-functions[`abi.decode`]. * * Requirements: * * - `target` must be a contract. * - calling `target` with `data` must not revert. * * _Available since v3.1._ */ function functionCall(address target, bytes memory data) internal returns (bytes memory) { return functionCall(target, data, "Address: low-level call failed"); } /** * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`], but with * `errorMessage` as a fallback revert reason when `target` reverts. * * _Available since v3.1._ */ function functionCall( address target, bytes memory data, string memory errorMessage ) internal returns (bytes memory) { return functionCallWithValue(target, data, 0, errorMessage); } /** * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`], * but also transferring `value` wei to `target`. * * Requirements: * * - the calling contract must have an ETH balance of at least `value`. * - the called Solidity function must be `payable`. * * _Available since v3.1._ */ function functionCallWithValue( address target, bytes memory data, uint256 value ) internal returns (bytes memory) { return functionCallWithValue(target, data, value, "Address: low-level call with value failed"); } /** * @dev Same as {xref-Address-functionCallWithValue-address-bytes-uint256-}[`functionCallWithValue`], but * with `errorMessage` as a fallback revert reason when `target` reverts. * * _Available since v3.1._ */ function functionCallWithValue( address target, bytes memory data, uint256 value, string memory errorMessage ) internal returns (bytes memory) { require(address(this).balance >= value, "Address: insufficient balance for call"); require(isContract(target), "Address: call to non-contract"); (bool success, bytes memory returndata) = target.call{value: value}(data); return verifyCallResult(success, returndata, errorMessage); } /** * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`], * but performing a static call. * * _Available since v3.3._ */ function functionStaticCall(address target, bytes memory data) internal view returns (bytes memory) { return functionStaticCall(target, data, "Address: low-level static call failed"); } /** * @dev Same as {xref-Address-functionCall-address-bytes-string-}[`functionCall`], * but performing a static call. * * _Available since v3.3._ */ function functionStaticCall( address target, bytes memory data, string memory errorMessage ) internal view returns (bytes memory) { require(isContract(target), "Address: static call to non-contract"); (bool success, bytes memory returndata) = target.staticcall(data); return verifyCallResult(success, returndata, errorMessage); } /** * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`], * but performing a delegate call. * * _Available since v3.4._ */ function functionDelegateCall(address target, bytes memory data) internal returns (bytes memory) { return functionDelegateCall(target, data, "Address: low-level delegate call failed"); } /** * @dev Same as {xref-Address-functionCall-address-bytes-string-}[`functionCall`], * but performing a delegate call. * * _Available since v3.4._ */ function functionDelegateCall( address target, bytes memory data, string memory errorMessage ) internal returns (bytes memory) { require(isContract(target), "Address: delegate call to non-contract"); (bool success, bytes memory returndata) = target.delegatecall(data); return verifyCallResult(success, returndata, errorMessage); } /** * @dev Tool to verifies that a low level call was successful, and revert if it wasn't, either by bubbling the * revert reason using the provided one. * * _Available since v4.3._ */ function verifyCallResult( bool success, bytes memory returndata, string memory errorMessage ) internal pure returns (bytes memory) { if (success) { return returndata; } else { // Look for revert reason and bubble it up if present if (returndata.length > 0) { // The easiest way to bubble the revert reason is using memory via assembly assembly { let returndata_size := mload(returndata) revert(add(32, returndata), returndata_size) } } else { revert(errorMessage); } } } }
/** * @dev Collection of functions related to the address type */
NatSpecMultiLine
functionDelegateCall
function functionDelegateCall(address target, bytes memory data) internal returns (bytes memory) { return functionDelegateCall(target, data, "Address: low-level delegate call failed"); }
/** * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`], * but performing a delegate call. * * _Available since v3.4._ */
NatSpecMultiLine
v0.8.3+commit.8d00100c
MIT
ipfs://1f710d8bcd8966b315557e51d40efc2bd775afde93afea26f8386cf10b49aa6f
{ "func_code_index": [ 6200, 6405 ] }
57,746
SlammaJamma
SlammaJamma.sol
0x2aa1c5306f0212e23f2950ecb8464eefb169456d
Solidity
Address
library Address { /** * @dev Returns true if `account` is a contract. * * [IMPORTANT] * ==== * It is unsafe to assume that an address for which this function returns * false is an externally-owned account (EOA) and not a contract. * * Among others, `isContract` will return false for the following * types of addresses: * * - an externally-owned account * - a contract in construction * - an address where a contract will be created * - an address where a contract lived, but was destroyed * ==== */ function isContract(address account) internal view returns (bool) { // This method relies on extcodesize, which returns 0 for contracts in // construction, since the code is only stored at the end of the // constructor execution. uint256 size; assembly { size := extcodesize(account) } return size > 0; } /** * @dev Replacement for Solidity's `transfer`: sends `amount` wei to * `recipient`, forwarding all available gas and reverting on errors. * * https://eips.ethereum.org/EIPS/eip-1884[EIP1884] increases the gas cost * of certain opcodes, possibly making contracts go over the 2300 gas limit * imposed by `transfer`, making them unable to receive funds via * `transfer`. {sendValue} removes this limitation. * * https://diligence.consensys.net/posts/2019/09/stop-using-soliditys-transfer-now/[Learn more]. * * IMPORTANT: because control is transferred to `recipient`, care must be * taken to not create reentrancy vulnerabilities. Consider using * {ReentrancyGuard} or the * https://solidity.readthedocs.io/en/v0.5.11/security-considerations.html#use-the-checks-effects-interactions-pattern[checks-effects-interactions pattern]. */ function sendValue(address payable recipient, uint256 amount) internal { require(address(this).balance >= amount, "Address: insufficient balance"); (bool success, ) = recipient.call{value: amount}(""); require(success, "Address: unable to send value, recipient may have reverted"); } /** * @dev Performs a Solidity function call using a low level `call`. A * plain `call` is an unsafe replacement for a function call: use this * function instead. * * If `target` reverts with a revert reason, it is bubbled up by this * function (like regular Solidity function calls). * * Returns the raw returned data. To convert to the expected return value, * use https://solidity.readthedocs.io/en/latest/units-and-global-variables.html?highlight=abi.decode#abi-encoding-and-decoding-functions[`abi.decode`]. * * Requirements: * * - `target` must be a contract. * - calling `target` with `data` must not revert. * * _Available since v3.1._ */ function functionCall(address target, bytes memory data) internal returns (bytes memory) { return functionCall(target, data, "Address: low-level call failed"); } /** * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`], but with * `errorMessage` as a fallback revert reason when `target` reverts. * * _Available since v3.1._ */ function functionCall( address target, bytes memory data, string memory errorMessage ) internal returns (bytes memory) { return functionCallWithValue(target, data, 0, errorMessage); } /** * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`], * but also transferring `value` wei to `target`. * * Requirements: * * - the calling contract must have an ETH balance of at least `value`. * - the called Solidity function must be `payable`. * * _Available since v3.1._ */ function functionCallWithValue( address target, bytes memory data, uint256 value ) internal returns (bytes memory) { return functionCallWithValue(target, data, value, "Address: low-level call with value failed"); } /** * @dev Same as {xref-Address-functionCallWithValue-address-bytes-uint256-}[`functionCallWithValue`], but * with `errorMessage` as a fallback revert reason when `target` reverts. * * _Available since v3.1._ */ function functionCallWithValue( address target, bytes memory data, uint256 value, string memory errorMessage ) internal returns (bytes memory) { require(address(this).balance >= value, "Address: insufficient balance for call"); require(isContract(target), "Address: call to non-contract"); (bool success, bytes memory returndata) = target.call{value: value}(data); return verifyCallResult(success, returndata, errorMessage); } /** * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`], * but performing a static call. * * _Available since v3.3._ */ function functionStaticCall(address target, bytes memory data) internal view returns (bytes memory) { return functionStaticCall(target, data, "Address: low-level static call failed"); } /** * @dev Same as {xref-Address-functionCall-address-bytes-string-}[`functionCall`], * but performing a static call. * * _Available since v3.3._ */ function functionStaticCall( address target, bytes memory data, string memory errorMessage ) internal view returns (bytes memory) { require(isContract(target), "Address: static call to non-contract"); (bool success, bytes memory returndata) = target.staticcall(data); return verifyCallResult(success, returndata, errorMessage); } /** * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`], * but performing a delegate call. * * _Available since v3.4._ */ function functionDelegateCall(address target, bytes memory data) internal returns (bytes memory) { return functionDelegateCall(target, data, "Address: low-level delegate call failed"); } /** * @dev Same as {xref-Address-functionCall-address-bytes-string-}[`functionCall`], * but performing a delegate call. * * _Available since v3.4._ */ function functionDelegateCall( address target, bytes memory data, string memory errorMessage ) internal returns (bytes memory) { require(isContract(target), "Address: delegate call to non-contract"); (bool success, bytes memory returndata) = target.delegatecall(data); return verifyCallResult(success, returndata, errorMessage); } /** * @dev Tool to verifies that a low level call was successful, and revert if it wasn't, either by bubbling the * revert reason using the provided one. * * _Available since v4.3._ */ function verifyCallResult( bool success, bytes memory returndata, string memory errorMessage ) internal pure returns (bytes memory) { if (success) { return returndata; } else { // Look for revert reason and bubble it up if present if (returndata.length > 0) { // The easiest way to bubble the revert reason is using memory via assembly assembly { let returndata_size := mload(returndata) revert(add(32, returndata), returndata_size) } } else { revert(errorMessage); } } } }
/** * @dev Collection of functions related to the address type */
NatSpecMultiLine
functionDelegateCall
function functionDelegateCall( address target, bytes memory data, string memory errorMessage ) internal returns (bytes memory) { require(isContract(target), "Address: delegate call to non-contract"); (bool success, bytes memory returndata) = target.delegatecall(data); return verifyCallResult(success, returndata, errorMessage); }
/** * @dev Same as {xref-Address-functionCall-address-bytes-string-}[`functionCall`], * but performing a delegate call. * * _Available since v3.4._ */
NatSpecMultiLine
v0.8.3+commit.8d00100c
MIT
ipfs://1f710d8bcd8966b315557e51d40efc2bd775afde93afea26f8386cf10b49aa6f
{ "func_code_index": [ 6594, 6995 ] }
57,747
SlammaJamma
SlammaJamma.sol
0x2aa1c5306f0212e23f2950ecb8464eefb169456d
Solidity
Address
library Address { /** * @dev Returns true if `account` is a contract. * * [IMPORTANT] * ==== * It is unsafe to assume that an address for which this function returns * false is an externally-owned account (EOA) and not a contract. * * Among others, `isContract` will return false for the following * types of addresses: * * - an externally-owned account * - a contract in construction * - an address where a contract will be created * - an address where a contract lived, but was destroyed * ==== */ function isContract(address account) internal view returns (bool) { // This method relies on extcodesize, which returns 0 for contracts in // construction, since the code is only stored at the end of the // constructor execution. uint256 size; assembly { size := extcodesize(account) } return size > 0; } /** * @dev Replacement for Solidity's `transfer`: sends `amount` wei to * `recipient`, forwarding all available gas and reverting on errors. * * https://eips.ethereum.org/EIPS/eip-1884[EIP1884] increases the gas cost * of certain opcodes, possibly making contracts go over the 2300 gas limit * imposed by `transfer`, making them unable to receive funds via * `transfer`. {sendValue} removes this limitation. * * https://diligence.consensys.net/posts/2019/09/stop-using-soliditys-transfer-now/[Learn more]. * * IMPORTANT: because control is transferred to `recipient`, care must be * taken to not create reentrancy vulnerabilities. Consider using * {ReentrancyGuard} or the * https://solidity.readthedocs.io/en/v0.5.11/security-considerations.html#use-the-checks-effects-interactions-pattern[checks-effects-interactions pattern]. */ function sendValue(address payable recipient, uint256 amount) internal { require(address(this).balance >= amount, "Address: insufficient balance"); (bool success, ) = recipient.call{value: amount}(""); require(success, "Address: unable to send value, recipient may have reverted"); } /** * @dev Performs a Solidity function call using a low level `call`. A * plain `call` is an unsafe replacement for a function call: use this * function instead. * * If `target` reverts with a revert reason, it is bubbled up by this * function (like regular Solidity function calls). * * Returns the raw returned data. To convert to the expected return value, * use https://solidity.readthedocs.io/en/latest/units-and-global-variables.html?highlight=abi.decode#abi-encoding-and-decoding-functions[`abi.decode`]. * * Requirements: * * - `target` must be a contract. * - calling `target` with `data` must not revert. * * _Available since v3.1._ */ function functionCall(address target, bytes memory data) internal returns (bytes memory) { return functionCall(target, data, "Address: low-level call failed"); } /** * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`], but with * `errorMessage` as a fallback revert reason when `target` reverts. * * _Available since v3.1._ */ function functionCall( address target, bytes memory data, string memory errorMessage ) internal returns (bytes memory) { return functionCallWithValue(target, data, 0, errorMessage); } /** * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`], * but also transferring `value` wei to `target`. * * Requirements: * * - the calling contract must have an ETH balance of at least `value`. * - the called Solidity function must be `payable`. * * _Available since v3.1._ */ function functionCallWithValue( address target, bytes memory data, uint256 value ) internal returns (bytes memory) { return functionCallWithValue(target, data, value, "Address: low-level call with value failed"); } /** * @dev Same as {xref-Address-functionCallWithValue-address-bytes-uint256-}[`functionCallWithValue`], but * with `errorMessage` as a fallback revert reason when `target` reverts. * * _Available since v3.1._ */ function functionCallWithValue( address target, bytes memory data, uint256 value, string memory errorMessage ) internal returns (bytes memory) { require(address(this).balance >= value, "Address: insufficient balance for call"); require(isContract(target), "Address: call to non-contract"); (bool success, bytes memory returndata) = target.call{value: value}(data); return verifyCallResult(success, returndata, errorMessage); } /** * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`], * but performing a static call. * * _Available since v3.3._ */ function functionStaticCall(address target, bytes memory data) internal view returns (bytes memory) { return functionStaticCall(target, data, "Address: low-level static call failed"); } /** * @dev Same as {xref-Address-functionCall-address-bytes-string-}[`functionCall`], * but performing a static call. * * _Available since v3.3._ */ function functionStaticCall( address target, bytes memory data, string memory errorMessage ) internal view returns (bytes memory) { require(isContract(target), "Address: static call to non-contract"); (bool success, bytes memory returndata) = target.staticcall(data); return verifyCallResult(success, returndata, errorMessage); } /** * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`], * but performing a delegate call. * * _Available since v3.4._ */ function functionDelegateCall(address target, bytes memory data) internal returns (bytes memory) { return functionDelegateCall(target, data, "Address: low-level delegate call failed"); } /** * @dev Same as {xref-Address-functionCall-address-bytes-string-}[`functionCall`], * but performing a delegate call. * * _Available since v3.4._ */ function functionDelegateCall( address target, bytes memory data, string memory errorMessage ) internal returns (bytes memory) { require(isContract(target), "Address: delegate call to non-contract"); (bool success, bytes memory returndata) = target.delegatecall(data); return verifyCallResult(success, returndata, errorMessage); } /** * @dev Tool to verifies that a low level call was successful, and revert if it wasn't, either by bubbling the * revert reason using the provided one. * * _Available since v4.3._ */ function verifyCallResult( bool success, bytes memory returndata, string memory errorMessage ) internal pure returns (bytes memory) { if (success) { return returndata; } else { // Look for revert reason and bubble it up if present if (returndata.length > 0) { // The easiest way to bubble the revert reason is using memory via assembly assembly { let returndata_size := mload(returndata) revert(add(32, returndata), returndata_size) } } else { revert(errorMessage); } } } }
/** * @dev Collection of functions related to the address type */
NatSpecMultiLine
verifyCallResult
function verifyCallResult( bool success, bytes memory returndata, string memory errorMessage ) internal pure returns (bytes memory) { if (success) { return returndata; } else { // Look for revert reason and bubble it up if present if (returndata.length > 0) { // The easiest way to bubble the revert reason is using memory via assembly assembly { let returndata_size := mload(returndata) revert(add(32, returndata), returndata_size) } } else { revert(errorMessage); } } }
/** * @dev Tool to verifies that a low level call was successful, and revert if it wasn't, either by bubbling the * revert reason using the provided one. * * _Available since v4.3._ */
NatSpecMultiLine
v0.8.3+commit.8d00100c
MIT
ipfs://1f710d8bcd8966b315557e51d40efc2bd775afde93afea26f8386cf10b49aa6f
{ "func_code_index": [ 7218, 7935 ] }
57,748
SlammaJamma
SlammaJamma.sol
0x2aa1c5306f0212e23f2950ecb8464eefb169456d
Solidity
ERC165
abstract contract ERC165 is IERC165 { /** * @dev See {IERC165-supportsInterface}. */ function supportsInterface(bytes4 interfaceId) public view virtual override returns (bool) { return interfaceId == type(IERC165).interfaceId; } }
/** * @dev Implementation of the {IERC165} interface. * * Contracts that want to implement ERC165 should inherit from this contract and override {supportsInterface} to check * for the additional interface id that will be supported. For example: * * ```solidity * function supportsInterface(bytes4 interfaceId) public view virtual override returns (bool) { * return interfaceId == type(MyInterface).interfaceId || super.supportsInterface(interfaceId); * } * ``` * * Alternatively, {ERC165Storage} provides an easier to use but more expensive implementation. */
NatSpecMultiLine
supportsInterface
function supportsInterface(bytes4 interfaceId) public view virtual override returns (bool) { return interfaceId == type(IERC165).interfaceId; }
/** * @dev See {IERC165-supportsInterface}. */
NatSpecMultiLine
v0.8.3+commit.8d00100c
MIT
ipfs://1f710d8bcd8966b315557e51d40efc2bd775afde93afea26f8386cf10b49aa6f
{ "func_code_index": [ 103, 265 ] }
57,749
SlammaJamma
SlammaJamma.sol
0x2aa1c5306f0212e23f2950ecb8464eefb169456d
Solidity
ERC721
contract ERC721 is Context, ERC165, IERC721, IERC721Metadata { using Address for address; using Strings for uint256; // Token name string private _name; // Token symbol string private _symbol; // Mapping from token ID to owner address mapping(uint256 => address) private _owners; // Mapping owner address to token count mapping(address => uint256) private _balances; // Mapping from token ID to approved address mapping(uint256 => address) private _tokenApprovals; // Mapping from owner to operator approvals mapping(address => mapping(address => bool)) private _operatorApprovals; /** * @dev Initializes the contract by setting a `name` and a `symbol` to the token collection. */ constructor(string memory name_, string memory symbol_) { _name = name_; _symbol = symbol_; } /** * @dev See {IERC165-supportsInterface}. */ function supportsInterface(bytes4 interfaceId) public view virtual override(ERC165, IERC165) returns (bool) { return interfaceId == type(IERC721).interfaceId || interfaceId == type(IERC721Metadata).interfaceId || super.supportsInterface(interfaceId); } /** * @dev See {IERC721-balanceOf}. */ function balanceOf(address owner) public view virtual override returns (uint256) { require(owner != address(0), "ERC721: balance query for the zero address"); return _balances[owner]; } /** * @dev See {IERC721-ownerOf}. */ function ownerOf(uint256 tokenId) public view virtual override returns (address) { address owner = _owners[tokenId]; require(owner != address(0), "ERC721: owner query for nonexistent token"); return owner; } /** * @dev See {IERC721Metadata-name}. */ function name() public view virtual override returns (string memory) { return _name; } /** * @dev See {IERC721Metadata-symbol}. */ function symbol() public view virtual override returns (string memory) { return _symbol; } /** * @dev See {IERC721Metadata-tokenURI}. */ function tokenURI(uint256 tokenId) public view virtual override returns (string memory) { require(_exists(tokenId), "ERC721Metadata: URI query for nonexistent token"); string memory baseURI = _baseURI(); return bytes(baseURI).length > 0 ? string(abi.encodePacked(baseURI, tokenId.toString())) : ""; } /** * @dev Base URI for computing {tokenURI}. If set, the resulting URI for each * token will be the concatenation of the `baseURI` and the `tokenId`. Empty * by default, can be overriden in child contracts. */ function _baseURI() internal view virtual returns (string memory) { return ""; } /** * @dev See {IERC721-approve}. */ function approve(address to, uint256 tokenId) public virtual override { address owner = ERC721.ownerOf(tokenId); require(to != owner, "ERC721: approval to current owner"); require( _msgSender() == owner || isApprovedForAll(owner, _msgSender()), "ERC721: approve caller is not owner nor approved for all" ); _approve(to, tokenId); } /** * @dev 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]; } /** * @dev See {IERC721-setApprovalForAll}. */ function setApprovalForAll(address operator, bool approved) public virtual override { require(operator != _msgSender(), "ERC721: approve to caller"); _operatorApprovals[_msgSender()][operator] = approved; emit ApprovalForAll(_msgSender(), operator, approved); } /** * @dev See {IERC721-isApprovedForAll}. */ function isApprovedForAll(address owner, address operator) public view virtual override returns (bool) { return _operatorApprovals[owner][operator]; } /** * @dev See {IERC721-transferFrom}. */ function transferFrom( address from, address to, uint256 tokenId ) public virtual override { //solhint-disable-next-line max-line-length require(_isApprovedOrOwner(_msgSender(), tokenId), "ERC721: transfer caller is not owner nor approved"); _transfer(from, to, tokenId); } /** * @dev See {IERC721-safeTransferFrom}. */ function safeTransferFrom( address from, address to, uint256 tokenId ) public virtual override { safeTransferFrom(from, to, tokenId, ""); } /** * @dev See {IERC721-safeTransferFrom}. */ function safeTransferFrom( address from, address to, uint256 tokenId, bytes memory _data ) public virtual override { require(_isApprovedOrOwner(_msgSender(), tokenId), "ERC721: transfer caller is not owner nor approved"); _safeTransfer(from, to, tokenId, _data); } /** * @dev Safely transfers `tokenId` token from `from` to `to`, checking first that contract recipients * are aware of the ERC721 protocol to prevent tokens from being forever locked. * * `_data` is additional data, it has no specified format and it is sent in call to `to`. * * This internal function is equivalent to {safeTransferFrom}, and can be used to e.g. * implement alternative mechanisms to perform token transfer, such as signature-based. * * Requirements: * * - `from` cannot be the zero address. * - `to` cannot be the zero address. * - `tokenId` token must exist and be owned by `from`. * - If `to` refers to a smart contract, it must implement {IERC721Receiver-onERC721Received}, which is called upon a safe transfer. * * Emits a {Transfer} event. */ function _safeTransfer( address from, address to, uint256 tokenId, bytes memory _data ) internal virtual { _transfer(from, to, tokenId); require(_checkOnERC721Received(from, to, tokenId, _data), "ERC721: transfer to non ERC721Receiver implementer"); } /** * @dev Returns whether `tokenId` exists. * * Tokens can be managed by their owner or approved accounts via {approve} or {setApprovalForAll}. * * Tokens start existing when they are minted (`_mint`), * and stop existing when they are burned (`_burn`). */ function _exists(uint256 tokenId) internal view virtual returns (bool) { return _owners[tokenId] != address(0); } /** * @dev Returns whether `spender` is allowed to manage `tokenId`. * * Requirements: * * - `tokenId` must exist. */ function _isApprovedOrOwner(address spender, uint256 tokenId) internal view virtual returns (bool) { require(_exists(tokenId), "ERC721: operator query for nonexistent token"); address owner = ERC721.ownerOf(tokenId); return (spender == owner || getApproved(tokenId) == spender || isApprovedForAll(owner, spender)); } /** * @dev Safely mints `tokenId` and transfers it to `to`. * * Requirements: * * - `tokenId` must not exist. * - If `to` refers to a smart contract, it must implement {IERC721Receiver-onERC721Received}, which is called upon a safe transfer. * * Emits a {Transfer} event. */ function _safeMint(address to, uint256 tokenId) internal virtual { _safeMint(to, tokenId, ""); } /** * @dev Same as {xref-ERC721-_safeMint-address-uint256-}[`_safeMint`], with an additional `data` parameter which is * forwarded 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" ); } /** * @dev Mints `tokenId` and transfers it to `to`. * * WARNING: Usage of this method is discouraged, use {_safeMint} whenever possible * * Requirements: * * - `tokenId` must not exist. * - `to` cannot be the zero address. * * Emits a {Transfer} event. */ function _mint(address to, uint256 tokenId) internal virtual { require(to != address(0), "ERC721: mint to the zero address"); require(!_exists(tokenId), "ERC721: token already minted"); _beforeTokenTransfer(address(0), to, tokenId); _balances[to] += 1; _owners[tokenId] = to; emit Transfer(address(0), to, tokenId); } /** * @dev Destroys `tokenId`. * The approval is cleared when the token is burned. * * Requirements: * * - `tokenId` must exist. * * Emits a {Transfer} event. */ function _burn(uint256 tokenId) internal virtual { address owner = ERC721.ownerOf(tokenId); _beforeTokenTransfer(owner, address(0), tokenId); // Clear approvals _approve(address(0), tokenId); _balances[owner] -= 1; delete _owners[tokenId]; emit Transfer(owner, address(0), tokenId); } /** * @dev Transfers `tokenId` from `from` to `to`. * As opposed to {transferFrom}, this imposes no restrictions on msg.sender. * * Requirements: * * - `to` cannot be the zero address. * - `tokenId` token must be owned by `from`. * * Emits a {Transfer} event. */ function _transfer( address from, address to, uint256 tokenId ) internal virtual { require(ERC721.ownerOf(tokenId) == from, "ERC721: transfer of token that is not own"); require(to != address(0), "ERC721: transfer to the zero address"); _beforeTokenTransfer(from, to, tokenId); // Clear approvals from the previous owner _approve(address(0), tokenId); _balances[from] -= 1; _balances[to] += 1; _owners[tokenId] = to; emit Transfer(from, to, tokenId); } /** * @dev Approve `to` to operate on `tokenId` * * Emits a {Approval} event. */ function _approve(address to, uint256 tokenId) internal virtual { _tokenApprovals[tokenId] = to; emit Approval(ERC721.ownerOf(tokenId), to, tokenId); } /** * @dev Internal function to invoke {IERC721Receiver-onERC721Received} on a target address. * The call is not executed if the target address is not a contract. * * @param from address representing the previous owner of the given token ID * @param to target address that will receive the tokens * @param tokenId uint256 ID of the token to be transferred * @param _data bytes optional data to send along with the call * @return bool whether the call correctly returned the expected magic value */ function _checkOnERC721Received( address from, address to, uint256 tokenId, bytes memory _data ) private returns (bool) { if (to.isContract()) { try IERC721Receiver(to).onERC721Received(_msgSender(), from, tokenId, _data) returns (bytes4 retval) { return retval == IERC721Receiver.onERC721Received.selector; } catch (bytes memory reason) { if (reason.length == 0) { revert("ERC721: transfer to non ERC721Receiver implementer"); } else { assembly { revert(add(32, reason), mload(reason)) } } } } else { return true; } } /** * @dev Hook that is called before any token transfer. This includes minting * and burning. * * Calling conditions: * * - When `from` and `to` are both non-zero, ``from``'s `tokenId` will be * transferred to `to`. * - When `from` is zero, `tokenId` will be minted for `to`. * - When `to` is zero, ``from``'s `tokenId` will be burned. * - `from` and `to` are never both zero. * * To learn more about hooks, head to xref:ROOT:extending-contracts.adoc#using-hooks[Using Hooks]. */ function _beforeTokenTransfer( address from, address to, uint256 tokenId ) internal virtual {} }
/** * @dev Implementation of https://eips.ethereum.org/EIPS/eip-721[ERC721] Non-Fungible Token Standard, including * the Metadata extension, but not including the Enumerable extension, which is available separately as * {ERC721Enumerable}. */
NatSpecMultiLine
supportsInterface
function supportsInterface(bytes4 interfaceId) public view virtual override(ERC165, IERC165) returns (bool) { return interfaceId == type(IERC721).interfaceId || interfaceId == type(IERC721Metadata).interfaceId || super.supportsInterface(interfaceId); }
/** * @dev See {IERC165-supportsInterface}. */
NatSpecMultiLine
v0.8.3+commit.8d00100c
MIT
ipfs://1f710d8bcd8966b315557e51d40efc2bd775afde93afea26f8386cf10b49aa6f
{ "func_code_index": [ 971, 1281 ] }
57,750
SlammaJamma
SlammaJamma.sol
0x2aa1c5306f0212e23f2950ecb8464eefb169456d
Solidity
ERC721
contract ERC721 is Context, ERC165, IERC721, IERC721Metadata { using Address for address; using Strings for uint256; // Token name string private _name; // Token symbol string private _symbol; // Mapping from token ID to owner address mapping(uint256 => address) private _owners; // Mapping owner address to token count mapping(address => uint256) private _balances; // Mapping from token ID to approved address mapping(uint256 => address) private _tokenApprovals; // Mapping from owner to operator approvals mapping(address => mapping(address => bool)) private _operatorApprovals; /** * @dev Initializes the contract by setting a `name` and a `symbol` to the token collection. */ constructor(string memory name_, string memory symbol_) { _name = name_; _symbol = symbol_; } /** * @dev See {IERC165-supportsInterface}. */ function supportsInterface(bytes4 interfaceId) public view virtual override(ERC165, IERC165) returns (bool) { return interfaceId == type(IERC721).interfaceId || interfaceId == type(IERC721Metadata).interfaceId || super.supportsInterface(interfaceId); } /** * @dev See {IERC721-balanceOf}. */ function balanceOf(address owner) public view virtual override returns (uint256) { require(owner != address(0), "ERC721: balance query for the zero address"); return _balances[owner]; } /** * @dev See {IERC721-ownerOf}. */ function ownerOf(uint256 tokenId) public view virtual override returns (address) { address owner = _owners[tokenId]; require(owner != address(0), "ERC721: owner query for nonexistent token"); return owner; } /** * @dev See {IERC721Metadata-name}. */ function name() public view virtual override returns (string memory) { return _name; } /** * @dev See {IERC721Metadata-symbol}. */ function symbol() public view virtual override returns (string memory) { return _symbol; } /** * @dev See {IERC721Metadata-tokenURI}. */ function tokenURI(uint256 tokenId) public view virtual override returns (string memory) { require(_exists(tokenId), "ERC721Metadata: URI query for nonexistent token"); string memory baseURI = _baseURI(); return bytes(baseURI).length > 0 ? string(abi.encodePacked(baseURI, tokenId.toString())) : ""; } /** * @dev Base URI for computing {tokenURI}. If set, the resulting URI for each * token will be the concatenation of the `baseURI` and the `tokenId`. Empty * by default, can be overriden in child contracts. */ function _baseURI() internal view virtual returns (string memory) { return ""; } /** * @dev See {IERC721-approve}. */ function approve(address to, uint256 tokenId) public virtual override { address owner = ERC721.ownerOf(tokenId); require(to != owner, "ERC721: approval to current owner"); require( _msgSender() == owner || isApprovedForAll(owner, _msgSender()), "ERC721: approve caller is not owner nor approved for all" ); _approve(to, tokenId); } /** * @dev 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]; } /** * @dev See {IERC721-setApprovalForAll}. */ function setApprovalForAll(address operator, bool approved) public virtual override { require(operator != _msgSender(), "ERC721: approve to caller"); _operatorApprovals[_msgSender()][operator] = approved; emit ApprovalForAll(_msgSender(), operator, approved); } /** * @dev See {IERC721-isApprovedForAll}. */ function isApprovedForAll(address owner, address operator) public view virtual override returns (bool) { return _operatorApprovals[owner][operator]; } /** * @dev See {IERC721-transferFrom}. */ function transferFrom( address from, address to, uint256 tokenId ) public virtual override { //solhint-disable-next-line max-line-length require(_isApprovedOrOwner(_msgSender(), tokenId), "ERC721: transfer caller is not owner nor approved"); _transfer(from, to, tokenId); } /** * @dev See {IERC721-safeTransferFrom}. */ function safeTransferFrom( address from, address to, uint256 tokenId ) public virtual override { safeTransferFrom(from, to, tokenId, ""); } /** * @dev See {IERC721-safeTransferFrom}. */ function safeTransferFrom( address from, address to, uint256 tokenId, bytes memory _data ) public virtual override { require(_isApprovedOrOwner(_msgSender(), tokenId), "ERC721: transfer caller is not owner nor approved"); _safeTransfer(from, to, tokenId, _data); } /** * @dev Safely transfers `tokenId` token from `from` to `to`, checking first that contract recipients * are aware of the ERC721 protocol to prevent tokens from being forever locked. * * `_data` is additional data, it has no specified format and it is sent in call to `to`. * * This internal function is equivalent to {safeTransferFrom}, and can be used to e.g. * implement alternative mechanisms to perform token transfer, such as signature-based. * * Requirements: * * - `from` cannot be the zero address. * - `to` cannot be the zero address. * - `tokenId` token must exist and be owned by `from`. * - If `to` refers to a smart contract, it must implement {IERC721Receiver-onERC721Received}, which is called upon a safe transfer. * * Emits a {Transfer} event. */ function _safeTransfer( address from, address to, uint256 tokenId, bytes memory _data ) internal virtual { _transfer(from, to, tokenId); require(_checkOnERC721Received(from, to, tokenId, _data), "ERC721: transfer to non ERC721Receiver implementer"); } /** * @dev Returns whether `tokenId` exists. * * Tokens can be managed by their owner or approved accounts via {approve} or {setApprovalForAll}. * * Tokens start existing when they are minted (`_mint`), * and stop existing when they are burned (`_burn`). */ function _exists(uint256 tokenId) internal view virtual returns (bool) { return _owners[tokenId] != address(0); } /** * @dev Returns whether `spender` is allowed to manage `tokenId`. * * Requirements: * * - `tokenId` must exist. */ function _isApprovedOrOwner(address spender, uint256 tokenId) internal view virtual returns (bool) { require(_exists(tokenId), "ERC721: operator query for nonexistent token"); address owner = ERC721.ownerOf(tokenId); return (spender == owner || getApproved(tokenId) == spender || isApprovedForAll(owner, spender)); } /** * @dev Safely mints `tokenId` and transfers it to `to`. * * Requirements: * * - `tokenId` must not exist. * - If `to` refers to a smart contract, it must implement {IERC721Receiver-onERC721Received}, which is called upon a safe transfer. * * Emits a {Transfer} event. */ function _safeMint(address to, uint256 tokenId) internal virtual { _safeMint(to, tokenId, ""); } /** * @dev Same as {xref-ERC721-_safeMint-address-uint256-}[`_safeMint`], with an additional `data` parameter which is * forwarded 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" ); } /** * @dev Mints `tokenId` and transfers it to `to`. * * WARNING: Usage of this method is discouraged, use {_safeMint} whenever possible * * Requirements: * * - `tokenId` must not exist. * - `to` cannot be the zero address. * * Emits a {Transfer} event. */ function _mint(address to, uint256 tokenId) internal virtual { require(to != address(0), "ERC721: mint to the zero address"); require(!_exists(tokenId), "ERC721: token already minted"); _beforeTokenTransfer(address(0), to, tokenId); _balances[to] += 1; _owners[tokenId] = to; emit Transfer(address(0), to, tokenId); } /** * @dev Destroys `tokenId`. * The approval is cleared when the token is burned. * * Requirements: * * - `tokenId` must exist. * * Emits a {Transfer} event. */ function _burn(uint256 tokenId) internal virtual { address owner = ERC721.ownerOf(tokenId); _beforeTokenTransfer(owner, address(0), tokenId); // Clear approvals _approve(address(0), tokenId); _balances[owner] -= 1; delete _owners[tokenId]; emit Transfer(owner, address(0), tokenId); } /** * @dev Transfers `tokenId` from `from` to `to`. * As opposed to {transferFrom}, this imposes no restrictions on msg.sender. * * Requirements: * * - `to` cannot be the zero address. * - `tokenId` token must be owned by `from`. * * Emits a {Transfer} event. */ function _transfer( address from, address to, uint256 tokenId ) internal virtual { require(ERC721.ownerOf(tokenId) == from, "ERC721: transfer of token that is not own"); require(to != address(0), "ERC721: transfer to the zero address"); _beforeTokenTransfer(from, to, tokenId); // Clear approvals from the previous owner _approve(address(0), tokenId); _balances[from] -= 1; _balances[to] += 1; _owners[tokenId] = to; emit Transfer(from, to, tokenId); } /** * @dev Approve `to` to operate on `tokenId` * * Emits a {Approval} event. */ function _approve(address to, uint256 tokenId) internal virtual { _tokenApprovals[tokenId] = to; emit Approval(ERC721.ownerOf(tokenId), to, tokenId); } /** * @dev Internal function to invoke {IERC721Receiver-onERC721Received} on a target address. * The call is not executed if the target address is not a contract. * * @param from address representing the previous owner of the given token ID * @param to target address that will receive the tokens * @param tokenId uint256 ID of the token to be transferred * @param _data bytes optional data to send along with the call * @return bool whether the call correctly returned the expected magic value */ function _checkOnERC721Received( address from, address to, uint256 tokenId, bytes memory _data ) private returns (bool) { if (to.isContract()) { try IERC721Receiver(to).onERC721Received(_msgSender(), from, tokenId, _data) returns (bytes4 retval) { return retval == IERC721Receiver.onERC721Received.selector; } catch (bytes memory reason) { if (reason.length == 0) { revert("ERC721: transfer to non ERC721Receiver implementer"); } else { assembly { revert(add(32, reason), mload(reason)) } } } } else { return true; } } /** * @dev Hook that is called before any token transfer. This includes minting * and burning. * * Calling conditions: * * - When `from` and `to` are both non-zero, ``from``'s `tokenId` will be * transferred to `to`. * - When `from` is zero, `tokenId` will be minted for `to`. * - When `to` is zero, ``from``'s `tokenId` will be burned. * - `from` and `to` are never both zero. * * To learn more about hooks, head to xref:ROOT:extending-contracts.adoc#using-hooks[Using Hooks]. */ function _beforeTokenTransfer( address from, address to, uint256 tokenId ) internal virtual {} }
/** * @dev Implementation of https://eips.ethereum.org/EIPS/eip-721[ERC721] Non-Fungible Token Standard, including * the Metadata extension, but not including the Enumerable extension, which is available separately as * {ERC721Enumerable}. */
NatSpecMultiLine
balanceOf
function balanceOf(address owner) public view virtual override returns (uint256) { require(owner != address(0), "ERC721: balance query for the zero address"); return _balances[owner]; }
/** * @dev See {IERC721-balanceOf}. */
NatSpecMultiLine
v0.8.3+commit.8d00100c
MIT
ipfs://1f710d8bcd8966b315557e51d40efc2bd775afde93afea26f8386cf10b49aa6f
{ "func_code_index": [ 1340, 1553 ] }
57,751
SlammaJamma
SlammaJamma.sol
0x2aa1c5306f0212e23f2950ecb8464eefb169456d
Solidity
ERC721
contract ERC721 is Context, ERC165, IERC721, IERC721Metadata { using Address for address; using Strings for uint256; // Token name string private _name; // Token symbol string private _symbol; // Mapping from token ID to owner address mapping(uint256 => address) private _owners; // Mapping owner address to token count mapping(address => uint256) private _balances; // Mapping from token ID to approved address mapping(uint256 => address) private _tokenApprovals; // Mapping from owner to operator approvals mapping(address => mapping(address => bool)) private _operatorApprovals; /** * @dev Initializes the contract by setting a `name` and a `symbol` to the token collection. */ constructor(string memory name_, string memory symbol_) { _name = name_; _symbol = symbol_; } /** * @dev See {IERC165-supportsInterface}. */ function supportsInterface(bytes4 interfaceId) public view virtual override(ERC165, IERC165) returns (bool) { return interfaceId == type(IERC721).interfaceId || interfaceId == type(IERC721Metadata).interfaceId || super.supportsInterface(interfaceId); } /** * @dev See {IERC721-balanceOf}. */ function balanceOf(address owner) public view virtual override returns (uint256) { require(owner != address(0), "ERC721: balance query for the zero address"); return _balances[owner]; } /** * @dev See {IERC721-ownerOf}. */ function ownerOf(uint256 tokenId) public view virtual override returns (address) { address owner = _owners[tokenId]; require(owner != address(0), "ERC721: owner query for nonexistent token"); return owner; } /** * @dev See {IERC721Metadata-name}. */ function name() public view virtual override returns (string memory) { return _name; } /** * @dev See {IERC721Metadata-symbol}. */ function symbol() public view virtual override returns (string memory) { return _symbol; } /** * @dev See {IERC721Metadata-tokenURI}. */ function tokenURI(uint256 tokenId) public view virtual override returns (string memory) { require(_exists(tokenId), "ERC721Metadata: URI query for nonexistent token"); string memory baseURI = _baseURI(); return bytes(baseURI).length > 0 ? string(abi.encodePacked(baseURI, tokenId.toString())) : ""; } /** * @dev Base URI for computing {tokenURI}. If set, the resulting URI for each * token will be the concatenation of the `baseURI` and the `tokenId`. Empty * by default, can be overriden in child contracts. */ function _baseURI() internal view virtual returns (string memory) { return ""; } /** * @dev See {IERC721-approve}. */ function approve(address to, uint256 tokenId) public virtual override { address owner = ERC721.ownerOf(tokenId); require(to != owner, "ERC721: approval to current owner"); require( _msgSender() == owner || isApprovedForAll(owner, _msgSender()), "ERC721: approve caller is not owner nor approved for all" ); _approve(to, tokenId); } /** * @dev 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]; } /** * @dev See {IERC721-setApprovalForAll}. */ function setApprovalForAll(address operator, bool approved) public virtual override { require(operator != _msgSender(), "ERC721: approve to caller"); _operatorApprovals[_msgSender()][operator] = approved; emit ApprovalForAll(_msgSender(), operator, approved); } /** * @dev See {IERC721-isApprovedForAll}. */ function isApprovedForAll(address owner, address operator) public view virtual override returns (bool) { return _operatorApprovals[owner][operator]; } /** * @dev See {IERC721-transferFrom}. */ function transferFrom( address from, address to, uint256 tokenId ) public virtual override { //solhint-disable-next-line max-line-length require(_isApprovedOrOwner(_msgSender(), tokenId), "ERC721: transfer caller is not owner nor approved"); _transfer(from, to, tokenId); } /** * @dev See {IERC721-safeTransferFrom}. */ function safeTransferFrom( address from, address to, uint256 tokenId ) public virtual override { safeTransferFrom(from, to, tokenId, ""); } /** * @dev See {IERC721-safeTransferFrom}. */ function safeTransferFrom( address from, address to, uint256 tokenId, bytes memory _data ) public virtual override { require(_isApprovedOrOwner(_msgSender(), tokenId), "ERC721: transfer caller is not owner nor approved"); _safeTransfer(from, to, tokenId, _data); } /** * @dev Safely transfers `tokenId` token from `from` to `to`, checking first that contract recipients * are aware of the ERC721 protocol to prevent tokens from being forever locked. * * `_data` is additional data, it has no specified format and it is sent in call to `to`. * * This internal function is equivalent to {safeTransferFrom}, and can be used to e.g. * implement alternative mechanisms to perform token transfer, such as signature-based. * * Requirements: * * - `from` cannot be the zero address. * - `to` cannot be the zero address. * - `tokenId` token must exist and be owned by `from`. * - If `to` refers to a smart contract, it must implement {IERC721Receiver-onERC721Received}, which is called upon a safe transfer. * * Emits a {Transfer} event. */ function _safeTransfer( address from, address to, uint256 tokenId, bytes memory _data ) internal virtual { _transfer(from, to, tokenId); require(_checkOnERC721Received(from, to, tokenId, _data), "ERC721: transfer to non ERC721Receiver implementer"); } /** * @dev Returns whether `tokenId` exists. * * Tokens can be managed by their owner or approved accounts via {approve} or {setApprovalForAll}. * * Tokens start existing when they are minted (`_mint`), * and stop existing when they are burned (`_burn`). */ function _exists(uint256 tokenId) internal view virtual returns (bool) { return _owners[tokenId] != address(0); } /** * @dev Returns whether `spender` is allowed to manage `tokenId`. * * Requirements: * * - `tokenId` must exist. */ function _isApprovedOrOwner(address spender, uint256 tokenId) internal view virtual returns (bool) { require(_exists(tokenId), "ERC721: operator query for nonexistent token"); address owner = ERC721.ownerOf(tokenId); return (spender == owner || getApproved(tokenId) == spender || isApprovedForAll(owner, spender)); } /** * @dev Safely mints `tokenId` and transfers it to `to`. * * Requirements: * * - `tokenId` must not exist. * - If `to` refers to a smart contract, it must implement {IERC721Receiver-onERC721Received}, which is called upon a safe transfer. * * Emits a {Transfer} event. */ function _safeMint(address to, uint256 tokenId) internal virtual { _safeMint(to, tokenId, ""); } /** * @dev Same as {xref-ERC721-_safeMint-address-uint256-}[`_safeMint`], with an additional `data` parameter which is * forwarded 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" ); } /** * @dev Mints `tokenId` and transfers it to `to`. * * WARNING: Usage of this method is discouraged, use {_safeMint} whenever possible * * Requirements: * * - `tokenId` must not exist. * - `to` cannot be the zero address. * * Emits a {Transfer} event. */ function _mint(address to, uint256 tokenId) internal virtual { require(to != address(0), "ERC721: mint to the zero address"); require(!_exists(tokenId), "ERC721: token already minted"); _beforeTokenTransfer(address(0), to, tokenId); _balances[to] += 1; _owners[tokenId] = to; emit Transfer(address(0), to, tokenId); } /** * @dev Destroys `tokenId`. * The approval is cleared when the token is burned. * * Requirements: * * - `tokenId` must exist. * * Emits a {Transfer} event. */ function _burn(uint256 tokenId) internal virtual { address owner = ERC721.ownerOf(tokenId); _beforeTokenTransfer(owner, address(0), tokenId); // Clear approvals _approve(address(0), tokenId); _balances[owner] -= 1; delete _owners[tokenId]; emit Transfer(owner, address(0), tokenId); } /** * @dev Transfers `tokenId` from `from` to `to`. * As opposed to {transferFrom}, this imposes no restrictions on msg.sender. * * Requirements: * * - `to` cannot be the zero address. * - `tokenId` token must be owned by `from`. * * Emits a {Transfer} event. */ function _transfer( address from, address to, uint256 tokenId ) internal virtual { require(ERC721.ownerOf(tokenId) == from, "ERC721: transfer of token that is not own"); require(to != address(0), "ERC721: transfer to the zero address"); _beforeTokenTransfer(from, to, tokenId); // Clear approvals from the previous owner _approve(address(0), tokenId); _balances[from] -= 1; _balances[to] += 1; _owners[tokenId] = to; emit Transfer(from, to, tokenId); } /** * @dev Approve `to` to operate on `tokenId` * * Emits a {Approval} event. */ function _approve(address to, uint256 tokenId) internal virtual { _tokenApprovals[tokenId] = to; emit Approval(ERC721.ownerOf(tokenId), to, tokenId); } /** * @dev Internal function to invoke {IERC721Receiver-onERC721Received} on a target address. * The call is not executed if the target address is not a contract. * * @param from address representing the previous owner of the given token ID * @param to target address that will receive the tokens * @param tokenId uint256 ID of the token to be transferred * @param _data bytes optional data to send along with the call * @return bool whether the call correctly returned the expected magic value */ function _checkOnERC721Received( address from, address to, uint256 tokenId, bytes memory _data ) private returns (bool) { if (to.isContract()) { try IERC721Receiver(to).onERC721Received(_msgSender(), from, tokenId, _data) returns (bytes4 retval) { return retval == IERC721Receiver.onERC721Received.selector; } catch (bytes memory reason) { if (reason.length == 0) { revert("ERC721: transfer to non ERC721Receiver implementer"); } else { assembly { revert(add(32, reason), mload(reason)) } } } } else { return true; } } /** * @dev Hook that is called before any token transfer. This includes minting * and burning. * * Calling conditions: * * - When `from` and `to` are both non-zero, ``from``'s `tokenId` will be * transferred to `to`. * - When `from` is zero, `tokenId` will be minted for `to`. * - When `to` is zero, ``from``'s `tokenId` will be burned. * - `from` and `to` are never both zero. * * To learn more about hooks, head to xref:ROOT:extending-contracts.adoc#using-hooks[Using Hooks]. */ function _beforeTokenTransfer( address from, address to, uint256 tokenId ) internal virtual {} }
/** * @dev Implementation of https://eips.ethereum.org/EIPS/eip-721[ERC721] Non-Fungible Token Standard, including * the Metadata extension, but not including the Enumerable extension, which is available separately as * {ERC721Enumerable}. */
NatSpecMultiLine
ownerOf
function ownerOf(uint256 tokenId) public view virtual override returns (address) { address owner = _owners[tokenId]; require(owner != address(0), "ERC721: owner query for nonexistent token"); return owner; }
/** * @dev See {IERC721-ownerOf}. */
NatSpecMultiLine
v0.8.3+commit.8d00100c
MIT
ipfs://1f710d8bcd8966b315557e51d40efc2bd775afde93afea26f8386cf10b49aa6f
{ "func_code_index": [ 1610, 1854 ] }
57,752
SlammaJamma
SlammaJamma.sol
0x2aa1c5306f0212e23f2950ecb8464eefb169456d
Solidity
ERC721
contract ERC721 is Context, ERC165, IERC721, IERC721Metadata { using Address for address; using Strings for uint256; // Token name string private _name; // Token symbol string private _symbol; // Mapping from token ID to owner address mapping(uint256 => address) private _owners; // Mapping owner address to token count mapping(address => uint256) private _balances; // Mapping from token ID to approved address mapping(uint256 => address) private _tokenApprovals; // Mapping from owner to operator approvals mapping(address => mapping(address => bool)) private _operatorApprovals; /** * @dev Initializes the contract by setting a `name` and a `symbol` to the token collection. */ constructor(string memory name_, string memory symbol_) { _name = name_; _symbol = symbol_; } /** * @dev See {IERC165-supportsInterface}. */ function supportsInterface(bytes4 interfaceId) public view virtual override(ERC165, IERC165) returns (bool) { return interfaceId == type(IERC721).interfaceId || interfaceId == type(IERC721Metadata).interfaceId || super.supportsInterface(interfaceId); } /** * @dev See {IERC721-balanceOf}. */ function balanceOf(address owner) public view virtual override returns (uint256) { require(owner != address(0), "ERC721: balance query for the zero address"); return _balances[owner]; } /** * @dev See {IERC721-ownerOf}. */ function ownerOf(uint256 tokenId) public view virtual override returns (address) { address owner = _owners[tokenId]; require(owner != address(0), "ERC721: owner query for nonexistent token"); return owner; } /** * @dev See {IERC721Metadata-name}. */ function name() public view virtual override returns (string memory) { return _name; } /** * @dev See {IERC721Metadata-symbol}. */ function symbol() public view virtual override returns (string memory) { return _symbol; } /** * @dev See {IERC721Metadata-tokenURI}. */ function tokenURI(uint256 tokenId) public view virtual override returns (string memory) { require(_exists(tokenId), "ERC721Metadata: URI query for nonexistent token"); string memory baseURI = _baseURI(); return bytes(baseURI).length > 0 ? string(abi.encodePacked(baseURI, tokenId.toString())) : ""; } /** * @dev Base URI for computing {tokenURI}. If set, the resulting URI for each * token will be the concatenation of the `baseURI` and the `tokenId`. Empty * by default, can be overriden in child contracts. */ function _baseURI() internal view virtual returns (string memory) { return ""; } /** * @dev See {IERC721-approve}. */ function approve(address to, uint256 tokenId) public virtual override { address owner = ERC721.ownerOf(tokenId); require(to != owner, "ERC721: approval to current owner"); require( _msgSender() == owner || isApprovedForAll(owner, _msgSender()), "ERC721: approve caller is not owner nor approved for all" ); _approve(to, tokenId); } /** * @dev 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]; } /** * @dev See {IERC721-setApprovalForAll}. */ function setApprovalForAll(address operator, bool approved) public virtual override { require(operator != _msgSender(), "ERC721: approve to caller"); _operatorApprovals[_msgSender()][operator] = approved; emit ApprovalForAll(_msgSender(), operator, approved); } /** * @dev See {IERC721-isApprovedForAll}. */ function isApprovedForAll(address owner, address operator) public view virtual override returns (bool) { return _operatorApprovals[owner][operator]; } /** * @dev See {IERC721-transferFrom}. */ function transferFrom( address from, address to, uint256 tokenId ) public virtual override { //solhint-disable-next-line max-line-length require(_isApprovedOrOwner(_msgSender(), tokenId), "ERC721: transfer caller is not owner nor approved"); _transfer(from, to, tokenId); } /** * @dev See {IERC721-safeTransferFrom}. */ function safeTransferFrom( address from, address to, uint256 tokenId ) public virtual override { safeTransferFrom(from, to, tokenId, ""); } /** * @dev See {IERC721-safeTransferFrom}. */ function safeTransferFrom( address from, address to, uint256 tokenId, bytes memory _data ) public virtual override { require(_isApprovedOrOwner(_msgSender(), tokenId), "ERC721: transfer caller is not owner nor approved"); _safeTransfer(from, to, tokenId, _data); } /** * @dev Safely transfers `tokenId` token from `from` to `to`, checking first that contract recipients * are aware of the ERC721 protocol to prevent tokens from being forever locked. * * `_data` is additional data, it has no specified format and it is sent in call to `to`. * * This internal function is equivalent to {safeTransferFrom}, and can be used to e.g. * implement alternative mechanisms to perform token transfer, such as signature-based. * * Requirements: * * - `from` cannot be the zero address. * - `to` cannot be the zero address. * - `tokenId` token must exist and be owned by `from`. * - If `to` refers to a smart contract, it must implement {IERC721Receiver-onERC721Received}, which is called upon a safe transfer. * * Emits a {Transfer} event. */ function _safeTransfer( address from, address to, uint256 tokenId, bytes memory _data ) internal virtual { _transfer(from, to, tokenId); require(_checkOnERC721Received(from, to, tokenId, _data), "ERC721: transfer to non ERC721Receiver implementer"); } /** * @dev Returns whether `tokenId` exists. * * Tokens can be managed by their owner or approved accounts via {approve} or {setApprovalForAll}. * * Tokens start existing when they are minted (`_mint`), * and stop existing when they are burned (`_burn`). */ function _exists(uint256 tokenId) internal view virtual returns (bool) { return _owners[tokenId] != address(0); } /** * @dev Returns whether `spender` is allowed to manage `tokenId`. * * Requirements: * * - `tokenId` must exist. */ function _isApprovedOrOwner(address spender, uint256 tokenId) internal view virtual returns (bool) { require(_exists(tokenId), "ERC721: operator query for nonexistent token"); address owner = ERC721.ownerOf(tokenId); return (spender == owner || getApproved(tokenId) == spender || isApprovedForAll(owner, spender)); } /** * @dev Safely mints `tokenId` and transfers it to `to`. * * Requirements: * * - `tokenId` must not exist. * - If `to` refers to a smart contract, it must implement {IERC721Receiver-onERC721Received}, which is called upon a safe transfer. * * Emits a {Transfer} event. */ function _safeMint(address to, uint256 tokenId) internal virtual { _safeMint(to, tokenId, ""); } /** * @dev Same as {xref-ERC721-_safeMint-address-uint256-}[`_safeMint`], with an additional `data` parameter which is * forwarded 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" ); } /** * @dev Mints `tokenId` and transfers it to `to`. * * WARNING: Usage of this method is discouraged, use {_safeMint} whenever possible * * Requirements: * * - `tokenId` must not exist. * - `to` cannot be the zero address. * * Emits a {Transfer} event. */ function _mint(address to, uint256 tokenId) internal virtual { require(to != address(0), "ERC721: mint to the zero address"); require(!_exists(tokenId), "ERC721: token already minted"); _beforeTokenTransfer(address(0), to, tokenId); _balances[to] += 1; _owners[tokenId] = to; emit Transfer(address(0), to, tokenId); } /** * @dev Destroys `tokenId`. * The approval is cleared when the token is burned. * * Requirements: * * - `tokenId` must exist. * * Emits a {Transfer} event. */ function _burn(uint256 tokenId) internal virtual { address owner = ERC721.ownerOf(tokenId); _beforeTokenTransfer(owner, address(0), tokenId); // Clear approvals _approve(address(0), tokenId); _balances[owner] -= 1; delete _owners[tokenId]; emit Transfer(owner, address(0), tokenId); } /** * @dev Transfers `tokenId` from `from` to `to`. * As opposed to {transferFrom}, this imposes no restrictions on msg.sender. * * Requirements: * * - `to` cannot be the zero address. * - `tokenId` token must be owned by `from`. * * Emits a {Transfer} event. */ function _transfer( address from, address to, uint256 tokenId ) internal virtual { require(ERC721.ownerOf(tokenId) == from, "ERC721: transfer of token that is not own"); require(to != address(0), "ERC721: transfer to the zero address"); _beforeTokenTransfer(from, to, tokenId); // Clear approvals from the previous owner _approve(address(0), tokenId); _balances[from] -= 1; _balances[to] += 1; _owners[tokenId] = to; emit Transfer(from, to, tokenId); } /** * @dev Approve `to` to operate on `tokenId` * * Emits a {Approval} event. */ function _approve(address to, uint256 tokenId) internal virtual { _tokenApprovals[tokenId] = to; emit Approval(ERC721.ownerOf(tokenId), to, tokenId); } /** * @dev Internal function to invoke {IERC721Receiver-onERC721Received} on a target address. * The call is not executed if the target address is not a contract. * * @param from address representing the previous owner of the given token ID * @param to target address that will receive the tokens * @param tokenId uint256 ID of the token to be transferred * @param _data bytes optional data to send along with the call * @return bool whether the call correctly returned the expected magic value */ function _checkOnERC721Received( address from, address to, uint256 tokenId, bytes memory _data ) private returns (bool) { if (to.isContract()) { try IERC721Receiver(to).onERC721Received(_msgSender(), from, tokenId, _data) returns (bytes4 retval) { return retval == IERC721Receiver.onERC721Received.selector; } catch (bytes memory reason) { if (reason.length == 0) { revert("ERC721: transfer to non ERC721Receiver implementer"); } else { assembly { revert(add(32, reason), mload(reason)) } } } } else { return true; } } /** * @dev Hook that is called before any token transfer. This includes minting * and burning. * * Calling conditions: * * - When `from` and `to` are both non-zero, ``from``'s `tokenId` will be * transferred to `to`. * - When `from` is zero, `tokenId` will be minted for `to`. * - When `to` is zero, ``from``'s `tokenId` will be burned. * - `from` and `to` are never both zero. * * To learn more about hooks, head to xref:ROOT:extending-contracts.adoc#using-hooks[Using Hooks]. */ function _beforeTokenTransfer( address from, address to, uint256 tokenId ) internal virtual {} }
/** * @dev Implementation of https://eips.ethereum.org/EIPS/eip-721[ERC721] Non-Fungible Token Standard, including * the Metadata extension, but not including the Enumerable extension, which is available separately as * {ERC721Enumerable}. */
NatSpecMultiLine
name
function name() public view virtual override returns (string memory) { return _name; }
/** * @dev See {IERC721Metadata-name}. */
NatSpecMultiLine
v0.8.3+commit.8d00100c
MIT
ipfs://1f710d8bcd8966b315557e51d40efc2bd775afde93afea26f8386cf10b49aa6f
{ "func_code_index": [ 1916, 2021 ] }
57,753
SlammaJamma
SlammaJamma.sol
0x2aa1c5306f0212e23f2950ecb8464eefb169456d
Solidity
ERC721
contract ERC721 is Context, ERC165, IERC721, IERC721Metadata { using Address for address; using Strings for uint256; // Token name string private _name; // Token symbol string private _symbol; // Mapping from token ID to owner address mapping(uint256 => address) private _owners; // Mapping owner address to token count mapping(address => uint256) private _balances; // Mapping from token ID to approved address mapping(uint256 => address) private _tokenApprovals; // Mapping from owner to operator approvals mapping(address => mapping(address => bool)) private _operatorApprovals; /** * @dev Initializes the contract by setting a `name` and a `symbol` to the token collection. */ constructor(string memory name_, string memory symbol_) { _name = name_; _symbol = symbol_; } /** * @dev See {IERC165-supportsInterface}. */ function supportsInterface(bytes4 interfaceId) public view virtual override(ERC165, IERC165) returns (bool) { return interfaceId == type(IERC721).interfaceId || interfaceId == type(IERC721Metadata).interfaceId || super.supportsInterface(interfaceId); } /** * @dev See {IERC721-balanceOf}. */ function balanceOf(address owner) public view virtual override returns (uint256) { require(owner != address(0), "ERC721: balance query for the zero address"); return _balances[owner]; } /** * @dev See {IERC721-ownerOf}. */ function ownerOf(uint256 tokenId) public view virtual override returns (address) { address owner = _owners[tokenId]; require(owner != address(0), "ERC721: owner query for nonexistent token"); return owner; } /** * @dev See {IERC721Metadata-name}. */ function name() public view virtual override returns (string memory) { return _name; } /** * @dev See {IERC721Metadata-symbol}. */ function symbol() public view virtual override returns (string memory) { return _symbol; } /** * @dev See {IERC721Metadata-tokenURI}. */ function tokenURI(uint256 tokenId) public view virtual override returns (string memory) { require(_exists(tokenId), "ERC721Metadata: URI query for nonexistent token"); string memory baseURI = _baseURI(); return bytes(baseURI).length > 0 ? string(abi.encodePacked(baseURI, tokenId.toString())) : ""; } /** * @dev Base URI for computing {tokenURI}. If set, the resulting URI for each * token will be the concatenation of the `baseURI` and the `tokenId`. Empty * by default, can be overriden in child contracts. */ function _baseURI() internal view virtual returns (string memory) { return ""; } /** * @dev See {IERC721-approve}. */ function approve(address to, uint256 tokenId) public virtual override { address owner = ERC721.ownerOf(tokenId); require(to != owner, "ERC721: approval to current owner"); require( _msgSender() == owner || isApprovedForAll(owner, _msgSender()), "ERC721: approve caller is not owner nor approved for all" ); _approve(to, tokenId); } /** * @dev 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]; } /** * @dev See {IERC721-setApprovalForAll}. */ function setApprovalForAll(address operator, bool approved) public virtual override { require(operator != _msgSender(), "ERC721: approve to caller"); _operatorApprovals[_msgSender()][operator] = approved; emit ApprovalForAll(_msgSender(), operator, approved); } /** * @dev See {IERC721-isApprovedForAll}. */ function isApprovedForAll(address owner, address operator) public view virtual override returns (bool) { return _operatorApprovals[owner][operator]; } /** * @dev See {IERC721-transferFrom}. */ function transferFrom( address from, address to, uint256 tokenId ) public virtual override { //solhint-disable-next-line max-line-length require(_isApprovedOrOwner(_msgSender(), tokenId), "ERC721: transfer caller is not owner nor approved"); _transfer(from, to, tokenId); } /** * @dev See {IERC721-safeTransferFrom}. */ function safeTransferFrom( address from, address to, uint256 tokenId ) public virtual override { safeTransferFrom(from, to, tokenId, ""); } /** * @dev See {IERC721-safeTransferFrom}. */ function safeTransferFrom( address from, address to, uint256 tokenId, bytes memory _data ) public virtual override { require(_isApprovedOrOwner(_msgSender(), tokenId), "ERC721: transfer caller is not owner nor approved"); _safeTransfer(from, to, tokenId, _data); } /** * @dev Safely transfers `tokenId` token from `from` to `to`, checking first that contract recipients * are aware of the ERC721 protocol to prevent tokens from being forever locked. * * `_data` is additional data, it has no specified format and it is sent in call to `to`. * * This internal function is equivalent to {safeTransferFrom}, and can be used to e.g. * implement alternative mechanisms to perform token transfer, such as signature-based. * * Requirements: * * - `from` cannot be the zero address. * - `to` cannot be the zero address. * - `tokenId` token must exist and be owned by `from`. * - If `to` refers to a smart contract, it must implement {IERC721Receiver-onERC721Received}, which is called upon a safe transfer. * * Emits a {Transfer} event. */ function _safeTransfer( address from, address to, uint256 tokenId, bytes memory _data ) internal virtual { _transfer(from, to, tokenId); require(_checkOnERC721Received(from, to, tokenId, _data), "ERC721: transfer to non ERC721Receiver implementer"); } /** * @dev Returns whether `tokenId` exists. * * Tokens can be managed by their owner or approved accounts via {approve} or {setApprovalForAll}. * * Tokens start existing when they are minted (`_mint`), * and stop existing when they are burned (`_burn`). */ function _exists(uint256 tokenId) internal view virtual returns (bool) { return _owners[tokenId] != address(0); } /** * @dev Returns whether `spender` is allowed to manage `tokenId`. * * Requirements: * * - `tokenId` must exist. */ function _isApprovedOrOwner(address spender, uint256 tokenId) internal view virtual returns (bool) { require(_exists(tokenId), "ERC721: operator query for nonexistent token"); address owner = ERC721.ownerOf(tokenId); return (spender == owner || getApproved(tokenId) == spender || isApprovedForAll(owner, spender)); } /** * @dev Safely mints `tokenId` and transfers it to `to`. * * Requirements: * * - `tokenId` must not exist. * - If `to` refers to a smart contract, it must implement {IERC721Receiver-onERC721Received}, which is called upon a safe transfer. * * Emits a {Transfer} event. */ function _safeMint(address to, uint256 tokenId) internal virtual { _safeMint(to, tokenId, ""); } /** * @dev Same as {xref-ERC721-_safeMint-address-uint256-}[`_safeMint`], with an additional `data` parameter which is * forwarded 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" ); } /** * @dev Mints `tokenId` and transfers it to `to`. * * WARNING: Usage of this method is discouraged, use {_safeMint} whenever possible * * Requirements: * * - `tokenId` must not exist. * - `to` cannot be the zero address. * * Emits a {Transfer} event. */ function _mint(address to, uint256 tokenId) internal virtual { require(to != address(0), "ERC721: mint to the zero address"); require(!_exists(tokenId), "ERC721: token already minted"); _beforeTokenTransfer(address(0), to, tokenId); _balances[to] += 1; _owners[tokenId] = to; emit Transfer(address(0), to, tokenId); } /** * @dev Destroys `tokenId`. * The approval is cleared when the token is burned. * * Requirements: * * - `tokenId` must exist. * * Emits a {Transfer} event. */ function _burn(uint256 tokenId) internal virtual { address owner = ERC721.ownerOf(tokenId); _beforeTokenTransfer(owner, address(0), tokenId); // Clear approvals _approve(address(0), tokenId); _balances[owner] -= 1; delete _owners[tokenId]; emit Transfer(owner, address(0), tokenId); } /** * @dev Transfers `tokenId` from `from` to `to`. * As opposed to {transferFrom}, this imposes no restrictions on msg.sender. * * Requirements: * * - `to` cannot be the zero address. * - `tokenId` token must be owned by `from`. * * Emits a {Transfer} event. */ function _transfer( address from, address to, uint256 tokenId ) internal virtual { require(ERC721.ownerOf(tokenId) == from, "ERC721: transfer of token that is not own"); require(to != address(0), "ERC721: transfer to the zero address"); _beforeTokenTransfer(from, to, tokenId); // Clear approvals from the previous owner _approve(address(0), tokenId); _balances[from] -= 1; _balances[to] += 1; _owners[tokenId] = to; emit Transfer(from, to, tokenId); } /** * @dev Approve `to` to operate on `tokenId` * * Emits a {Approval} event. */ function _approve(address to, uint256 tokenId) internal virtual { _tokenApprovals[tokenId] = to; emit Approval(ERC721.ownerOf(tokenId), to, tokenId); } /** * @dev Internal function to invoke {IERC721Receiver-onERC721Received} on a target address. * The call is not executed if the target address is not a contract. * * @param from address representing the previous owner of the given token ID * @param to target address that will receive the tokens * @param tokenId uint256 ID of the token to be transferred * @param _data bytes optional data to send along with the call * @return bool whether the call correctly returned the expected magic value */ function _checkOnERC721Received( address from, address to, uint256 tokenId, bytes memory _data ) private returns (bool) { if (to.isContract()) { try IERC721Receiver(to).onERC721Received(_msgSender(), from, tokenId, _data) returns (bytes4 retval) { return retval == IERC721Receiver.onERC721Received.selector; } catch (bytes memory reason) { if (reason.length == 0) { revert("ERC721: transfer to non ERC721Receiver implementer"); } else { assembly { revert(add(32, reason), mload(reason)) } } } } else { return true; } } /** * @dev Hook that is called before any token transfer. This includes minting * and burning. * * Calling conditions: * * - When `from` and `to` are both non-zero, ``from``'s `tokenId` will be * transferred to `to`. * - When `from` is zero, `tokenId` will be minted for `to`. * - When `to` is zero, ``from``'s `tokenId` will be burned. * - `from` and `to` are never both zero. * * To learn more about hooks, head to xref:ROOT:extending-contracts.adoc#using-hooks[Using Hooks]. */ function _beforeTokenTransfer( address from, address to, uint256 tokenId ) internal virtual {} }
/** * @dev Implementation of https://eips.ethereum.org/EIPS/eip-721[ERC721] Non-Fungible Token Standard, including * the Metadata extension, but not including the Enumerable extension, which is available separately as * {ERC721Enumerable}. */
NatSpecMultiLine
symbol
function symbol() public view virtual override returns (string memory) { return _symbol; }
/** * @dev See {IERC721Metadata-symbol}. */
NatSpecMultiLine
v0.8.3+commit.8d00100c
MIT
ipfs://1f710d8bcd8966b315557e51d40efc2bd775afde93afea26f8386cf10b49aa6f
{ "func_code_index": [ 2085, 2194 ] }
57,754
SlammaJamma
SlammaJamma.sol
0x2aa1c5306f0212e23f2950ecb8464eefb169456d
Solidity
ERC721
contract ERC721 is Context, ERC165, IERC721, IERC721Metadata { using Address for address; using Strings for uint256; // Token name string private _name; // Token symbol string private _symbol; // Mapping from token ID to owner address mapping(uint256 => address) private _owners; // Mapping owner address to token count mapping(address => uint256) private _balances; // Mapping from token ID to approved address mapping(uint256 => address) private _tokenApprovals; // Mapping from owner to operator approvals mapping(address => mapping(address => bool)) private _operatorApprovals; /** * @dev Initializes the contract by setting a `name` and a `symbol` to the token collection. */ constructor(string memory name_, string memory symbol_) { _name = name_; _symbol = symbol_; } /** * @dev See {IERC165-supportsInterface}. */ function supportsInterface(bytes4 interfaceId) public view virtual override(ERC165, IERC165) returns (bool) { return interfaceId == type(IERC721).interfaceId || interfaceId == type(IERC721Metadata).interfaceId || super.supportsInterface(interfaceId); } /** * @dev See {IERC721-balanceOf}. */ function balanceOf(address owner) public view virtual override returns (uint256) { require(owner != address(0), "ERC721: balance query for the zero address"); return _balances[owner]; } /** * @dev See {IERC721-ownerOf}. */ function ownerOf(uint256 tokenId) public view virtual override returns (address) { address owner = _owners[tokenId]; require(owner != address(0), "ERC721: owner query for nonexistent token"); return owner; } /** * @dev See {IERC721Metadata-name}. */ function name() public view virtual override returns (string memory) { return _name; } /** * @dev See {IERC721Metadata-symbol}. */ function symbol() public view virtual override returns (string memory) { return _symbol; } /** * @dev See {IERC721Metadata-tokenURI}. */ function tokenURI(uint256 tokenId) public view virtual override returns (string memory) { require(_exists(tokenId), "ERC721Metadata: URI query for nonexistent token"); string memory baseURI = _baseURI(); return bytes(baseURI).length > 0 ? string(abi.encodePacked(baseURI, tokenId.toString())) : ""; } /** * @dev Base URI for computing {tokenURI}. If set, the resulting URI for each * token will be the concatenation of the `baseURI` and the `tokenId`. Empty * by default, can be overriden in child contracts. */ function _baseURI() internal view virtual returns (string memory) { return ""; } /** * @dev See {IERC721-approve}. */ function approve(address to, uint256 tokenId) public virtual override { address owner = ERC721.ownerOf(tokenId); require(to != owner, "ERC721: approval to current owner"); require( _msgSender() == owner || isApprovedForAll(owner, _msgSender()), "ERC721: approve caller is not owner nor approved for all" ); _approve(to, tokenId); } /** * @dev 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]; } /** * @dev See {IERC721-setApprovalForAll}. */ function setApprovalForAll(address operator, bool approved) public virtual override { require(operator != _msgSender(), "ERC721: approve to caller"); _operatorApprovals[_msgSender()][operator] = approved; emit ApprovalForAll(_msgSender(), operator, approved); } /** * @dev See {IERC721-isApprovedForAll}. */ function isApprovedForAll(address owner, address operator) public view virtual override returns (bool) { return _operatorApprovals[owner][operator]; } /** * @dev See {IERC721-transferFrom}. */ function transferFrom( address from, address to, uint256 tokenId ) public virtual override { //solhint-disable-next-line max-line-length require(_isApprovedOrOwner(_msgSender(), tokenId), "ERC721: transfer caller is not owner nor approved"); _transfer(from, to, tokenId); } /** * @dev See {IERC721-safeTransferFrom}. */ function safeTransferFrom( address from, address to, uint256 tokenId ) public virtual override { safeTransferFrom(from, to, tokenId, ""); } /** * @dev See {IERC721-safeTransferFrom}. */ function safeTransferFrom( address from, address to, uint256 tokenId, bytes memory _data ) public virtual override { require(_isApprovedOrOwner(_msgSender(), tokenId), "ERC721: transfer caller is not owner nor approved"); _safeTransfer(from, to, tokenId, _data); } /** * @dev Safely transfers `tokenId` token from `from` to `to`, checking first that contract recipients * are aware of the ERC721 protocol to prevent tokens from being forever locked. * * `_data` is additional data, it has no specified format and it is sent in call to `to`. * * This internal function is equivalent to {safeTransferFrom}, and can be used to e.g. * implement alternative mechanisms to perform token transfer, such as signature-based. * * Requirements: * * - `from` cannot be the zero address. * - `to` cannot be the zero address. * - `tokenId` token must exist and be owned by `from`. * - If `to` refers to a smart contract, it must implement {IERC721Receiver-onERC721Received}, which is called upon a safe transfer. * * Emits a {Transfer} event. */ function _safeTransfer( address from, address to, uint256 tokenId, bytes memory _data ) internal virtual { _transfer(from, to, tokenId); require(_checkOnERC721Received(from, to, tokenId, _data), "ERC721: transfer to non ERC721Receiver implementer"); } /** * @dev Returns whether `tokenId` exists. * * Tokens can be managed by their owner or approved accounts via {approve} or {setApprovalForAll}. * * Tokens start existing when they are minted (`_mint`), * and stop existing when they are burned (`_burn`). */ function _exists(uint256 tokenId) internal view virtual returns (bool) { return _owners[tokenId] != address(0); } /** * @dev Returns whether `spender` is allowed to manage `tokenId`. * * Requirements: * * - `tokenId` must exist. */ function _isApprovedOrOwner(address spender, uint256 tokenId) internal view virtual returns (bool) { require(_exists(tokenId), "ERC721: operator query for nonexistent token"); address owner = ERC721.ownerOf(tokenId); return (spender == owner || getApproved(tokenId) == spender || isApprovedForAll(owner, spender)); } /** * @dev Safely mints `tokenId` and transfers it to `to`. * * Requirements: * * - `tokenId` must not exist. * - If `to` refers to a smart contract, it must implement {IERC721Receiver-onERC721Received}, which is called upon a safe transfer. * * Emits a {Transfer} event. */ function _safeMint(address to, uint256 tokenId) internal virtual { _safeMint(to, tokenId, ""); } /** * @dev Same as {xref-ERC721-_safeMint-address-uint256-}[`_safeMint`], with an additional `data` parameter which is * forwarded 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" ); } /** * @dev Mints `tokenId` and transfers it to `to`. * * WARNING: Usage of this method is discouraged, use {_safeMint} whenever possible * * Requirements: * * - `tokenId` must not exist. * - `to` cannot be the zero address. * * Emits a {Transfer} event. */ function _mint(address to, uint256 tokenId) internal virtual { require(to != address(0), "ERC721: mint to the zero address"); require(!_exists(tokenId), "ERC721: token already minted"); _beforeTokenTransfer(address(0), to, tokenId); _balances[to] += 1; _owners[tokenId] = to; emit Transfer(address(0), to, tokenId); } /** * @dev Destroys `tokenId`. * The approval is cleared when the token is burned. * * Requirements: * * - `tokenId` must exist. * * Emits a {Transfer} event. */ function _burn(uint256 tokenId) internal virtual { address owner = ERC721.ownerOf(tokenId); _beforeTokenTransfer(owner, address(0), tokenId); // Clear approvals _approve(address(0), tokenId); _balances[owner] -= 1; delete _owners[tokenId]; emit Transfer(owner, address(0), tokenId); } /** * @dev Transfers `tokenId` from `from` to `to`. * As opposed to {transferFrom}, this imposes no restrictions on msg.sender. * * Requirements: * * - `to` cannot be the zero address. * - `tokenId` token must be owned by `from`. * * Emits a {Transfer} event. */ function _transfer( address from, address to, uint256 tokenId ) internal virtual { require(ERC721.ownerOf(tokenId) == from, "ERC721: transfer of token that is not own"); require(to != address(0), "ERC721: transfer to the zero address"); _beforeTokenTransfer(from, to, tokenId); // Clear approvals from the previous owner _approve(address(0), tokenId); _balances[from] -= 1; _balances[to] += 1; _owners[tokenId] = to; emit Transfer(from, to, tokenId); } /** * @dev Approve `to` to operate on `tokenId` * * Emits a {Approval} event. */ function _approve(address to, uint256 tokenId) internal virtual { _tokenApprovals[tokenId] = to; emit Approval(ERC721.ownerOf(tokenId), to, tokenId); } /** * @dev Internal function to invoke {IERC721Receiver-onERC721Received} on a target address. * The call is not executed if the target address is not a contract. * * @param from address representing the previous owner of the given token ID * @param to target address that will receive the tokens * @param tokenId uint256 ID of the token to be transferred * @param _data bytes optional data to send along with the call * @return bool whether the call correctly returned the expected magic value */ function _checkOnERC721Received( address from, address to, uint256 tokenId, bytes memory _data ) private returns (bool) { if (to.isContract()) { try IERC721Receiver(to).onERC721Received(_msgSender(), from, tokenId, _data) returns (bytes4 retval) { return retval == IERC721Receiver.onERC721Received.selector; } catch (bytes memory reason) { if (reason.length == 0) { revert("ERC721: transfer to non ERC721Receiver implementer"); } else { assembly { revert(add(32, reason), mload(reason)) } } } } else { return true; } } /** * @dev Hook that is called before any token transfer. This includes minting * and burning. * * Calling conditions: * * - When `from` and `to` are both non-zero, ``from``'s `tokenId` will be * transferred to `to`. * - When `from` is zero, `tokenId` will be minted for `to`. * - When `to` is zero, ``from``'s `tokenId` will be burned. * - `from` and `to` are never both zero. * * To learn more about hooks, head to xref:ROOT:extending-contracts.adoc#using-hooks[Using Hooks]. */ function _beforeTokenTransfer( address from, address to, uint256 tokenId ) internal virtual {} }
/** * @dev Implementation of https://eips.ethereum.org/EIPS/eip-721[ERC721] Non-Fungible Token Standard, including * the Metadata extension, but not including the Enumerable extension, which is available separately as * {ERC721Enumerable}. */
NatSpecMultiLine
tokenURI
function tokenURI(uint256 tokenId) public view virtual override returns (string memory) { require(_exists(tokenId), "ERC721Metadata: URI query for nonexistent token"); string memory baseURI = _baseURI(); return bytes(baseURI).length > 0 ? string(abi.encodePacked(baseURI, tokenId.toString())) : ""; }
/** * @dev See {IERC721Metadata-tokenURI}. */
NatSpecMultiLine
v0.8.3+commit.8d00100c
MIT
ipfs://1f710d8bcd8966b315557e51d40efc2bd775afde93afea26f8386cf10b49aa6f
{ "func_code_index": [ 2260, 2599 ] }
57,755
SlammaJamma
SlammaJamma.sol
0x2aa1c5306f0212e23f2950ecb8464eefb169456d
Solidity
ERC721
contract ERC721 is Context, ERC165, IERC721, IERC721Metadata { using Address for address; using Strings for uint256; // Token name string private _name; // Token symbol string private _symbol; // Mapping from token ID to owner address mapping(uint256 => address) private _owners; // Mapping owner address to token count mapping(address => uint256) private _balances; // Mapping from token ID to approved address mapping(uint256 => address) private _tokenApprovals; // Mapping from owner to operator approvals mapping(address => mapping(address => bool)) private _operatorApprovals; /** * @dev Initializes the contract by setting a `name` and a `symbol` to the token collection. */ constructor(string memory name_, string memory symbol_) { _name = name_; _symbol = symbol_; } /** * @dev See {IERC165-supportsInterface}. */ function supportsInterface(bytes4 interfaceId) public view virtual override(ERC165, IERC165) returns (bool) { return interfaceId == type(IERC721).interfaceId || interfaceId == type(IERC721Metadata).interfaceId || super.supportsInterface(interfaceId); } /** * @dev See {IERC721-balanceOf}. */ function balanceOf(address owner) public view virtual override returns (uint256) { require(owner != address(0), "ERC721: balance query for the zero address"); return _balances[owner]; } /** * @dev See {IERC721-ownerOf}. */ function ownerOf(uint256 tokenId) public view virtual override returns (address) { address owner = _owners[tokenId]; require(owner != address(0), "ERC721: owner query for nonexistent token"); return owner; } /** * @dev See {IERC721Metadata-name}. */ function name() public view virtual override returns (string memory) { return _name; } /** * @dev See {IERC721Metadata-symbol}. */ function symbol() public view virtual override returns (string memory) { return _symbol; } /** * @dev See {IERC721Metadata-tokenURI}. */ function tokenURI(uint256 tokenId) public view virtual override returns (string memory) { require(_exists(tokenId), "ERC721Metadata: URI query for nonexistent token"); string memory baseURI = _baseURI(); return bytes(baseURI).length > 0 ? string(abi.encodePacked(baseURI, tokenId.toString())) : ""; } /** * @dev Base URI for computing {tokenURI}. If set, the resulting URI for each * token will be the concatenation of the `baseURI` and the `tokenId`. Empty * by default, can be overriden in child contracts. */ function _baseURI() internal view virtual returns (string memory) { return ""; } /** * @dev See {IERC721-approve}. */ function approve(address to, uint256 tokenId) public virtual override { address owner = ERC721.ownerOf(tokenId); require(to != owner, "ERC721: approval to current owner"); require( _msgSender() == owner || isApprovedForAll(owner, _msgSender()), "ERC721: approve caller is not owner nor approved for all" ); _approve(to, tokenId); } /** * @dev 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]; } /** * @dev See {IERC721-setApprovalForAll}. */ function setApprovalForAll(address operator, bool approved) public virtual override { require(operator != _msgSender(), "ERC721: approve to caller"); _operatorApprovals[_msgSender()][operator] = approved; emit ApprovalForAll(_msgSender(), operator, approved); } /** * @dev See {IERC721-isApprovedForAll}. */ function isApprovedForAll(address owner, address operator) public view virtual override returns (bool) { return _operatorApprovals[owner][operator]; } /** * @dev See {IERC721-transferFrom}. */ function transferFrom( address from, address to, uint256 tokenId ) public virtual override { //solhint-disable-next-line max-line-length require(_isApprovedOrOwner(_msgSender(), tokenId), "ERC721: transfer caller is not owner nor approved"); _transfer(from, to, tokenId); } /** * @dev See {IERC721-safeTransferFrom}. */ function safeTransferFrom( address from, address to, uint256 tokenId ) public virtual override { safeTransferFrom(from, to, tokenId, ""); } /** * @dev See {IERC721-safeTransferFrom}. */ function safeTransferFrom( address from, address to, uint256 tokenId, bytes memory _data ) public virtual override { require(_isApprovedOrOwner(_msgSender(), tokenId), "ERC721: transfer caller is not owner nor approved"); _safeTransfer(from, to, tokenId, _data); } /** * @dev Safely transfers `tokenId` token from `from` to `to`, checking first that contract recipients * are aware of the ERC721 protocol to prevent tokens from being forever locked. * * `_data` is additional data, it has no specified format and it is sent in call to `to`. * * This internal function is equivalent to {safeTransferFrom}, and can be used to e.g. * implement alternative mechanisms to perform token transfer, such as signature-based. * * Requirements: * * - `from` cannot be the zero address. * - `to` cannot be the zero address. * - `tokenId` token must exist and be owned by `from`. * - If `to` refers to a smart contract, it must implement {IERC721Receiver-onERC721Received}, which is called upon a safe transfer. * * Emits a {Transfer} event. */ function _safeTransfer( address from, address to, uint256 tokenId, bytes memory _data ) internal virtual { _transfer(from, to, tokenId); require(_checkOnERC721Received(from, to, tokenId, _data), "ERC721: transfer to non ERC721Receiver implementer"); } /** * @dev Returns whether `tokenId` exists. * * Tokens can be managed by their owner or approved accounts via {approve} or {setApprovalForAll}. * * Tokens start existing when they are minted (`_mint`), * and stop existing when they are burned (`_burn`). */ function _exists(uint256 tokenId) internal view virtual returns (bool) { return _owners[tokenId] != address(0); } /** * @dev Returns whether `spender` is allowed to manage `tokenId`. * * Requirements: * * - `tokenId` must exist. */ function _isApprovedOrOwner(address spender, uint256 tokenId) internal view virtual returns (bool) { require(_exists(tokenId), "ERC721: operator query for nonexistent token"); address owner = ERC721.ownerOf(tokenId); return (spender == owner || getApproved(tokenId) == spender || isApprovedForAll(owner, spender)); } /** * @dev Safely mints `tokenId` and transfers it to `to`. * * Requirements: * * - `tokenId` must not exist. * - If `to` refers to a smart contract, it must implement {IERC721Receiver-onERC721Received}, which is called upon a safe transfer. * * Emits a {Transfer} event. */ function _safeMint(address to, uint256 tokenId) internal virtual { _safeMint(to, tokenId, ""); } /** * @dev Same as {xref-ERC721-_safeMint-address-uint256-}[`_safeMint`], with an additional `data` parameter which is * forwarded 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" ); } /** * @dev Mints `tokenId` and transfers it to `to`. * * WARNING: Usage of this method is discouraged, use {_safeMint} whenever possible * * Requirements: * * - `tokenId` must not exist. * - `to` cannot be the zero address. * * Emits a {Transfer} event. */ function _mint(address to, uint256 tokenId) internal virtual { require(to != address(0), "ERC721: mint to the zero address"); require(!_exists(tokenId), "ERC721: token already minted"); _beforeTokenTransfer(address(0), to, tokenId); _balances[to] += 1; _owners[tokenId] = to; emit Transfer(address(0), to, tokenId); } /** * @dev Destroys `tokenId`. * The approval is cleared when the token is burned. * * Requirements: * * - `tokenId` must exist. * * Emits a {Transfer} event. */ function _burn(uint256 tokenId) internal virtual { address owner = ERC721.ownerOf(tokenId); _beforeTokenTransfer(owner, address(0), tokenId); // Clear approvals _approve(address(0), tokenId); _balances[owner] -= 1; delete _owners[tokenId]; emit Transfer(owner, address(0), tokenId); } /** * @dev Transfers `tokenId` from `from` to `to`. * As opposed to {transferFrom}, this imposes no restrictions on msg.sender. * * Requirements: * * - `to` cannot be the zero address. * - `tokenId` token must be owned by `from`. * * Emits a {Transfer} event. */ function _transfer( address from, address to, uint256 tokenId ) internal virtual { require(ERC721.ownerOf(tokenId) == from, "ERC721: transfer of token that is not own"); require(to != address(0), "ERC721: transfer to the zero address"); _beforeTokenTransfer(from, to, tokenId); // Clear approvals from the previous owner _approve(address(0), tokenId); _balances[from] -= 1; _balances[to] += 1; _owners[tokenId] = to; emit Transfer(from, to, tokenId); } /** * @dev Approve `to` to operate on `tokenId` * * Emits a {Approval} event. */ function _approve(address to, uint256 tokenId) internal virtual { _tokenApprovals[tokenId] = to; emit Approval(ERC721.ownerOf(tokenId), to, tokenId); } /** * @dev Internal function to invoke {IERC721Receiver-onERC721Received} on a target address. * The call is not executed if the target address is not a contract. * * @param from address representing the previous owner of the given token ID * @param to target address that will receive the tokens * @param tokenId uint256 ID of the token to be transferred * @param _data bytes optional data to send along with the call * @return bool whether the call correctly returned the expected magic value */ function _checkOnERC721Received( address from, address to, uint256 tokenId, bytes memory _data ) private returns (bool) { if (to.isContract()) { try IERC721Receiver(to).onERC721Received(_msgSender(), from, tokenId, _data) returns (bytes4 retval) { return retval == IERC721Receiver.onERC721Received.selector; } catch (bytes memory reason) { if (reason.length == 0) { revert("ERC721: transfer to non ERC721Receiver implementer"); } else { assembly { revert(add(32, reason), mload(reason)) } } } } else { return true; } } /** * @dev Hook that is called before any token transfer. This includes minting * and burning. * * Calling conditions: * * - When `from` and `to` are both non-zero, ``from``'s `tokenId` will be * transferred to `to`. * - When `from` is zero, `tokenId` will be minted for `to`. * - When `to` is zero, ``from``'s `tokenId` will be burned. * - `from` and `to` are never both zero. * * To learn more about hooks, head to xref:ROOT:extending-contracts.adoc#using-hooks[Using Hooks]. */ function _beforeTokenTransfer( address from, address to, uint256 tokenId ) internal virtual {} }
/** * @dev Implementation of https://eips.ethereum.org/EIPS/eip-721[ERC721] Non-Fungible Token Standard, including * the Metadata extension, but not including the Enumerable extension, which is available separately as * {ERC721Enumerable}. */
NatSpecMultiLine
_baseURI
function _baseURI() internal view virtual returns (string memory) { return ""; }
/** * @dev Base URI for computing {tokenURI}. If set, the resulting URI for each * token will be the concatenation of the `baseURI` and the `tokenId`. Empty * by default, can be overriden in child contracts. */
NatSpecMultiLine
v0.8.3+commit.8d00100c
MIT
ipfs://1f710d8bcd8966b315557e51d40efc2bd775afde93afea26f8386cf10b49aa6f
{ "func_code_index": [ 2842, 2941 ] }
57,756
SlammaJamma
SlammaJamma.sol
0x2aa1c5306f0212e23f2950ecb8464eefb169456d
Solidity
ERC721
contract ERC721 is Context, ERC165, IERC721, IERC721Metadata { using Address for address; using Strings for uint256; // Token name string private _name; // Token symbol string private _symbol; // Mapping from token ID to owner address mapping(uint256 => address) private _owners; // Mapping owner address to token count mapping(address => uint256) private _balances; // Mapping from token ID to approved address mapping(uint256 => address) private _tokenApprovals; // Mapping from owner to operator approvals mapping(address => mapping(address => bool)) private _operatorApprovals; /** * @dev Initializes the contract by setting a `name` and a `symbol` to the token collection. */ constructor(string memory name_, string memory symbol_) { _name = name_; _symbol = symbol_; } /** * @dev See {IERC165-supportsInterface}. */ function supportsInterface(bytes4 interfaceId) public view virtual override(ERC165, IERC165) returns (bool) { return interfaceId == type(IERC721).interfaceId || interfaceId == type(IERC721Metadata).interfaceId || super.supportsInterface(interfaceId); } /** * @dev See {IERC721-balanceOf}. */ function balanceOf(address owner) public view virtual override returns (uint256) { require(owner != address(0), "ERC721: balance query for the zero address"); return _balances[owner]; } /** * @dev See {IERC721-ownerOf}. */ function ownerOf(uint256 tokenId) public view virtual override returns (address) { address owner = _owners[tokenId]; require(owner != address(0), "ERC721: owner query for nonexistent token"); return owner; } /** * @dev See {IERC721Metadata-name}. */ function name() public view virtual override returns (string memory) { return _name; } /** * @dev See {IERC721Metadata-symbol}. */ function symbol() public view virtual override returns (string memory) { return _symbol; } /** * @dev See {IERC721Metadata-tokenURI}. */ function tokenURI(uint256 tokenId) public view virtual override returns (string memory) { require(_exists(tokenId), "ERC721Metadata: URI query for nonexistent token"); string memory baseURI = _baseURI(); return bytes(baseURI).length > 0 ? string(abi.encodePacked(baseURI, tokenId.toString())) : ""; } /** * @dev Base URI for computing {tokenURI}. If set, the resulting URI for each * token will be the concatenation of the `baseURI` and the `tokenId`. Empty * by default, can be overriden in child contracts. */ function _baseURI() internal view virtual returns (string memory) { return ""; } /** * @dev See {IERC721-approve}. */ function approve(address to, uint256 tokenId) public virtual override { address owner = ERC721.ownerOf(tokenId); require(to != owner, "ERC721: approval to current owner"); require( _msgSender() == owner || isApprovedForAll(owner, _msgSender()), "ERC721: approve caller is not owner nor approved for all" ); _approve(to, tokenId); } /** * @dev 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]; } /** * @dev See {IERC721-setApprovalForAll}. */ function setApprovalForAll(address operator, bool approved) public virtual override { require(operator != _msgSender(), "ERC721: approve to caller"); _operatorApprovals[_msgSender()][operator] = approved; emit ApprovalForAll(_msgSender(), operator, approved); } /** * @dev See {IERC721-isApprovedForAll}. */ function isApprovedForAll(address owner, address operator) public view virtual override returns (bool) { return _operatorApprovals[owner][operator]; } /** * @dev See {IERC721-transferFrom}. */ function transferFrom( address from, address to, uint256 tokenId ) public virtual override { //solhint-disable-next-line max-line-length require(_isApprovedOrOwner(_msgSender(), tokenId), "ERC721: transfer caller is not owner nor approved"); _transfer(from, to, tokenId); } /** * @dev See {IERC721-safeTransferFrom}. */ function safeTransferFrom( address from, address to, uint256 tokenId ) public virtual override { safeTransferFrom(from, to, tokenId, ""); } /** * @dev See {IERC721-safeTransferFrom}. */ function safeTransferFrom( address from, address to, uint256 tokenId, bytes memory _data ) public virtual override { require(_isApprovedOrOwner(_msgSender(), tokenId), "ERC721: transfer caller is not owner nor approved"); _safeTransfer(from, to, tokenId, _data); } /** * @dev Safely transfers `tokenId` token from `from` to `to`, checking first that contract recipients * are aware of the ERC721 protocol to prevent tokens from being forever locked. * * `_data` is additional data, it has no specified format and it is sent in call to `to`. * * This internal function is equivalent to {safeTransferFrom}, and can be used to e.g. * implement alternative mechanisms to perform token transfer, such as signature-based. * * Requirements: * * - `from` cannot be the zero address. * - `to` cannot be the zero address. * - `tokenId` token must exist and be owned by `from`. * - If `to` refers to a smart contract, it must implement {IERC721Receiver-onERC721Received}, which is called upon a safe transfer. * * Emits a {Transfer} event. */ function _safeTransfer( address from, address to, uint256 tokenId, bytes memory _data ) internal virtual { _transfer(from, to, tokenId); require(_checkOnERC721Received(from, to, tokenId, _data), "ERC721: transfer to non ERC721Receiver implementer"); } /** * @dev Returns whether `tokenId` exists. * * Tokens can be managed by their owner or approved accounts via {approve} or {setApprovalForAll}. * * Tokens start existing when they are minted (`_mint`), * and stop existing when they are burned (`_burn`). */ function _exists(uint256 tokenId) internal view virtual returns (bool) { return _owners[tokenId] != address(0); } /** * @dev Returns whether `spender` is allowed to manage `tokenId`. * * Requirements: * * - `tokenId` must exist. */ function _isApprovedOrOwner(address spender, uint256 tokenId) internal view virtual returns (bool) { require(_exists(tokenId), "ERC721: operator query for nonexistent token"); address owner = ERC721.ownerOf(tokenId); return (spender == owner || getApproved(tokenId) == spender || isApprovedForAll(owner, spender)); } /** * @dev Safely mints `tokenId` and transfers it to `to`. * * Requirements: * * - `tokenId` must not exist. * - If `to` refers to a smart contract, it must implement {IERC721Receiver-onERC721Received}, which is called upon a safe transfer. * * Emits a {Transfer} event. */ function _safeMint(address to, uint256 tokenId) internal virtual { _safeMint(to, tokenId, ""); } /** * @dev Same as {xref-ERC721-_safeMint-address-uint256-}[`_safeMint`], with an additional `data` parameter which is * forwarded 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" ); } /** * @dev Mints `tokenId` and transfers it to `to`. * * WARNING: Usage of this method is discouraged, use {_safeMint} whenever possible * * Requirements: * * - `tokenId` must not exist. * - `to` cannot be the zero address. * * Emits a {Transfer} event. */ function _mint(address to, uint256 tokenId) internal virtual { require(to != address(0), "ERC721: mint to the zero address"); require(!_exists(tokenId), "ERC721: token already minted"); _beforeTokenTransfer(address(0), to, tokenId); _balances[to] += 1; _owners[tokenId] = to; emit Transfer(address(0), to, tokenId); } /** * @dev Destroys `tokenId`. * The approval is cleared when the token is burned. * * Requirements: * * - `tokenId` must exist. * * Emits a {Transfer} event. */ function _burn(uint256 tokenId) internal virtual { address owner = ERC721.ownerOf(tokenId); _beforeTokenTransfer(owner, address(0), tokenId); // Clear approvals _approve(address(0), tokenId); _balances[owner] -= 1; delete _owners[tokenId]; emit Transfer(owner, address(0), tokenId); } /** * @dev Transfers `tokenId` from `from` to `to`. * As opposed to {transferFrom}, this imposes no restrictions on msg.sender. * * Requirements: * * - `to` cannot be the zero address. * - `tokenId` token must be owned by `from`. * * Emits a {Transfer} event. */ function _transfer( address from, address to, uint256 tokenId ) internal virtual { require(ERC721.ownerOf(tokenId) == from, "ERC721: transfer of token that is not own"); require(to != address(0), "ERC721: transfer to the zero address"); _beforeTokenTransfer(from, to, tokenId); // Clear approvals from the previous owner _approve(address(0), tokenId); _balances[from] -= 1; _balances[to] += 1; _owners[tokenId] = to; emit Transfer(from, to, tokenId); } /** * @dev Approve `to` to operate on `tokenId` * * Emits a {Approval} event. */ function _approve(address to, uint256 tokenId) internal virtual { _tokenApprovals[tokenId] = to; emit Approval(ERC721.ownerOf(tokenId), to, tokenId); } /** * @dev Internal function to invoke {IERC721Receiver-onERC721Received} on a target address. * The call is not executed if the target address is not a contract. * * @param from address representing the previous owner of the given token ID * @param to target address that will receive the tokens * @param tokenId uint256 ID of the token to be transferred * @param _data bytes optional data to send along with the call * @return bool whether the call correctly returned the expected magic value */ function _checkOnERC721Received( address from, address to, uint256 tokenId, bytes memory _data ) private returns (bool) { if (to.isContract()) { try IERC721Receiver(to).onERC721Received(_msgSender(), from, tokenId, _data) returns (bytes4 retval) { return retval == IERC721Receiver.onERC721Received.selector; } catch (bytes memory reason) { if (reason.length == 0) { revert("ERC721: transfer to non ERC721Receiver implementer"); } else { assembly { revert(add(32, reason), mload(reason)) } } } } else { return true; } } /** * @dev Hook that is called before any token transfer. This includes minting * and burning. * * Calling conditions: * * - When `from` and `to` are both non-zero, ``from``'s `tokenId` will be * transferred to `to`. * - When `from` is zero, `tokenId` will be minted for `to`. * - When `to` is zero, ``from``'s `tokenId` will be burned. * - `from` and `to` are never both zero. * * To learn more about hooks, head to xref:ROOT:extending-contracts.adoc#using-hooks[Using Hooks]. */ function _beforeTokenTransfer( address from, address to, uint256 tokenId ) internal virtual {} }
/** * @dev Implementation of https://eips.ethereum.org/EIPS/eip-721[ERC721] Non-Fungible Token Standard, including * the Metadata extension, but not including the Enumerable extension, which is available separately as * {ERC721Enumerable}. */
NatSpecMultiLine
approve
function approve(address to, uint256 tokenId) public virtual override { address owner = ERC721.ownerOf(tokenId); require(to != owner, "ERC721: approval to current owner"); require( _msgSender() == owner || isApprovedForAll(owner, _msgSender()), "ERC721: approve caller is not owner nor approved for all" ); _approve(to, tokenId); }
/** * @dev See {IERC721-approve}. */
NatSpecMultiLine
v0.8.3+commit.8d00100c
MIT
ipfs://1f710d8bcd8966b315557e51d40efc2bd775afde93afea26f8386cf10b49aa6f
{ "func_code_index": [ 2998, 3414 ] }
57,757
SlammaJamma
SlammaJamma.sol
0x2aa1c5306f0212e23f2950ecb8464eefb169456d
Solidity
ERC721
contract ERC721 is Context, ERC165, IERC721, IERC721Metadata { using Address for address; using Strings for uint256; // Token name string private _name; // Token symbol string private _symbol; // Mapping from token ID to owner address mapping(uint256 => address) private _owners; // Mapping owner address to token count mapping(address => uint256) private _balances; // Mapping from token ID to approved address mapping(uint256 => address) private _tokenApprovals; // Mapping from owner to operator approvals mapping(address => mapping(address => bool)) private _operatorApprovals; /** * @dev Initializes the contract by setting a `name` and a `symbol` to the token collection. */ constructor(string memory name_, string memory symbol_) { _name = name_; _symbol = symbol_; } /** * @dev See {IERC165-supportsInterface}. */ function supportsInterface(bytes4 interfaceId) public view virtual override(ERC165, IERC165) returns (bool) { return interfaceId == type(IERC721).interfaceId || interfaceId == type(IERC721Metadata).interfaceId || super.supportsInterface(interfaceId); } /** * @dev See {IERC721-balanceOf}. */ function balanceOf(address owner) public view virtual override returns (uint256) { require(owner != address(0), "ERC721: balance query for the zero address"); return _balances[owner]; } /** * @dev See {IERC721-ownerOf}. */ function ownerOf(uint256 tokenId) public view virtual override returns (address) { address owner = _owners[tokenId]; require(owner != address(0), "ERC721: owner query for nonexistent token"); return owner; } /** * @dev See {IERC721Metadata-name}. */ function name() public view virtual override returns (string memory) { return _name; } /** * @dev See {IERC721Metadata-symbol}. */ function symbol() public view virtual override returns (string memory) { return _symbol; } /** * @dev See {IERC721Metadata-tokenURI}. */ function tokenURI(uint256 tokenId) public view virtual override returns (string memory) { require(_exists(tokenId), "ERC721Metadata: URI query for nonexistent token"); string memory baseURI = _baseURI(); return bytes(baseURI).length > 0 ? string(abi.encodePacked(baseURI, tokenId.toString())) : ""; } /** * @dev Base URI for computing {tokenURI}. If set, the resulting URI for each * token will be the concatenation of the `baseURI` and the `tokenId`. Empty * by default, can be overriden in child contracts. */ function _baseURI() internal view virtual returns (string memory) { return ""; } /** * @dev See {IERC721-approve}. */ function approve(address to, uint256 tokenId) public virtual override { address owner = ERC721.ownerOf(tokenId); require(to != owner, "ERC721: approval to current owner"); require( _msgSender() == owner || isApprovedForAll(owner, _msgSender()), "ERC721: approve caller is not owner nor approved for all" ); _approve(to, tokenId); } /** * @dev 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]; } /** * @dev See {IERC721-setApprovalForAll}. */ function setApprovalForAll(address operator, bool approved) public virtual override { require(operator != _msgSender(), "ERC721: approve to caller"); _operatorApprovals[_msgSender()][operator] = approved; emit ApprovalForAll(_msgSender(), operator, approved); } /** * @dev See {IERC721-isApprovedForAll}. */ function isApprovedForAll(address owner, address operator) public view virtual override returns (bool) { return _operatorApprovals[owner][operator]; } /** * @dev See {IERC721-transferFrom}. */ function transferFrom( address from, address to, uint256 tokenId ) public virtual override { //solhint-disable-next-line max-line-length require(_isApprovedOrOwner(_msgSender(), tokenId), "ERC721: transfer caller is not owner nor approved"); _transfer(from, to, tokenId); } /** * @dev See {IERC721-safeTransferFrom}. */ function safeTransferFrom( address from, address to, uint256 tokenId ) public virtual override { safeTransferFrom(from, to, tokenId, ""); } /** * @dev See {IERC721-safeTransferFrom}. */ function safeTransferFrom( address from, address to, uint256 tokenId, bytes memory _data ) public virtual override { require(_isApprovedOrOwner(_msgSender(), tokenId), "ERC721: transfer caller is not owner nor approved"); _safeTransfer(from, to, tokenId, _data); } /** * @dev Safely transfers `tokenId` token from `from` to `to`, checking first that contract recipients * are aware of the ERC721 protocol to prevent tokens from being forever locked. * * `_data` is additional data, it has no specified format and it is sent in call to `to`. * * This internal function is equivalent to {safeTransferFrom}, and can be used to e.g. * implement alternative mechanisms to perform token transfer, such as signature-based. * * Requirements: * * - `from` cannot be the zero address. * - `to` cannot be the zero address. * - `tokenId` token must exist and be owned by `from`. * - If `to` refers to a smart contract, it must implement {IERC721Receiver-onERC721Received}, which is called upon a safe transfer. * * Emits a {Transfer} event. */ function _safeTransfer( address from, address to, uint256 tokenId, bytes memory _data ) internal virtual { _transfer(from, to, tokenId); require(_checkOnERC721Received(from, to, tokenId, _data), "ERC721: transfer to non ERC721Receiver implementer"); } /** * @dev Returns whether `tokenId` exists. * * Tokens can be managed by their owner or approved accounts via {approve} or {setApprovalForAll}. * * Tokens start existing when they are minted (`_mint`), * and stop existing when they are burned (`_burn`). */ function _exists(uint256 tokenId) internal view virtual returns (bool) { return _owners[tokenId] != address(0); } /** * @dev Returns whether `spender` is allowed to manage `tokenId`. * * Requirements: * * - `tokenId` must exist. */ function _isApprovedOrOwner(address spender, uint256 tokenId) internal view virtual returns (bool) { require(_exists(tokenId), "ERC721: operator query for nonexistent token"); address owner = ERC721.ownerOf(tokenId); return (spender == owner || getApproved(tokenId) == spender || isApprovedForAll(owner, spender)); } /** * @dev Safely mints `tokenId` and transfers it to `to`. * * Requirements: * * - `tokenId` must not exist. * - If `to` refers to a smart contract, it must implement {IERC721Receiver-onERC721Received}, which is called upon a safe transfer. * * Emits a {Transfer} event. */ function _safeMint(address to, uint256 tokenId) internal virtual { _safeMint(to, tokenId, ""); } /** * @dev Same as {xref-ERC721-_safeMint-address-uint256-}[`_safeMint`], with an additional `data` parameter which is * forwarded 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" ); } /** * @dev Mints `tokenId` and transfers it to `to`. * * WARNING: Usage of this method is discouraged, use {_safeMint} whenever possible * * Requirements: * * - `tokenId` must not exist. * - `to` cannot be the zero address. * * Emits a {Transfer} event. */ function _mint(address to, uint256 tokenId) internal virtual { require(to != address(0), "ERC721: mint to the zero address"); require(!_exists(tokenId), "ERC721: token already minted"); _beforeTokenTransfer(address(0), to, tokenId); _balances[to] += 1; _owners[tokenId] = to; emit Transfer(address(0), to, tokenId); } /** * @dev Destroys `tokenId`. * The approval is cleared when the token is burned. * * Requirements: * * - `tokenId` must exist. * * Emits a {Transfer} event. */ function _burn(uint256 tokenId) internal virtual { address owner = ERC721.ownerOf(tokenId); _beforeTokenTransfer(owner, address(0), tokenId); // Clear approvals _approve(address(0), tokenId); _balances[owner] -= 1; delete _owners[tokenId]; emit Transfer(owner, address(0), tokenId); } /** * @dev Transfers `tokenId` from `from` to `to`. * As opposed to {transferFrom}, this imposes no restrictions on msg.sender. * * Requirements: * * - `to` cannot be the zero address. * - `tokenId` token must be owned by `from`. * * Emits a {Transfer} event. */ function _transfer( address from, address to, uint256 tokenId ) internal virtual { require(ERC721.ownerOf(tokenId) == from, "ERC721: transfer of token that is not own"); require(to != address(0), "ERC721: transfer to the zero address"); _beforeTokenTransfer(from, to, tokenId); // Clear approvals from the previous owner _approve(address(0), tokenId); _balances[from] -= 1; _balances[to] += 1; _owners[tokenId] = to; emit Transfer(from, to, tokenId); } /** * @dev Approve `to` to operate on `tokenId` * * Emits a {Approval} event. */ function _approve(address to, uint256 tokenId) internal virtual { _tokenApprovals[tokenId] = to; emit Approval(ERC721.ownerOf(tokenId), to, tokenId); } /** * @dev Internal function to invoke {IERC721Receiver-onERC721Received} on a target address. * The call is not executed if the target address is not a contract. * * @param from address representing the previous owner of the given token ID * @param to target address that will receive the tokens * @param tokenId uint256 ID of the token to be transferred * @param _data bytes optional data to send along with the call * @return bool whether the call correctly returned the expected magic value */ function _checkOnERC721Received( address from, address to, uint256 tokenId, bytes memory _data ) private returns (bool) { if (to.isContract()) { try IERC721Receiver(to).onERC721Received(_msgSender(), from, tokenId, _data) returns (bytes4 retval) { return retval == IERC721Receiver.onERC721Received.selector; } catch (bytes memory reason) { if (reason.length == 0) { revert("ERC721: transfer to non ERC721Receiver implementer"); } else { assembly { revert(add(32, reason), mload(reason)) } } } } else { return true; } } /** * @dev Hook that is called before any token transfer. This includes minting * and burning. * * Calling conditions: * * - When `from` and `to` are both non-zero, ``from``'s `tokenId` will be * transferred to `to`. * - When `from` is zero, `tokenId` will be minted for `to`. * - When `to` is zero, ``from``'s `tokenId` will be burned. * - `from` and `to` are never both zero. * * To learn more about hooks, head to xref:ROOT:extending-contracts.adoc#using-hooks[Using Hooks]. */ function _beforeTokenTransfer( address from, address to, uint256 tokenId ) internal virtual {} }
/** * @dev Implementation of https://eips.ethereum.org/EIPS/eip-721[ERC721] Non-Fungible Token Standard, including * the Metadata extension, but not including the Enumerable extension, which is available separately as * {ERC721Enumerable}. */
NatSpecMultiLine
getApproved
function getApproved(uint256 tokenId) public view virtual override returns (address) { require(_exists(tokenId), "ERC721: approved query for nonexistent token"); return _tokenApprovals[tokenId]; }
/** * @dev See {IERC721-getApproved}. */
NatSpecMultiLine
v0.8.3+commit.8d00100c
MIT
ipfs://1f710d8bcd8966b315557e51d40efc2bd775afde93afea26f8386cf10b49aa6f
{ "func_code_index": [ 3475, 3701 ] }
57,758
SlammaJamma
SlammaJamma.sol
0x2aa1c5306f0212e23f2950ecb8464eefb169456d
Solidity
ERC721
contract ERC721 is Context, ERC165, IERC721, IERC721Metadata { using Address for address; using Strings for uint256; // Token name string private _name; // Token symbol string private _symbol; // Mapping from token ID to owner address mapping(uint256 => address) private _owners; // Mapping owner address to token count mapping(address => uint256) private _balances; // Mapping from token ID to approved address mapping(uint256 => address) private _tokenApprovals; // Mapping from owner to operator approvals mapping(address => mapping(address => bool)) private _operatorApprovals; /** * @dev Initializes the contract by setting a `name` and a `symbol` to the token collection. */ constructor(string memory name_, string memory symbol_) { _name = name_; _symbol = symbol_; } /** * @dev See {IERC165-supportsInterface}. */ function supportsInterface(bytes4 interfaceId) public view virtual override(ERC165, IERC165) returns (bool) { return interfaceId == type(IERC721).interfaceId || interfaceId == type(IERC721Metadata).interfaceId || super.supportsInterface(interfaceId); } /** * @dev See {IERC721-balanceOf}. */ function balanceOf(address owner) public view virtual override returns (uint256) { require(owner != address(0), "ERC721: balance query for the zero address"); return _balances[owner]; } /** * @dev See {IERC721-ownerOf}. */ function ownerOf(uint256 tokenId) public view virtual override returns (address) { address owner = _owners[tokenId]; require(owner != address(0), "ERC721: owner query for nonexistent token"); return owner; } /** * @dev See {IERC721Metadata-name}. */ function name() public view virtual override returns (string memory) { return _name; } /** * @dev See {IERC721Metadata-symbol}. */ function symbol() public view virtual override returns (string memory) { return _symbol; } /** * @dev See {IERC721Metadata-tokenURI}. */ function tokenURI(uint256 tokenId) public view virtual override returns (string memory) { require(_exists(tokenId), "ERC721Metadata: URI query for nonexistent token"); string memory baseURI = _baseURI(); return bytes(baseURI).length > 0 ? string(abi.encodePacked(baseURI, tokenId.toString())) : ""; } /** * @dev Base URI for computing {tokenURI}. If set, the resulting URI for each * token will be the concatenation of the `baseURI` and the `tokenId`. Empty * by default, can be overriden in child contracts. */ function _baseURI() internal view virtual returns (string memory) { return ""; } /** * @dev See {IERC721-approve}. */ function approve(address to, uint256 tokenId) public virtual override { address owner = ERC721.ownerOf(tokenId); require(to != owner, "ERC721: approval to current owner"); require( _msgSender() == owner || isApprovedForAll(owner, _msgSender()), "ERC721: approve caller is not owner nor approved for all" ); _approve(to, tokenId); } /** * @dev 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]; } /** * @dev See {IERC721-setApprovalForAll}. */ function setApprovalForAll(address operator, bool approved) public virtual override { require(operator != _msgSender(), "ERC721: approve to caller"); _operatorApprovals[_msgSender()][operator] = approved; emit ApprovalForAll(_msgSender(), operator, approved); } /** * @dev See {IERC721-isApprovedForAll}. */ function isApprovedForAll(address owner, address operator) public view virtual override returns (bool) { return _operatorApprovals[owner][operator]; } /** * @dev See {IERC721-transferFrom}. */ function transferFrom( address from, address to, uint256 tokenId ) public virtual override { //solhint-disable-next-line max-line-length require(_isApprovedOrOwner(_msgSender(), tokenId), "ERC721: transfer caller is not owner nor approved"); _transfer(from, to, tokenId); } /** * @dev See {IERC721-safeTransferFrom}. */ function safeTransferFrom( address from, address to, uint256 tokenId ) public virtual override { safeTransferFrom(from, to, tokenId, ""); } /** * @dev See {IERC721-safeTransferFrom}. */ function safeTransferFrom( address from, address to, uint256 tokenId, bytes memory _data ) public virtual override { require(_isApprovedOrOwner(_msgSender(), tokenId), "ERC721: transfer caller is not owner nor approved"); _safeTransfer(from, to, tokenId, _data); } /** * @dev Safely transfers `tokenId` token from `from` to `to`, checking first that contract recipients * are aware of the ERC721 protocol to prevent tokens from being forever locked. * * `_data` is additional data, it has no specified format and it is sent in call to `to`. * * This internal function is equivalent to {safeTransferFrom}, and can be used to e.g. * implement alternative mechanisms to perform token transfer, such as signature-based. * * Requirements: * * - `from` cannot be the zero address. * - `to` cannot be the zero address. * - `tokenId` token must exist and be owned by `from`. * - If `to` refers to a smart contract, it must implement {IERC721Receiver-onERC721Received}, which is called upon a safe transfer. * * Emits a {Transfer} event. */ function _safeTransfer( address from, address to, uint256 tokenId, bytes memory _data ) internal virtual { _transfer(from, to, tokenId); require(_checkOnERC721Received(from, to, tokenId, _data), "ERC721: transfer to non ERC721Receiver implementer"); } /** * @dev Returns whether `tokenId` exists. * * Tokens can be managed by their owner or approved accounts via {approve} or {setApprovalForAll}. * * Tokens start existing when they are minted (`_mint`), * and stop existing when they are burned (`_burn`). */ function _exists(uint256 tokenId) internal view virtual returns (bool) { return _owners[tokenId] != address(0); } /** * @dev Returns whether `spender` is allowed to manage `tokenId`. * * Requirements: * * - `tokenId` must exist. */ function _isApprovedOrOwner(address spender, uint256 tokenId) internal view virtual returns (bool) { require(_exists(tokenId), "ERC721: operator query for nonexistent token"); address owner = ERC721.ownerOf(tokenId); return (spender == owner || getApproved(tokenId) == spender || isApprovedForAll(owner, spender)); } /** * @dev Safely mints `tokenId` and transfers it to `to`. * * Requirements: * * - `tokenId` must not exist. * - If `to` refers to a smart contract, it must implement {IERC721Receiver-onERC721Received}, which is called upon a safe transfer. * * Emits a {Transfer} event. */ function _safeMint(address to, uint256 tokenId) internal virtual { _safeMint(to, tokenId, ""); } /** * @dev Same as {xref-ERC721-_safeMint-address-uint256-}[`_safeMint`], with an additional `data` parameter which is * forwarded 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" ); } /** * @dev Mints `tokenId` and transfers it to `to`. * * WARNING: Usage of this method is discouraged, use {_safeMint} whenever possible * * Requirements: * * - `tokenId` must not exist. * - `to` cannot be the zero address. * * Emits a {Transfer} event. */ function _mint(address to, uint256 tokenId) internal virtual { require(to != address(0), "ERC721: mint to the zero address"); require(!_exists(tokenId), "ERC721: token already minted"); _beforeTokenTransfer(address(0), to, tokenId); _balances[to] += 1; _owners[tokenId] = to; emit Transfer(address(0), to, tokenId); } /** * @dev Destroys `tokenId`. * The approval is cleared when the token is burned. * * Requirements: * * - `tokenId` must exist. * * Emits a {Transfer} event. */ function _burn(uint256 tokenId) internal virtual { address owner = ERC721.ownerOf(tokenId); _beforeTokenTransfer(owner, address(0), tokenId); // Clear approvals _approve(address(0), tokenId); _balances[owner] -= 1; delete _owners[tokenId]; emit Transfer(owner, address(0), tokenId); } /** * @dev Transfers `tokenId` from `from` to `to`. * As opposed to {transferFrom}, this imposes no restrictions on msg.sender. * * Requirements: * * - `to` cannot be the zero address. * - `tokenId` token must be owned by `from`. * * Emits a {Transfer} event. */ function _transfer( address from, address to, uint256 tokenId ) internal virtual { require(ERC721.ownerOf(tokenId) == from, "ERC721: transfer of token that is not own"); require(to != address(0), "ERC721: transfer to the zero address"); _beforeTokenTransfer(from, to, tokenId); // Clear approvals from the previous owner _approve(address(0), tokenId); _balances[from] -= 1; _balances[to] += 1; _owners[tokenId] = to; emit Transfer(from, to, tokenId); } /** * @dev Approve `to` to operate on `tokenId` * * Emits a {Approval} event. */ function _approve(address to, uint256 tokenId) internal virtual { _tokenApprovals[tokenId] = to; emit Approval(ERC721.ownerOf(tokenId), to, tokenId); } /** * @dev Internal function to invoke {IERC721Receiver-onERC721Received} on a target address. * The call is not executed if the target address is not a contract. * * @param from address representing the previous owner of the given token ID * @param to target address that will receive the tokens * @param tokenId uint256 ID of the token to be transferred * @param _data bytes optional data to send along with the call * @return bool whether the call correctly returned the expected magic value */ function _checkOnERC721Received( address from, address to, uint256 tokenId, bytes memory _data ) private returns (bool) { if (to.isContract()) { try IERC721Receiver(to).onERC721Received(_msgSender(), from, tokenId, _data) returns (bytes4 retval) { return retval == IERC721Receiver.onERC721Received.selector; } catch (bytes memory reason) { if (reason.length == 0) { revert("ERC721: transfer to non ERC721Receiver implementer"); } else { assembly { revert(add(32, reason), mload(reason)) } } } } else { return true; } } /** * @dev Hook that is called before any token transfer. This includes minting * and burning. * * Calling conditions: * * - When `from` and `to` are both non-zero, ``from``'s `tokenId` will be * transferred to `to`. * - When `from` is zero, `tokenId` will be minted for `to`. * - When `to` is zero, ``from``'s `tokenId` will be burned. * - `from` and `to` are never both zero. * * To learn more about hooks, head to xref:ROOT:extending-contracts.adoc#using-hooks[Using Hooks]. */ function _beforeTokenTransfer( address from, address to, uint256 tokenId ) internal virtual {} }
/** * @dev Implementation of https://eips.ethereum.org/EIPS/eip-721[ERC721] Non-Fungible Token Standard, including * the Metadata extension, but not including the Enumerable extension, which is available separately as * {ERC721Enumerable}. */
NatSpecMultiLine
setApprovalForAll
function setApprovalForAll(address operator, bool approved) public virtual override { require(operator != _msgSender(), "ERC721: approve to caller"); _operatorApprovals[_msgSender()][operator] = approved; emit ApprovalForAll(_msgSender(), operator, approved); }
/** * @dev See {IERC721-setApprovalForAll}. */
NatSpecMultiLine
v0.8.3+commit.8d00100c
MIT
ipfs://1f710d8bcd8966b315557e51d40efc2bd775afde93afea26f8386cf10b49aa6f
{ "func_code_index": [ 3768, 4068 ] }
57,759
SlammaJamma
SlammaJamma.sol
0x2aa1c5306f0212e23f2950ecb8464eefb169456d
Solidity
ERC721
contract ERC721 is Context, ERC165, IERC721, IERC721Metadata { using Address for address; using Strings for uint256; // Token name string private _name; // Token symbol string private _symbol; // Mapping from token ID to owner address mapping(uint256 => address) private _owners; // Mapping owner address to token count mapping(address => uint256) private _balances; // Mapping from token ID to approved address mapping(uint256 => address) private _tokenApprovals; // Mapping from owner to operator approvals mapping(address => mapping(address => bool)) private _operatorApprovals; /** * @dev Initializes the contract by setting a `name` and a `symbol` to the token collection. */ constructor(string memory name_, string memory symbol_) { _name = name_; _symbol = symbol_; } /** * @dev See {IERC165-supportsInterface}. */ function supportsInterface(bytes4 interfaceId) public view virtual override(ERC165, IERC165) returns (bool) { return interfaceId == type(IERC721).interfaceId || interfaceId == type(IERC721Metadata).interfaceId || super.supportsInterface(interfaceId); } /** * @dev See {IERC721-balanceOf}. */ function balanceOf(address owner) public view virtual override returns (uint256) { require(owner != address(0), "ERC721: balance query for the zero address"); return _balances[owner]; } /** * @dev See {IERC721-ownerOf}. */ function ownerOf(uint256 tokenId) public view virtual override returns (address) { address owner = _owners[tokenId]; require(owner != address(0), "ERC721: owner query for nonexistent token"); return owner; } /** * @dev See {IERC721Metadata-name}. */ function name() public view virtual override returns (string memory) { return _name; } /** * @dev See {IERC721Metadata-symbol}. */ function symbol() public view virtual override returns (string memory) { return _symbol; } /** * @dev See {IERC721Metadata-tokenURI}. */ function tokenURI(uint256 tokenId) public view virtual override returns (string memory) { require(_exists(tokenId), "ERC721Metadata: URI query for nonexistent token"); string memory baseURI = _baseURI(); return bytes(baseURI).length > 0 ? string(abi.encodePacked(baseURI, tokenId.toString())) : ""; } /** * @dev Base URI for computing {tokenURI}. If set, the resulting URI for each * token will be the concatenation of the `baseURI` and the `tokenId`. Empty * by default, can be overriden in child contracts. */ function _baseURI() internal view virtual returns (string memory) { return ""; } /** * @dev See {IERC721-approve}. */ function approve(address to, uint256 tokenId) public virtual override { address owner = ERC721.ownerOf(tokenId); require(to != owner, "ERC721: approval to current owner"); require( _msgSender() == owner || isApprovedForAll(owner, _msgSender()), "ERC721: approve caller is not owner nor approved for all" ); _approve(to, tokenId); } /** * @dev 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]; } /** * @dev See {IERC721-setApprovalForAll}. */ function setApprovalForAll(address operator, bool approved) public virtual override { require(operator != _msgSender(), "ERC721: approve to caller"); _operatorApprovals[_msgSender()][operator] = approved; emit ApprovalForAll(_msgSender(), operator, approved); } /** * @dev See {IERC721-isApprovedForAll}. */ function isApprovedForAll(address owner, address operator) public view virtual override returns (bool) { return _operatorApprovals[owner][operator]; } /** * @dev See {IERC721-transferFrom}. */ function transferFrom( address from, address to, uint256 tokenId ) public virtual override { //solhint-disable-next-line max-line-length require(_isApprovedOrOwner(_msgSender(), tokenId), "ERC721: transfer caller is not owner nor approved"); _transfer(from, to, tokenId); } /** * @dev See {IERC721-safeTransferFrom}. */ function safeTransferFrom( address from, address to, uint256 tokenId ) public virtual override { safeTransferFrom(from, to, tokenId, ""); } /** * @dev See {IERC721-safeTransferFrom}. */ function safeTransferFrom( address from, address to, uint256 tokenId, bytes memory _data ) public virtual override { require(_isApprovedOrOwner(_msgSender(), tokenId), "ERC721: transfer caller is not owner nor approved"); _safeTransfer(from, to, tokenId, _data); } /** * @dev Safely transfers `tokenId` token from `from` to `to`, checking first that contract recipients * are aware of the ERC721 protocol to prevent tokens from being forever locked. * * `_data` is additional data, it has no specified format and it is sent in call to `to`. * * This internal function is equivalent to {safeTransferFrom}, and can be used to e.g. * implement alternative mechanisms to perform token transfer, such as signature-based. * * Requirements: * * - `from` cannot be the zero address. * - `to` cannot be the zero address. * - `tokenId` token must exist and be owned by `from`. * - If `to` refers to a smart contract, it must implement {IERC721Receiver-onERC721Received}, which is called upon a safe transfer. * * Emits a {Transfer} event. */ function _safeTransfer( address from, address to, uint256 tokenId, bytes memory _data ) internal virtual { _transfer(from, to, tokenId); require(_checkOnERC721Received(from, to, tokenId, _data), "ERC721: transfer to non ERC721Receiver implementer"); } /** * @dev Returns whether `tokenId` exists. * * Tokens can be managed by their owner or approved accounts via {approve} or {setApprovalForAll}. * * Tokens start existing when they are minted (`_mint`), * and stop existing when they are burned (`_burn`). */ function _exists(uint256 tokenId) internal view virtual returns (bool) { return _owners[tokenId] != address(0); } /** * @dev Returns whether `spender` is allowed to manage `tokenId`. * * Requirements: * * - `tokenId` must exist. */ function _isApprovedOrOwner(address spender, uint256 tokenId) internal view virtual returns (bool) { require(_exists(tokenId), "ERC721: operator query for nonexistent token"); address owner = ERC721.ownerOf(tokenId); return (spender == owner || getApproved(tokenId) == spender || isApprovedForAll(owner, spender)); } /** * @dev Safely mints `tokenId` and transfers it to `to`. * * Requirements: * * - `tokenId` must not exist. * - If `to` refers to a smart contract, it must implement {IERC721Receiver-onERC721Received}, which is called upon a safe transfer. * * Emits a {Transfer} event. */ function _safeMint(address to, uint256 tokenId) internal virtual { _safeMint(to, tokenId, ""); } /** * @dev Same as {xref-ERC721-_safeMint-address-uint256-}[`_safeMint`], with an additional `data` parameter which is * forwarded 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" ); } /** * @dev Mints `tokenId` and transfers it to `to`. * * WARNING: Usage of this method is discouraged, use {_safeMint} whenever possible * * Requirements: * * - `tokenId` must not exist. * - `to` cannot be the zero address. * * Emits a {Transfer} event. */ function _mint(address to, uint256 tokenId) internal virtual { require(to != address(0), "ERC721: mint to the zero address"); require(!_exists(tokenId), "ERC721: token already minted"); _beforeTokenTransfer(address(0), to, tokenId); _balances[to] += 1; _owners[tokenId] = to; emit Transfer(address(0), to, tokenId); } /** * @dev Destroys `tokenId`. * The approval is cleared when the token is burned. * * Requirements: * * - `tokenId` must exist. * * Emits a {Transfer} event. */ function _burn(uint256 tokenId) internal virtual { address owner = ERC721.ownerOf(tokenId); _beforeTokenTransfer(owner, address(0), tokenId); // Clear approvals _approve(address(0), tokenId); _balances[owner] -= 1; delete _owners[tokenId]; emit Transfer(owner, address(0), tokenId); } /** * @dev Transfers `tokenId` from `from` to `to`. * As opposed to {transferFrom}, this imposes no restrictions on msg.sender. * * Requirements: * * - `to` cannot be the zero address. * - `tokenId` token must be owned by `from`. * * Emits a {Transfer} event. */ function _transfer( address from, address to, uint256 tokenId ) internal virtual { require(ERC721.ownerOf(tokenId) == from, "ERC721: transfer of token that is not own"); require(to != address(0), "ERC721: transfer to the zero address"); _beforeTokenTransfer(from, to, tokenId); // Clear approvals from the previous owner _approve(address(0), tokenId); _balances[from] -= 1; _balances[to] += 1; _owners[tokenId] = to; emit Transfer(from, to, tokenId); } /** * @dev Approve `to` to operate on `tokenId` * * Emits a {Approval} event. */ function _approve(address to, uint256 tokenId) internal virtual { _tokenApprovals[tokenId] = to; emit Approval(ERC721.ownerOf(tokenId), to, tokenId); } /** * @dev Internal function to invoke {IERC721Receiver-onERC721Received} on a target address. * The call is not executed if the target address is not a contract. * * @param from address representing the previous owner of the given token ID * @param to target address that will receive the tokens * @param tokenId uint256 ID of the token to be transferred * @param _data bytes optional data to send along with the call * @return bool whether the call correctly returned the expected magic value */ function _checkOnERC721Received( address from, address to, uint256 tokenId, bytes memory _data ) private returns (bool) { if (to.isContract()) { try IERC721Receiver(to).onERC721Received(_msgSender(), from, tokenId, _data) returns (bytes4 retval) { return retval == IERC721Receiver.onERC721Received.selector; } catch (bytes memory reason) { if (reason.length == 0) { revert("ERC721: transfer to non ERC721Receiver implementer"); } else { assembly { revert(add(32, reason), mload(reason)) } } } } else { return true; } } /** * @dev Hook that is called before any token transfer. This includes minting * and burning. * * Calling conditions: * * - When `from` and `to` are both non-zero, ``from``'s `tokenId` will be * transferred to `to`. * - When `from` is zero, `tokenId` will be minted for `to`. * - When `to` is zero, ``from``'s `tokenId` will be burned. * - `from` and `to` are never both zero. * * To learn more about hooks, head to xref:ROOT:extending-contracts.adoc#using-hooks[Using Hooks]. */ function _beforeTokenTransfer( address from, address to, uint256 tokenId ) internal virtual {} }
/** * @dev Implementation of https://eips.ethereum.org/EIPS/eip-721[ERC721] Non-Fungible Token Standard, including * the Metadata extension, but not including the Enumerable extension, which is available separately as * {ERC721Enumerable}. */
NatSpecMultiLine
isApprovedForAll
function isApprovedForAll(address owner, address operator) public view virtual override returns (bool) { return _operatorApprovals[owner][operator]; }
/** * @dev See {IERC721-isApprovedForAll}. */
NatSpecMultiLine
v0.8.3+commit.8d00100c
MIT
ipfs://1f710d8bcd8966b315557e51d40efc2bd775afde93afea26f8386cf10b49aa6f
{ "func_code_index": [ 4134, 4303 ] }
57,760