Skip to content

Commit

Permalink
test: fix remaining tests that deploy tokens
Browse files Browse the repository at this point in the history
  • Loading branch information
CJ42 committed Nov 24, 2023
1 parent 2b2577d commit fc580a3
Show file tree
Hide file tree
Showing 14 changed files with 86 additions and 4 deletions.
11 changes: 11 additions & 0 deletions tests/Benchmark.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@ import {
PERMISSIONS,
CALLTYPE,
LSP8_TOKEN_ID_TYPES,
LSP4_TOKEN_TYPES,
} from '../constants';
import { LSP6TestContext } from './utils/context';
import { setupKeyManager, setupProfileWithKeyManagerWithURD } from './utils/fixtures';
Expand Down Expand Up @@ -129,6 +130,7 @@ describe('⛽📊 Gas Benchmark', () => {
'MTKN',
accounts[0].address,
false,
LSP4_TOKEN_TYPES.TOKEN,
);

const lsp7DeployTransaction = lsp7Mintable.deployTransaction;
Expand All @@ -142,6 +144,7 @@ describe('⛽📊 Gas Benchmark', () => {
'MNFT',
accounts[0].address,
LSP8_TOKEN_ID_TYPES.NUMBER,
LSP4_TOKEN_TYPES.NFT,
);

const lsp8DeployTransaction = lsp8Mintable.deployTransaction;
Expand Down Expand Up @@ -552,6 +555,7 @@ describe('⛽📊 Gas Benchmark', () => {
'MTKN',
context.mainController.address,
false,
LSP4_TOKEN_TYPES.TOKEN,
);

// deploy a LSP8 token
Expand All @@ -560,6 +564,7 @@ describe('⛽📊 Gas Benchmark', () => {
'MNFT',
context.mainController.address,
LSP8_TOKEN_ID_TYPES.UNIQUE_ID,
LSP4_TOKEN_TYPES.NFT,
);

universalProfile1 = await new UniversalProfile__factory(context.mainController).deploy(
Expand Down Expand Up @@ -704,6 +709,7 @@ describe('⛽📊 Gas Benchmark', () => {
'MTC',
context.mainController.address,
false,
LSP4_TOKEN_TYPES.TOKEN,
);

// deploy a LSP8 NFT
Expand All @@ -712,6 +718,7 @@ describe('⛽📊 Gas Benchmark', () => {
'MNF',
context.mainController.address,
LSP8_TOKEN_ID_TYPES.UNIQUE_ID,
LSP4_TOKEN_TYPES.NFT,
);

// mint some tokens to the UP
Expand Down Expand Up @@ -891,13 +898,15 @@ describe('⛽📊 Gas Benchmark', () => {
'MTC',
context.mainController.address,
false,
LSP4_TOKEN_TYPES.TOKEN,
);

lsp7LyxDai = await new LSP7Mintable__factory(context.mainController).deploy(
'LyxDai',
'LDAI',
context.mainController.address,
false,
LSP4_TOKEN_TYPES.TOKEN,
);

[lsp7MetaCoin, lsp7LyxDai].forEach(async (token) => {
Expand All @@ -912,13 +921,15 @@ describe('⛽📊 Gas Benchmark', () => {
'MNF',
context.mainController.address,
LSP8_TOKEN_ID_TYPES.UNIQUE_ID,
LSP4_TOKEN_TYPES.NFT,
);

lsp8LyxPunks = await new LSP8Mintable__factory(context.mainController).deploy(
'LyxPunks',
'LPK',
context.mainController.address,
LSP8_TOKEN_ID_TYPES.UNIQUE_ID,
LSP4_TOKEN_TYPES.NFT,
);

[
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,7 @@ import {
OPERATION_TYPES,
LSP1_TYPE_IDS,
LSP8_TOKEN_ID_TYPES,
LSP4_TOKEN_TYPES,
} from '../../constants';

// fixtures
Expand Down Expand Up @@ -245,18 +246,21 @@ export const shouldBehaveLikeLSP1Delegate = (
'TokenAlpha',
'TA',
context.accounts.random.address,
LSP4_TOKEN_TYPES.TOKEN,
);

lsp7TokenB = await new LSP7Tester__factory(context.accounts.random).deploy(
'TokenBeta',
'TB',
context.accounts.random.address,
LSP4_TOKEN_TYPES.TOKEN,
);

lsp7TokenC = await new LSP7Tester__factory(context.accounts.random).deploy(
'TokenGamma',
'TA',
context.accounts.random.address,
LSP4_TOKEN_TYPES.TOKEN,
);
});

Expand All @@ -269,6 +273,7 @@ export const shouldBehaveLikeLSP1Delegate = (
'LSP7 Token',
'TKN',
context.universalProfile1.address,
LSP4_TOKEN_TYPES.TOKEN,
);
});

Expand Down Expand Up @@ -931,6 +936,7 @@ export const shouldBehaveLikeLSP1Delegate = (
'Example LSP7 token',
'EL7T',
context.accounts.random.address,
LSP4_TOKEN_TYPES.TOKEN,
);
});

Expand Down Expand Up @@ -1124,6 +1130,7 @@ export const shouldBehaveLikeLSP1Delegate = (
'Example LSP7 token',
'EL7T',
context.accounts.random.address,
LSP4_TOKEN_TYPES.TOKEN,
);

arrayKey = ERC725YDataKeys.LSP5['LSP5ReceivedAssets[]'].length;
Expand Down Expand Up @@ -1782,20 +1789,23 @@ export const shouldBehaveLikeLSP1Delegate = (
'TA',
context.accounts.random.address,
LSP8_TOKEN_ID_TYPES.UNIQUE_ID,
LSP4_TOKEN_TYPES.NFT,
);

lsp8TokenB = await new LSP8Tester__factory(context.accounts.random).deploy(
'TokenBeta',
'TB',
context.accounts.random.address,
LSP8_TOKEN_ID_TYPES.UNIQUE_ID,
LSP4_TOKEN_TYPES.NFT,
);

lsp8TokenC = await new LSP8Tester__factory(context.accounts.random).deploy(
'TokenGamma',
'TA',
context.accounts.random.address,
LSP8_TOKEN_ID_TYPES.UNIQUE_ID,
LSP4_TOKEN_TYPES.NFT,
);
});

Expand Down Expand Up @@ -3087,6 +3097,7 @@ export const shouldBehaveLikeLSP1Delegate = (
'MyToken',
'MTK',
context.universalProfile1.address,
LSP4_TOKEN_TYPES.TOKEN,
);

expect(await LSP7.balanceOf(context.universalProfile1.address)).to.equal(1000);
Expand Down Expand Up @@ -3119,6 +3130,7 @@ export const shouldBehaveLikeLSP1Delegate = (
'MTK',
context.universalProfile1.address,
LSP8_TOKEN_ID_TYPES.NUMBER,
LSP4_TOKEN_TYPES.NFT,
);
// Mint token for UP1
await LSP8.mint(context.universalProfile1.address, '0x' + '0'.repeat(64), true, '0x');
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@ import {
OPERATION_TYPES,
LSP1_TYPE_IDS,
LSP8_TOKEN_ID_TYPES,
LSP4_TOKEN_TYPES,
} from '../../constants';
import { callPayload, getLSP5MapAndArrayKeysValue } from '../utils/fixtures';
import { BigNumber, BytesLike, Transaction } from 'ethers';
Expand Down Expand Up @@ -209,18 +210,21 @@ export const shouldBehaveLikeLSP1Delegate = (buildContext: () => Promise<LSP1Tes
'TokenAlpha',
'TA',
context.accounts.random.address,
LSP4_TOKEN_TYPES.TOKEN,
);

lsp7TokenB = await new LSP7Tester__factory(context.accounts.random).deploy(
'TokenBeta',
'TB',
context.accounts.random.address,
LSP4_TOKEN_TYPES.TOKEN,
);

lsp7TokenC = await new LSP7Tester__factory(context.accounts.random).deploy(
'TokenGamma',
'TA',
context.accounts.random.address,
LSP4_TOKEN_TYPES.TOKEN,
);
});

Expand All @@ -233,6 +237,7 @@ export const shouldBehaveLikeLSP1Delegate = (buildContext: () => Promise<LSP1Tes
'LSP7 Token',
'TKN',
context.lsp9Vault1.address,
LSP4_TOKEN_TYPES.TOKEN,
);
});

