Verified contractPartial
Adoption
Address0xbae533c9c0a67d5de2b89a8fd0bc01a2b450bd2d
- Balance
0 ETH
- Transactions
73
- 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,152,680
- Creation transaction
- 0x22c8ca153c…7ee83a4463
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) public payable {
oldOwner.transfer(price);
}
function gimmeTendies(address, uint256 price) public payable {
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));
gimmeTendies(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
{
"optimizer": {
"runs": 0,
"enabled": false
}
}Source code and metadata: Sourcify.
The source code belongs to the authors of the contract.