Created
January 10, 2023 18:48
-
-
Save WPSmartContracts/69ca858b4f094d68a824bd62dccf1c34 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
> hardhat test "test/stake/test-eve-otc-emergency.js" | |
Contract: EVE OTC / Emergency Functions | |
Pausing the contract | |
✓ Only owner can pause the contract (383ms) | |
When commissions are greater than 1 | |
shouldBehaveLikeBuyAndSell | |
Sellers | |
✓ Should not add offers if paused (111ms) | |
✓ Should not buy offers if paused (242ms) | |
✓ Emergency withdraw (86ms) | |
✓ Only owner can do an emergency withdraw (90ms) | |
Buyers | |
Should not cancel trades if paused | |
✓ Should not withdraw funds if paused (86ms) | |
When commissions are lower than 1 | |
shouldBehaveLikeBuyAndSell | |
Sellers | |
✓ Should not add offers if paused (106ms) | |
✓ Should not buy offers if paused (224ms) | |
✓ Emergency withdraw (80ms) | |
✓ Only owner can do an emergency withdraw (94ms) | |
Buyers | |
Should not cancel trades if paused | |
✓ Should not withdraw funds if paused (83ms) | |
11 passing (26s) | |
> hardhat test "test/stake/test-eve-otc.js" | |
Contract: EVE OTC | |
Basic data | |
✓ commission (55ms) | |
✓ modify value (46ms) | |
✓ Verify permission for modify with a non-admin user (59ms) | |
3 passing (2s) | |
> hardhat test "test/stake/test-eve-otc-option.js" | |
Contract: EVE OTC / Oracle | |
addOffer | |
pre conditions | |
✓ Positive offer (66ms) | |
✓ Erroring transfer sale funds (47ms) | |
Token for sale not enabled | |
✓ when token does not exists | |
✓ when token exists but is not enabled | |
✓ when is not a token | |
Token for payments not enabled | |
✓ when token does not exists | |
✓ when token exists but is not enabled | |
✓ when is not a token | |
events | |
✓ New Offer (63ms) | |
Option Trades | |
When the seller have no stake | |
add offers with system tokens | |
Should Behave Like An Option Trade | |
Cancel Trade | |
✓ only owner can cancel the trade | |
✓ offer should be inactive | |
✓ should return all funds if no buying has happened | |
Check Funds | |
✓ The amount available should be exact to the one added | |
Changing commissions | |
✓ The amount available should be exact to the one added | |
Premium | |
Paying premium | |
✓ estimatePremiumAmount | |
✓ Should create the order if the premium is paid (77ms) | |
✓ Should close the offer if the buyer buys all (80ms) | |
✓ Should not close the offer if the buyer don't buys it all (95ms) | |
✓ Emits a NewPremium event (68ms) | |
Exceptions | |
✓ When the offer does not exists (59ms) | |
✓ When the offer is not an option trade (98ms) | |
✓ When there is not approved amount | |
Paying an option trade | |
Paying an option trade with the same token as premium | |
✓ Estimate option trade (107ms) | |
✓ Should sell the tokens if the premium is paid (313ms) | |
Exceptions | |
✓ Paying an option trade with another token | |
✓ When the offer does not exists | |
✓ When the buy does not exists | |
✓ When the offer is not an option trade | |
✓ When there is not approved amount | |
✓ When the caller is not the buyer | |
✓ When the buy is already paid | |
✓ When the payment is out of the payment window | |
Cancelling an option trade | |
✓ After creation | |
✓ After sellings | |
Should Behave Like An Option Trade | |
Cancel Trade | |
✓ only owner can cancel the trade | |
✓ offer should be inactive (89ms) | |
✓ should return all funds if no buying has happened (99ms) | |
Check Funds | |
✓ The amount available should be exact to the one added | |
Changing commissions | |
✓ The amount available should be exact to the one added | |
Premium | |
Paying premium | |
✓ estimatePremiumAmount | |
✓ Should create the order if the premium is paid (153ms) | |
✓ Should close the offer if the buyer buys all (163ms) | |
✓ Should not close the offer if the buyer don't buys it all (134ms) | |
✓ Emits a NewPremium event (155ms) | |
Exceptions | |
✓ When the offer does not exists (117ms) | |
✓ When the offer is not an option trade (307ms) | |
✓ When there is not approved amount | |
Paying an option trade | |
Paying an option trade with the same token as premium | |
✓ Estimate option trade (185ms) | |
✓ Should sell the tokens if the premium is paid (573ms) | |
Exceptions | |
✓ Paying an option trade with another token | |
✓ When the offer does not exists | |
✓ When the buy does not exists | |
✓ When the offer is not an option trade | |
✓ When there is not approved amount | |
✓ When the caller is not the buyer | |
✓ When the buy is already paid | |
✓ When the payment is out of the payment window | |
Cancelling an option trade | |
✓ After creation | |
✓ After sellings | |
Should Behave Like An Option Trade | |
Cancel Trade | |
✓ only owner can cancel the trade (64ms) | |
✓ offer should be inactive (55ms) | |
✓ should return all funds if no buying has happened (47ms) | |
Check Funds | |
✓ The amount available should be exact to the one added | |
Changing commissions | |
✓ The amount available should be exact to the one added | |
Premium | |
Paying premium | |
✓ estimatePremiumAmount | |
✓ Should create the order if the premium is paid (232ms) | |
✓ Should close the offer if the buyer buys all (111ms) | |
✓ Should not close the offer if the buyer don't buys it all (251ms) | |
✓ Emits a NewPremium event (146ms) | |
Exceptions | |
✓ When the offer does not exists (169ms) | |
✓ When the offer is not an option trade (211ms) | |
✓ When there is not approved amount | |
Paying an option trade | |
Paying an option trade with the same token as premium | |
✓ Estimate option trade (196ms) | |
✓ Should sell the tokens if the premium is paid (597ms) | |
Exceptions | |
✓ Paying an option trade with another token | |
✓ When the offer does not exists | |
✓ When the buy does not exists | |
✓ When the offer is not an option trade | |
✓ When there is not approved amount | |
✓ When the caller is not the buyer | |
✓ When the buy is already paid | |
✓ When the payment is out of the payment window | |
Cancelling an option trade | |
✓ After creation | |
✓ After sellings | |
Should Behave Like An Option Trade | |
Cancel Trade | |
✓ only owner can cancel the trade (50ms) | |
✓ offer should be inactive (67ms) | |
✓ should return all funds if no buying has happened (90ms) | |
Check Funds | |
✓ The amount available should be exact to the one added | |
Changing commissions | |
✓ The amount available should be exact to the one added | |
Premium | |
Paying premium | |
✓ estimatePremiumAmount | |
✓ Should create the order if the premium is paid (177ms) | |
✓ Should close the offer if the buyer buys all (217ms) | |
✓ Should not close the offer if the buyer don't buys it all (243ms) | |
✓ Emits a NewPremium event (167ms) | |
Exceptions | |
✓ When the offer does not exists (113ms) | |
✓ When the offer is not an option trade (253ms) | |
✓ When there is not approved amount (85ms) | |
Paying an option trade | |
Paying an option trade with the same token as premium | |
✓ Estimate option trade (201ms) | |
✓ Should sell the tokens if the premium is paid (925ms) | |
Exceptions | |
✓ Paying an option trade with another token | |
✓ When the offer does not exists | |
✓ When the buy does not exists | |
✓ When the offer is not an option trade | |
✓ When there is not approved amount | |
✓ When the caller is not the buyer | |
✓ When the buy is already paid | |
✓ When the payment is out of the payment window | |
Cancelling an option trade | |
✓ After creation | |
✓ After sellings | |
Should Behave Like An Option Trade | |
Cancel Trade | |
✓ only owner can cancel the trade | |
✓ offer should be inactive (82ms) | |
✓ should return all funds if no buying has happened (85ms) | |
Check Funds | |
✓ The amount available should be exact to the one added | |
Changing commissions | |
✓ The amount available should be exact to the one added | |
Premium | |
Paying premium | |
✓ estimatePremiumAmount | |
✓ Should create the order if the premium is paid (212ms) | |
✓ Should close the offer if the buyer buys all (605ms) | |
✓ Should not close the offer if the buyer don't buys it all (244ms) | |
✓ Emits a NewPremium event (164ms) | |
Exceptions | |
✓ When the offer does not exists (128ms) | |
✓ When the offer is not an option trade (230ms) | |
✓ When there is not approved amount | |
Paying an option trade | |
Paying an option trade with the same token as premium | |
✓ Estimate option trade (187ms) | |
✓ Should sell the tokens if the premium is paid (646ms) | |
Exceptions | |
✓ Paying an option trade with another token | |
✓ When the offer does not exists | |
✓ When the buy does not exists | |
✓ When the offer is not an option trade | |
✓ When there is not approved amount | |
✓ When the caller is not the buyer | |
✓ When the buy is already paid | |
✓ When the payment is out of the payment window | |
Cancelling an option trade | |
✓ After creation | |
✓ After sellings | |
Should Behave Like An Option Trade | |
Cancel Trade | |
✓ only owner can cancel the trade | |
✓ offer should be inactive (93ms) | |
✓ should return all funds if no buying has happened (74ms) | |
Check Funds | |
✓ The amount available should be exact to the one added | |
Changing commissions | |
✓ The amount available should be exact to the one added | |
Premium | |
Paying premium | |
✓ estimatePremiumAmount | |
✓ Should create the order if the premium is paid (195ms) | |
✓ Should close the offer if the buyer buys all (234ms) | |
✓ Should not close the offer if the buyer don't buys it all (172ms) | |
✓ Emits a NewPremium event (254ms) | |
Exceptions | |
✓ When the offer does not exists (91ms) | |
✓ When the offer is not an option trade (523ms) | |
✓ When there is not approved amount | |
Paying an option trade | |
Paying an option trade with the same token as premium | |
✓ Estimate option trade (205ms) | |
✓ Should sell the tokens if the premium is paid (642ms) | |
Exceptions | |
✓ Paying an option trade with another token | |
✓ When the offer does not exists | |
✓ When the buy does not exists | |
✓ When the offer is not an option trade | |
✓ When there is not approved amount | |
✓ When the caller is not the buyer | |
✓ When the buy is already paid | |
✓ When the payment is out of the payment window | |
Cancelling an option trade | |
✓ After creation | |
✓ After sellings | |
Should Behave Like An Option Trade | |
Cancel Trade | |
✓ only owner can cancel the trade (42ms) | |
✓ offer should be inactive (100ms) | |
✓ should return all funds if no buying has happened (75ms) | |
Check Funds | |
✓ The amount available should be exact to the one added | |
Changing commissions | |
✓ The amount available should be exact to the one added | |
Premium | |
Paying premium | |
✓ estimatePremiumAmount | |
✓ Should create the order if the premium is paid (217ms) | |
✓ Should close the offer if the buyer buys all (273ms) | |
✓ Should not close the offer if the buyer don't buys it all (248ms) | |
✓ Emits a NewPremium event (162ms) | |
Exceptions | |
✓ When the offer does not exists (140ms) | |
✓ When the offer is not an option trade (260ms) | |
✓ When there is not approved amount (52ms) | |
Paying an option trade | |
Paying an option trade with the same token as premium | |
✓ Estimate option trade (212ms) | |
✓ Should sell the tokens if the premium is paid (586ms) | |
Exceptions | |
✓ Paying an option trade with another token | |
✓ When the offer does not exists | |
✓ When the buy does not exists | |
✓ When the offer is not an option trade | |
✓ When there is not approved amount | |
✓ When the caller is not the buyer | |
✓ When the buy is already paid | |
✓ When the payment is out of the payment window | |
Cancelling an option trade | |
✓ After creation | |
✓ After sellings | |
Should Behave Like An Option Trade | |
Cancel Trade | |
✓ only owner can cancel the trade (81ms) | |
✓ offer should be inactive (66ms) | |
✓ should return all funds if no buying has happened (68ms) | |
Check Funds | |
✓ The amount available should be exact to the one added | |
Changing commissions | |
✓ The amount available should be exact to the one added | |
Premium | |
Paying premium | |
✓ estimatePremiumAmount | |
✓ Should create the order if the premium is paid (189ms) | |
✓ Should close the offer if the buyer buys all (192ms) | |
✓ Should not close the offer if the buyer don't buys it all (190ms) | |
✓ Emits a NewPremium event (173ms) | |
Exceptions | |
✓ When the offer does not exists (90ms) | |
✓ When the offer is not an option trade (252ms) | |
✓ When there is not approved amount (60ms) | |
Paying an option trade | |
Paying an option trade with the same token as premium | |
✓ Estimate option trade (202ms) | |
✓ Should sell the tokens if the premium is paid (530ms) | |
Exceptions | |
✓ Paying an option trade with another token | |
✓ When the offer does not exists | |
✓ When the buy does not exists | |
✓ When the offer is not an option trade | |
✓ When there is not approved amount | |
✓ When the caller is not the buyer | |
✓ When the buy is already paid | |
✓ When the payment is out of the payment window | |
Cancelling an option trade | |
✓ After creation | |
✓ After sellings | |
When the seller add a stake | |
✓ Should not affect old trades, they have to keep the old commission system | |
210 passing (7m) | |
> hardhat test "test/stake/test-eve-otc-oracle.js" | |
Contract: EVE OTC / Oracle | |
Decimals | |
✓ 8 (41ms) | |
✓ 12 | |
Deploy | |
✓ oracle deployed | |
✓ EVE deployed | |
✓ Oracle properly set in EVE | |
Custom API tests | |
✓ Deployer is an authorized caller | |
Others | |
✓ Other is not an authorized caller (79ms) | |
✓ Other can not authorize caller | |
✓ Other is an authorized caller if added (57ms) | |
✓ Owner is not authorized caller if removed (62ms) | |
OTC EVE | |
Authorization | |
✓ EVE is not an authorized caller by default (96ms) | |
✓ EVE is an authorized caller if added (118ms) | |
Tokens | |
add token | |
✓ add zero address should fail | |
by owner | |
✓ should add the token enabled | |
✓ should add a CMC token | |
✓ should add an aggregator token | |
✓ should add a manual entry token | |
✓ change token length | |
change tokens paramenters | |
✓ token 1 is now a custom price token | |
✓ token 2 is now a cmc index | |
✓ token 3 is now an aggregator | |
✓ should not add more tokens to list | |
by others | |
✓ should fail (104ms) | |
disable token | |
✓ admin can disable token (146ms) | |
✓ others cannot disable token (106ms) | |
✓ if added again the token will be set as enabled (253ms) | |
re-enable token | |
✓ admin can re-enable the token (190ms) | |
✓ others cannot re-enable the token (205ms) | |
add user token | |
✓ add zero address should fail | |
when adding the token for the first time | |
✓ the token has the data | |
✓ the user should be the owner of the new token | |
✓ change user token length | |
✓ the user can change the price of the token (63ms) | |
✓ others cannot change the price of the token (50ms) | |
✓ others cannot add the same token (46ms) | |
admin can change the owner of one token | |
✓ the new owner can change the token price (317ms) | |
✓ others cannot change the token price (65ms) | |
user token status | |
✓ the token should be disabled by default | |
admin can enable token | |
✓ the token should be enabled (40ms) | |
✓ if added again by the owner the token will stay as disabled (45ms) | |
admin can re-enable token | |
✓ the token should be enabled (80ms) | |
Price in USD | |
System Tokens | |
When using CMC API | |
when getting price | |
when token enabled | |
✓ should emit a USDPriceCustomAPI event | |
should update the last_update time | |
✓ in eve contract | |
when token disabled | |
✓ should fail | |
when token re-enabled | |
✓ should succed (76ms) | |
When using Chainlink aggregator | |
when getting price | |
when token enabled | |
✓ should emit a USDPriceAggregator event | |
✓ should update the last_update time | |
✓ should update the price | |
when token disabled | |
✓ should fail (164ms) | |
when token re-enabled | |
✓ should succed | |
When using manual price | |
when setting price | |
✓ should emit a USDPriceManualEntry event | |
✓ should return a different price than before | |
✓ should update the last_update time (72ms) | |
when getting price | |
when token enabled | |
✓ should update the price | |
when token disabled | |
✓ get price should fail (51ms) | |
when token re-enabled | |
✓ get price should succed | |
User Tokens | |
tokens are created | |
✓ get price and token data is ok | |
✓ user_token_length is ok | |
when setting price | |
✓ not owner cannot set the price (44ms) | |
owner can set the price | |
✓ should emit a USDPriceManualEntry event | |
✓ should return a different price than before | |
✓ should update the last_update time | |
when getting price | |
when token enabled | |
when price is not set | |
✓ price should be zero (55ms) | |
when price is set | |
✓ price should be > 0 | |
when token disabled | |
✓ should fail | |
unknown tokens | |
✓ should fail | |
When User Tokens coexist with system tokens | |
✓ price should be take from system tokens (167ms) | |
67 passing (41s) | |
> hardhat test "test/stake/test-eve-otc-stakes.js" | |
Contract: EVE OTC | |
Basic data | |
✓ asset | |
✓ modify value | |
✓ Verify permission for modify with a non-admin user (117ms) | |
Lock options | |
When the admin user has approved enough funds to pay interest | |
✓ expiring_discount should be current block timestam plus the expiring time of the plan | |
✓ should fail if the user doesnt have funds (50ms) | |
✓ should fail if the user doesnt have funds, even if he approves (53ms) | |
✓ query the locked funds | |
✓ query funds in the contract | |
one more lock | |
✓ query the locked funds | |
✓ query funds in the contract | |
When the admin user has NOT approved enough funds to pay interest | |
✓ should fail if the user doesnt have funds (41ms) | |
✓ should fail if the user doesnt have funds, even if he approves (53ms) | |
✓ query the locked funds | |
✓ query funds in the contract | |
one more lock | |
✓ query the locked funds | |
✓ query funds in the contract | |
New features | |
✓ can add a plan | |
✓ data of the plan can be querable 2 (143ms) | |
✓ plan not active (92ms) | |
✓ discounts (122ms) | |
✓ change plan amount (122ms) | |
✓ multiple locks (343ms) | |
Exceptions | |
✓ add plan with a non-admin user (64ms) | |
✓ only owner can deactivate plan (90ms) | |
✓ zero values (113ms) | |
✓ plan not active (107ms) | |
26 passing (11s) | |
> hardhat test "test/stake/test-eve-otc-trades-commissions.js" | |
Contract: EVE OTC / Oracle | |
New commissions scheme | |
When commissions are greater than 1 | |
shouldBehaveLikeBuyAndSell | |
When the commission are unchanged during the process | |
Sellers | |
✓ The seller commission is locked in advance (592ms) | |
✓ The contract pays the commission to admin when a trader buys an offer (1045ms) | |
When canceling trades | |
When there is no trade in the middle | |
✓ Should return all funds including the surplus (566ms) | |
When there are trades in the middle | |
✓ Should return the remaining funds including the surplus (1359ms) | |
Buyers | |
The buyer receives the amount of token minus admin commission on | |
✓ first partial withdrawal (316ms) | |
✓ second partial withdrawal (565ms) | |
✓ total withdrawal (357ms) | |
When the commission change during the process | |
Sellers | |
✓ Old trades are charged with the old commission (1576ms) | |
✓ New trades are charged with the new commission (1947ms) | |
Buyers | |
✓ Old trades are charged with the old commission (2610ms) | |
✓ New trades are charged with the new commission (2172ms) | |
Discounts | |
trades are done with no discount | |
with no stake | |
✓ The seller commission is locked in advance (612ms) | |
✓ The contract pays the commission to admin when a trader buys an offer (1321ms) | |
The buyer receives the amount of token minus admin commission on | |
✓ first partial withdrawal (285ms) | |
✓ second partial withdrawal (704ms) | |
✓ total withdrawal (489ms) | |
with stake with no discount | |
✓ The seller commission is locked in advance (934ms) | |
✓ The contract pays the commission to admin when a trader buys an offer (1850ms) | |
The buyer receives the amount of token minus admin commission on | |
✓ first partial withdrawal (413ms) | |
✓ second partial withdrawal (765ms) | |
✓ total withdrawal (358ms) | |
Discounts is applied in the window time | |
30% | |
seller only | |
✓ The seller commission is locked in advance (1119ms) | |
✓ The contract pays the commission to admin when a trader buys an offer (1875ms) | |
The buyer receives the amount of token minus admin commission on | |
✓ first partial withdrawal (450ms) | |
✓ second partial withdrawal (776ms) | |
✓ total withdrawal (450ms) | |
buyer only | |
✓ The seller commission is locked in advance (713ms) | |
✓ The contract pays the commission to admin when a trader buys an offer (1443ms) | |
The buyer receives the amount of token minus admin commission on | |
✓ first partial withdrawal (455ms) | |
✓ second partial withdrawal (713ms) | |
✓ total withdrawal (320ms) | |
both | |
✓ The seller commission is locked in advance (565ms) | |
✓ The contract pays the commission to admin when a trader buys an offer (1409ms) | |
The buyer receives the amount of token minus admin commission on | |
✓ first partial withdrawal (411ms) | |
✓ second partial withdrawal (1559ms) | |
✓ total withdrawal (702ms) | |
100% | |
seller only | |
✓ The seller commission is locked in advance (688ms) | |
✓ The contract pays the commission to admin when a trader buys an offer (1439ms) | |
The buyer receives the amount of token minus admin commission on | |
✓ first partial withdrawal (350ms) | |
✓ second partial withdrawal (678ms) | |
✓ total withdrawal (640ms) | |
buyer only | |
✓ The seller commission is locked in advance (572ms) | |
✓ The contract pays the commission to admin when a trader buys an offer (1584ms) | |
The buyer receives the amount of token minus admin commission on | |
✓ first partial withdrawal (463ms) | |
✓ second partial withdrawal (573ms) | |
✓ total withdrawal (717ms) | |
both | |
✓ The seller commission is locked in advance (522ms) | |
✓ The contract pays the commission to admin when a trader buys an offer (1291ms) | |
The buyer receives the amount of token minus admin commission on | |
✓ first partial withdrawal (388ms) | |
✓ second partial withdrawal (605ms) | |
✓ total withdrawal (406ms) | |
Discounts expires | |
with stake with no discount | |
✓ The seller commission is locked in advance (663ms) | |
✓ The contract pays the commission to admin when a trader buys an offer (2208ms) | |
The buyer receives the amount of token minus admin commission on | |
✓ first partial withdrawal (319ms) | |
✓ second partial withdrawal (751ms) | |
✓ total withdrawal (317ms) | |
Discounts are replaced | |
✓ The seller commission is locked in advance (584ms) | |
✓ The contract pays the commission to admin when a trader buys an offer (1495ms) | |
The buyer receives the amount of token minus admin commission on | |
✓ first partial withdrawal (333ms) | |
✓ second partial withdrawal (607ms) | |
✓ total withdrawal (402ms) | |
NFT Discounts is applied | |
30% | |
seller only | |
✓ The seller commission is locked in advance (726ms) | |
✓ The contract pays the commission to admin when a trader buys an offer (2213ms) | |
The buyer receives the amount of token minus admin commission on | |
✓ first partial withdrawal (203ms) | |
✓ second partial withdrawal (690ms) | |
✓ total withdrawal (193ms) | |
buyer only | |
✓ The seller commission is locked in advance (358ms) | |
✓ The contract pays the commission to admin when a trader buys an offer (872ms) | |
The buyer receives the amount of token minus admin commission on | |
✓ first partial withdrawal (603ms) | |
✓ second partial withdrawal (902ms) | |
✓ total withdrawal (566ms) | |
both | |
✓ The seller commission is locked in advance (825ms) | |
✓ The contract pays the commission to admin when a trader buys an offer (1693ms) | |
The buyer receives the amount of token minus admin commission on | |
✓ first partial withdrawal (425ms) | |
✓ second partial withdrawal (667ms) | |
✓ total withdrawal (404ms) | |
100% | |
seller only | |
✓ The seller commission is locked in advance (757ms) | |
✓ The contract pays the commission to admin when a trader buys an offer (1839ms) | |
The buyer receives the amount of token minus admin commission on | |
✓ first partial withdrawal (430ms) | |
✓ second partial withdrawal (735ms) | |
✓ total withdrawal (450ms) | |
buyer only | |
✓ The seller commission is locked in advance (721ms) | |
✓ The contract pays the commission to admin when a trader buys an offer (1752ms) | |
The buyer receives the amount of token minus admin commission on | |
✓ first partial withdrawal (416ms) | |
✓ second partial withdrawal (751ms) | |
✓ total withdrawal (392ms) | |
both | |
✓ The seller commission is locked in advance (719ms) | |
✓ The contract pays the commission to admin when a trader buys an offer (1799ms) | |
The buyer receives the amount of token minus admin commission on | |
✓ first partial withdrawal (486ms) | |
✓ second partial withdrawal (723ms) | |
✓ total withdrawal (447ms) | |
When commissions are lower than 1 | |
shouldBehaveLikeBuyAndSell | |
When the commission are unchanged during the process | |
Sellers | |
✓ The seller commission is locked in advance (774ms) | |
✓ The contract pays the commission to admin when a trader buys an offer (2130ms) | |
When canceling trades | |
When there is no trade in the middle | |
✓ Should return all funds including the surplus (667ms) | |
When there are trades in the middle | |
✓ Should return the remaining funds including the surplus (1639ms) | |
Buyers | |
The buyer receives the amount of token minus admin commission on | |
✓ first partial withdrawal (389ms) | |
✓ second partial withdrawal (844ms) | |
✓ total withdrawal (419ms) | |
When the commission change during the process | |
Sellers | |
✓ Old trades are charged with the old commission (1813ms) | |
✓ New trades are charged with the new commission (1812ms) | |
Buyers | |
✓ Old trades are charged with the old commission (2012ms) | |
✓ New trades are charged with the new commission (2088ms) | |
Discounts | |
trades are done with no discount | |
with no stake | |
✓ The seller commission is locked in advance (723ms) | |
✓ The contract pays the commission to admin when a trader buys an offer (1763ms) | |
The buyer receives the amount of token minus admin commission on | |
✓ first partial withdrawal (372ms) | |
✓ second partial withdrawal (560ms) | |
✓ total withdrawal (334ms) | |
with stake with no discount | |
✓ The seller commission is locked in advance (575ms) | |
✓ The contract pays the commission to admin when a trader buys an offer (1424ms) | |
The buyer receives the amount of token minus admin commission on | |
✓ first partial withdrawal (304ms) | |
✓ second partial withdrawal (709ms) | |
✓ total withdrawal (416ms) | |
Discounts is applied in the window time | |
30% | |
seller only | |
✓ The seller commission is locked in advance (726ms) | |
✓ The contract pays the commission to admin when a trader buys an offer (1651ms) | |
The buyer receives the amount of token minus admin commission on | |
✓ first partial withdrawal (480ms) | |
✓ second partial withdrawal (1096ms) | |
✓ total withdrawal (758ms) | |
buyer only | |
✓ The seller commission is locked in advance (846ms) | |
✓ The contract pays the commission to admin when a trader buys an offer (2270ms) | |
The buyer receives the amount of token minus admin commission on | |
✓ first partial withdrawal (412ms) | |
✓ second partial withdrawal (716ms) | |
✓ total withdrawal (500ms) | |
both | |
✓ The seller commission is locked in advance (1343ms) | |
✓ The contract pays the commission to admin when a trader buys an offer (2473ms) | |
The buyer receives the amount of token minus admin commission on | |
✓ first partial withdrawal (417ms) | |
✓ second partial withdrawal (680ms) | |
✓ total withdrawal (369ms) | |
100% | |
seller only | |
✓ The seller commission is locked in advance (722ms) | |
✓ The contract pays the commission to admin when a trader buys an offer (1930ms) | |
The buyer receives the amount of token minus admin commission on | |
✓ first partial withdrawal (1042ms) | |
✓ second partial withdrawal (737ms) | |
✓ total withdrawal (604ms) | |
buyer only | |
✓ The seller commission is locked in advance (907ms) | |
✓ The contract pays the commission to admin when a trader buys an offer (1530ms) | |
The buyer receives the amount of token minus admin commission on | |
✓ first partial withdrawal (440ms) | |
✓ second partial withdrawal (770ms) | |
✓ total withdrawal (457ms) | |
both | |
✓ The seller commission is locked in advance (647ms) | |
✓ The contract pays the commission to admin when a trader buys an offer (1953ms) | |
The buyer receives the amount of token minus admin commission on | |
✓ first partial withdrawal (378ms) | |
✓ second partial withdrawal (740ms) | |
✓ total withdrawal (414ms) | |
Discounts expires | |
with stake with no discount | |
✓ The seller commission is locked in advance (826ms) | |
✓ The contract pays the commission to admin when a trader buys an offer (1642ms) | |
The buyer receives the amount of token minus admin commission on | |
✓ first partial withdrawal (388ms) | |
✓ second partial withdrawal (711ms) | |
✓ total withdrawal (386ms) | |
Discounts are replaced | |
✓ The seller commission is locked in advance (662ms) | |
✓ The contract pays the commission to admin when a trader buys an offer (1930ms) | |
The buyer receives the amount of token minus admin commission on | |
✓ first partial withdrawal (478ms) | |
✓ second partial withdrawal (716ms) | |
✓ total withdrawal (421ms) | |
NFT Discounts is applied | |
30% | |
seller only | |
✓ The seller commission is locked in advance (668ms) | |
✓ The contract pays the commission to admin when a trader buys an offer (1796ms) | |
The buyer receives the amount of token minus admin commission on | |
✓ first partial withdrawal (388ms) | |
✓ second partial withdrawal (909ms) | |
✓ total withdrawal (551ms) | |
buyer only | |
✓ The seller commission is locked in advance (865ms) | |
✓ The contract pays the commission to admin when a trader buys an offer (2343ms) | |
The buyer receives the amount of token minus admin commission on | |
✓ first partial withdrawal (346ms) | |
✓ second partial withdrawal (580ms) | |
✓ total withdrawal (310ms) | |
both | |
✓ The seller commission is locked in advance (640ms) | |
✓ The contract pays the commission to admin when a trader buys an offer (1667ms) | |
The buyer receives the amount of token minus admin commission on | |
✓ first partial withdrawal (635ms) | |
✓ second partial withdrawal (690ms) | |
✓ total withdrawal (689ms) | |
100% | |
seller only | |
✓ The seller commission is locked in advance (942ms) | |
✓ The contract pays the commission to admin when a trader buys an offer (1974ms) | |
The buyer receives the amount of token minus admin commission on | |
✓ first partial withdrawal (359ms) | |
✓ second partial withdrawal (720ms) | |
✓ total withdrawal (357ms) | |
buyer only | |
✓ The seller commission is locked in advance (688ms) | |
✓ The contract pays the commission to admin when a trader buys an offer (1764ms) | |
The buyer receives the amount of token minus admin commission on | |
✓ first partial withdrawal (422ms) | |
✓ second partial withdrawal (771ms) | |
✓ total withdrawal (677ms) | |
both | |
✓ The seller commission is locked in advance (614ms) | |
✓ The contract pays the commission to admin when a trader buys an offer (1843ms) | |
The buyer receives the amount of token minus admin commission on | |
✓ first partial withdrawal (432ms) | |
✓ second partial withdrawal (617ms) | |
✓ total withdrawal (450ms) | |
182 passing (13m) | |
> hardhat test "test/stake/test-eve-otc-trades-commissions-nft.js" | |
Contract: EVE OTC / NFT | |
✓ only owner can add NFT (115ms) | |
✓ add NFT (201ms) | |
✓ only owner can add NFT (56ms) | |
✓ remove NFT (178ms) | |
discounts | |
when discount is not set | |
when NFT is not set | |
✓ should be 0 | |
when NFT is set | |
when the user have NFTs | |
✓ should be 0 | |
when the user does not have NFTs | |
✓ should be 0 | |
when the NFT is removed | |
when the user have NFTs | |
✓ should be 0 | |
when the user does not have NFTs | |
✓ should be 0 | |
when discount is set | |
when NFT is not set | |
✓ should be 0 | |
when NFT is set | |
when the user have NFTs | |
✓ should be positive | |
when the user does not have NFTs | |
✓ should be 0 | |
when the NFT is removed | |
when the user have NFTs | |
✓ should be 0 | |
when the user does not have NFTs | |
✓ should be 0 | |
14 passing (5s) | |
> hardhat test "test/stake/test-eve-otc-trades-discount-premium.js" | |
Contract: EVE OTC / Discount / Premium | |
addOffer | |
buySmartTrade | |
when there are no discounts on admin fees | |
basic data | |
✓ the offers parameters are set with discount or premium (73ms) | |
estimate price | |
✓ estimate the offers with discount / premium (284ms) | |
buy smart trade | |
✓ buy the offer 0 (493ms) | |
✓ buy the offer 1 (508ms) | |
✓ buy the offer 2 (505ms) | |
✓ buy the offer 3 (487ms) | |
when 50% discount on admin fees | |
basic data | |
✓ the offers parameters are set with discount or premium (42ms) | |
estimate price | |
✓ estimate the offers with discount / premium (173ms) | |
buy smart trade | |
✓ buy the offer 0 (596ms) | |
✓ buy the offer 1 (672ms) | |
✓ buy the offer 2 (657ms) | |
✓ buy the offer 3 (727ms) | |
12 passing (26s) | |
> hardhat test "test/stake/test-eve-otc-trades-no-stakes.js" | |
Contract: EVE OTC / Oracle | |
addOffer | |
pre conditions | |
✓ Positive offer (131ms) | |
✓ Discount lower than 100 (70ms) | |
✓ Erroring transfer sale funds (86ms) | |
Token for sale not enabled | |
✓ when token does not exists (49ms) | |
✓ when token exists but is not enabled (65ms) | |
✓ when is not a token (46ms) | |
Token for payments not enabled | |
✓ when token does not exists (57ms) | |
✓ when token exists but is not enabled (70ms) | |
✓ when is not a token (61ms) | |
events | |
✓ New Offer (199ms) | |
Smart Trades | |
When the seller have no stake | |
add offers with system tokens | |
Should Behave Like A Smart Trade | |
Cancel Trade | |
✓ only owner can cancel the trade (95ms) | |
✓ offer should be inactive (91ms) | |
✓ should return all funds if no buying has happened (92ms) | |
✓ should return remaining funds if a buying has happened (316ms) | |
✓ reiterative cancel trades (929ms) | |
Check Funds | |
✓ The amount available should be exact to the one added | |
Changing commissions | |
✓ The amount available should be exact to the one added | |
Should Behave Like A Smart Trade | |
ⓘ token_chainlink_oracle | |
✓ trades length is ok | |
✓ trades are ok (40ms) | |
Should Behave Like A Smart Trade | |
Cancel Trade | |
✓ only owner can cancel the trade | |
✓ offer should be inactive (84ms) | |
✓ should return all funds if no buying has happened (118ms) | |
✓ should return remaining funds if a buying has happened (333ms) | |
✓ reiterative cancel trades (709ms) | |
Check Funds | |
✓ The amount available should be exact to the one added | |
Changing commissions | |
✓ The amount available should be exact to the one added | |
Should Behave Like A Smart Trade | |
ⓘ token_chainlink_oracle | |
✓ trades length is ok | |
✓ trades are ok | |
Should Behave Like A Smart Trade | |
Cancel Trade | |
✓ only owner can cancel the trade (81ms) | |
✓ offer should be inactive (91ms) | |
✓ should return all funds if no buying has happened (98ms) | |
✓ should return remaining funds if a buying has happened (264ms) | |
✓ reiterative cancel trades (879ms) | |
Check Funds | |
✓ The amount available should be exact to the one added | |
Changing commissions | |
✓ The amount available should be exact to the one added | |
Should Behave Like A Smart Trade | |
ⓘ token_custom_oracle | |
✓ trades length is ok | |
✓ trades are ok | |
Should Behave Like A Smart Trade | |
Cancel Trade | |
✓ only owner can cancel the trade | |
✓ offer should be inactive (85ms) | |
✓ should return all funds if no buying has happened (84ms) | |
✓ should return remaining funds if a buying has happened (265ms) | |
✓ reiterative cancel trades (659ms) | |
Check Funds | |
✓ The amount available should be exact to the one added | |
Changing commissions | |
✓ The amount available should be exact to the one added | |
Should Behave Like A Smart Trade | |
ⓘ token_custom_oracle | |
✓ trades length is ok | |
✓ trades are ok | |
Should Behave Like A Smart Trade | |
Cancel Trade | |
✓ only owner can cancel the trade (103ms) | |
✓ offer should be inactive (102ms) | |
✓ should return all funds if no buying has happened (59ms) | |
✓ should return remaining funds if a buying has happened (262ms) | |
✓ reiterative cancel trades (620ms) | |
Check Funds | |
✓ The amount available should be exact to the one added | |
Changing commissions | |
✓ The amount available should be exact to the one added | |
Should Behave Like A Smart Trade | |
ⓘ token_custom_price | |
✓ trades length is ok | |
✓ trades are ok | |
Should Behave Like A Smart Trade | |
Cancel Trade | |
✓ only owner can cancel the trade (50ms) | |
✓ offer should be inactive (61ms) | |
✓ should return all funds if no buying has happened (67ms) | |
✓ should return remaining funds if a buying has happened (227ms) | |
✓ reiterative cancel trades (741ms) | |
Check Funds | |
✓ The amount available should be exact to the one added | |
Changing commissions | |
✓ The amount available should be exact to the one added | |
Should Behave Like A Smart Trade | |
ⓘ token_custom_price | |
✓ trades length is ok | |
✓ trades are ok | |
Should Behave Like A Smart Trade | |
Cancel Trade | |
✓ only owner can cancel the trade (83ms) | |
✓ offer should be inactive (97ms) | |
✓ should return all funds if no buying has happened (73ms) | |
✓ should return remaining funds if a buying has happened (264ms) | |
✓ reiterative cancel trades (696ms) | |
Check Funds | |
✓ The amount available should be exact to the one added | |
Changing commissions | |
✓ The amount available should be exact to the one added | |
Should Behave Like A Smart Trade | |
ⓘ token_user_token | |
✓ trades length is ok | |
✓ trades are ok | |
Should Behave Like A Smart Trade | |
Cancel Trade | |
✓ only owner can cancel the trade (104ms) | |
✓ offer should be inactive (102ms) | |
✓ should return all funds if no buying has happened (98ms) | |
✓ should return remaining funds if a buying has happened (420ms) | |
✓ reiterative cancel trades (559ms) | |
Check Funds | |
✓ The amount available should be exact to the one added | |
Changing commissions | |
✓ The amount available should be exact to the one added | |
Should Behave Like A Smart Trade | |
ⓘ token_user_token | |
✓ trades length is ok | |
✓ trades are ok | |
buySmartTrade | |
when the seller has no stakes | |
buy tokens | |
✓ the contract should have anough balance from seller to sell and pay commissions | |
shouldBehaveLikeBuying | |
✓ Buy 1000000 token_custom_oracle with 300000000000000000 token_user_token (456ms) | |
✓ Estimate Buying Price 1000000 token_custom_oracle with 300000000000000000 token_user_token | |
withdraw | |
query getPurchasedWithdrawableTokens | |
✓ at the moment of buying, should be 0 | |
✓ before expiring | |
✓ at expiring | |
✓ after expiring | |
getPurchasedTokens | |
during time | |
✓ should fail to withdraw other than buyer | |
✓ should succeed to withdraw the buyer (103ms) | |
at expiring | |
✓ should fail to withdraw other than buyer (62ms) | |
✓ should succeed to withdraw the buyer (131ms) | |
after expiration time | |
✓ should fail to withdraw other than buyer (66ms) | |
✓ should succeed to withdraw the buyer (281ms) | |
during time, three times | |
✓ should fail to withdraw other than buyer (65ms) | |
✓ should succeed to withdraw the buyer (98ms) | |
others | |
✓ check multiple buys successful (615ms) | |
exceptions | |
✓ OTC: token not found in the selected offer (52ms) | |
✓ OTC: this is not a smart trade (188ms) | |
✓ OTC: not enough amount in the offer (120ms) | |
shouldBehaveLikeBuying | |
✓ Buy 1000000000 token_custom_price with 450 token_chainlink_oracle (342ms) | |
✓ Estimate Buying Price 1000000000 token_custom_price with 450 token_chainlink_oracle | |
withdraw | |
query getPurchasedWithdrawableTokens | |
✓ at the moment of buying, should be 0 | |
✓ before expiring | |
✓ at expiring | |
✓ after expiring | |
getPurchasedTokens | |
during time | |
✓ should fail to withdraw other than buyer (67ms) | |
✓ should succeed to withdraw the buyer (118ms) | |
at expiring | |
✓ should fail to withdraw other than buyer (48ms) | |
✓ should succeed to withdraw the buyer (112ms) | |
after expiration time | |
✓ should fail to withdraw other than buyer (44ms) | |
✓ should succeed to withdraw the buyer (240ms) | |
during time, three times | |
✓ should fail to withdraw other than buyer (45ms) | |
✓ should succeed to withdraw the buyer (322ms) | |
others | |
✓ check multiple buys successful (545ms) | |
exceptions | |
✓ OTC: token not found in the selected offer (68ms) | |
✓ OTC: this is not a smart trade (174ms) | |
✓ OTC: not enough amount in the offer (85ms) | |
shouldBehaveLikeBuying | |
✓ Buy 5000000000 token_custom_price with 2250 token_chainlink_oracle (306ms) | |
✓ Estimate Buying Price 5000000000 token_custom_price with 2250 token_chainlink_oracle | |
withdraw | |
query getPurchasedWithdrawableTokens | |
✓ at the moment of buying, should be 0 | |
✓ before expiring | |
✓ at expiring | |
✓ after expiring | |
getPurchasedTokens | |
during time | |
✓ should fail to withdraw other than buyer (41ms) | |
✓ should succeed to withdraw the buyer (106ms) | |
at expiring | |
✓ should fail to withdraw other than buyer | |
✓ should succeed to withdraw the buyer (100ms) | |
after expiration time | |
✓ should fail to withdraw other than buyer (47ms) | |
✓ should succeed to withdraw the buyer (173ms) | |
during time, three times | |
✓ should fail to withdraw other than buyer (65ms) | |
✓ should succeed to withdraw the buyer (265ms) | |
others | |
✓ check multiple buys successful (662ms) | |
exceptions | |
✓ OTC: token not found in the selected offer (43ms) | |
✓ OTC: this is not a smart trade (135ms) | |
✓ OTC: not enough amount in the offer (61ms) | |
shouldBehaveLikeBuying | |
✓ Buy 100000000000 token_custom_price with 45000 token_chainlink_oracle (331ms) | |
✓ Estimate Buying Price 100000000000 token_custom_price with 45000 token_chainlink_oracle | |
withdraw | |
query getPurchasedWithdrawableTokens | |
✓ at the moment of buying, should be 0 | |
✓ before expiring | |
✓ at expiring | |
✓ after expiring | |
getPurchasedTokens | |
during time | |
✓ should fail to withdraw other than buyer (49ms) | |
✓ should succeed to withdraw the buyer (106ms) | |
at expiring | |
✓ should fail to withdraw other than buyer (64ms) | |
✓ should succeed to withdraw the buyer (94ms) | |
after expiration time | |
✓ should fail to withdraw other than buyer (38ms) | |
✓ should succeed to withdraw the buyer (244ms) | |
during time, three times | |
✓ should fail to withdraw other than buyer (107ms) | |
✓ should succeed to withdraw the buyer (299ms) | |
others | |
✓ check multiple buys successful (571ms) | |
exceptions | |
✓ OTC: token not found in the selected offer | |
✓ OTC: this is not a smart trade (145ms) | |
✓ OTC: not enough amount in the offer (103ms) | |
shouldBehaveLikeBuying | |
✓ Buy 1000 token_chainlink_oracle with 1800000000 token_custom_price (376ms) | |
✓ Estimate Buying Price 1000 token_chainlink_oracle with 1800000000 token_custom_price | |
withdraw | |
query getPurchasedWithdrawableTokens | |
✓ at the moment of buying, should be 0 | |
✓ before expiring | |
✓ at expiring | |
✓ after expiring | |
getPurchasedTokens | |
during time | |
✓ should fail to withdraw other than buyer (135ms) | |
✓ should succeed to withdraw the buyer (74ms) | |
at expiring | |
✓ should fail to withdraw other than buyer | |
✓ should succeed to withdraw the buyer (69ms) | |
after expiration time | |
✓ should fail to withdraw other than buyer (44ms) | |
✓ should succeed to withdraw the buyer (211ms) | |
during time, three times | |
✓ should fail to withdraw other than buyer | |
✓ should succeed to withdraw the buyer (260ms) | |
others | |
✓ check multiple buys successful (642ms) | |
exceptions | |
✓ OTC: token not found in the selected offer (47ms) | |
✓ OTC: this is not a smart trade (228ms) | |
✓ OTC: not enough amount in the offer (94ms) | |
shouldBehaveLikeBuying | |
✓ Buy 5000 token_chainlink_oracle with 9000000000 token_custom_price (398ms) | |
✓ Estimate Buying Price 5000 token_chainlink_oracle with 9000000000 token_custom_price | |
withdraw | |
query getPurchasedWithdrawableTokens | |
✓ at the moment of buying, should be 0 | |
✓ before expiring | |
✓ at expiring | |
✓ after expiring | |
getPurchasedTokens | |
during time | |
✓ should fail to withdraw other than buyer (88ms) | |
✓ should succeed to withdraw the buyer (89ms) | |
at expiring | |
✓ should fail to withdraw other than buyer (57ms) | |
✓ should succeed to withdraw the buyer (116ms) | |
after expiration time | |
✓ should fail to withdraw other than buyer (49ms) | |
✓ should succeed to withdraw the buyer (170ms) | |
during time, three times | |
✓ should fail to withdraw other than buyer (56ms) | |
✓ should succeed to withdraw the buyer (255ms) | |
others | |
✓ check multiple buys successful (576ms) | |
exceptions | |
✓ OTC: token not found in the selected offer (71ms) | |
✓ OTC: this is not a smart trade (146ms) | |
✓ OTC: not enough amount in the offer (84ms) | |
shouldBehaveLikeBuying | |
✓ Buy 100000 token_chainlink_oracle with 180000000000 token_custom_price (308ms) | |
✓ Estimate Buying Price 100000 token_chainlink_oracle with 180000000000 token_custom_price | |
withdraw | |
query getPurchasedWithdrawableTokens | |
✓ at the moment of buying, should be 0 | |
✓ before expiring | |
✓ at expiring | |
✓ after expiring | |
getPurchasedTokens | |
during time | |
✓ should fail to withdraw other than buyer | |
✓ should succeed to withdraw the buyer (67ms) | |
at expiring | |
✓ should fail to withdraw other than buyer | |
✓ should succeed to withdraw the buyer (87ms) | |
after expiration time | |
✓ should fail to withdraw other than buyer | |
✓ should succeed to withdraw the buyer (162ms) | |
during time, three times | |
✓ should fail to withdraw other than buyer (39ms) | |
✓ should succeed to withdraw the buyer (287ms) | |
others | |
✓ check multiple buys successful (651ms) | |
exceptions | |
✓ OTC: token not found in the selected offer (61ms) | |
✓ OTC: this is not a smart trade (134ms) | |
✓ OTC: not enough amount in the offer (62ms) | |
shouldBehaveLikeBuying | |
✓ Buy 1000000000000000000 token_user_token with 2700000 token_custom_oracle (322ms) | |
✓ Estimate Buying Price 1000000000000000000 token_user_token with 2700000 token_custom_oracle | |
withdraw | |
query getPurchasedWithdrawableTokens | |
✓ at the moment of buying, should be 0 | |
✓ before expiring | |
✓ at expiring | |
✓ after expiring | |
getPurchasedTokens | |
during time | |
✓ should fail to withdraw other than buyer (46ms) | |
✓ should succeed to withdraw the buyer (95ms) | |
at expiring | |
✓ should fail to withdraw other than buyer | |
✓ should succeed to withdraw the buyer (122ms) | |
after expiration time | |
✓ should fail to withdraw other than buyer | |
✓ should succeed to withdraw the buyer (200ms) | |
during time, three times | |
✓ should fail to withdraw other than buyer | |
✓ should succeed to withdraw the buyer (337ms) | |
others | |
✓ check multiple buys successful (622ms) | |
exceptions | |
✓ OTC: token not found in the selected offer | |
✓ OTC: this is not a smart trade (183ms) | |
✓ OTC: not enough amount in the offer (58ms) | |
shouldBehaveLikeBuying | |
✓ Buy 5000000000000000000 token_user_token with 13500000 token_custom_oracle (344ms) | |
✓ Estimate Buying Price 5000000000000000000 token_user_token with 13500000 token_custom_oracle | |
withdraw | |
query getPurchasedWithdrawableTokens | |
✓ at the moment of buying, should be 0 | |
✓ before expiring | |
✓ at expiring | |
✓ after expiring | |
getPurchasedTokens | |
during time | |
✓ should fail to withdraw other than buyer (72ms) | |
✓ should succeed to withdraw the buyer (97ms) | |
at expiring | |
✓ should fail to withdraw other than buyer (76ms) | |
✓ should succeed to withdraw the buyer (109ms) | |
after expiration time | |
✓ should fail to withdraw other than buyer | |
✓ should succeed to withdraw the buyer (148ms) | |
during time, three times | |
✓ should fail to withdraw other than buyer | |
✓ should succeed to withdraw the buyer (329ms) | |
others | |
✓ check multiple buys successful (667ms) | |
exceptions | |
✓ OTC: token not found in the selected offer (40ms) | |
✓ OTC: this is not a smart trade (203ms) | |
✓ OTC: not enough amount in the offer (98ms) | |
shouldBehaveLikeBuying | |
✓ Buy 100000000000000000000 token_user_token with 270000000 token_custom_oracle (362ms) | |
✓ Estimate Buying Price 100000000000000000000 token_user_token with 270000000 token_custom_oracle | |
withdraw | |
query getPurchasedWithdrawableTokens | |
✓ at the moment of buying, should be 0 | |
✓ before expiring | |
✓ at expiring | |
✓ after expiring | |
getPurchasedTokens | |
during time | |
✓ should fail to withdraw other than buyer | |
✓ should succeed to withdraw the buyer (147ms) | |
at expiring | |
✓ should fail to withdraw other than buyer (77ms) | |
✓ should succeed to withdraw the buyer (99ms) | |
after expiration time | |
✓ should fail to withdraw other than buyer (41ms) | |
✓ should succeed to withdraw the buyer (197ms) | |
during time, three times | |
✓ should fail to withdraw other than buyer (42ms) | |
✓ should succeed to withdraw the buyer (270ms) | |
others | |
✓ check multiple buys successful (781ms) | |
exceptions | |
✓ OTC: token not found in the selected offer (108ms) | |
✓ OTC: this is not a smart trade (261ms) | |
✓ OTC: not enough amount in the offer (163ms) | |
shouldBehaveLikeBuying | |
✓ Buy 1000000 token_custom_oracle with 300000000000000000 token_user_token (418ms) | |
✓ Estimate Buying Price 1000000 token_custom_oracle with 300000000000000000 token_user_token | |
withdraw | |
query getPurchasedWithdrawableTokens | |
✓ at the moment of buying, should be 0 | |
✓ before expiring | |
✓ at expiring | |
✓ after expiring | |
getPurchasedTokens | |
during time | |
✓ should fail to withdraw other than buyer (94ms) | |
✓ should succeed to withdraw the buyer (127ms) | |
at expiring | |
✓ should fail to withdraw other than buyer | |
✓ should succeed to withdraw the buyer (203ms) | |
after expiration time | |
✓ should fail to withdraw other than buyer (51ms) | |
✓ should succeed to withdraw the buyer (185ms) | |
during time, three times | |
✓ should fail to withdraw other than buyer | |
✓ should succeed to withdraw the buyer (307ms) | |
others | |
✓ check multiple buys successful (732ms) | |
exceptions | |
✓ OTC: token not found in the selected offer (66ms) | |
✓ OTC: this is not a smart trade (174ms) | |
✓ OTC: not enough amount in the offer (63ms) | |
shouldBehaveLikeBuying | |
✓ Buy 5000000 token_custom_oracle with 1500000000000000000 token_user_token (370ms) | |
✓ Estimate Buying Price 5000000 token_custom_oracle with 1500000000000000000 token_user_token | |
withdraw | |
query getPurchasedWithdrawableTokens | |
✓ at the moment of buying, should be 0 | |
✓ before expiring | |
✓ at expiring | |
✓ after expiring | |
getPurchasedTokens | |
during time | |
✓ should fail to withdraw other than buyer (59ms) | |
✓ should succeed to withdraw the buyer (136ms) | |
at expiring | |
✓ should fail to withdraw other than buyer (67ms) | |
✓ should succeed to withdraw the buyer (112ms) | |
after expiration time | |
✓ should fail to withdraw other than buyer (82ms) | |
✓ should succeed to withdraw the buyer (176ms) | |
during time, three times | |
✓ should fail to withdraw other than buyer | |
✓ should succeed to withdraw the buyer (250ms) | |
others | |
✓ check multiple buys successful (875ms) | |
exceptions | |
✓ OTC: token not found in the selected offer | |
✓ OTC: this is not a smart trade (200ms) | |
✓ OTC: not enough amount in the offer (99ms) | |
shouldBehaveLikeBuying | |
✓ Buy 100000000 token_custom_oracle with 30000000000000000000 token_user_token (369ms) | |
✓ Estimate Buying Price 100000000 token_custom_oracle with 30000000000000000000 token_user_token | |
withdraw | |
query getPurchasedWithdrawableTokens | |
✓ at the moment of buying, should be 0 | |
✓ before expiring | |
✓ at expiring | |
✓ after expiring | |
getPurchasedTokens | |
during time | |
✓ should fail to withdraw other than buyer (94ms) | |
✓ should succeed to withdraw the buyer (151ms) | |
at expiring | |
✓ should fail to withdraw other than buyer (52ms) | |
✓ should succeed to withdraw the buyer (147ms) | |
after expiration time | |
✓ should fail to withdraw other than buyer (73ms) | |
✓ should succeed to withdraw the buyer (182ms) | |
during time, three times | |
✓ should fail to withdraw other than buyer (39ms) | |
✓ should succeed to withdraw the buyer (209ms) | |
others | |
✓ check multiple buys successful (562ms) | |
exceptions | |
✓ OTC: token not found in the selected offer (57ms) | |
✓ OTC: this is not a smart trade (159ms) | |
✓ OTC: not enough amount in the offer (55ms) | |
flow | |
✓ flow (749ms) | |
318 passing (14m) | |
> hardhat test "test/stake/test-eve-otc-trades-stakes.js" | |
Contract: EVE OTC / Oracle | |
addOffer | |
Smart Trades | |
When the seller have a stake | |
add offers with system tokens | |
Should Behave Like A Smart Trade | |
Cancel Trade | |
✓ only owner can cancel the trade (123ms) | |
✓ offer should be inactive (79ms) | |
✓ should return all funds if no buying has happened (124ms) | |
✓ should return remaining funds if a buying has happened (266ms) | |
✓ reiterative cancel trades (766ms) | |
Check Funds | |
✓ The amount available should be exact to the one added | |
Changing commissions | |
✓ The amount available should be exact to the one added | |
Should Behave Like A Smart Trade | |
ⓘ token_chainlink_oracle | |
✓ trades length is ok | |
✓ trades are ok | |
Should Behave Like A Smart Trade | |
Cancel Trade | |
✓ only owner can cancel the trade (96ms) | |
✓ offer should be inactive (147ms) | |
✓ should return all funds if no buying has happened (120ms) | |
✓ should return remaining funds if a buying has happened (338ms) | |
✓ reiterative cancel trades (788ms) | |
Check Funds | |
✓ The amount available should be exact to the one added | |
Changing commissions | |
✓ The amount available should be exact to the one added | |
Should Behave Like A Smart Trade | |
ⓘ token_chainlink_oracle | |
✓ trades length is ok | |
✓ trades are ok (47ms) | |
Should Behave Like A Smart Trade | |
Cancel Trade | |
✓ only owner can cancel the trade (47ms) | |
✓ offer should be inactive (127ms) | |
✓ should return all funds if no buying has happened (97ms) | |
✓ should return remaining funds if a buying has happened (370ms) | |
✓ reiterative cancel trades (733ms) | |
Check Funds | |
✓ The amount available should be exact to the one added | |
Changing commissions | |
✓ The amount available should be exact to the one added | |
Should Behave Like A Smart Trade | |
ⓘ token_custom_oracle | |
✓ trades length is ok | |
✓ trades are ok (42ms) | |
Should Behave Like A Smart Trade | |
Cancel Trade | |
✓ only owner can cancel the trade (44ms) | |
✓ offer should be inactive (111ms) | |
✓ should return all funds if no buying has happened (143ms) | |
✓ should return remaining funds if a buying has happened (343ms) | |
✓ reiterative cancel trades (878ms) | |
Check Funds | |
✓ The amount available should be exact to the one added | |
Changing commissions | |
✓ The amount available should be exact to the one added | |
Should Behave Like A Smart Trade | |
ⓘ token_custom_oracle | |
✓ trades length is ok | |
✓ trades are ok | |
Should Behave Like A Smart Trade | |
Cancel Trade | |
✓ only owner can cancel the trade (55ms) | |
✓ offer should be inactive (103ms) | |
✓ should return all funds if no buying has happened (82ms) | |
✓ should return remaining funds if a buying has happened (320ms) | |
✓ reiterative cancel trades (800ms) | |
Check Funds | |
✓ The amount available should be exact to the one added | |
Changing commissions | |
✓ The amount available should be exact to the one added | |
Should Behave Like A Smart Trade | |
ⓘ token_custom_price | |
✓ trades length is ok | |
✓ trades are ok | |
Should Behave Like A Smart Trade | |
Cancel Trade | |
✓ only owner can cancel the trade (76ms) | |
✓ offer should be inactive (94ms) | |
✓ should return all funds if no buying has happened (115ms) | |
✓ should return remaining funds if a buying has happened (328ms) | |
✓ reiterative cancel trades (855ms) | |
Check Funds | |
✓ The amount available should be exact to the one added | |
Changing commissions | |
✓ The amount available should be exact to the one added | |
Should Behave Like A Smart Trade | |
ⓘ token_custom_price | |
✓ trades length is ok | |
✓ trades are ok (40ms) | |
add offers with user tokens | |
Should Behave Like A Smart Trade | |
Cancel Trade | |
✓ only owner can cancel the trade (155ms) | |
✓ offer should be inactive (107ms) | |
✓ should return all funds if no buying has happened (133ms) | |
✓ should return remaining funds if a buying has happened (325ms) | |
✓ reiterative cancel trades (811ms) | |
Check Funds | |
✓ The amount available should be exact to the one added | |
Changing commissions | |
✓ The amount available should be exact to the one added | |
Should Behave Like A Smart Trade | |
ⓘ token_user_token | |
✓ trades length is ok | |
✓ trades are ok | |
Should Behave Like A Smart Trade | |
Cancel Trade | |
✓ only owner can cancel the trade (53ms) | |
✓ offer should be inactive (85ms) | |
✓ should return all funds if no buying has happened (134ms) | |
✓ should return remaining funds if a buying has happened (807ms) | |
✓ reiterative cancel trades (923ms) | |
Check Funds | |
✓ The amount available should be exact to the one added | |
Changing commissions | |
✓ The amount available should be exact to the one added | |
Should Behave Like A Smart Trade | |
ⓘ token_user_token | |
✓ trades length is ok | |
✓ trades are ok (41ms) | |
When the seller ends the stake | |
✓ Should not affect old trades, they have to keep the old commission system (426ms) | |
buySmartTrade | |
when the seller has stakes | |
buy tokens | |
✓ the contract should have anough balance from seller to sell and pay commissions | |
shouldBehaveLikeBuying | |
✓ Buy 1000000000 token_custom_price with 450 token_chainlink_oracle (495ms) | |
✓ Estimate Buying Price 1000000000 token_custom_price with 450 token_chainlink_oracle (40ms) | |
withdraw | |
query getPurchasedWithdrawableTokens | |
✓ at the moment of buying, should be 0 | |
✓ before expiring | |
✓ at expiring | |
✓ after expiring | |
getPurchasedTokens | |
during time | |
✓ should fail to withdraw other than buyer (78ms) | |
✓ should succeed to withdraw the buyer (145ms) | |
at expiring | |
✓ should fail to withdraw other than buyer (71ms) | |
✓ should succeed to withdraw the buyer (132ms) | |
after expiration time | |
✓ should fail to withdraw other than buyer (43ms) | |
✓ should succeed to withdraw the buyer (223ms) | |
during time, three times | |
✓ should fail to withdraw other than buyer (103ms) | |
✓ should succeed to withdraw the buyer (342ms) | |
others | |
✓ check multiple buys successful (806ms) | |
exceptions | |
✓ OTC: token not found in the selected offer (77ms) | |
✓ OTC: this is not a smart trade (290ms) | |
✓ OTC: not enough amount in the offer (157ms) | |
shouldBehaveLikeBuying | |
✓ Buy 5000000000 token_custom_price with 2250 token_chainlink_oracle (602ms) | |
✓ Estimate Buying Price 5000000000 token_custom_price with 2250 token_chainlink_oracle (41ms) | |
withdraw | |
query getPurchasedWithdrawableTokens | |
✓ at the moment of buying, should be 0 | |
✓ before expiring | |
✓ at expiring | |
✓ after expiring | |
getPurchasedTokens | |
during time | |
✓ should fail to withdraw other than buyer (59ms) | |
✓ should succeed to withdraw the buyer (152ms) | |
at expiring | |
✓ should fail to withdraw other than buyer (46ms) | |
✓ should succeed to withdraw the buyer (117ms) | |
after expiration time | |
✓ should fail to withdraw other than buyer (43ms) | |
✓ should succeed to withdraw the buyer (256ms) | |
during time, three times | |
✓ should fail to withdraw other than buyer | |
✓ should succeed to withdraw the buyer (334ms) | |
others | |
✓ check multiple buys successful (818ms) | |
exceptions | |
✓ OTC: token not found in the selected offer (82ms) | |
✓ OTC: this is not a smart trade (186ms) | |
✓ OTC: not enough amount in the offer (169ms) | |
shouldBehaveLikeBuying | |
✓ Buy 100000000000 token_custom_price with 45000 token_chainlink_oracle (515ms) | |
✓ Estimate Buying Price 100000000000 token_custom_price with 45000 token_chainlink_oracle (43ms) | |
withdraw | |
query getPurchasedWithdrawableTokens | |
✓ at the moment of buying, should be 0 | |
✓ before expiring | |
✓ at expiring | |
✓ after expiring | |
getPurchasedTokens | |
during time | |
✓ should fail to withdraw other than buyer (50ms) | |
✓ should succeed to withdraw the buyer (125ms) | |
at expiring | |
✓ should fail to withdraw other than buyer (56ms) | |
✓ should succeed to withdraw the buyer (106ms) | |
after expiration time | |
✓ should fail to withdraw other than buyer (57ms) | |
✓ should succeed to withdraw the buyer (313ms) | |
during time, three times | |
✓ should fail to withdraw other than buyer (71ms) | |
✓ should succeed to withdraw the buyer (391ms) | |
others | |
✓ check multiple buys successful (745ms) | |
exceptions | |
✓ OTC: token not found in the selected offer (86ms) | |
✓ OTC: this is not a smart trade (301ms) | |
✓ OTC: not enough amount in the offer (91ms) | |
shouldBehaveLikeBuying | |
✓ Buy 1000 token_chainlink_oracle with 1800000000 token_custom_price (492ms) | |
✓ Estimate Buying Price 1000 token_chainlink_oracle with 1800000000 token_custom_price (42ms) | |
withdraw | |
query getPurchasedWithdrawableTokens | |
✓ at the moment of buying, should be 0 | |
✓ before expiring | |
✓ at expiring | |
✓ after expiring | |
getPurchasedTokens | |
during time | |
✓ should fail to withdraw other than buyer (112ms) | |
✓ should succeed to withdraw the buyer (147ms) | |
at expiring | |
✓ should fail to withdraw other than buyer (89ms) | |
✓ should succeed to withdraw the buyer (162ms) | |
after expiration time | |
✓ should fail to withdraw other than buyer (57ms) | |
✓ should succeed to withdraw the buyer (251ms) | |
during time, three times | |
✓ should fail to withdraw other than buyer (92ms) | |
✓ should succeed to withdraw the buyer (388ms) | |
others | |
✓ check multiple buys successful (752ms) | |
exceptions | |
✓ OTC: token not found in the selected offer (63ms) | |
✓ OTC: this is not a smart trade (253ms) | |
✓ OTC: not enough amount in the offer (114ms) | |
shouldBehaveLikeBuying | |
✓ Buy 5000 token_chainlink_oracle with 9000000000 token_custom_price (515ms) | |
✓ Estimate Buying Price 5000 token_chainlink_oracle with 9000000000 token_custom_price (41ms) | |
withdraw | |
query getPurchasedWithdrawableTokens | |
✓ at the moment of buying, should be 0 | |
✓ before expiring | |
✓ at expiring | |
✓ after expiring | |
getPurchasedTokens | |
during time | |
✓ should fail to withdraw other than buyer (90ms) | |
✓ should succeed to withdraw the buyer (144ms) | |
at expiring | |
✓ should fail to withdraw other than buyer (73ms) | |
✓ should succeed to withdraw the buyer (177ms) | |
after expiration time | |
✓ should fail to withdraw other than buyer | |
✓ should succeed to withdraw the buyer (292ms) | |
during time, three times | |
✓ should fail to withdraw other than buyer (96ms) | |
✓ should succeed to withdraw the buyer (401ms) | |
others | |
✓ check multiple buys successful (817ms) | |
exceptions | |
✓ OTC: token not found in the selected offer (72ms) | |
✓ OTC: this is not a smart trade (265ms) | |
✓ OTC: not enough amount in the offer (102ms) | |
shouldBehaveLikeBuying | |
✓ Buy 100000 token_chainlink_oracle with 180000000000 token_custom_price (501ms) | |
✓ Estimate Buying Price 100000 token_chainlink_oracle with 180000000000 token_custom_price (40ms) | |
withdraw | |
query getPurchasedWithdrawableTokens | |
✓ at the moment of buying, should be 0 | |
✓ before expiring | |
✓ at expiring | |
✓ after expiring | |
getPurchasedTokens | |
during time | |
✓ should fail to withdraw other than buyer (64ms) | |
✓ should succeed to withdraw the buyer (151ms) | |
at expiring | |
✓ should fail to withdraw other than buyer | |
✓ should succeed to withdraw the buyer (117ms) | |
after expiration time | |
✓ should fail to withdraw other than buyer (47ms) | |
✓ should succeed to withdraw the buyer (214ms) | |
during time, three times | |
✓ should fail to withdraw other than buyer (62ms) | |
✓ should succeed to withdraw the buyer (383ms) | |
others | |
✓ check multiple buys successful (817ms) | |
exceptions | |
✓ OTC: token not found in the selected offer (67ms) | |
✓ OTC: this is not a smart trade (232ms) | |
✓ OTC: not enough amount in the offer (146ms) | |
shouldBehaveLikeBuying | |
✓ Buy 1000000000000000000 token_user_token with 2700000 token_custom_oracle (468ms) | |
✓ Estimate Buying Price 1000000000000000000 token_user_token with 2700000 token_custom_oracle | |
withdraw | |
query getPurchasedWithdrawableTokens | |
✓ at the moment of buying, should be 0 | |
✓ before expiring | |
✓ at expiring | |
✓ after expiring | |
getPurchasedTokens | |
during time | |
✓ should fail to withdraw other than buyer (65ms) | |
✓ should succeed to withdraw the buyer (137ms) | |
at expiring | |
✓ should fail to withdraw other than buyer | |
✓ should succeed to withdraw the buyer (165ms) | |
after expiration time | |
✓ should fail to withdraw other than buyer | |
✓ should succeed to withdraw the buyer (188ms) | |
during time, three times | |
✓ should fail to withdraw other than buyer (72ms) | |
✓ should succeed to withdraw the buyer (404ms) | |
others | |
✓ check multiple buys successful (747ms) | |
exceptions | |
✓ OTC: token not found in the selected offer (64ms) | |
✓ OTC: this is not a smart trade (277ms) | |
✓ OTC: not enough amount in the offer (95ms) | |
shouldBehaveLikeBuying | |
✓ Buy 5000000000000000000 token_user_token with 13500000 token_custom_oracle (529ms) | |
✓ Estimate Buying Price 5000000000000000000 token_user_token with 13500000 token_custom_oracle | |
withdraw | |
query getPurchasedWithdrawableTokens | |
✓ at the moment of buying, should be 0 | |
✓ before expiring | |
✓ at expiring | |
✓ after expiring | |
getPurchasedTokens | |
during time | |
✓ should fail to withdraw other than buyer (96ms) | |
✓ should succeed to withdraw the buyer (145ms) | |
at expiring | |
✓ should fail to withdraw other than buyer (54ms) | |
✓ should succeed to withdraw the buyer (150ms) | |
after expiration time | |
✓ should fail to withdraw other than buyer (66ms) | |
✓ should succeed to withdraw the buyer (312ms) | |
during time, three times | |
✓ should fail to withdraw other than buyer (126ms) | |
✓ should succeed to withdraw the buyer (400ms) | |
others | |
✓ check multiple buys successful (773ms) | |
exceptions | |
✓ OTC: token not found in the selected offer | |
✓ OTC: this is not a smart trade (558ms) | |
✓ OTC: not enough amount in the offer (126ms) | |
shouldBehaveLikeBuying | |
✓ Buy 100000000000000000000 token_user_token with 270000000 token_custom_oracle (554ms) | |
✓ Estimate Buying Price 100000000000000000000 token_user_token with 270000000 token_custom_oracle | |
withdraw | |
query getPurchasedWithdrawableTokens | |
✓ at the moment of buying, should be 0 | |
✓ before expiring | |
✓ at expiring | |
✓ after expiring | |
getPurchasedTokens | |
during time | |
✓ should fail to withdraw other than buyer (76ms) | |
✓ should succeed to withdraw the buyer (122ms) | |
at expiring | |
✓ should fail to withdraw other than buyer (74ms) | |
✓ should succeed to withdraw the buyer (126ms) | |
after expiration time | |
✓ should fail to withdraw other than buyer (52ms) | |
✓ should succeed to withdraw the buyer (239ms) | |
during time, three times | |
✓ should fail to withdraw other than buyer | |
✓ should succeed to withdraw the buyer (361ms) | |
others | |
✓ check multiple buys successful (767ms) | |
exceptions | |
✓ OTC: token not found in the selected offer | |
✓ OTC: this is not a smart trade (236ms) | |
✓ OTC: not enough amount in the offer (186ms) | |
shouldBehaveLikeBuying | |
✓ Buy 1000000 token_custom_oracle with 300000000000000000 token_user_token (443ms) | |
✓ Estimate Buying Price 1000000 token_custom_oracle with 300000000000000000 token_user_token | |
withdraw | |
query getPurchasedWithdrawableTokens | |
✓ at the moment of buying, should be 0 | |
✓ before expiring | |
✓ at expiring | |
✓ after expiring | |
getPurchasedTokens | |
during time | |
✓ should fail to withdraw other than buyer | |
✓ should succeed to withdraw the buyer (93ms) | |
at expiring | |
✓ should fail to withdraw other than buyer (51ms) | |
✓ should succeed to withdraw the buyer (137ms) | |
after expiration time | |
✓ should fail to withdraw other than buyer (75ms) | |
✓ should succeed to withdraw the buyer (308ms) | |
during time, three times | |
✓ should fail to withdraw other than buyer (109ms) | |
✓ should succeed to withdraw the buyer (320ms) | |
others | |
✓ check multiple buys successful (768ms) | |
exceptions | |
✓ OTC: token not found in the selected offer (74ms) | |
✓ OTC: this is not a smart trade (207ms) | |
✓ OTC: not enough amount in the offer (118ms) | |
shouldBehaveLikeBuying | |
✓ Buy 5000000 token_custom_oracle with 1500000000000000000 token_user_token (493ms) | |
✓ Estimate Buying Price 5000000 token_custom_oracle with 1500000000000000000 token_user_token | |
withdraw | |
query getPurchasedWithdrawableTokens | |
✓ at the moment of buying, should be 0 | |
✓ before expiring | |
✓ at expiring | |
✓ after expiring | |
getPurchasedTokens | |
during time | |
✓ should fail to withdraw other than buyer (50ms) | |
✓ should succeed to withdraw the buyer (137ms) | |
at expiring | |
✓ should fail to withdraw other than buyer (48ms) | |
✓ should succeed to withdraw the buyer (121ms) | |
after expiration time | |
✓ should fail to withdraw other than buyer (107ms) | |
✓ should succeed to withdraw the buyer (276ms) | |
during time, three times | |
✓ should fail to withdraw other than buyer (96ms) | |
✓ should succeed to withdraw the buyer (366ms) | |
others | |
✓ check multiple buys successful (788ms) | |
exceptions | |
✓ OTC: token not found in the selected offer | |
✓ OTC: this is not a smart trade (189ms) | |
✓ OTC: not enough amount in the offer (102ms) | |
shouldBehaveLikeBuying | |
✓ Buy 100000000 token_custom_oracle with 30000000000000000000 token_user_token (470ms) | |
✓ Estimate Buying Price 100000000 token_custom_oracle with 30000000000000000000 token_user_token | |
withdraw | |
query getPurchasedWithdrawableTokens | |
✓ at the moment of buying, should be 0 | |
✓ before expiring | |
✓ at expiring | |
✓ after expiring | |
getPurchasedTokens | |
during time | |
✓ should fail to withdraw other than buyer (54ms) | |
✓ should succeed to withdraw the buyer (142ms) | |
at expiring | |
✓ should fail to withdraw other than buyer | |
✓ should succeed to withdraw the buyer (159ms) | |
after expiration time | |
✓ should fail to withdraw other than buyer (93ms) | |
✓ should succeed to withdraw the buyer (252ms) | |
during time, three times | |
✓ should fail to withdraw other than buyer (111ms) | |
✓ should succeed to withdraw the buyer (392ms) | |
others | |
✓ check multiple buys successful (821ms) | |
exceptions | |
✓ OTC: token not found in the selected offer | |
✓ OTC: this is not a smart trade (257ms) | |
✓ OTC: not enough amount in the offer (134ms) | |
buySmartTrade 2 | |
when the seller has stakes with less than 100% discount | |
buy tokens | |
shouldBehaveLikeBuying | |
✓ Buy 1000000000 token_custom_price with 450 token_chainlink_oracle (485ms) | |
✓ Estimate Buying Price 1000000000 token_custom_price with 450 token_chainlink_oracle (42ms) | |
withdraw | |
query getPurchasedWithdrawableTokens | |
✓ at the moment of buying, should be 0 | |
✓ before expiring | |
✓ at expiring | |
✓ after expiring | |
getPurchasedTokens | |
during time | |
✓ should fail to withdraw other than buyer (49ms) | |
✓ should succeed to withdraw the buyer (147ms) | |
at expiring | |
✓ should fail to withdraw other than buyer (48ms) | |
✓ should succeed to withdraw the buyer (105ms) | |
after expiration time | |
✓ should fail to withdraw other than buyer (78ms) | |
✓ should succeed to withdraw the buyer (228ms) | |
during time, three times | |
✓ should fail to withdraw other than buyer (60ms) | |
✓ should succeed to withdraw the buyer (275ms) | |
others | |
✓ check multiple buys successful (538ms) | |
exceptions | |
✓ OTC: token not found in the selected offer (44ms) | |
✓ OTC: this is not a smart trade (172ms) | |
✓ OTC: not enough amount in the offer (84ms) | |
shouldBehaveLikeBuying | |
✓ Buy 5000000000 token_custom_price with 2250 token_chainlink_oracle (357ms) | |
✓ Estimate Buying Price 5000000000 token_custom_price with 2250 token_chainlink_oracle | |
withdraw | |
query getPurchasedWithdrawableTokens | |
✓ at the moment of buying, should be 0 | |
✓ before expiring | |
✓ at expiring | |
✓ after expiring | |
getPurchasedTokens | |
during time | |
✓ should fail to withdraw other than buyer (47ms) | |
✓ should succeed to withdraw the buyer (108ms) | |
at expiring | |
✓ should fail to withdraw other than buyer (79ms) | |
✓ should succeed to withdraw the buyer (136ms) | |
after expiration time | |
✓ should fail to withdraw other than buyer (48ms) | |
✓ should succeed to withdraw the buyer (174ms) | |
during time, three times | |
✓ should fail to withdraw other than buyer (51ms) | |
✓ should succeed to withdraw the buyer (305ms) | |
others | |
✓ check multiple buys successful (541ms) | |
exceptions | |
✓ OTC: token not found in the selected offer (68ms) | |
✓ OTC: this is not a smart trade (139ms) | |
✓ OTC: not enough amount in the offer (81ms) | |
shouldBehaveLikeBuying | |
✓ Buy 100000000000 token_custom_price with 45000 token_chainlink_oracle (367ms) | |
✓ Estimate Buying Price 100000000000 token_custom_price with 45000 token_chainlink_oracle | |
withdraw | |
query getPurchasedWithdrawableTokens | |
✓ at the moment of buying, should be 0 | |
✓ before expiring | |
✓ at expiring | |
✓ after expiring | |
getPurchasedTokens | |
during time | |
✓ should fail to withdraw other than buyer (94ms) | |
✓ should succeed to withdraw the buyer (100ms) | |
at expiring | |
✓ should fail to withdraw other than buyer (79ms) | |
✓ should succeed to withdraw the buyer (109ms) | |
after expiration time | |
✓ should fail to withdraw other than buyer | |
✓ should succeed to withdraw the buyer (171ms) | |
during time, three times | |
✓ should fail to withdraw other than buyer | |
✓ should succeed to withdraw the buyer (276ms) | |
others | |
✓ check multiple buys successful (624ms) | |
exceptions | |
✓ OTC: token not found in the selected offer (64ms) | |
✓ OTC: this is not a smart trade (173ms) | |
✓ OTC: not enough amount in the offer (64ms) | |
shouldBehaveLikeBuying | |
✓ Buy 1000 token_chainlink_oracle with 1800000000 token_custom_price (382ms) | |
✓ Estimate Buying Price 1000 token_chainlink_oracle with 1800000000 token_custom_price | |
withdraw | |
query getPurchasedWithdrawableTokens | |
✓ at the moment of buying, should be 0 | |
✓ before expiring | |
✓ at expiring | |
✓ after expiring | |
getPurchasedTokens | |
during time | |
✓ should fail to withdraw other than buyer (54ms) | |
✓ should succeed to withdraw the buyer (124ms) | |
at expiring | |
✓ should fail to withdraw other than buyer | |
✓ should succeed to withdraw the buyer (110ms) | |
after expiration time | |
✓ should fail to withdraw other than buyer (53ms) | |
✓ should succeed to withdraw the buyer (218ms) | |
during time, three times | |
✓ should fail to withdraw other than buyer (88ms) | |
✓ should succeed to withdraw the buyer (325ms) | |
others | |
✓ check multiple buys successful (692ms) | |
exceptions | |
✓ OTC: token not found in the selected offer | |
✓ OTC: this is not a smart trade (146ms) | |
✓ OTC: not enough amount in the offer (94ms) | |
shouldBehaveLikeBuying | |
✓ Buy 5000 token_chainlink_oracle with 9000000000 token_custom_price (353ms) | |
✓ Estimate Buying Price 5000 token_chainlink_oracle with 9000000000 token_custom_price | |
withdraw | |
query getPurchasedWithdrawableTokens | |
✓ at the moment of buying, should be 0 | |
✓ before expiring | |
✓ at expiring | |
✓ after expiring | |
getPurchasedTokens | |
during time | |
✓ should fail to withdraw other than buyer (43ms) | |
✓ should succeed to withdraw the buyer (127ms) | |
at expiring | |
✓ should fail to withdraw other than buyer (176ms) | |
✓ should succeed to withdraw the buyer (145ms) | |
after expiration time | |
✓ should fail to withdraw other than buyer | |
✓ should succeed to withdraw the buyer (142ms) | |
during time, three times | |
✓ should fail to withdraw other than buyer (68ms) | |
✓ should succeed to withdraw the buyer (187ms) | |
others | |
✓ check multiple buys successful (827ms) | |
exceptions | |
✓ OTC: token not found in the selected offer (46ms) | |
✓ OTC: this is not a smart trade (187ms) | |
✓ OTC: not enough amount in the offer (62ms) | |
shouldBehaveLikeBuying | |
✓ Buy 100000 token_chainlink_oracle with 180000000000 token_custom_price (398ms) | |
✓ Estimate Buying Price 100000 token_chainlink_oracle with 180000000000 token_custom_price | |
withdraw | |
query getPurchasedWithdrawableTokens | |
✓ at the moment of buying, should be 0 | |
✓ before expiring | |
✓ at expiring | |
✓ after expiring | |
getPurchasedTokens | |
during time | |
✓ should fail to withdraw other than buyer | |
✓ should succeed to withdraw the buyer (112ms) | |
at expiring | |
✓ should fail to withdraw other than buyer (102ms) | |
✓ should succeed to withdraw the buyer (160ms) | |
after expiration time | |
✓ should fail to withdraw other than buyer | |
✓ should succeed to withdraw the buyer (194ms) | |
during time, three times | |
✓ should fail to withdraw other than buyer | |
✓ should succeed to withdraw the buyer (256ms) | |
others | |
✓ check multiple buys successful (633ms) | |
exceptions | |
✓ OTC: token not found in the selected offer (68ms) | |
✓ OTC: this is not a smart trade (162ms) | |
✓ OTC: not enough amount in the offer (98ms) | |
shouldBehaveLikeBuying | |
✓ Buy 1000000000000000000 token_user_token with 2700000 token_custom_oracle (590ms) | |
✓ Estimate Buying Price 1000000000000000000 token_user_token with 2700000 token_custom_oracle | |
withdraw | |
query getPurchasedWithdrawableTokens | |
✓ at the moment of buying, should be 0 | |
✓ before expiring | |
✓ at expiring | |
✓ after expiring | |
getPurchasedTokens | |
during time | |
✓ should fail to withdraw other than buyer (67ms) | |
✓ should succeed to withdraw the buyer (198ms) | |
at expiring | |
✓ should fail to withdraw other than buyer (96ms) | |
✓ should succeed to withdraw the buyer (129ms) | |
after expiration time | |
✓ should fail to withdraw other than buyer | |
✓ should succeed to withdraw the buyer (291ms) | |
during time, three times | |
✓ should fail to withdraw other than buyer (47ms) | |
✓ should succeed to withdraw the buyer (266ms) | |
others | |
✓ check multiple buys successful (571ms) | |
exceptions | |
✓ OTC: token not found in the selected offer (48ms) | |
✓ OTC: this is not a smart trade (128ms) | |
✓ OTC: not enough amount in the offer (110ms) | |
shouldBehaveLikeBuying | |
✓ Buy 5000000000000000000 token_user_token with 13500000 token_custom_oracle (366ms) | |
✓ Estimate Buying Price 5000000000000000000 token_user_token with 13500000 token_custom_oracle | |
withdraw | |
query getPurchasedWithdrawableTokens | |
✓ at the moment of buying, should be 0 | |
✓ before expiring | |
✓ at expiring | |
✓ after expiring | |
getPurchasedTokens | |
during time | |
✓ should fail to withdraw other than buyer | |
✓ should succeed to withdraw the buyer (98ms) | |
at expiring | |
✓ should fail to withdraw other than buyer (62ms) | |
✓ should succeed to withdraw the buyer (144ms) | |
after expiration time | |
✓ should fail to withdraw other than buyer | |
✓ should succeed to withdraw the buyer (226ms) | |
during time, three times | |
✓ should fail to withdraw other than buyer | |
✓ should succeed to withdraw the buyer (382ms) | |
others | |
✓ check multiple buys successful (514ms) | |
exceptions | |
✓ OTC: token not found in the selected offer (39ms) | |
✓ OTC: this is not a smart trade (157ms) | |
✓ OTC: not enough amount in the offer (51ms) | |
shouldBehaveLikeBuying | |
✓ Buy 100000000000000000000 token_user_token with 270000000 token_custom_oracle (223ms) | |
✓ Estimate Buying Price 100000000000000000000 token_user_token with 270000000 token_custom_oracle | |
withdraw | |
query getPurchasedWithdrawableTokens | |
✓ at the moment of buying, should be 0 | |
✓ before expiring | |
✓ at expiring | |
✓ after expiring | |
getPurchasedTokens | |
during time | |
✓ should fail to withdraw other than buyer (129ms) | |
✓ should succeed to withdraw the buyer (133ms) | |
at expiring | |
✓ should fail to withdraw other than buyer (82ms) | |
✓ should succeed to withdraw the buyer (141ms) | |
after expiration time | |
✓ should fail to withdraw other than buyer (296ms) | |
✓ should succeed to withdraw the buyer (517ms) | |
during time, three times | |
✓ should fail to withdraw other than buyer (107ms) | |
✓ should succeed to withdraw the buyer (293ms) | |
others | |
✓ check multiple buys successful (559ms) | |
exceptions | |
✓ OTC: token not found in the selected offer (67ms) | |
✓ OTC: this is not a smart trade (163ms) | |
✓ OTC: not enough amount in the offer (141ms) | |
shouldBehaveLikeBuying | |
✓ Buy 1000000 token_custom_oracle with 300000000000000000 token_user_token (424ms) | |
✓ Estimate Buying Price 1000000 token_custom_oracle with 300000000000000000 token_user_token | |
withdraw | |
query getPurchasedWithdrawableTokens | |
✓ at the moment of buying, should be 0 | |
✓ before expiring | |
✓ at expiring | |
✓ after expiring | |
getPurchasedTokens | |
during time | |
✓ should fail to withdraw other than buyer (143ms) | |
✓ should succeed to withdraw the buyer (135ms) | |
at expiring | |
✓ should fail to withdraw other than buyer (42ms) | |
✓ should succeed to withdraw the buyer (184ms) | |
after expiration time | |
✓ should fail to withdraw other than buyer (40ms) | |
✓ should succeed to withdraw the buyer (190ms) | |
during time, three times | |
✓ should fail to withdraw other than buyer | |
✓ should succeed to withdraw the buyer (396ms) | |
others | |
✓ check multiple buys successful (629ms) | |
exceptions | |
✓ OTC: token not found in the selected offer | |
✓ OTC: this is not a smart trade (144ms) | |
✓ OTC: not enough amount in the offer (118ms) | |
shouldBehaveLikeBuying | |
✓ Buy 5000000 token_custom_oracle with 1500000000000000000 token_user_token (305ms) | |
✓ Estimate Buying Price 5000000 token_custom_oracle with 1500000000000000000 token_user_token | |
withdraw | |
query getPurchasedWithdrawableTokens | |
✓ at the moment of buying, should be 0 | |
✓ before expiring | |
✓ at expiring | |
✓ after expiring | |
getPurchasedTokens | |
during time | |
✓ should fail to withdraw other than buyer (54ms) | |
✓ should succeed to withdraw the buyer (167ms) | |
at expiring | |
✓ should fail to withdraw other than buyer (104ms) | |
✓ should succeed to withdraw the buyer (127ms) | |
after expiration time | |
✓ should fail to withdraw other than buyer | |
✓ should succeed to withdraw the buyer (253ms) | |
during time, three times | |
✓ should fail to withdraw other than buyer (43ms) | |
✓ should succeed to withdraw the buyer (525ms) | |
others | |
✓ check multiple buys successful (464ms) | |
exceptions | |
✓ OTC: token not found in the selected offer (48ms) | |
✓ OTC: this is not a smart trade (117ms) | |
✓ OTC: not enough amount in the offer (56ms) | |
shouldBehaveLikeBuying | |
✓ Buy 100000000 token_custom_oracle with 30000000000000000000 token_user_token (356ms) | |
✓ Estimate Buying Price 100000000 token_custom_oracle with 30000000000000000000 token_user_token | |
withdraw | |
query getPurchasedWithdrawableTokens | |
✓ at the moment of buying, should be 0 | |
✓ before expiring | |
✓ at expiring | |
✓ after expiring | |
getPurchasedTokens | |
during time | |
✓ should fail to withdraw other than buyer (41ms) | |
✓ should succeed to withdraw the buyer (533ms) | |
at expiring | |
✓ should fail to withdraw other than buyer (109ms) | |
✓ should succeed to withdraw the buyer (118ms) | |
after expiration time | |
✓ should fail to withdraw other than buyer (45ms) | |
✓ should succeed to withdraw the buyer (459ms) | |
during time, three times | |
✓ should fail to withdraw other than buyer | |
✓ should succeed to withdraw the buyer (338ms) | |
others | |
✓ check multiple buys successful (617ms) | |
exceptions | |
✓ OTC: token not found in the selected offer (82ms) | |
✓ OTC: this is not a smart trade (207ms) | |
✓ OTC: not enough amount in the offer (51ms) | |
506 passing (25m) | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment