Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Created for reviewing the presale app #1

Open
wants to merge 552 commits into
base: review
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
552 commits
Select commit Hold shift + click to select a range
2002466
muon tss rewards app
bakhshandeh Oct 2, 2023
5e12c94
Merge branch 'muon-protocol:master' into master
fofaraz Oct 4, 2023
b301452
batchRequest issue
Oct 4, 2023
38891ac
make rewardPeriod editable
bakhshandeh Oct 4, 2023
3bdf45d
batchRequest issue
Oct 5, 2023
1d62676
Merge pull request #41 from fofaraz/batch-request-issue
bakhshandeh Oct 7, 2023
fed7329
Merge pull request #34 from fofaraz/master
bakhshandeh Oct 7, 2023
39f2090
Add pion_tss_reward_oracle app
ShayanShiravani Oct 11, 2023
8760e42
Merge pull request #42 from ShayanShiravani/master
bakhshandeh Oct 11, 2023
c53a4ab
pion_tss_reward_oracle bugfix
ShayanShiravani Oct 11, 2023
5049067
Merge branch 'muon-protocol:master' into master
ShayanShiravani Oct 11, 2023
64d6618
Merge pull request #43 from ShayanShiravani/master
bakhshandeh Oct 11, 2023
2a8c275
Add `random-words` method to `stage_unitap` app
smrm-dev Oct 14, 2023
4b88db0
Merge pull request #44 from smrm-dev/feature/unitap
bakhshandeh Oct 15, 2023
b000756
Get `winnersCount` & check if equals words count
smrm-dev Oct 16, 2023
4d7b8ad
Update `unitap` app
smrm-dev Oct 16, 2023
8186f62
Merge pull request #45 from smrm-dev/feature/unitap
bakhshandeh Oct 16, 2023
1e1b19e
Fix `chainId`
smrm-dev Oct 16, 2023
015d673
Merge pull request #46 from smrm-dev/feature/unitap
bakhshandeh Oct 16, 2023
deb6054
unitap
bakhshandeh Oct 16, 2023
c7752a4
Fix `unitap` app
smrm-dev Oct 16, 2023
79a151d
Merge pull request #47 from smrm-dev/feature/unitap
bakhshandeh Oct 16, 2023
5740b6e
Fix abi in `stage_unitap`
smrm-dev Oct 19, 2023
fa96bfe
Merge pull request #48 from smrm-dev/feature/unitap
bakhshandeh Oct 19, 2023
e43d5f1
Get winners count from `winnersCount`
smrm-dev Oct 22, 2023
f3cc2b1
Merge pull request #49 from smrm-dev/feature/unitap
bakhshandeh Oct 22, 2023
c6bab84
PION rewards disabled
bakhshandeh Oct 25, 2023
33ef16f
Add app file
smrm-dev Nov 26, 2023
52672ed
Implement `info` method
smrm-dev Nov 26, 2023
b057ed2
enable pion_tss_rewards
bakhshandeh Nov 26, 2023
c4dffef
re-deploy
bakhshandeh Nov 26, 2023
5111b50
re-deploy
bakhshandeh Nov 26, 2023
8c516fd
apps updates
bakhshandeh Nov 27, 2023
7688a19
bugfix
bakhshandeh Nov 28, 2023
b1c8d67
Define `AccountManager` as class
smrm-dev Dec 3, 2023
bb3e540
Implement `getAccountManager`
smrm-dev Dec 3, 2023
9e7c1a0
Implement `isAccountValid`(WIP)
smrm-dev Dec 3, 2023
4c6cf66
Fix `getAccountManager`
smrm-dev Dec 3, 2023
2fb09d8
Add app file
smrm-dev Oct 30, 2023
675e82e
Implement `askGPT`
smrm-dev Dec 9, 2023
f65ceb8
Use axios.post instead of openai library
smrm-dev Dec 10, 2023
30572e2
Merge pull request #50 from smrm-dev/feature/chatGPT
bakhshandeh Dec 10, 2023
ef63de3
enable PION monitoring
bakhshandeh Dec 15, 2023
623f94a
enable PION monitoring
bakhshandeh Dec 15, 2023
09a7ea7
Upgrade to gpt4 and fix error handling
smrm-dev Dec 23, 2023
4f5616d
Merge pull request #51 from smrm-dev/feature/chatGPT
bakhshandeh Dec 23, 2023
1c6a2d7
Finish `isAccountValid` implementation
smrm-dev Dec 26, 2023
f0cb5ea
Implement `getBalanceOfUser`
smrm-dev Dec 26, 2023
540eeeb
Implement `getInfo`
smrm-dev Dec 26, 2023
6c70a5a
Fix abi and address
smrm-dev Dec 26, 2023
b025b17
Move `info` method implementation to `_info` function
smrm-dev Dec 26, 2023
9b863f3
Muon vrf app
ShayanShiravani Dec 27, 2023
d7d8c9f
Implement `pnl` method
smrm-dev Dec 30, 2023
94fc7d1
Add `owner` & `idCounter` to result & signature
smrm-dev Dec 30, 2023
ae66fb4
Change `idCounter` to `tcId`
smrm-dev Dec 30, 2023
e6af258
Merge pull request #53 from smrm-dev/feature/thena-tc
bakhshandeh Dec 30, 2023
d52004b
Merge pull request #52 from ShayanShiravani/master
bakhshandeh Dec 30, 2023
e4e56ba
bugfix
bakhshandeh Jan 1, 2024
70d95c8
bugfix
bakhshandeh Jan 1, 2024
9550392
bugfix
bakhshandeh Jan 1, 2024
b16db51
bugfix
bakhshandeh Jan 1, 2024
f46927d
feat: add brightid muon app
siftal Jan 4, 2024
70d7a57
Merge pull request #54 from siftal/master
bakhshandeh Jan 6, 2024
2b26546
tss3: switch to frost
bakhshandeh Jan 6, 2024
1f9d5c7
refactor
ShayanShiravani Jan 22, 2024
1dcee39
Merge pull request #55 from ShayanShiravani/master
bakhshandeh Jan 24, 2024
ac9bb93
bugfix
ShayanShiravani Jan 24, 2024
1ad83ab
Merge pull request #56 from ShayanShiravani/master
bakhshandeh Jan 25, 2024
6643443
DeRand app
ShayanShiravani Jan 28, 2024
83de7a8
Merge branch 'muon-protocol:master' into master
ShayanShiravani Jan 28, 2024
4dd4c7a
Merge pull request #57 from ShayanShiravani/master
bakhshandeh Jan 28, 2024
2fb04f6
feat: update APP_NAME
siftal Jan 29, 2024
43f48bc
feat: rename
siftal Jan 29, 2024
249b667
Merge pull request #58 from siftal/master
bakhshandeh Jan 30, 2024
590354b
bugfix
ShayanShiravani Feb 1, 2024
6646976
pionerv1_price
max-otc Feb 1, 2024
60275d2
Merge pull request #59 from ShayanShiravani/master
bakhshandeh Feb 2, 2024
a57ede5
correct variable price, time and confidence, .env itteration and Date…
max-otc Feb 3, 2024
e026523
Merge pull request #60 from Brillaugte/pioner
bakhshandeh Feb 3, 2024
8cc2884
Update stage_unitap
ShayanShiravani Feb 8, 2024
8ba2762
Merge pull request #61 from ShayanShiravani/master
bakhshandeh Feb 8, 2024
664899a
update mrc20 bridges
ShayanShiravani Feb 10, 2024
2e8c716
Merge pull request #62 from ShayanShiravani/master
bakhshandeh Feb 10, 2024
5710237
Update derand app
ShayanShiravani Feb 13, 2024
57e0c0d
Merge pull request #63 from ShayanShiravani/master
bakhshandeh Feb 14, 2024
247541b
Create gg.js
0xSullivan Feb 21, 2024
68fab19
Update and rename gg.js to golden_goose.js
0xSullivan Feb 21, 2024
ed4943c
Merge pull request #64 from 0xSullivan/master
bakhshandeh Feb 21, 2024
5a55b7f
Update mrc20_bridge
ShayanShiravani Feb 21, 2024
cece584
Merge branch 'master' of github.com:ShayanShiravani/muon-apps
ShayanShiravani Feb 21, 2024
54c8a17
Separate mrc404 from mrc20 app
ShayanShiravani Feb 21, 2024
1f6b0b7
mrc404 bridges apps
ShayanShiravani Feb 22, 2024
d15da78
Merge pull request #65 from ShayanShiravani/master
bakhshandeh Feb 22, 2024
48a70f1
proxy update
max-otc Feb 27, 2024
b9c61f9
String format error
max-otc Feb 27, 2024
01497a8
Merge pull request #66 from Brillaugte/pioner
bakhshandeh Feb 28, 2024
689c77f
update BL
bakhshandeh Mar 4, 2024
c7b855e
Corrected assetHex going other 32 slots.
max-otc Mar 8, 2024
a4a6bbe
Merge pull request #67 from Brillaugte/master
bakhshandeh Mar 8, 2024
0bff9a2
pion_tss updates
bakhshandeh Mar 15, 2024
27811a4
Update MRC404 bridge addresses
ShayanShiravani Mar 18, 2024
dfa0b90
apps
bakhshandeh Mar 18, 2024
29d43ad
Merge pull request #68 from ShayanShiravani/master
bakhshandeh Mar 18, 2024
029ec8e
apps
bakhshandeh Mar 21, 2024
cec3c78
apps
bakhshandeh Mar 24, 2024
c22ac81
apps
bakhshandeh Mar 25, 2024
a6435e6
Update golden_goose.js
0xSullivan Mar 30, 2024
63d5937
Update golden_goose.js
0xSullivan Mar 30, 2024
8c222ae
Update unitap app
ShayanShiravani Mar 31, 2024
a0627dd
Update unitap app
ShayanShiravani Mar 31, 2024
b05e003
Merge pull request #70 from ShayanShiravani/master
bakhshandeh Mar 31, 2024
03cc523
Merge pull request #69 from 0xSullivan/patch-1
bakhshandeh Mar 31, 2024
1ac3125
BTQ app
bakhshandeh Apr 10, 2024
b2d3977
apps
bakhshandeh Apr 11, 2024
4291bd2
Thena Trade 2 earn
PrometeoThena Apr 12, 2024
a0561ae
Merge pull request #71 from PrometeoThena/master
bakhshandeh Apr 12, 2024
4039f7e
apps
bakhshandeh Apr 12, 2024
71e9a16
change stage_unitap vrf client
ShayanShiravani Apr 15, 2024
64426e4
Merge pull request #72 from ShayanShiravani/master
bakhshandeh Apr 15, 2024
faad3cc
Fixed BN not working in signParams (wrong types)
Nebuleb33 Apr 21, 2024
4570227
add morphexTrade2Earn
Crolev Apr 22, 2024
8781b62
set contract and network id
Crolev Apr 22, 2024
f7bef97
rename file and app name
Crolev Apr 22, 2024
e244591
Merge pull request #1 from morphex-labs/add-morphex-app
Crolev Apr 22, 2024
af57e1e
Merge pull request #73 from Nebuleb33/master
bakhshandeh Apr 22, 2024
d09459f
Merge pull request #74 from morphex-labs/master
bakhshandeh Apr 22, 2024
c0897c3
Added errors + removed axios timeout
Nebuleb33 Apr 23, 2024
a25172d
Merge pull request #75 from Nebuleb33/master
bakhshandeh Apr 23, 2024
299e282
switch from daily to weekly rewards
Crolev May 7, 2024
47b28c0
Merge branch 'master' into add-morphex-app
Crolev May 7, 2024
b82cbe0
fixes to params
Crolev May 7, 2024
08075ee
Merge pull request #2 from morphex-labs/update-bmx-rewards-to-weekly
Crolev May 7, 2024
6ef1a0a
Merge branch 'muon-protocol:master' into master
Crolev May 7, 2024
517b04f
Merge pull request #76 from morphex-labs/master
bakhshandeh May 8, 2024
cacdf0d
Layer0 dvn
ShayanShiravani May 24, 2024
74d37a6
Merge pull request #77 from ShayanShiravani/master
bakhshandeh May 25, 2024
d9db0e3
switch from total to top n volume
Crolev May 27, 2024
9dda5ab
Merge branch 'muon-protocol:master' into add-top-n-leaderboard
Crolev May 27, 2024
b92c1de
Merge pull request #3 from morphex-labs/add-top-n-leaderboard
Crolev May 27, 2024
d4e83d9
Merge pull request #78 from morphex-labs/add-top-n-leaderboard
bakhshandeh May 27, 2024
3a05565
Carrier3net bridge
ShayanShiravani May 27, 2024
03a3a74
Merge pull request #79 from carrier3net/master
bakhshandeh May 28, 2024
5b3c720
carrier3: fix bridge addresses
ShayanShiravani May 28, 2024
933b550
Merge pull request #80 from carrier3net/master
bakhshandeh May 28, 2024
4f6bbd7
add paging and fix users outside leaderboard
Crolev May 28, 2024
3e2087d
Merge branch 'muon-protocol:master' into master
Crolev May 28, 2024
304d195
Merge branch 'master' into fix-top-n-leaderboard
Crolev May 28, 2024
f2bb860
Merge pull request #4 from morphex-labs/fix-top-n-leaderboard
Crolev May 28, 2024
acff6ff
Merge pull request #81 from morphex-labs/master
bakhshandeh May 29, 2024
6737b90
apps
bakhshandeh May 29, 2024
cf5e0ad
apps
bakhshandeh May 29, 2024
83e8d07
update layerzero dvn
ShayanShiravani Jun 4, 2024
da50d45
Merge pull request #82 from ShayanShiravani/master
bakhshandeh Jun 4, 2024
6a7608f
apps
bakhshandeh Jun 10, 2024
4e4d8d9
fixed confPrecision and added UUID to the request
Nebuleb33 Jun 19, 2024
a887943
Merge pull request #83 from Nebuleb33/master
bakhshandeh Jun 23, 2024
933adf4
Add vibe oracle
SAYaghoubnejad Jun 25, 2024
4e3d81c
Update thena_tc.js
PrometeoThena Jun 26, 2024
0c92e1e
Merge pull request #1 from PrometeoThena/ThenaTCUpdate
PrometeoThena Jun 26, 2024
75d580c
Update thena_tc.js
PrometeoThena Jun 26, 2024
be3bb0f
Merge pull request #86 from PrometeoThena/master
bakhshandeh Jun 26, 2024
07bd706
Merge pull request #84 from SAYaghoubnejad/master
bakhshandeh Jun 26, 2024
7d62f09
apps
bakhshandeh Jun 26, 2024
0da2a50
Update thena_tc.js
PrometeoThena Jun 27, 2024
705ecd9
Update thena_tc.js
PrometeoThena Jun 27, 2024
9102621
Merge pull request #87 from PrometeoThena/master
bakhshandeh Jun 28, 2024
32d9dce
apps
bakhshandeh Jun 28, 2024
9f6f8ac
Update thena_tc.js
PrometeoThena Jul 1, 2024
4f1d499
Merge pull request #88 from PrometeoThena/master
bakhshandeh Jul 1, 2024
da845a2
Update thena_tc.js
PrometeoThena Jul 1, 2024
9ec519d
Merge branch 'muon-protocol:master' into master
PrometeoThena Jul 1, 2024
376cf44
Merge pull request #89 from PrometeoThena/master
bakhshandeh Jul 1, 2024
37000a0
bugfix
bakhshandeh Jul 1, 2024
d7a12db
bugfix
bakhshandeh Jul 1, 2024
8e37a2b
Update thena_tc.js
PrometeoThena Jul 1, 2024
b66e9db
Update thena_tc.js
PrometeoThena Jul 1, 2024
0cc0689
Merge pull request #90 from PrometeoThena/master
bakhshandeh Jul 1, 2024
89936aa
bugfix
bakhshandeh Jul 1, 2024
b837fac
bugfix
bakhshandeh Jul 1, 2024
b110379
Layer0 DVN
ShayanShiravani Jul 2, 2024
8bd50dc
L0 DVN: new addresses
ShayanShiravani Jul 10, 2024
8e19dc3
Update Vibe app
SAYaghoubnejad Jul 13, 2024
a8f12f9
Merge branch 'master' of https://github.com/SAYaghoubnejad/muon-apps
SAYaghoubnejad Jul 13, 2024
99d74b3
Merge pull request #91 from SAYaghoubnejad/master
bakhshandeh Jul 13, 2024
baa37ae
Merge branch 'muon-protocol:master' into master
ShayanShiravani Jul 23, 2024
7d395ea
Merge pull request #92 from ShayanShiravani/master
bakhshandeh Jul 24, 2024
798fa04
layerzero dvn: bugfix
ShayanShiravani Jul 28, 2024
fc1a87f
Merge pull request #93 from ShayanShiravani/master
bakhshandeh Jul 28, 2024
cf34700
chore: add symmio app files
smrm-dev Jul 30, 2024
efe5c53
Merge pull request #94 from smrm-dev/feature/symmio
bakhshandeh Jul 30, 2024
9137821
useFrost for symmio
bakhshandeh Jul 30, 2024
aeedc7d
Unitap app: use frost
ShayanShiravani Aug 8, 2024
abc1134
Merge pull request #95 from ShayanShiravani/master
bakhshandeh Aug 8, 2024
55f8193
stage_unitap: use frost
ShayanShiravani Aug 12, 2024
1230881
Update vibe oracle
SAYaghoubnejad Aug 14, 2024
d1906b1
Merge pull request #96 from SAYaghoubnejad/master
bakhshandeh Aug 14, 2024
026a0cd
Update vibe oracle
SAYaghoubnejad Aug 26, 2024
0f13128
Merge pull request #97 from SAYaghoubnejad/master
bakhshandeh Aug 26, 2024
6ceb784
Merge branch 'muon-protocol:master' into master
ShayanShiravani Aug 27, 2024
d5bf3a2
unitap app: bugfix
ShayanShiravani Aug 27, 2024
cbcfe1f
Merge branch 'master' of github.com:ShayanShiravani/muon-apps
ShayanShiravani Aug 27, 2024
223fabf
Merge pull request #98 from ShayanShiravani/master
bakhshandeh Aug 27, 2024
f9cf9f0
layerzero_dvn: update dvns
ShayanShiravani Sep 9, 2024
a465015
Merge pull request #99 from ShayanShiravani/master
bakhshandeh Sep 9, 2024
28f2a2f
factGPT app
bakhshandeh Sep 23, 2024
f41926d
layerzero_dvn: mainnet dvns
ShayanShiravani Sep 24, 2024
2ad32e5
Merge pull request #100 from ShayanShiravani/master
bakhshandeh Sep 24, 2024
3c0b69a
evm_data_verifier
ShayanShiravani Sep 28, 2024
6ec63d9
evm_data_verifier
ShayanShiravani Sep 28, 2024
572949e
Merge pull request #101 from ShayanShiravani/master
bakhshandeh Sep 28, 2024
3290e94
snapshot app
ShayanShiravani Oct 2, 2024
967eb2c
Merge branch 'master' of github.com:ShayanShiravani/muon-apps
ShayanShiravani Oct 2, 2024
73722cb
Snapshot app
ShayanShiravani Oct 2, 2024
a7eb205
Merge pull request #102 from ShayanShiravani/master
bakhshandeh Oct 2, 2024
b305dbc
Snapshot app
ShayanShiravani Oct 3, 2024
34f0b48
Merge pull request #103 from ShayanShiravani/master
bakhshandeh Oct 3, 2024
3cc852a
factGPT dispute
ShayanShiravani Oct 6, 2024
e2c8087
factGPT dispute
ShayanShiravani Oct 6, 2024
cb89ed7
Merge pull request #104 from ShayanShiravani/master
bakhshandeh Oct 6, 2024
e64e157
Create thena_tc_testenv.js
PrometeoThena Oct 17, 2024
ffbbda4
Merge pull request #105 from PrometeoThena/master
bakhshandeh Oct 18, 2024
167e05c
LayerZeroDVN: testnets
ShayanShiravani Oct 30, 2024
2ab0c4a
Merge pull request #106 from ShayanShiravani/master
bakhshandeh Oct 30, 2024
899e374
Update thena_tc.js
PrometeoThena Nov 6, 2024
161baff
factGPT updates
bakhshandeh Nov 6, 2024
5c1d59f
factGPT updates
bakhshandeh Nov 6, 2024
143ea98
Merge pull request #107 from PrometeoThena/patch-1
bakhshandeh Nov 6, 2024
f8c86bd
apps
bakhshandeh Nov 7, 2024
edc7936
Merge branch 'master' of github.com:muon-protocol/muon-apps
bakhshandeh Nov 7, 2024
b8f13bc
factGPT updates
bakhshandeh Nov 7, 2024
3c2f18c
apps
bakhshandeh Nov 7, 2024
6c65633
symmio pion
ShayanShiravani Nov 13, 2024
f18fb2d
Merge pull request #108 from ShayanShiravani/master
bakhshandeh Nov 16, 2024
4c02932
symmio_pion app
ShayanShiravani Nov 16, 2024
6c05a32
Merge pull request #109 from ShayanShiravani/master
bakhshandeh Nov 16, 2024
4999af0
symmio_pion: bugfix
ShayanShiravani Nov 16, 2024
dfd63e9
Merge pull request #110 from ShayanShiravani/master
bakhshandeh Nov 16, 2024
10f0a88
symmio_pion app
ShayanShiravani Nov 17, 2024
d6134ea
Merge pull request #111 from ShayanShiravani/master
bakhshandeh Nov 17, 2024
524066f
Rename symmio apps
ShayanShiravani Nov 27, 2024
71ab1e1
Merge pull request #112 from ShayanShiravani/master
bakhshandeh Nov 27, 2024
994cca2
derand
ShayanShiravani Dec 4, 2024
01f73ff
Merge pull request #113 from ShayanShiravani/master
bakhshandeh Dec 4, 2024
6f20b3c
apps
bakhshandeh Dec 6, 2024
8ca8ab3
Merge branch 'master' of github.com:muon-protocol/muon-apps
bakhshandeh Dec 6, 2024
cd44979
apps
bakhshandeh Dec 6, 2024
aee8d76
layerzero dvn
ShayanShiravani Dec 15, 2024
e3b6a90
Merge pull request #114 from ShayanShiravani/master
bakhshandeh Dec 15, 2024
ac0f507
layerzero_dvn: more chains
ShayanShiravani Jan 6, 2025
789324d
Merge pull request #115 from ShayanShiravani/master
bakhshandeh Jan 6, 2025
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
83 changes: 57 additions & 26 deletions custom/sample.js
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ module.exports = {
'invokeTestMethod',
],

