Skip to content

Commit 74f218b

Browse files
committed
cleanup, more consistent use of addresses
1 parent 11c05e3 commit 74f218b

File tree

4 files changed

+19
-23
lines changed

4 files changed

+19
-23
lines changed

balances.json

+5-1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,8 @@
11
[
2+
{
3+
"principal": "ST31HHVBKYCYQQJ5AQ25ZHA6W2A548ZADDQ6S16GP",
4+
"amount": 200000000000000
5+
},
26
{
37
"principal": "ST3J2GVMMM2R07ZFBJDWTYEYAR8FZH5WKDTFJ9AHA",
48
"amount": 200000000000000
@@ -26,5 +30,5 @@
2630
{
2731
"principal": "ST3J2GVMMM2R07ZFBJDWTYEYAR8FZH5WKDTFJ9AHA.names",
2832
"amount": 2000
29-
}
33+
}
3034
]

contracts/oracle.clar

+1-1
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44
(define-constant err-older-timestamp (err u64))
55

66
;; TODO(psq): change address for mainnet, change to deployment address (ORACLE_STX)
7-
(define-constant contract-owner 'SZ2J6ZY48GV1EZ5V2V5RB9MP66SW86PYKKQ9H6DPR)
7+
(define-constant contract-owner 'ST31HHVBKYCYQQJ5AQ25ZHA6W2A548ZADDQ6S16GP)
88

99
;; "\x19Ethereum Signed Message:\n32"
1010
(define-constant eth-preamble 0x19457468657265756d205369676e6564204d6573736167653a0a3332)

src/clients/oracle-client-tx.js

+6-2
Original file line numberDiff line numberDiff line change
@@ -30,6 +30,7 @@ import {
3030
import {
3131
CONTRACT_NAME,
3232
MODE,
33+
ORACLE_PK,
3334
ORACLE_SK,
3435
ORACLE_STX,
3536
STACKS_API_URL,
@@ -42,13 +43,16 @@ console.log("mode", MODE)
4243
console.log("api", STACKS_API_URL)
4344

4445
export async function deployContract(contract_file) {
45-
console.log(`deploying ${contract_name}`)
46+
console.log(`deploying ${CONTRACT_NAME}`, ORACLE_PK, ORACLE_STX)
4647
const body = fs.readFileSync(`./contracts/${contract_file}.clar`).toString()
4748
const codeBody = body
48-
.replaceAll('SZ2J6ZY48GV1EZ5V2V5RB9MP66SW86PYKKQ9H6DPR', ORACLE_STX)
4949
.replaceAll('0367b2946150dfab1862457da80beb522440be5737ea51ba14cf8018a12911128f', ORACLE_PK)
5050
.replaceAll('ST31HHVBKYCYQQJ5AQ25ZHA6W2A548ZADDQ6S16GP', ORACLE_STX)
5151

52+
console.log("codeBody", codeBody)
53+
process.exit()
54+
55+
5256
const transaction = await makeContractDeploy({
5357
contractName: CONTRACT_NAME,
5458
codeBody,

test/unit/test-oracle.js

+7-19
Original file line numberDiff line numberDiff line change
@@ -31,23 +31,11 @@ describe("full test suite", () => {
3131
let provider
3232
let oracleClient
3333

34-
const addresses = [
35-
'SP2J6ZY48GV1EZ5V2V5RB9MP66SW86PYKKNRV9EJ7', // alice, u20 tokens of each
36-
'S02J6ZY48GV1EZ5V2V5RB9MP66SW86PYKKPVKG2CE', // bob, u10 tokens of each
37-
'SZ2J6ZY48GV1EZ5V2V5RB9MP66SW86PYKKQ9H6DPR', // zoe, no tokens
38-
'SP138CBPVKYBQQ480EZXJQK89HCHY32XBQ0T4BCCD', // TBD
39-
'SP30JX68J79SMTTN0D2KXQAJBFVYY56BZJEYS3X0B', // flexr treasury
40-
]
41-
42-
const alice = addresses[0]
43-
const bob = addresses[1]
44-
const zoe = addresses[2]
45-
const flexr_treasury = `${addresses[4]}`
46-
const flexr_token = `ST3J2GVMMM2R07ZFBJDWTYEYAR8FZH5WKDTFJ9AHA.flexr-token`
47-
const flexr_stx_token = `ST3J2GVMMM2R07ZFBJDWTYEYAR8FZH5WKDTFJ9AHA.flexr-stx-token`
48-
const stx_token = `ST3J2GVMMM2R07ZFBJDWTYEYAR8FZH5WKDTFJ9AHA.stx-token`
34+
const bob = 'SZ2J6ZY48GV1EZ5V2V5RB9MP66SW86PYKKQ9H6DPR'
35+
const zoe = 'ST31HHVBKYCYQQJ5AQ25ZHA6W2A548ZADDQ6S16GP'
4936

5037
const public_key1 = Buffer.from('0208c2e3d1cadc11ae62c5a66131a45cf43d10979dfdee99195bcf401498ecf230', 'hex')
38+
const public_key2 = Buffer.from('0367b2946150dfab1862457da80beb522440be5737ea51ba14cf8018a12911128f', 'hex')
5139

5240
before(async () => {
5341
ProviderRegistry.registerProvider(
@@ -65,7 +53,7 @@ describe("full test suite", () => {
6553
})
6654
})
6755

68-
describe("Full scenario", () => {
56+
describe("check main functions", () => {
6957
before(async function() {
7058
// await oracleClient.verify()
7159
// await oracleClient.extractTimestamp()
@@ -79,7 +67,7 @@ describe("full test suite", () => {
7967

8068
// should fail
8169
try {
82-
await oracleClient.addSource('source1', public_key1, {sender: bob})
70+
await oracleClient.addSource('source2', public_key2, {sender: bob})
8371
} catch(e) {
8472
// console.log(e, typeof e, e instanceof Object, e instanceof NotOwnerError)
8573
if (e instanceof NotOwnerError) {
@@ -91,7 +79,7 @@ describe("full test suite", () => {
9179

9280
// should fail
9381
try {
94-
await oracleClient.revokeSource('source1', {sender: bob})
82+
await oracleClient.revokeSource('source2', {sender: bob})
9583
} catch(e) {
9684
if (e instanceof NotOwnerError) {
9785
assert(true)
@@ -190,7 +178,7 @@ describe("full test suite", () => {
190178

191179
})
192180

193-
it("check balances after running scenario", async () => {
181+
it("needs a test", async () => {
194182
// all tests are done in the before hook, but need a test to trigger it
195183
})
196184

0 commit comments

Comments
 (0)