More Info
Private Name Tags
ContractCreator
Transaction Hash |
Method
|
Block
|
From
|
To
|
|||||
---|---|---|---|---|---|---|---|---|---|
Loading...
Loading
Similar Match Source Code This contract matches the deployed Bytecode of the Source Code for Contract 0xCcf9064c...45f0c5C88 The constructor portion of the code might be different and could alter the actual behaviour of the contract
Contract Name:
Escrow
Compiler Version
v0.5.2+commit.1df8f40c
Contract Source Code (Solidity)
/** *Submitted for verification at Etherscan.io on 2019-10-07 */ pragma solidity 0.5.2; /*************** ** ** ** INTERFACES ** ** ** ***************/ /** * @title Interface for Kong ERC20 Token Contract. */ interface KongERC20Interface { function balanceOf(address who) external view returns (uint256); function transfer(address to, uint256 value) external returns (bool); function mint(uint256 mintedAmount, address recipient) external; function getMintingLimit() external returns(uint256); } /** * @title Interface for EllipticCurve contract. */ interface EllipticCurveInterface { function validateSignature(bytes32 message, uint[2] calldata rs, uint[2] calldata Q) external view returns (bool); } /** * @title Kong escrow contract. * * @dev This contract escrows Kong tokens until the timestamp specified in `unlockTime`. * Afterwards, `transferTokens()` can be called to transfer the escrowed tokens to a * destination address of choice. The function has to be provided with a valid SECP256R1 * signature of a specifically-formatted sha256 hash for the public key stored in the * variables `publicKeyX` and `publicKeyY`. The signature is verified by a separately- * deployed contract capable of verifying SECP256R1 signatures. */ contract Escrow { uint256 _publicKeyX; uint256 _publicKeyY; uint256 _unlockTime; address _eccAddress; address _tokAddress; uint256 constant BLOCK_DELAY = 240; /** * @dev All of the variables set in the constructor are immutable. * * @param publicKeyX X coordinate of public key. * @param publicKeyY Y coordinate of public key. * @param eccAddress Address of elliptic curve contract. * @param tokAddress Address of Kong ERC20 contract. * @param unlockTime Timestamp at which transfers become possible. */ constructor( uint256 publicKeyX, uint256 publicKeyY, address eccAddress, address tokAddress, uint256 unlockTime ) public { _publicKeyX = publicKeyX; _publicKeyY = publicKeyY; _eccAddress = eccAddress; _tokAddress = tokAddress; _unlockTime = unlockTime; } /** * @dev Function to transfer Kong tokens. * * @param to Recipient. * @param blockNumber Number of the block(hash) included in the signature. * @param rs R+S value of the signature. */ function transferTokens( address to, uint256 blockNumber, uint256[2] calldata rs ) external { // Verify that timelock has expired. require(block.timestamp >= _unlockTime, 'Cannot unlock yet.'); // Verify blockhash is from recent past. require(block.number >= blockNumber, 'Invalid block.'); require(block.number <= blockNumber + BLOCK_DELAY, 'Outdated block.'); // Verify signature. require(_validateSignature(sha256(abi.encodePacked(to, blockhash(blockNumber))), rs), 'Invalid signature.'); // Transfer current balance from token contract to `to`. KongERC20Interface(_tokAddress).transfer(to, KongERC20Interface(_tokAddress).balanceOf(address(this))); } /** * @dev Function to validate SECP256R1 signatures. * * @param message The hash of the signed message. * @param rs R+S value of the signature. */ function _validateSignature( bytes32 message, uint256[2] memory rs ) internal view returns (bool) { return EllipticCurveInterface(_eccAddress).validateSignature(message, rs, [_publicKeyX, _publicKeyY]); } /** * @dev Helper function to return state variables. */ function getContractState() external view returns ( uint256, uint256, address, uint256, address ) { return (_publicKeyX, _publicKeyY, _eccAddress, _unlockTime, _tokAddress); } }
Contract Security Audit
- No Contract Security Audit Submitted- Submit Audit Here
[{"constant":true,"inputs":[],"name":"getContractState","outputs":[{"name":"","type":"uint256"},{"name":"","type":"uint256"},{"name":"","type":"address"},{"name":"","type":"uint256"},{"name":"","type":"address"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":false,"inputs":[{"name":"to","type":"address"},{"name":"blockNumber","type":"uint256"},{"name":"rs","type":"uint256[2]"}],"name":"transferTokens","outputs":[],"payable":false,"stateMutability":"nonpayable","type":"function"},{"inputs":[{"name":"publicKeyX","type":"uint256"},{"name":"publicKeyY","type":"uint256"},{"name":"eccAddress","type":"address"},{"name":"tokAddress","type":"address"},{"name":"unlockTime","type":"uint256"}],"payable":false,"stateMutability":"nonpayable","type":"constructor"}]
Deployed Bytecode
0x608060405234801561001057600080fd5b5060043610610053576000357c0100000000000000000000000000000000000000000000000000000000900480637f4e484914610058578063e686ee8b146100ea575b600080fd5b610060610142565b604051808681526020018581526020018473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020018381526020018273ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019550505050505060405180910390f35b6101406004803603608081101561010057600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff16906020019092919080359060200190929190806040019091929192905050506101a9565b005b60008060008060008054600154600360009054906101000a900473ffffffffffffffffffffffffffffffffffffffff16600254600460009054906101000a900473ffffffffffffffffffffffffffffffffffffffff16945094509450945094509091929394565b6002544210151515610223576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825260128152602001807f43616e6e6f7420756e6c6f636b207965742e000000000000000000000000000081525060200191505060405180910390fd5b81431015151561029b576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040180806020018281038252600e8152602001807f496e76616c696420626c6f636b2e00000000000000000000000000000000000081525060200191505060405180910390fd5b60f082014311151515610316576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040180806020018281038252600f8152602001807f4f7574646174656420626c6f636b2e000000000000000000000000000000000081525060200191505060405180910390fd5b6104596002848440604051602001808373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff166c01000000000000000000000000028152601401828152602001925050506040516020818303038152906040526040518082805190602001908083835b6020831015156103b4578051825260208201915060208101905060208303925061038f565b6001836020036101000a038019825116818451168082178552505050505050905001915050602060405180830381855afa1580156103f6573d6000803e3d6000fd5b5050506040513d602081101561040b57600080fd5b8101908080519060200190929190505050826002806020026040519081016040528092919082600260200280828437600081840152601f19601f8201169050808301925050505050506106c8565b15156104cd576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825260128152602001807f496e76616c6964207369676e61747572652e000000000000000000000000000081525060200191505060405180910390fd5b600460009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1663a9059cbb84600460009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff166370a08231306040518263ffffffff167c0100000000000000000000000000000000000000000000000000000000028152600401808273ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200191505060206040518083038186803b1580156105c757600080fd5b505afa1580156105db573d6000803e3d6000fd5b505050506040513d60208110156105f157600080fd5b81019080805190602001909291905050506040518363ffffffff167c0100000000000000000000000000000000000000000000000000000000028152600401808373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200182815260200192505050602060405180830381600087803b15801561068757600080fd5b505af115801561069b573d6000803e3d6000fd5b505050506040513d60208110156106b157600080fd5b810190808051906020019092919050505050505050565b6000600360009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff166304e960d78484604080519081016040528060005481526020016001548152506040518463ffffffff167c01000000000000000000000000000000000000000000000000000000000281526004018084815260200183600260200280838360005b8381101561077f578082015181840152602081019050610764565b5050505090500182600260200280838360005b838110156107ad578082015181840152602081019050610792565b50505050905001935050505060206040518083038186803b1580156107d157600080fd5b505afa1580156107e5573d6000803e3d6000fd5b505050506040513d60208110156107fb57600080fd5b810190808051906020019092919050505090509291505056fea165627a7a723058202d3069df31319100e8ebcb15877cc97f9e8bcf50493552dc1c33c3e4c0c23bfa0029
Deployed Bytecode Sourcemap
1302:2625:0:-;;;;8:9:-1;5:2;;;30:1;27;20:12;5:2;1302:2625:0;;;;;;;;;;;;;;;;;;;;;;;;;3731:191;;;:::i;:::-;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;2486:734;;;;;;13:3:-1;8;5:12;2:2;;;30:1;27;20:12;2:2;2486:734:0;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;:::i;:::-;;3731:191;3788:7;3797;3806;3815;3824;3852:11;;3865;;3878;;;;;;;;;;;3891;;3904;;;;;;;;;;;3844:72;;;;;;;;;;3731:191;;;;;:::o;2486:734::-;2680:11;;2661:15;:30;;2653:61;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;2793:11;2777:12;:27;;2769:54;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;1479:3;2854:11;:25;2838:12;:41;;2830:69;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;2942:76;2961:52;2985:2;2999:11;2989:22;2968:44;;;;;;;;;;;;;;;;;;;;;;;;;;;49:4:-1;39:7;30;26:21;22:32;13:7;6:49;2968:44:0;;;2961:52;;;;;;;;;;;;;36:153:-1;66:2;61:3;58:11;51:19;36:153;;;182:3;176:10;171:3;164:23;98:2;93:3;89:12;82:19;;123:2;118:3;114:12;107:19;;148:2;143:3;139:12;132:19;;36:153;;;274:1;267:3;263:2;259:12;254:3;250:22;246:30;315:4;311:9;305:3;299:10;295:26;356:4;350:3;344:10;340:21;389:7;380;377:20;372:3;365:33;3:399;;;2961:52:0;;;;;;;;;;;;;;;;;;;;8:9:-1;5:2;;;45:16;42:1;39;24:38;77:16;74:1;67:27;5:2;2961:52:0;;;;;;13:2:-1;8:3;5:11;2:2;;;29:1;26;19:12;2:2;2961:52:0;;;;;;;;;;;;;;;;3015:2;2942:76;;;;;;;;;;;;;;;;;;;30:3:-1;22:6;14;1:33;99:1;93:3;85:6;81:16;74:27;137:4;133:9;126:4;121:3;117:14;113:30;106:37;;169:3;161:6;157:16;147:26;;2942:76:0;;;;;:18;:76::i;:::-;2934:107;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;3131:11;;;;;;;;;;;3112:40;;;3153:2;3176:11;;;;;;;;;;;3157:41;;;3207:4;3157:56;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;8:9:-1;5:2;;;30:1;27;20:12;5:2;3157:56:0;;;;8:9:-1;5:2;;;45:16;42:1;39;24:38;77:16;74:1;67:27;5:2;3157:56:0;;;;;;;13:2:-1;8:3;5:11;2:2;;;29:1;26;19:12;2:2;3157:56:0;;;;;;;;;;;;;;;;3112:102;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;8:9:-1;5:2;;;30:1;27;20:12;5:2;3112:102:0;;;;8:9:-1;5:2;;;45:16;42:1;39;24:38;77:16;74:1;67:27;5:2;3112:102:0;;;;;;;13:2:-1;8:3;5:11;2:2;;;29:1;26;19:12;2:2;3112:102:0;;;;;;;;;;;;;;;;;2486:734;;;:::o;3424:233::-;3534:4;3580:11;;;;;;;;;;;3557:53;;;3611:7;3620:2;3557:94;;;;;;;;;3625:11;;3557:94;;;;3638:11;;3557:94;;;;;;;;;;;;;;;;;;;;;;;;;;;23:1:-1;8:100;33:3;30:1;27:10;8:100;;;99:1;94:3;90:11;84:18;80:1;75:3;71:11;64:39;52:2;49:1;45:10;40:15;;8:100;;;12:14;3557:94:0;;;;;;;;;;;;;23:1:-1;8:100;33:3;30:1;27:10;8:100;;;99:1;94:3;90:11;84:18;80:1;75:3;71:11;64:39;52:2;49:1;45:10;40:15;;8:100;;;12:14;3557:94:0;;;;;;;;;;;;;;;;;;;;;;8:9:-1;5:2;;;30:1;27;20:12;5:2;3557:94:0;;;;8:9:-1;5:2;;;45:16;42:1;39;24:38;77:16;74:1;67:27;5:2;3557:94:0;;;;;;;13:2:-1;8:3;5:11;2:2;;;29:1;26;19:12;2:2;3557:94:0;;;;;;;;;;;;;;;;3550:101;;3424:233;;;;:::o
Swarm Source
bzzr://2d3069df31319100e8ebcb15877cc97f9e8bcf50493552dc1c33c3e4c0c23bfa
Loading...
Loading
Loading...
Loading
Multichain Portfolio | 30 Chains
Chain | Token | Portfolio % | Price | Amount | Value |
---|
Loading...
Loading
A contract address hosts a smart contract, which is a set of code stored on the blockchain that runs when predetermined conditions are met. Learn more about addresses in our Knowledge Base.