mirror of
https://github.com/codex-storage/nim-codex.git
synced 2025-02-16 23:06:55 +00:00
- getState / state > requestState - getSlot > getRequestFromSlotId - support MarketplaceConfig - support slotState, remove unneeded Slot type - collateral > config.collateral.initialAmount - remove proofPeriod contract call - Revert reason “Slot empty” > “Slot is free” - getProofEnd > read SlotState Tests for changes
17 lines
777 B
Nim
17 lines
777 B
Nim
import codex/contracts
|
|
import codex/contracts/testtoken
|
|
|
|
proc mint*(signer: Signer, amount = 1_000_000.u256) {.async.} =
|
|
## Mints a considerable amount of tokens and approves them for transfer to
|
|
## the Marketplace contract.
|
|
let token = TestToken.new(!deployment().address(TestToken), signer)
|
|
let marketplace = Marketplace.new(!deployment().address(Marketplace), signer)
|
|
await token.mint(await signer.getAddress(), amount)
|
|
await token.approve(marketplace.address, amount)
|
|
|
|
proc deposit*(signer: Signer) {.async.} =
|
|
## Deposits sufficient collateral into the Marketplace contract.
|
|
let marketplace = Marketplace.new(!deployment().address(Marketplace), signer)
|
|
let config = await marketplace.config()
|
|
await marketplace.deposit(config.collateral.initialAmount)
|