Commit Graph

214 Commits

Author SHA1 Message Date
Mark Spanbroek 6e0aded775 Deposit collateral 2022-03-01 09:38:53 +01:00
Mark Spanbroek 7bcf3fe92c Run linter before tests 2022-02-10 07:46:03 +01:00
Mark Spanbroek f7af18eb2d Lint with solhint 2022-02-10 07:46:03 +01:00
Mark Spanbroek 78755ecaa2 Format using prettier 2022-02-10 07:46:03 +01:00
Mark Spanbroek 41fd33ac7a Add license 2022-01-10 11:16:47 +01:00
Mark Spanbroek 0fedd8875f Use standard ABI encoding instead of the non-standard
packing mode.
2021-11-24 11:43:31 +01:00
Mark Spanbroek b9a9be350a Simplify signature of TestToken.mint
To be compatible with nim-web3, which doesn't
support arrays in a method signature.
2021-11-23 14:35:00 +01:00
Mark Spanbroek a794141308 Add `npm start` to start development node
It also creates a JSON file with addresses
of the deployed contracts.
2021-11-18 13:56:12 +01:00
Mark Spanbroek a69a6d6975 Use deployment fixture for Storage contract tests 2021-11-18 13:56:12 +01:00
Mark Spanbroek 7b16841534 Change test token to allow arbitrary minting 2021-11-18 13:56:12 +01:00
Mark Spanbroek 9b957b9663 Add hardhat-deploy-ethers plugin 2021-11-18 13:56:12 +01:00
Mark Spanbroek ce4760608b Add deployment scripts for TestToken and Storage 2021-11-18 13:56:12 +01:00
Mark Spanbroek 3431f77c82 Add hardhat-deploy plugin 2021-11-18 13:56:12 +01:00
Mark Spanbroek f499b8453d Add Readme 2021-11-08 16:07:43 +01:00
Mark Spanbroek 0c0ee0fad6 MIT license 2021-11-08 16:03:32 +01:00
Mark Spanbroek 2277fd1366 Add TODO 2021-11-04 14:28:02 +01:00
Mark Spanbroek 8bb8441bce Slash host stake when too many proofs are missing 2021-11-04 14:19:58 +01:00
Mark Spanbroek 50bab88447 Allow slashing of stake 2021-11-04 13:16:11 +01:00
Mark Spanbroek 38fee6d83a Pay host when contract is finished 2021-11-04 11:55:47 +01:00
Mark Spanbroek d2a3cc4a89 Client pays price when creating contract 2021-11-04 11:40:03 +01:00
Mark Spanbroek afad0e49ec Mint test tokens for both client and host 2021-11-04 11:32:21 +01:00
Mark Spanbroek 54cc2987df Ensure that finishing a contract can only be done once 2021-11-04 11:18:05 +01:00
Mark Spanbroek 8fbb99630c Ensure that starting a contract can only be done once 2021-11-04 10:23:00 +01:00
Mark Spanbroek aa673ff71c Unlock host stake at end of contract 2021-11-04 10:19:23 +01:00
Mark Spanbroek d0a22afc3d Extract mining test helpers to separate module 2021-11-04 10:18:09 +01:00
Mark Spanbroek 6de82709ca Only host can call start on a contract 2021-11-04 10:00:41 +01:00
Mark Spanbroek 376962322d Only expect proofs when the contract is started 2021-11-04 10:00:41 +01:00
Mark Spanbroek 7bb949a5cc Wording 2021-11-03 17:20:33 +01:00
Mark Spanbroek b865d0f4c9 Decrease chance of incidental test failure 2021-11-03 17:15:24 +01:00
Mark Spanbroek c0fb0c725c Do not require proofs before start of contract 2021-11-03 17:15:03 +01:00
Mark Spanbroek 8efa9fe162 Stop requiring proofs when contract has ended 2021-11-03 17:02:12 +01:00
Mark Spanbroek 2784800c3e Add end time to proofs based on contract duration 2021-11-03 17:01:11 +01:00
Mark Spanbroek 3326c4fe74 Make isProofRequired() work for the current block
The block hash of the current block is not known yet, so
we use the block hash of the previous block to determine
whether a proof is required for a block.
2021-11-03 13:20:40 +01:00
Mark Spanbroek e7f3dc3dae Define contract duration in number of blocks
This makes calculation with duration in Solidity simpler
and less prone to errors.
2021-11-03 11:10:42 +01:00
Mark Spanbroek 65c3cacb66 Host stake is locked up when contract is created 2021-11-02 12:50:20 +01:00
Mark Spanbroek d49c75a74b Make amount of stake configurable 2021-11-02 12:45:53 +01:00
Mark Spanbroek 8736e5a1aa Host has to put up stake before entering into a contract 2021-11-02 11:25:01 +01:00
Mark Spanbroek 3b6ec4126d Fix comments 2021-11-02 11:22:34 +01:00
Mark Spanbroek 5eb571fe1c Use 'request' and 'bid' objects in tests 2021-11-02 09:45:49 +01:00
Mark Spanbroek a5e05018ad Move example values for tests into separate file 2021-11-02 09:04:51 +01:00
Mark Spanbroek 7b6c6c2fc5 Rename: StorageContracts -> Storage 2021-11-01 16:34:01 +01:00
Mark Spanbroek eefa23ff02 Change parameter order
Move parameters belonging to the bid together.
2021-11-01 16:23:37 +01:00
Mark Spanbroek 650f5d1f1a Checking of new storage contracts is moved to Contracts.sol 2021-11-01 16:17:42 +01:00
Mark Spanbroek aa0def1127 Move timeout validity check to Proofs contract 2021-11-01 15:28:22 +01:00
Mark Spanbroek d5dede6e6b Change visibility of stake functions to 'internal'
This ensures that any contract that inherits from Stakes
doesn't expose its functions by default.
2021-11-01 15:17:19 +01:00
Mark Spanbroek d1f5ce0786 Extract logic around proofs into separate contract 2021-11-01 15:12:05 +01:00
Mark Spanbroek c013a37229 Add contract for keeping track of stakes in ERC20 tokens 2021-10-21 14:09:37 +02:00
Mark Spanbroek 23887f9190 Do not mark proof as missing twice 2021-10-21 10:32:29 +02:00
Mark Spanbroek c3e85c675a Use bid hash as contract id
Adds nonce to storage request to ensure uniqueness.
2021-10-20 14:30:31 +02:00
Mark Spanbroek 08cedae4bf Multiple storage contracts in solidity contract 2021-10-20 14:30:31 +02:00