myReadOnlyMethod: async function(params){
myReadOnlyMethod: async function({params}){
return {
message: "sample readonly method",
data: [
Expand All @@ -33,7 +33,7 @@ module.exports = {
}
},

invokeTestMethod: async function(params) {
invokeTestMethod: async function({params}) {
let request = {
method: 'call',
data: {
Expand All @@ -60,6 +60,23 @@ module.exports = {
onAppInit: async function (){
},

/**
* Run on all nodes before onRequest
* on the gateway node runs before onArrive
* @param request
* @returns {Promise<void>}
*/
validateRequest: async function(request) {
const {method} = request
switch (method) {
case "test-method": {
/**
* Do your method validation here
*/
}
}
},

/**
* Request arrival hook
* Runs only on the first node
Expand All @@ -70,20 +87,23 @@ module.exports = {
onArrive: async function (request) {
let {method, data: {params}} = request;
switch (method) {
case 'lock':
case 'lock-1':
let {user} = params;

/**
* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
* Do all request validations here to prevent incorrect lock. *
* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
*/

// looking for data in memory
let lock = await this.readNodeMem({"data.name": LOCK_NAME, "data.value": user})
let lock = await this.readNodeMem(`user-lock-${user}`)
if (lock) {
throw {message: `User [${user}] locked for a moment`}
}

// Write to memory
let memory = [
{type: 'uint256', name: LOCK_NAME, value: user}
]
await this.writeNodeMem(memory, 120);
await this.writeNodeMem(`user-lock-${user}`, [{type: 'bool', value: true}], 120);

// wait for memory write confirmation
await timeout(1000);
Expand All @@ -101,27 +121,34 @@ module.exports = {
case 'test_speed': {
return 'speed test done.'
}

case 'test_redis':{
let previews = await this.redis.get('last-exec-time');
let current = `${Math.floor(Date.now()/1000)}`
this.redis.set("last-exec-time", current);
return "done";
}
case 'lock':

case 'test_memory': {
let { user } = params
return `Data stored in memory for user: ${user}`
}

// You can check for atomic run of the lock method
let lock = await this.readNodeMem({"data.name": LOCK_NAME, "data.value": user}, {distinct: "owner"})
if(lock.length === 0) {
throw {message: 'Memory write not confirmed.'}
}
else if(lock.length > 1) {
throw {message: 'Atomic run failed.'}
}
case 'lock-1': {
let {user} = params
return 'lock done.'
}

case 'lock-2': {
let {user} = params
/** Atomic locally read and write */
const alreadyLocked = await this.writeLocalMem(`lock-${user}`, [{type: "bool", value: true}], 120, {getset: true})
if(alreadyLocked)
throw `user locked`;
return 'lock done.'
}

case 'btc_price':
case 'btc_price': {
let result = await getBtcPrice()
let price = toBaseUnit(
result.bpi.USD.rate_float.toString(),
Expand All @@ -134,24 +161,27 @@ module.exports = {
price,
price_float: result.bpi.USD.rate_float
}
}

default:
return 'test done'
}
},

hashRequestResult: (request, result) => {
signParams: function (request, result) {
// console.log(result)
switch (request.method) {
case 'test_speed':
case 'test_redis':
case 'lock':
return soliditySha3([{type: 'string', value: result}])
case 'test_memory':
case 'lock-1':
case 'lock-2':
return [{type: 'string', value: result}]
case 'btc_price':
let hash = soliditySha3([
return [
{ type: 'uint256', value: request.data.result.time },
{ type: 'uint256', value: result.price }
])
return hash
]
default:
throw { message: `Unknown method: ${request.method}` }
}
Expand All @@ -160,14 +190,15 @@ module.exports = {
/**
* store data on request confirm
*/
onMemWrite: (req, res) => {
if (req.method === 'lock') {
onMemWrite: function (req, res) {
if (req.method === 'test_memory') {
let {
data: {
params: { user }
}
} = req
return {
key: "sample-key",
ttl: 10,
data: [{ name: 'lock', type: 'string', value: user }]
}
Expand Down
6 changes: 3 additions & 3 deletions custom/tss-test.js
Original file line number Diff line number Diff line change
Expand Up @@ -15,15 +15,15 @@ const TssApp = {
}
},

hashRequestResult: function (request, result){
signParams: function (request, result) {
switch (request.method) {
case 'test':
case 'data-change':
return soliditySha3([{type: 'string', value: result.toString()}]);
return [{type: 'string', value: result.toString()}]
default:
throw { message: `Unknown method: ${request.method}` }
}
},
}
}

module.exports = TssApp
125 changes: 0 additions & 125 deletions general/aggregate_oracles.js

This file was deleted.

Loading