Skip to content

Commit

Permalink
rename: uniswapx (#240)
Browse files Browse the repository at this point in the history
  • Loading branch information
marktoda authored Jul 7, 2023
1 parent 390507e commit 4f3068e
Show file tree
Hide file tree
Showing 22 changed files with 44 additions and 44 deletions.
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
# Gouda Service
# UniswapX Service

## Prerequisite

Expand Down
4 changes: 2 additions & 2 deletions bin/app.ts
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@ export class APIPipeline extends Stack {
constructor(scope: Construct, id: string, props?: StackProps) {
super(scope, id, props)

const code = CodePipelineSource.gitHub('Uniswap/gouda-service', 'main', {
const code = CodePipelineSource.gitHub('Uniswap/uniswapx-service', 'main', {
authentication: SecretValue.secretsManager('github-token-2'),
})

Expand Down Expand Up @@ -195,7 +195,7 @@ export class APIPipeline extends Stack {
value: 'github-token-2',
type: BuildEnvironmentVariableType.SECRETS_MANAGER,
},
GOUDA_SERVICE_URL: {
UNISWAPX_SERVICE_URL: {
value: `${stage}/gouda-service/url`,
type: BuildEnvironmentVariableType.SECRETS_MANAGER,
},
Expand Down
2 changes: 1 addition & 1 deletion lib/entities/Order.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { OrderType } from '@uniswap/gouda-sdk'
import { OrderType } from '@uniswap/uniswapx-sdk'

export enum ORDER_STATUS {
OPEN = 'open',
Expand Down
2 changes: 1 addition & 1 deletion lib/handlers/check-order-status/handler.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { DutchOrder, OrderValidation } from '@uniswap/gouda-sdk'
import { DutchOrder, OrderValidation } from '@uniswap/uniswapx-sdk'
import { default as Logger } from 'bunyan'
import { ethers } from 'ethers'
import Joi from 'joi'
Expand Down
2 changes: 1 addition & 1 deletion lib/handlers/check-order-status/injector.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { EventWatcher, OrderType, OrderValidator, REACTOR_ADDRESS_MAPPING } from '@uniswap/gouda-sdk'
import { EventWatcher, OrderType, OrderValidator, REACTOR_ADDRESS_MAPPING } from '@uniswap/uniswapx-sdk'
import { DynamoDB } from 'aws-sdk'
import { default as bunyan, default as Logger } from 'bunyan'
import { ethers } from 'ethers'
Expand Down
2 changes: 1 addition & 1 deletion lib/handlers/get-nonce/injector.ts
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ export class GetNonceInjector extends ApiInjector<ContainerInjected, RequestInje
const requestId = context.awsRequestId

metrics.setNamespace('Uniswap')
metrics.setDimensions({ Service: 'GoudaService' })
metrics.setDimensions({ Service: 'UniswapXService' })
setGlobalMetrics(metrics)

log = log.child({
Expand Down
2 changes: 1 addition & 1 deletion lib/handlers/get-orders/injector.ts
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@ export class GetOrdersInjector extends ApiInjector<ContainerInjected, RequestInj
setGlobalLogger(log)

metrics.setNamespace('Uniswap')
metrics.setDimensions({ Service: 'GoudaService' })
metrics.setDimensions({ Service: 'UniswapXService' })
setGlobalMetrics(metrics)

// default to no limit
Expand Down
2 changes: 1 addition & 1 deletion lib/handlers/post-order/handler.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import { SFNClient, StartExecutionCommand } from '@aws-sdk/client-sfn'
import { DutchOrder, OrderType, OrderValidation } from '@uniswap/gouda-sdk'
import { DutchOrder, OrderType, OrderValidation } from '@uniswap/uniswapx-sdk'
import { Unit } from 'aws-embedded-metrics'
import { APIGatewayProxyEvent, APIGatewayProxyResult, Context } from 'aws-lambda'
import Logger from 'bunyan'
Expand Down
4 changes: 2 additions & 2 deletions lib/handlers/post-order/injector.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { OrderValidator as OnchainValidator } from '@uniswap/gouda-sdk'
import { OrderValidator as OnchainValidator } from '@uniswap/uniswapx-sdk'
import { MetricsLogger } from 'aws-embedded-metrics'
import { APIGatewayEvent, Context } from 'aws-lambda'
import { DynamoDB } from 'aws-sdk'
Expand Down Expand Up @@ -47,7 +47,7 @@ export class PostOrderInjector extends ApiInjector<ContainerInjected, ApiRInj, P
metrics: MetricsLogger
): Promise<ApiRInj> {
metrics.setNamespace('Uniswap')
metrics.setDimensions({ Service: 'GoudaService' })
metrics.setDimensions({ Service: 'UniswapXService' })
setGlobalMetrics(metrics)
setGlobalLogger(log)

Expand Down
4 changes: 2 additions & 2 deletions lib/util/field-validator.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
// import { OrderType } from '@uniswap/gouda-sdk'
import { OrderType } from '@uniswap/gouda-sdk'
// import { OrderType } from '@uniswap/uniswapx-sdk'
import { OrderType } from '@uniswap/uniswapx-sdk'
import { BigNumber, ethers } from 'ethers'
import Joi, { CustomHelpers, NumberSchema, StringSchema } from 'joi'
import { ORDER_STATUS, SORT_FIELDS } from '../entities'
Expand Down
2 changes: 1 addition & 1 deletion lib/util/nonce.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ import { ethers } from 'ethers'

/**
* uses crypto.randomBytes() under the hood to generate a 'cryptographically strong'
* random data of 28 bytes and prefix that with gouda specific 3-byte value
* random data of 28 bytes and prefix that with uniswapx specific 3-byte value
* (in total 248 bits, which is the number of words in the Permit2 unorderd nonceBitmap).
* We then left shin total ift by 8 bits to form the complete uint256 nonce value; we do
* this because we want the first nonce to land on the word boundary to save gas (clean sstore
Expand Down
2 changes: 1 addition & 1 deletion lib/util/order-validator.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { DutchOrder, DutchOutput } from '@uniswap/gouda-sdk'
import { DutchOrder, DutchOutput } from '@uniswap/uniswapx-sdk'
import { BigNumber } from 'ethers'
import FieldValidator from './field-validator'

Expand Down
2 changes: 1 addition & 1 deletion lib/util/order.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { DutchOrder, OrderType } from '@uniswap/gouda-sdk'
import { DutchOrder, OrderType } from '@uniswap/uniswapx-sdk'
import { DynamoDBRecord } from 'aws-lambda'
import { OrderEntity, ORDER_STATUS } from '../entities'

Expand Down
6 changes: 3 additions & 3 deletions package.json
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
{
"name": "@uniswap/gouda-service",
"name": "@uniswap/uniswapx-service",
"version": "0.1.0",
"bin": {
"app": "./dist/bin/app.js"
},
"license": "GPL",
"repository": "https://github.com/Uniswap/gouda-service",
"repository": "https://github.com/Uniswap/uniswapx-service",
"scripts": {
"build": "tsc",
"clean": "rm -rf dist cdk.out",
Expand Down Expand Up @@ -52,7 +52,7 @@
"@aws-sdk/client-s3": "^3.341.0",
"@aws-sdk/client-sfn": "^3.341.0",
"@types/sinon": "^10.0.13",
"@uniswap/gouda-sdk": "^1.0.0-alpha.5",
"@uniswap/uniswapx-sdk": "^1.0.0",
"aws-cdk-lib": "2.85.0",
"aws-embedded-metrics": "^4.1.0",
"aws-sdk": "^2.1238.0",
Expand Down
2 changes: 1 addition & 1 deletion test/handlers/check-order-status.test.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/* eslint-disable */
import { OrderType, OrderValidation } from '@uniswap/gouda-sdk'
import { OrderType, OrderValidation } from '@uniswap/uniswapx-sdk'
import { OrderEntity, ORDER_STATUS } from '../../lib/entities'
import { CheckOrderStatusHandler, FILL_EVENT_LOOKBACK_BLOCKS_ON } from '../../lib/handlers/check-order-status/handler'

Expand Down
2 changes: 1 addition & 1 deletion test/handlers/get-orders.test.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { OrderType } from '@uniswap/gouda-sdk'
import { OrderType } from '@uniswap/uniswapx-sdk'
import { ORDER_STATUS, SORT_FIELDS } from '../../lib/entities'
import { GetOrdersHandler } from '../../lib/handlers/get-orders/handler'
import { HeaderExpectation } from '../utils'
Expand Down
6 changes: 3 additions & 3 deletions test/handlers/post-order.test.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
var parserMock = jest.fn()

import { SFNClient, StartExecutionCommand } from '@aws-sdk/client-sfn'
import { DutchOrderInfo, OrderValidation } from '@uniswap/gouda-sdk'
import { DutchOrderInfo, OrderValidation } from '@uniswap/uniswapx-sdk'
import { mockClient } from 'aws-sdk-client-mock'
import { BigNumber } from 'ethers'
import { ORDER_STATUS } from '../../lib/entities'
Expand Down Expand Up @@ -67,8 +67,8 @@ const DECODED_ORDER = {
chainId: 1,
}

jest.mock('@uniswap/gouda-sdk', () => {
const originalSdk = jest.requireActual('@uniswap/gouda-sdk')
jest.mock('@uniswap/uniswapx-sdk', () => {
const originalSdk = jest.requireActual('@uniswap/uniswapx-sdk')
return {
...originalSdk,
DutchOrder: {
Expand Down
4 changes: 2 additions & 2 deletions test/integ/nonce.test.ts
Original file line number Diff line number Diff line change
@@ -1,12 +1,12 @@
import { DutchOrderBuilder } from '@uniswap/gouda-sdk'
import { DutchOrderBuilder } from '@uniswap/uniswapx-sdk'
import axios from 'axios'
import dotenv from 'dotenv'
import { BigNumber, ethers } from 'ethers'
import { checkDefined } from '../../lib/preconditions/preconditions'
import { ANVIL_TEST_WALLET_PK, ZERO_ADDRESS } from './constants'
dotenv.config()

const URL = checkDefined(process.env.GOUDA_SERVICE_URL, 'GOUDA_SERVICE_URL must be defined')
const URL = checkDefined(process.env.UNISWAPX_SERVICE_URL, 'UNISWAPX_SERVICE_URL must be defined')

const wallet = new ethers.Wallet(ANVIL_TEST_WALLET_PK)
const amount = BigNumber.from(10).pow(18)
Expand Down
10 changes: 5 additions & 5 deletions test/integ/order.test.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import { DutchOrder, DutchOrderBuilder, REACTOR_ADDRESS_MAPPING, SignedOrder } from '@uniswap/gouda-sdk'
import { factories } from '@uniswap/gouda-sdk/dist/src/contracts/index'
import { DutchOrder, DutchOrderBuilder, REACTOR_ADDRESS_MAPPING, SignedOrder } from '@uniswap/uniswapx-sdk'
import { factories } from '@uniswap/uniswapx-sdk/dist/src/contracts/index'
import axios from 'axios'
import dotenv from 'dotenv'
import { BigNumber, Contract, ethers, Wallet } from 'ethers'
Expand Down Expand Up @@ -52,8 +52,8 @@ describe('/dutch-auction/order', () => {
const amount = ethers.utils.parseEther('0.01')

beforeAll(async () => {
if (!process.env.GOUDA_SERVICE_URL) {
throw new Error('GOUDA_SERVICE_URL not set')
if (!process.env.UNISWAPX_SERVICE_URL) {
throw new Error('UNISWAPX_SERVICE_URL not set')
}
if (!process.env.RPC_5) {
throw new Error('RPC_5 not set')
Expand All @@ -64,7 +64,7 @@ describe('/dutch-auction/order', () => {
if (!process.env.TEST_FILLER_PK) {
throw new Error('TEST_FILLER_PK not set')
}
URL = process.env.GOUDA_SERVICE_URL
URL = process.env.UNISWAPX_SERVICE_URL

provider = new ethers.providers.JsonRpcProvider(process.env.RPC_5)
alice = new ethers.Wallet(process.env.TEST_WALLET_PK).connect(provider)
Expand Down
2 changes: 1 addition & 1 deletion test/util/nonce.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ import { generateRandomNonce } from '../../lib/util/nonce'
const MAX_UINT256 = ethers.BigNumber.from('0xffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff')

describe('random nonce generation test', () => {
it('should generate an in-range nonce with prefixed gouda bits', () => {
it('should generate an in-range nonce with prefixed uniswapx bits', () => {
const nonceBN = ethers.BigNumber.from(generateRandomNonce())

expect(nonceBN.lt(ethers.BigNumber.from(MAX_UINT256))).toBeTruthy()
Expand Down
2 changes: 1 addition & 1 deletion test/util/order-validator.test.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { DutchOrder } from '@uniswap/gouda-sdk'
import { DutchOrder } from '@uniswap/uniswapx-sdk'
import { BigNumber } from 'ethers'
import { OrderValidator } from '../../lib/util/order-validator'

Expand Down
22 changes: 11 additions & 11 deletions yarn.lock
Original file line number Diff line number Diff line change
Expand Up @@ -3045,17 +3045,6 @@
"@typescript-eslint/types" "5.41.0"
eslint-visitor-keys "^3.3.0"

"@uniswap/gouda-sdk@^1.0.0-alpha.5":
version "1.0.0-alpha.5"
resolved "https://registry.yarnpkg.com/@uniswap/gouda-sdk/-/gouda-sdk-1.0.0-alpha.5.tgz#3c74161701b9e115740111b482a82233c35679ae"
integrity sha512-V+4nGBuPF8FAwYX22qit+nhRM+edsvhEcr0N1/Kva5V62yZvCq7Xrz5e517axebrkneDtR1cyOaLkCxIymI61A==
dependencies:
"@ethersproject/bytes" "^5.7.0"
"@ethersproject/providers" "^5.7.0"
"@uniswap/permit2-sdk" "^1.2.0"
"@uniswap/sdk-core" "^3.0.2"
ethers "^5.7.0"

"@uniswap/permit2-sdk@^1.2.0":
version "1.2.0"
resolved "https://registry.npmjs.org/@uniswap/permit2-sdk/-/permit2-sdk-1.2.0.tgz"
Expand All @@ -3076,6 +3065,17 @@
tiny-invariant "^1.1.0"
toformat "^2.0.0"

"@uniswap/uniswapx-sdk@^1.0.0":
version "1.0.0"
resolved "https://registry.yarnpkg.com/@uniswap/uniswapx-sdk/-/uniswapx-sdk-1.0.0.tgz#5e27a86aca4b9955da90ec8209f44bad257178d2"
integrity sha512-2e+74J8pTxrP7Vq2bw5Cae+Z1uLDUi/sMbvG+SFBM/qJM+rn5UFs5pdAaLTzPaEwgoL0aExlu8QJYchri0D2aA==
dependencies:
"@ethersproject/bytes" "^5.7.0"
"@ethersproject/providers" "^5.7.0"
"@uniswap/permit2-sdk" "^1.2.0"
"@uniswap/sdk-core" "^3.0.2"
ethers "^5.7.0"

acorn-jsx@^5.3.2:
version "5.3.2"
resolved "https://registry.npmjs.org/acorn-jsx/-/acorn-jsx-5.3.2.tgz"
Expand Down

0 comments on commit 4f3068e

Please sign in to comment.