Skip to content

Commit b99be3f

Browse files
Slokhampcode-com
andcommitted
chore: update moderato escrow contract address
Update testnet escrow contract to 0xe1c4d3dce17bc111181ddf716f75bae49e61a336. Replace hardcoded addresses in tests with imports from defaults. Amp-Thread-ID: https://ampcode.com/threads/T-019cfcd7-f22b-70e2-80c0-cbf26fafc32b Co-authored-by: Amp <amp@ampcode.com>
1 parent 01ca5d5 commit b99be3f

10 files changed

Lines changed: 21 additions & 9 deletions

File tree

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
---
2+
"mppx": patch
3+
---
4+
5+
Updated Moderato (testnet) escrow contract address to `0xe1c4d3dce17bc111181ddf716f75bae49e61a336`.

src/tempo/client/ChannelOps.test.ts

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@ import { type Address, createClient } from 'viem'
33
import { privateKeyToAccount } from 'viem/accounts'
44
import { Addresses } from 'viem/tempo'
55
import { beforeAll, describe, expect, test } from 'vitest'
6+
import { chainId as chainIdDefaults, escrowContract as escrowContractDefaults } from '../internal/defaults.js'
67
import { deployEscrow, openChannel } from '~test/tempo/session.js'
78
import { accounts, asset, chain, client, fundAccount, http } from '~test/tempo/viem.js'
89
import type { Challenge } from '../../Challenge.js'
@@ -17,7 +18,7 @@ import {
1718
tryRecoverChannel,
1819
} from './ChannelOps.js'
1920

20-
const escrow42431 = '0x542831e3E4Ace07559b7C8787395f4Fb99F70787' as Address
21+
const escrow42431 = escrowContractDefaults[chainIdDefaults.testnet] as Address
2122

2223
const localAccount = privateKeyToAccount(
2324
'0xac0974bec39a17e36ba4a6b4d238ff944bacb478cbed5efcae784d7bf4f2ff80',

src/tempo/client/Session.test.ts

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@ import { type Address, createClient, type Hex, http } from 'viem'
22
import { privateKeyToAccount } from 'viem/accounts'
33
import { Addresses } from 'viem/tempo'
44
import { beforeAll, describe, expect, test } from 'vitest'
5+
import { chainId, escrowContract as escrowContractDefaults } from '../internal/defaults.js'
56
import { deployEscrow, openChannel } from '~test/tempo/session.js'
67
import { accounts, asset, chain, client, fundAccount } from '~test/tempo/viem.js'
78
import * as Challenge from '../../Challenge.js'
@@ -22,7 +23,7 @@ const pureClient = createClient({
2223
transport: http('http://127.0.0.1'),
2324
})
2425

25-
const escrowAddress = '0x542831e3E4Ace07559b7C8787395f4Fb99F70787' as Address
26+
const escrowAddress = escrowContractDefaults[chainId.testnet] as Address
2627
const recipient = '0x2222222222222222222222222222222222222222' as Address
2728
const currency = '0x3333333333333333333333333333333333333333' as Address
2829

src/tempo/internal/defaults.test.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -53,7 +53,7 @@ describe('escrowContract', () => {
5353
})
5454

5555
test('testnet escrow contract', () => {
56-
expect(escrowContract[chainId.testnet]).toBe('0x542831e3E4Ace07559b7C8787395f4Fb99F70787')
56+
expect(escrowContract[chainId.testnet]).toBe('0xe1c4d3dce17bc111181ddf716f75bae49e61a336')
5757
})
5858
})
5959

src/tempo/internal/defaults.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,7 @@ export const decimals = 6
3232
/** Default payment-channel escrow contract addresses per chain. */
3333
export const escrowContract = {
3434
[chainId.mainnet]: '0x33b901018174DDabE4841042ab76ba85D4e24f25',
35-
[chainId.testnet]: '0x542831e3E4Ace07559b7C8787395f4Fb99F70787',
35+
[chainId.testnet]: '0xe1c4d3dce17bc111181ddf716f75bae49e61a336',
3636
} as const satisfies Record<ChainId, string>
3737

3838
/** Default RPC URLs for each Tempo chain. */

