11import hre from "hardhat"
22import { expect } from "chai"
3- import { itUint , Wallet } from "@coti-io/coti-ethers"
3+ import { itUint256 , Wallet } from "@coti-io/coti-ethers"
44import { setupAccounts } from "./utils/accounts"
55
66const gasLimit = 12000000
@@ -19,7 +19,7 @@ async function deploy() {
1919 await (
2020 await token
2121 . connect ( owner )
22- . mint ( owner . address , initialSupply )
22+ . mint ( owner . address , initialSupply , { gasLimit } )
2323 ) . wait ( )
2424
2525 const factory = await hre . ethers . getContractFactory ( "PrivateAuction" )
@@ -45,7 +45,7 @@ async function expectBalance(
4545 user : Wallet
4646) {
4747 const ctBalance = await token [ "balanceOf(address)" ] ( user . address )
48- let balance = await user . decryptValue ( ctBalance )
48+ let balance = await user . decryptValue256 ( ctBalance )
4949 expect ( balance ) . to . equal ( amount )
5050}
5151
@@ -55,7 +55,7 @@ async function expectBid(
5555 user : Wallet
5656) {
5757 const ctBalance = await contract . connect ( user ) . getBid . staticCall ( )
58- let bid = await user . decryptValue ( ctBalance )
58+ let bid = await user . decryptValue256 ( ctBalance )
5959 expect ( bid ) . to . equal ( amount )
6060}
6161
@@ -93,24 +93,24 @@ describe("Private Auction", function () {
9393 it ( `Bid ${ bidAmount } ` , async function ( ) {
9494 const { token, tokenAddress, contract, contractAddress, owner } = deployment
9595
96- const initialBalance = Number ( await owner . decryptValue ( await token [ "balanceOf(address)" ] ( owner . address ) ) )
96+ const initialBalance = Number ( await owner . decryptValue256 ( await token [ "balanceOf(address)" ] ( owner . address ) ) )
9797
98- let itBidAmount = await owner . encryptValue (
98+ let itBidAmount = await owner . encryptValue256 (
9999 bidAmount ,
100100 tokenAddress ,
101- token [ "approve(address,(uint256,bytes))" ] . fragment . selector
102- ) as itUint
101+ token . interface . getFunction ( "approve(address,(( uint256,uint256), bytes))" ) . selector
102+ ) as itUint256
103103
104104 await (
105105 await token
106106 . connect ( owner )
107- [ "approve(address,(uint256,bytes))" ]
107+ . getFunction ( "approve(address,(( uint256,uint256), bytes))" )
108108 ( contractAddress , itBidAmount , { gasLimit } )
109109 ) . wait ( )
110110
111111 const func = contract . connect ( owner ) . bid
112112 const selector = func . fragment . selector
113- itBidAmount = await owner . encryptValue ( BigInt ( bidAmount ) , contractAddress , selector ) as itUint
113+ itBidAmount = await owner . encryptValue256 ( BigInt ( bidAmount ) , contractAddress , selector ) as itUint256
114114 await ( await func ( itBidAmount , { gasLimit } ) ) . wait ( )
115115
116116 await expectBalance ( token , initialBalance - bidAmount , owner )
@@ -121,24 +121,24 @@ describe("Private Auction", function () {
121121 it ( `Increase Bid ${ bidAmount * 2 } ` , async function ( ) {
122122 const { token, tokenAddress, contract, contractAddress, owner } = deployment
123123
124- const initialBalance = Number ( await owner . decryptValue ( await token [ "balanceOf(address)" ] ( owner . address ) ) )
124+ const initialBalance = Number ( await owner . decryptValue256 ( await token [ "balanceOf(address)" ] ( owner . address ) ) )
125125
126- let itBidAmount = await owner . encryptValue (
126+ let itBidAmount = await owner . encryptValue256 (
127127 bidAmount * 2 ,
128128 tokenAddress ,
129- token [ "approve(address,(uint256,bytes))" ] . fragment . selector
130- ) as itUint
129+ token . interface . getFunction ( "approve(address,(( uint256,uint256), bytes))" ) . selector
130+ ) as itUint256
131131
132132 await (
133133 await token
134134 . connect ( owner )
135- [ "approve(address,(uint256,bytes))" ]
135+ . getFunction ( "approve(address,(( uint256,uint256), bytes))" )
136136 ( contractAddress , itBidAmount , { gasLimit } )
137137 ) . wait ( )
138138
139139 const func = contract . connect ( owner ) . bid
140140 const selector = func . fragment . selector
141- itBidAmount = await owner . encryptValue ( BigInt ( bidAmount * 2 ) , contractAddress , selector ) as itUint
141+ itBidAmount = await owner . encryptValue256 ( BigInt ( bidAmount * 2 ) , contractAddress , selector ) as itUint256
142142 await ( await func ( itBidAmount , { gasLimit } ) ) . wait ( )
143143
144144 await expectBalance ( token , initialBalance - bidAmount , owner )
0 commit comments