Expand Down Expand Up @@ -880,6 +885,7 @@ export const shouldBehaveLikeLSP1Delegate = (buildContext: () => Promise<LSP1Tes
'Example LSP7 token',
'EL7T',
context.accounts.random.address,
LSP4_TOKEN_TYPES.TOKEN,
);

arrayKey = ERC725YDataKeys.LSP5['LSP5ReceivedAssets[]'].length;
Expand Down Expand Up @@ -1169,20 +1175,23 @@ export const shouldBehaveLikeLSP1Delegate = (buildContext: () => Promise<LSP1Tes
'TA',
context.accounts.random.address,
LSP8_TOKEN_ID_TYPES.UNIQUE_ID,
LSP4_TOKEN_TYPES.NFT,
);

lsp8TokenB = await new LSP8Tester__factory(context.accounts.random).deploy(
'TokenBeta',
'TB',
context.accounts.random.address,
LSP8_TOKEN_ID_TYPES.UNIQUE_ID,
LSP4_TOKEN_TYPES.NFT,
);

lsp8TokenC = await new LSP8Tester__factory(context.accounts.random).deploy(
'TokenGamma',
'TA',
context.accounts.random.address,
LSP8_TOKEN_ID_TYPES.UNIQUE_ID,
LSP4_TOKEN_TYPES.NFT,
);
});