src/tempo/server/Session.test.ts

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,7 @@ import {
1818
InvalidSignatureError,
1919
} from '../../Errors.js'
2020
import * as Store from '../../Store.js'
21+
import { chainId as chainIdDefaults, escrowContract as escrowContractDefaults } from '../internal/defaults.js'
2122
import type * as Methods from '../Methods.js'
2223
import * as ChannelStore from '../session/ChannelStore.js'
2324
import type { SessionReceipt } from '../session/Types.js'
@@ -1309,7 +1310,7 @@ describe('monotonicity and TOCTOU (unit tests)', () => {
13091310
token: '0x0000000000000000000000000000000000000003' as Address,
13101311
authorizedSigner: '0x0000000000000000000000000000000000000004' as Address,
13111312
chainId: 42431,
1312-
escrowContract: '0x542831e3E4Ace07559b7C8787395f4Fb99F70787' as Address,
1313+
escrowContract: escrowContractDefaults[chainIdDefaults.testnet] as Address,
13131314
deposit: 10000000n,
13141315
settledOnChain: 0n,
13151316
highestVoucherAmount: 5000000n,

src/tempo/server/Sse.test.ts

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
import type { Address, Hex } from 'viem'
22
import { describe, expect, test } from 'vitest'
3+
import { chainId, escrowContract as escrowContractDefaults } from '../internal/defaults.js'
34
import type * as ChannelStore from '../session/ChannelStore.js'
45
import { serve, toResponse } from '../session/Sse.js'
56

@@ -33,7 +34,7 @@ function seedChannel(
3334
token: '0x0000000000000000000000000000000000000003' as Address,
3435
authorizedSigner: '0x0000000000000000000000000000000000000004' as Address,
3536
chainId: 42431,
36-
escrowContract: '0x542831e3E4Ace07559b7C8787395f4Fb99F70787' as Address,
37+
escrowContract: escrowContractDefaults[chainId.testnet] as Address,
3738
deposit: balance,
3839
settledOnChain: 0n,
3940
highestVoucherAmount: balance,

src/tempo/server/internal/transport.test.ts

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@ import { Challenge, Credential } from 'mppx'
22
import type { Address, Hex } from 'viem'
33
import { describe, expect, test } from 'vitest'
44
import * as Store from '../../../Store.js'
5+
import { chainId, escrowContract as escrowContractDefaults } from '../../internal/defaults.js'
56
import * as ChannelStore from '../../session/ChannelStore.js'
67
import { sse } from './transport.js'
78

@@ -23,7 +24,7 @@ function seedChannel(
2324
token: '0x0000000000000000000000000000000000000003' as Address,
2425
authorizedSigner: '0x0000000000000000000000000000000000000004' as Address,
2526
chainId: 42431,
26-
escrowContract: '0x542831e3E4Ace07559b7C8787395f4Fb99F70787' as Address,
27+
escrowContract: escrowContractDefaults[chainId.testnet] as Address,
2728
deposit: balance,
2829
settledOnChain: 0n,
2930
highestVoucherAmount: balance,

src/tempo/session/ChannelStore.test.ts

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
import type { Address, Hex } from 'viem'
22
import { describe, expect, test } from 'vitest'
33
import * as Store from '../../Store.js'
4+
import { chainId, escrowContract as escrowContractDefaults } from '../internal/defaults.js'
45
import * as ChannelStore from './ChannelStore.js'
56

67
const channelId = '0x0000000000000000000000000000000000000000000000000000000000000001' as Hex
@@ -14,7 +15,7 @@ function makeChannel(overrides?: Partial<ChannelStore.State>): ChannelStore.Stat
1415
token: '0x0000000000000000000000000000000000000003' as Address,
1516
authorizedSigner: '0x0000000000000000000000000000000000000004' as Address,
1617
chainId: 42431,
17-
escrowContract: '0x542831e3E4Ace07559b7C8787395f4Fb99F70787' as Address,
18+
escrowContract: escrowContractDefaults[chainId.testnet] as Address,
1819
deposit: 10_000_000n,
1920
settledOnChain: 0n,
2021
highestVoucherAmount: 10_000_000n,

src/tempo/session/Sse.test.ts

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
import type { Address, Hex } from 'viem'
22
import { describe, expect, test } from 'vitest'
3+
import { chainId, escrowContract as escrowContractDefaults } from '../internal/defaults.js'
34
import type * as ChannelStore from './ChannelStore.js'
45
import { formatNeedVoucherEvent, formatReceiptEvent, parseEvent, serve } from './Sse.js'
56
import type { NeedVoucherEvent, SessionReceipt } from './Types.js'
@@ -218,7 +219,7 @@ describe('serve', () => {
218219
token: '0x0000000000000000000000000000000000000003' as Address,
219220
authorizedSigner: '0x0000000000000000000000000000000000000004' as Address,
220221
chainId: 42431,
221-
escrowContract: '0x542831e3E4Ace07559b7C8787395f4Fb99F70787' as Address,
222+
escrowContract: escrowContractDefaults[chainId.testnet] as Address,
222223
deposit: balance,
223224
settledOnChain: 0n,
224225
highestVoucherAmount: balance,

0 commit comments

Comments
 (0)