Verified contractPartial
Adoption
Address0x9cc5404e0ad06fe0ff4d2c7cc5f28a32ae95e483
- Balance
0.001 ETH
- Transactions
36
- Compiler
solc 0.4.20
- Same code
1 more contract
Details
- Compiler
- solc 0.4.20+commit.3155dd80
- Language
- solidity
- Optimization
- No
- License
- Not stated
- Match
- Partialcreation code: yes, runtime code: yes
- Verified on Sourcify
- Created in block
- 5,153,277
- Creation transaction
- 0xb88dcdc1ac…d583f1350b
Adoption.sol
pragma solidity ^0.4.19;
contract Adoption {
address ceoAddress = 0x1AEA2d3709bB7CFf5326a4Abc44c45Aa2629C626;
struct Pepe {
address owner;
uint256 price;
}
Pepe[16] data;
function Adoption() public {
for (uint i = 0; i < 16; i++) {
data[i].price = 10000000000000000;
data[i].owner = msg.sender;
}
}
function returnEth(address oldOwner, uint256 price) private {
oldOwner.transfer(price);
}
function fee(address, uint256 price) public {
ceoAddress.transfer(price);
}
// Adopting a pet
function adopt(uint pepeId) public payable returns (uint, uint) {
require(pepeId >= 0 && pepeId <= 15);
if ( data[pepeId].price == 10000000000000000 ) {
data[pepeId].price = 20000000000000000;
} else {
data[pepeId].price = data[pepeId].price * 2;
}
require(msg.value >= data[pepeId].price * uint256(1));
returnEth(data[pepeId].owner, (data[pepeId].price / 10) * (9));
fee(ceoAddress, (data[pepeId].price / 10) * (1));
data[pepeId].owner = msg.sender;
return (pepeId, data[pepeId].price);
//return value;
}
function getAdopters() external view returns (address[], uint256[]) {
address[] memory owners = new address[](16);
uint256[] memory prices = new uint256[](16);
for (uint i=0; i<16; i++) {
owners[i] = (data[i].owner);
prices[i] = (data[i].price);
}
return (owners,prices);
}
}Compiler settingsShow
{
"libraries": {},
"optimizer": {
"runs": 200,
"enabled": false
},
"remappings": []
}Source code and metadata: Sourcify.
The source code belongs to the authors of the contract.