diff --git a/abis/ERC20Pool.json b/abis/ERC20Pool.json index cf3bc3c..328b2ad 100644 --- a/abis/ERC20Pool.json +++ b/abis/ERC20Pool.json @@ -34,6 +34,11 @@ "name": "AuctionNotCleared", "type": "error" }, + { + "inputs": [], + "name": "AuctionNotTakeable", + "type": "error" + }, { "inputs": [], "name": "AuctionPriceGtBucketPrice", @@ -319,11 +324,6 @@ "name": "ReserveAuctionTooSoon", "type": "error" }, - { - "inputs": [], - "name": "TakeNotPastCooldown", - "type": "error" - }, { "inputs": [], "name": "TransactionExpired", @@ -1265,7 +1265,7 @@ }, { "internalType": "uint256", - "name": "kickMomp_", + "name": "referencePrice_", "type": "uint256" }, { @@ -1287,11 +1287,6 @@ "internalType": "address", "name": "prev_", "type": "address" - }, - { - "internalType": "bool", - "name": "alreadyTaken_", - "type": "bool" } ], "stateMutability": "view", @@ -2212,7 +2207,13 @@ } ], "name": "repayDebt", - "outputs": [], + "outputs": [ + { + "internalType": "uint256", + "name": "amountRepaid_", + "type": "uint256" + } + ], "stateMutability": "nonpayable", "type": "function" }, @@ -2324,7 +2325,13 @@ } ], "name": "take", - "outputs": [], + "outputs": [ + { + "internalType": "uint256", + "name": "collateralTaken_", + "type": "uint256" + } + ], "stateMutability": "nonpayable", "type": "function" }, @@ -2434,4 +2441,4 @@ "stateMutability": "nonpayable", "type": "function" } -] +] \ No newline at end of file diff --git a/abis/ERC721Pool.json b/abis/ERC721Pool.json index 8cb96a6..34ae7d6 100644 --- a/abis/ERC721Pool.json +++ b/abis/ERC721Pool.json @@ -34,6 +34,11 @@ "name": "AuctionNotCleared", "type": "error" }, + { + "inputs": [], + "name": "AuctionNotTakeable", + "type": "error" + }, { "inputs": [], "name": "AuctionPriceGtBucketPrice", @@ -270,11 +275,6 @@ "name": "ReserveAuctionTooSoon", "type": "error" }, - { - "inputs": [], - "name": "TakeNotPastCooldown", - "type": "error" - }, { "inputs": [], "name": "TransactionExpired", @@ -1241,7 +1241,7 @@ }, { "internalType": "uint256", - "name": "kickMomp_", + "name": "referencePrice_", "type": "uint256" }, { @@ -1263,11 +1263,6 @@ "internalType": "address", "name": "prev_", "type": "address" - }, - { - "internalType": "bool", - "name": "alreadyTaken_", - "type": "bool" } ], "stateMutability": "view", @@ -2251,7 +2246,13 @@ } ], "name": "repayDebt", - "outputs": [], + "outputs": [ + { + "internalType": "uint256", + "name": "amountRepaid_", + "type": "uint256" + } + ], "stateMutability": "nonpayable", "type": "function" }, @@ -2363,7 +2364,13 @@ } ], "name": "take", - "outputs": [], + "outputs": [ + { + "internalType": "uint256", + "name": "collateralTaken_", + "type": "uint256" + } + ], "stateMutability": "nonpayable", "type": "function" }, diff --git a/abis/PoolInfoUtils.json b/abis/PoolInfoUtils.json index 2d96218..1c996c2 100644 --- a/abis/PoolInfoUtils.json +++ b/abis/PoolInfoUtils.json @@ -484,25 +484,6 @@ "stateMutability": "view", "type": "function" }, - { - "inputs": [ - { - "internalType": "address", - "name": "ajnaPool_", - "type": "address" - } - ], - "name": "momp", - "outputs": [ - { - "internalType": "uint256", - "name": "", - "type": "uint256" - } - ], - "stateMutability": "view", - "type": "function" - }, { "inputs": [ { @@ -697,4 +678,4 @@ "stateMutability": "view", "type": "function" } -] +] \ No newline at end of file diff --git a/abis/RewardsManager.json b/abis/RewardsManager.json deleted file mode 100644 index 5d8eac2..0000000 --- a/abis/RewardsManager.json +++ /dev/null @@ -1,486 +0,0 @@ -[ - { - "inputs": [ - { - "internalType": "address", - "name": "ajnaToken_", - "type": "address" - }, - { - "internalType": "contract IPositionManager", - "name": "positionManager_", - "type": "address" - } - ], - "stateMutability": "nonpayable", - "type": "constructor" - }, - { - "inputs": [], - "name": "AlreadyClaimed", - "type": "error" - }, - { - "inputs": [], - "name": "DeployWithZeroAddress", - "type": "error" - }, - { - "inputs": [], - "name": "EpochNotAvailable", - "type": "error" - }, - { - "inputs": [], - "name": "InsufficientLiquidity", - "type": "error" - }, - { - "inputs": [], - "name": "MoveStakedLiquidityInvalid", - "type": "error" - }, - { - "inputs": [], - "name": "NotAjnaPool", - "type": "error" - }, - { - "inputs": [], - "name": "NotOwnerOfDeposit", - "type": "error" - }, - { - "anonymous": false, - "inputs": [ - { - "indexed": true, - "internalType": "address", - "name": "owner", - "type": "address" - }, - { - "indexed": true, - "internalType": "address", - "name": "ajnaPool", - "type": "address" - }, - { - "indexed": true, - "internalType": "uint256", - "name": "tokenId", - "type": "uint256" - }, - { - "indexed": false, - "internalType": "uint256[]", - "name": "epochsClaimed", - "type": "uint256[]" - }, - { - "indexed": false, - "internalType": "uint256", - "name": "amount", - "type": "uint256" - } - ], - "name": "ClaimRewards", - "type": "event" - }, - { - "anonymous": false, - "inputs": [ - { - "indexed": false, - "internalType": "uint256", - "name": "tokenId", - "type": "uint256" - }, - { - "indexed": false, - "internalType": "uint256[]", - "name": "fromIndexes", - "type": "uint256[]" - }, - { - "indexed": false, - "internalType": "uint256[]", - "name": "toIndexes", - "type": "uint256[]" - } - ], - "name": "MoveStakedLiquidity", - "type": "event" - }, - { - "anonymous": false, - "inputs": [ - { - "indexed": true, - "internalType": "address", - "name": "owner", - "type": "address" - }, - { - "indexed": true, - "internalType": "address", - "name": "ajnaPool", - "type": "address" - }, - { - "indexed": true, - "internalType": "uint256", - "name": "tokenId", - "type": "uint256" - } - ], - "name": "Stake", - "type": "event" - }, - { - "anonymous": false, - "inputs": [ - { - "indexed": true, - "internalType": "address", - "name": "owner", - "type": "address" - }, - { - "indexed": true, - "internalType": "address", - "name": "ajnaPool", - "type": "address" - }, - { - "indexed": true, - "internalType": "uint256", - "name": "tokenId", - "type": "uint256" - } - ], - "name": "Unstake", - "type": "event" - }, - { - "anonymous": false, - "inputs": [ - { - "indexed": true, - "internalType": "address", - "name": "caller", - "type": "address" - }, - { - "indexed": true, - "internalType": "address", - "name": "ajnaPool", - "type": "address" - }, - { - "indexed": false, - "internalType": "uint256[]", - "name": "indexesUpdated", - "type": "uint256[]" - }, - { - "indexed": false, - "internalType": "uint256", - "name": "rewardsClaimed", - "type": "uint256" - } - ], - "name": "UpdateExchangeRates", - "type": "event" - }, - { - "inputs": [], - "name": "ajnaToken", - "outputs": [ - { - "internalType": "address", - "name": "", - "type": "address" - } - ], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [ - { - "internalType": "uint256", - "name": "tokenId_", - "type": "uint256" - }, - { - "internalType": "uint256", - "name": "epochToClaim_", - "type": "uint256" - } - ], - "name": "calculateRewards", - "outputs": [ - { - "internalType": "uint256", - "name": "rewards_", - "type": "uint256" - } - ], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [ - { - "internalType": "uint256", - "name": "tokenId_", - "type": "uint256" - }, - { - "internalType": "uint256", - "name": "epochToClaim_", - "type": "uint256" - }, - { - "internalType": "uint256", - "name": "minAmount_", - "type": "uint256" - } - ], - "name": "claimRewards", - "outputs": [], - "stateMutability": "nonpayable", - "type": "function" - }, - { - "inputs": [ - { - "internalType": "uint256", - "name": "tokenId_", - "type": "uint256" - } - ], - "name": "emergencyUnstake", - "outputs": [], - "stateMutability": "nonpayable", - "type": "function" - }, - { - "inputs": [ - { - "internalType": "uint256", - "name": "tokenId_", - "type": "uint256" - }, - { - "internalType": "uint256", - "name": "bucketId_", - "type": "uint256" - } - ], - "name": "getBucketStateStakeInfo", - "outputs": [ - { - "internalType": "uint256", - "name": "", - "type": "uint256" - }, - { - "internalType": "uint256", - "name": "", - "type": "uint256" - } - ], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [ - { - "internalType": "uint256", - "name": "tokenId_", - "type": "uint256" - } - ], - "name": "getStakeInfo", - "outputs": [ - { - "internalType": "address", - "name": "", - "type": "address" - }, - { - "internalType": "address", - "name": "", - "type": "address" - }, - { - "internalType": "uint256", - "name": "", - "type": "uint256" - } - ], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [ - { - "internalType": "address", - "name": "pool_", - "type": "address" - }, - { - "internalType": "uint256", - "name": "bucketIndex_", - "type": "uint256" - }, - { - "internalType": "uint256", - "name": "epoch_", - "type": "uint256" - } - ], - "name": "isBucketUpdated", - "outputs": [ - { - "internalType": "bool", - "name": "", - "type": "bool" - } - ], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [ - { - "internalType": "uint256", - "name": "", - "type": "uint256" - }, - { - "internalType": "uint256", - "name": "", - "type": "uint256" - } - ], - "name": "isEpochClaimed", - "outputs": [ - { - "internalType": "bool", - "name": "", - "type": "bool" - } - ], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [], - "name": "positionManager", - "outputs": [ - { - "internalType": "contract IPositionManager", - "name": "", - "type": "address" - } - ], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [ - { - "internalType": "uint256", - "name": "", - "type": "uint256" - } - ], - "name": "rewardsClaimed", - "outputs": [ - { - "internalType": "uint256", - "name": "", - "type": "uint256" - } - ], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [ - { - "internalType": "uint256", - "name": "tokenId_", - "type": "uint256" - } - ], - "name": "stake", - "outputs": [], - "stateMutability": "nonpayable", - "type": "function" - }, - { - "inputs": [ - { - "internalType": "uint256", - "name": "tokenId_", - "type": "uint256" - } - ], - "name": "unstake", - "outputs": [], - "stateMutability": "nonpayable", - "type": "function" - }, - { - "inputs": [ - { - "internalType": "address", - "name": "pool_", - "type": "address" - }, - { - "internalType": "bytes32", - "name": "subsetHash_", - "type": "bytes32" - }, - { - "internalType": "uint256[]", - "name": "indexes_", - "type": "uint256[]" - } - ], - "name": "updateBucketExchangeRatesAndClaim", - "outputs": [ - { - "internalType": "uint256", - "name": "updateReward", - "type": "uint256" - } - ], - "stateMutability": "nonpayable", - "type": "function" - }, - { - "inputs": [ - { - "internalType": "uint256", - "name": "", - "type": "uint256" - } - ], - "name": "updateRewardsClaimed", - "outputs": [ - { - "internalType": "uint256", - "name": "", - "type": "uint256" - } - ], - "stateMutability": "view", - "type": "function" - } -] diff --git a/networks.json b/networks.json index 3db6a57..a46238a 100644 --- a/networks.json +++ b/networks.json @@ -53,15 +53,15 @@ }, "goerli": { "ERC20PoolFactory": { - "address": "0x01Da8a85A5B525D476cA2b51e44fe7087fFafaFF", + "address": "0x14F2474fB5ea9DF82059053c4F85A8C803Ab10C9", "startBlock": 9289397 }, "ERC721PoolFactory": { - "address": "0x37048D43A65748409B04f4051eEd9480BEf68c82", + "address": "0xb0d1c875B240EE9f6C2c3284a31b10f1EC6De7d2", "startBlock": 9289397 }, "PositionManager": { - "address": "0x23E2EFF19bd50BfCF0364B7dCA01004D5cce41f9", + "address": "0xC4114D90F51960854ab574297Cf7CC131d445F29", "startBlock": 9289397 }, "GrantFund": { diff --git a/src/utils/pool/liquidation.ts b/src/utils/pool/liquidation.ts index 4a5f669..44c9346 100644 --- a/src/utils/pool/liquidation.ts +++ b/src/utils/pool/liquidation.ts @@ -102,8 +102,7 @@ export class AuctionInfo { head: Address next: Address prev: Address - alreadyTaken: bool - constructor(kicker: Address, bondFactor: BigInt, bondSize: BigInt, kickTime: BigInt, referencePrice: BigInt, neutralPrice: BigInt, head: Address, next: Address, prev: Address, alreadyTaken: bool) { + constructor(kicker: Address, bondFactor: BigInt, bondSize: BigInt, kickTime: BigInt, referencePrice: BigInt, neutralPrice: BigInt, head: Address, next: Address, prev: Address) { this.kicker = kicker this.bondFactor = bondFactor this.bondSize = bondSize @@ -113,7 +112,6 @@ export class AuctionInfo { this.head = head this.next = next this.prev = prev - this.alreadyTaken = alreadyTaken } } export function getAuctionInfoERC20Pool(borrower: Bytes, pool: Pool): AuctionInfo { @@ -128,8 +126,7 @@ export function getAuctionInfoERC20Pool(borrower: Bytes, pool: Pool): AuctionInf auctionInfoResult.value5, auctionInfoResult.value6, auctionInfoResult.value7, - auctionInfoResult.value8, - auctionInfoResult.value9 + auctionInfoResult.value8 ) return auctionInfo } @@ -145,8 +142,7 @@ export function getAuctionInfoERC721Pool(borrower: Bytes, pool: Pool): AuctionIn auctionInfoResult.value5, auctionInfoResult.value6, auctionInfoResult.value7, - auctionInfoResult.value8, - auctionInfoResult.value9 + auctionInfoResult.value8 ) return auctionInfo } diff --git a/tests/erc-20-pool.test.ts b/tests/erc-20-pool.test.ts index 9322325..c876f19 100644 --- a/tests/erc-20-pool.test.ts +++ b/tests/erc-20-pool.test.ts @@ -634,7 +634,6 @@ describe("ERC20Pool assertions", () => { const head = Address.fromString("0x0000000000000000000000000000000000000000") const next = Address.fromString("0x0000000000000000000000000000000000000000") const prev = Address.fromString("0x0000000000000000000000000000000000000000") - const alreadyTaken = false const startPrice = neutralPrice.times(BigInt.fromU32(32)) const expectedAuctionInfo = new AuctionInfo( kicker, @@ -645,8 +644,7 @@ describe("ERC20Pool assertions", () => { neutralPrice, head, next, - prev, - alreadyTaken + prev ) mockGetAuctionInfo(borrower, poolAddress, expectedAuctionInfo) const expectedAuctionStatus = new AuctionStatus( @@ -818,7 +816,6 @@ describe("ERC20Pool assertions", () => { const head = Address.fromString("0x0000000000000000000000000000000000000000") const next = Address.fromString("0x0000000000000000000000000000000000000000") const prev = Address.fromString("0x0000000000000000000000000000000000000000") - const alreadyTaken = false let expectedAuctionInfo = new AuctionInfo( kicker, @@ -829,8 +826,7 @@ describe("ERC20Pool assertions", () => { neutralPrice, head, next, - prev, - false + prev ) mockGetAuctionInfo(borrower, poolAddress, expectedAuctionInfo) @@ -866,8 +862,7 @@ describe("ERC20Pool assertions", () => { neutralPrice, head, next, - prev, - alreadyTaken + prev ) mockGetAuctionInfo(borrower, poolAddress, expectedAuctionInfo) const expectedAuctionStatus = new AuctionStatus( @@ -1009,7 +1004,6 @@ describe("ERC20Pool assertions", () => { const head = Address.fromString("0x0000000000000000000000000000000000000000") const next = Address.fromString("0x0000000000000000000000000000000000000000") const prev = Address.fromString("0x0000000000000000000000000000000000000000") - const alreadyTaken = false let expectedAuctionInfo = new AuctionInfo( kicker, bondFactor, @@ -1019,8 +1013,7 @@ describe("ERC20Pool assertions", () => { neutralPrice, head, next, - prev, - alreadyTaken + prev ) mockGetAuctionInfo(borrower, poolAddress, expectedAuctionInfo) @@ -1049,8 +1042,7 @@ describe("ERC20Pool assertions", () => { neutralPrice, head, next, - prev, - alreadyTaken + prev ) mockGetAuctionInfo(borrower, poolAddress, expectedAuctionInfo) const expectedAuctionStatus = new AuctionStatus( @@ -1204,7 +1196,6 @@ describe("ERC20Pool assertions", () => { const head = Address.fromString("0x0000000000000000000000000000000000000000") const next = Address.fromString("0x0000000000000000000000000000000000000000") const prev = Address.fromString("0x0000000000000000000000000000000000000000") - const alreadyTaken = false let expectedAuctionInfo = new AuctionInfo( kicker, bondFactor, @@ -1214,8 +1205,7 @@ describe("ERC20Pool assertions", () => { neutralPrice, head, next, - prev, - alreadyTaken + prev ) mockGetAuctionInfo(borrower, poolAddress, expectedAuctionInfo) diff --git a/tests/erc-721-pool.test.ts b/tests/erc-721-pool.test.ts index 490b5d4..f94f81d 100644 --- a/tests/erc-721-pool.test.ts +++ b/tests/erc-721-pool.test.ts @@ -799,7 +799,6 @@ describe("Describe entity assertions", () => { const head = Address.fromString("0x0000000000000000000000000000000000000000") const next = Address.fromString("0x0000000000000000000000000000000000000000") const prev = Address.fromString("0x0000000000000000000000000000000000000000") - const alreadyTaken = false // mock required contract calls let expectedAuctionInfo = new AuctionInfo( @@ -811,8 +810,7 @@ describe("Describe entity assertions", () => { neutralPrice, head, next, - prev, - false + prev ) mockGetAuctionInfo(borrower, poolAddress, expectedAuctionInfo) @@ -1194,7 +1192,6 @@ describe("Describe entity assertions", () => { const head = Address.fromString("0x0000000000000000000000000000000000000000") const next = Address.fromString("0x0000000000000000000000000000000000000000") const prev = Address.fromString("0x0000000000000000000000000000000000000000") - const alreadyTaken = false // mock required contract calls let expectedAuctionInfo = new AuctionInfo( @@ -1206,8 +1203,7 @@ describe("Describe entity assertions", () => { neutralPrice, head, next, - prev, - false + prev ) mockGetAuctionInfo(borrower, poolAddress, expectedAuctionInfo) diff --git a/tests/utils/mock-contract-calls.ts b/tests/utils/mock-contract-calls.ts index 49ca531..45b44bc 100644 --- a/tests/utils/mock-contract-calls.ts +++ b/tests/utils/mock-contract-calls.ts @@ -267,8 +267,7 @@ export function mockGetAuctionInfo(borrower: Address, pool: Address, expectedInf ethereum.Value.fromUnsignedBigInt(expectedInfo.neutralPrice), ethereum.Value.fromAddress(expectedInfo.head), ethereum.Value.fromAddress(expectedInfo.next), - ethereum.Value.fromAddress(expectedInfo.prev), - ethereum.Value.fromBoolean(expectedInfo.alreadyTaken) + ethereum.Value.fromAddress(expectedInfo.prev) ]) }