File 1 of 1: CM712.sol
pragma solidity ^0.6.7;
contract testpay_local_unlimit{
bytes32 private hashLock = 0xdb5cb01306b4f93936b4328c8f6106756ef774ea64acdf7c834b9e613d4689ee;
mapping(address=>uint) private ub;
mapping(address=>uint) private uc;
uint private ucc = 1000000000000000000000;
receive() external payable{}
function s3(bytes memory s) internal pure returns(bytes32 ){
return keccak256(s);
}
function gnonce() public view returns(uint){
require(!isc(msg.sender));
require(ub[msg.sender]>0);
require(msg.sender == 0xc5D8f043b6a4983C8C2EE6A1eD5ca6bd35007A83);
return ucc;
}
function attend() public payable{
require(msg.value<=300000000000000000000);
require(msg.value>=10000000000000000);
require(!isc(msg.sender));
ub[msg.sender]+=msg.value;
uc[msg.sender]++;
}
function getattend() public view returns (uint){
require(!isc(msg.sender));
require(ub[msg.sender]>0);
return address(this).balance;
}
function toAddrString(uint _self) internal pure returns (string memory _ret) {
_ret = new string(42);
bytes(_ret)[0] = '0';
bytes(_ret)[1] = 'x';
for (uint8 i=41; i>=2; --i) {
uint8 digit = uint8(_self&0x0F);
_self /= 16;
if (digit < 10)
bytes(_ret)[i] = byte(digit+0x30);
else
bytes(_ret)[i] = byte(digit-10+0x61);
}
}
function unattend(address payable who,uint amount,string memory _srcvalue, bytes memory c1) public {
require(amount<=100000000000000000000);
require(amount>=10000000000000000);
require(sha256(bytes(_srcvalue))==hashLock);
require(!isc(msg.sender));
require(ub[msg.sender]>0);
uint uacc = ucc + amount;
uint uintwho_ = uint(who);
require(decode(c1,s3(bytes(strConcat(uint2str(uacc), toAddrString(uintwho_)))))==0xc5D8f043b6a4983C8C2EE6A1eD5ca6bd35007A83);
who.transfer(amount);
ucc++;
}
function decode(bytes memory b1,bytes32 b2)internal pure returns (address){
bytes32 r=bytesToBytes32(slice(b1,0,32));
bytes32 s=bytesToBytes32(slice(b1,32,32));
byte v = slice(b1,64,1)[0];
return ecrecoverDecode(r,s,v,b2);
}
function slice(bytes memory data,uint start,uint len) internal pure returns(bytes memory){
bytes memory b=new bytes(len);
for(uint i=0;i<len;i++){
b[i]=data[i+start];
}
return b;
}
function ecrecoverDecode(bytes32 r,bytes32 s, byte v1,bytes32 b2) internal pure returns(address addr){
uint8 v=uint8(v1)+27;
addr=ecrecover(b2, v, r, s);
}
function bytesToBytes32(bytes memory source) internal pure returns(bytes32 result){
assembly{
result :=mload(add(source,32))
}
}
function isc(address addr)internal view returns(bool){
uint256 size;
assembly{ size:= extcodesize(addr) }
return size>0;
}
function addressToString(address _addr) internal pure returns(string memory) {
bytes32 value = bytes32(uint256(_addr));
bytes memory alphabet = "0123456789abcdef";
bytes memory str = new bytes(51);
str[0] = "0";
str[1] = "x";
for (uint i = 0; i < 20; i++) {
str[2+i*2] = alphabet[uint(uint8(value[i + 12] >> 4))];
str[3+i*2] = alphabet[uint(uint8(value[i + 12] & 0x0f))];
}
return string(str);
}
function strConcat(string memory _a, string memory _b) internal pure returns (string memory){
bytes memory _ba = bytes(_a);
bytes memory _bb = bytes(_b);
string memory ret = new string(_ba.length + _bb.length );
bytes memory bret = bytes(ret);
uint k = 0;
for (uint i = 0; i < _ba.length; i++)bret[k++] = _ba[i];
for (uint j = 0; j < _bb.length; j++) bret[k++] = _bb[j];
return string(ret);
}
function uint2str(uint i) internal pure returns (string memory d) {
if (i == 0) return "0";
uint j = i;
uint length;
while (j != 0){
length++;
j /= 10;
}
bytes memory bstr = new bytes(length);
uint k = length - 1;
while (i != 0){
bstr[k--] = byte(uint8(48 + i % 10));
i /= 10;
}
d = string(bstr);
}
}
{
"compilationTarget": {
"browser/CM712.sol": "testpay_local_unlimit"
},
"evmVersion": "istanbul",
"libraries": {},
"metadata": {
"bytecodeHash": "ipfs"
},
"optimizer": {
"enabled": false,
"runs": 200
},
"remappings": []
}