Expand Down Expand Up @@ -1730,6 +1739,7 @@ export const shouldBehaveLikeLSP1Delegate = (buildContext: () => Promise<LSP1Tes
'MyToken',
'MTK',
context.lsp9Vault1.address,
LSP4_TOKEN_TYPES.TOKEN,
);

const LSP7_TransferCalldata = LSP7.interface.encodeFunctionData('transfer', [
Expand Down Expand Up @@ -1766,6 +1776,7 @@ export const shouldBehaveLikeLSP1Delegate = (buildContext: () => Promise<LSP1Tes
'MTK',
context.lsp9Vault1.address,
LSP8_TOKEN_ID_TYPES.NUMBER,
LSP4_TOKEN_TYPES.NFT,
);
await LSP8.mint(context.lsp9Vault1.address, '0x' + '0'.repeat(64), false, '0x');

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@ import {
INTERFACE_IDS,
CALLTYPE,
LSP8_TOKEN_ID_TYPES,
LSP4_TOKEN_TYPES,
} from '../../../../constants';

// setup
Expand Down Expand Up @@ -190,13 +191,15 @@ export const shouldBehaveLikeAllowedFunctions = (buildContext: () => Promise<LSP
'TKN',
context.accounts[0].address,
false,
LSP4_TOKEN_TYPES.TOKEN,
);

lsp8Contract = await new LSP8Mintable__factory(context.accounts[0]).deploy(
'LSP8 NFT',
'NFT',
context.accounts[0].address,
LSP8_TOKEN_ID_TYPES.UNIQUE_ID,
LSP4_TOKEN_TYPES.NFT,
);

await lsp7Contract
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@ import {
OPERATION_TYPES,
PERMISSIONS,
CALLTYPE,
LSP4_TOKEN_TYPES,
} from '../../../../constants';

// setup
Expand Down Expand Up @@ -261,20 +262,23 @@ export const shouldBehaveLikeAllowedStandards = (buildContext: () => Promise<LSP
'TKNA',
context.accounts[0].address,
false,
LSP4_TOKEN_TYPES.TOKEN,
);

lsp7TokenB = await new LSP7Mintable__factory(context.accounts[0]).deploy(
'LSP7 Token B',
'TKNB',
context.accounts[0].address,
false,
LSP4_TOKEN_TYPES.TOKEN,
);

lsp7TokenC = await new LSP7Mintable__factory(context.accounts[0]).deploy(
'LSP7 Token C',
'TKNC',
context.accounts[0].address,
false,
LSP4_TOKEN_TYPES.TOKEN,
);

await lsp7TokenA
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ import { ethers } from 'hardhat';
import { BigNumber } from 'ethers';

// constants
import { ERC725YDataKeys, OPERATION_TYPES } from '../../../../constants';
import { ERC725YDataKeys, LSP4_TOKEN_TYPES, OPERATION_TYPES } from '../../../../constants';

// setup
import { LSP6TestContext } from '../../../utils/context';
Expand Down Expand Up @@ -36,20 +36,23 @@ export const shouldBehaveLikeBatchExecute = (
'LYXDAI',
context.accounts[0].address,
false,
LSP4_TOKEN_TYPES.TOKEN,
);

metaCoin = await new LSP7Mintable__factory(context.accounts[0]).deploy(
'Meta Coin',
'MTC',
context.accounts[0].address,
false,
LSP4_TOKEN_TYPES.TOKEN,
);

rLyxToken = await new LSP7Mintable__factory(context.accounts[0]).deploy(
'LUKSO Relay Token',
'rLYX',
context.accounts[0].address,
false,
LSP4_TOKEN_TYPES.TOKEN,
);

await lyxDaiToken.mint(context.universalProfile.address, 100, false, '0x');
Expand Down Expand Up @@ -229,6 +232,7 @@ export const shouldBehaveLikeBatchExecute = (
'UPLSP7',
context.universalProfile.address,
false,
LSP4_TOKEN_TYPES.TOKEN,
]);

// use interface of an existing token contract
Expand Down
Loading

0 comments on commit fc580a3

Please sign in to comment.