Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[SDK-CORE|SUBGRAPH] ERC20x peripherals #1312

Closed
wants to merge 117 commits into from
Closed
Show file tree
Hide file tree
Changes from 114 commits
Commits
Show all changes
117 commits
Select commit Hold shift + click to select a range
3c19e03
CFANFTBase COFNFT WIP
0xdavinchee Jan 24, 2023
918224a
NFT implementation WIP
0xdavinchee Jan 26, 2023
a091975
NFT contracts upgradability
0xdavinchee Jan 26, 2023
91aaf4c
minor cleanups
0xdavinchee Jan 26, 2023
f7c2fde
constant outflow nft tests
0xdavinchee Jan 26, 2023
fab9fd9
CIF NFT tests WIP
0xdavinchee Jan 27, 2023
e70ce4f
upgradability test wip
0xdavinchee Jan 30, 2023
0f6c33c
Upgradability tests
0xdavinchee Jan 30, 2023
f1bb95d
cfa nft integration
0xdavinchee Jan 30, 2023
cbd133d
fix tests w/ cfa integration
0xdavinchee Jan 31, 2023
1f440dc
rename flowDataBySenderReceiver
0xdavinchee Jan 31, 2023
5a5fa8e
cfa integration tests super happy path
0xdavinchee Jan 31, 2023
70a43c1
cleanup
0xdavinchee Jan 31, 2023
32195c9
comment review WIP
0xdavinchee Feb 1, 2023
82595af
fix build and cleanup
0xdavinchee Feb 2, 2023
6e33227
add getFlow to SuperToken
0xdavinchee Feb 2, 2023
c4ef6b3
split deployers
0xdavinchee Feb 3, 2023
d2f3ab3
Merge branch 'dev' into erc20x
0xdavinchee Feb 3, 2023
d1f4147
NFT proxy deployment
0xdavinchee Feb 3, 2023
2e0535d
SuperfluidNFTDeployer added
0xdavinchee Feb 3, 2023
02b2321
fix up automations tests
0xdavinchee Feb 3, 2023
b892e71
clean up ci.canary comment
0xdavinchee Feb 3, 2023
4775eac
fix breaking test
0xdavinchee Feb 4, 2023
bdffc65
fix up tsconfigs
0xdavinchee Feb 4, 2023
6d60372
fixes + cleanup
0xdavinchee Feb 6, 2023
301bbdb
fix the sdk-core build
0xdavinchee Feb 6, 2023
16d35df
should use same value
0xdavinchee Feb 6, 2023
ea8ba90
liquidations test WIP
0xdavinchee Feb 6, 2023
05d1059
cleanup
0xdavinchee Feb 6, 2023
6a491be
cleanup continued
0xdavinchee Feb 7, 2023
3f1f297
cleanup continued
0xdavinchee Feb 7, 2023
00cdd4c
cleanup continued
0xdavinchee Feb 7, 2023
48feff3
remove SuperfluidDevNFTDeployer
0xdavinchee Feb 7, 2023
5986d73
permission control mint/burn
0xdavinchee Feb 7, 2023
0e3a26b
add new updateLogicContracts
0xdavinchee Feb 7, 2023
c9c1148
add sanity check test
0xdavinchee Feb 7, 2023
50c8364
Merge branch 'supertokenfactory-new-update' into erc20x
0xdavinchee Feb 7, 2023
6ee1790
move creation to helpers
0xdavinchee Feb 7, 2023
c047556
migration test and gas test
0xdavinchee Feb 7, 2023
a1c28ae
forge install: forge-std
0xdavinchee Feb 8, 2023
64298ea
forge install: forge-std
0xdavinchee Feb 8, 2023
81e9041
SuperTokenFactory deploy test
0xdavinchee Feb 8, 2023
e9a2a29
fix framework test
0xdavinchee Feb 8, 2023
ab6d46e
forge install: forge-std
0xdavinchee Feb 8, 2023
2d34cf4
fix redundant naming
0xdavinchee Feb 8, 2023
b418259
Ops flow cleanup
0xdavinchee Feb 9, 2023
89face8
cleanup
0xdavinchee Feb 9, 2023
2e25904
Merge branch 'dev' into supertokenfactory-new-update
0xdavinchee Feb 9, 2023
ea138a0
Merge branch 'supertokenfactory-new-update' of github.com:superfluid-…
0xdavinchee Feb 9, 2023
82b87f2
fork baseline
0xdavinchee Feb 9, 2023
82d5353
fork baseline wip
0xdavinchee Feb 10, 2023
42876a5
Update CHANGELOG.md
0xdavinchee Feb 10, 2023
f723573
Initial cleanup after discussion
0xdavinchee Feb 10, 2023
8d1fffd
Merge branch 'supertokenfactory-new-update' into erc20x
0xdavinchee Feb 10, 2023
dc6c748
fix build
0xdavinchee Feb 10, 2023
85231c7
further cleanup
0xdavinchee Feb 10, 2023
4d31f9b
Merge branch 'dev' into supertokenfactory-new-update
0xdavinchee Feb 10, 2023
d88fe53
deprecate non upgradeable deploy
0xdavinchee Feb 10, 2023
8f31c5b
merge dev
0xdavinchee Feb 10, 2023
d066739
Merge branch 'supertokenfactory-new-update' into erc20x
0xdavinchee Feb 10, 2023
484ae13
fix broken build
0xdavinchee Feb 11, 2023
51399cf
bump solidity version
0xdavinchee Feb 11, 2023
352afac
deploy nft in SuperToken
0xdavinchee Feb 11, 2023
90e9dc5
refactor and skip tests in CI
0xdavinchee Feb 11, 2023
aab2b43
fix build and cleanup
0xdavinchee Feb 11, 2023
3355ce4
do existence check
0xdavinchee Feb 13, 2023
8709b9b
Merge branch 'dev' into erc20x
0xdavinchee Feb 13, 2023
012b0fd
additional fixes for merge
0xdavinchee Feb 13, 2023
2cb48b9
SuperToken NFT deployAndSet
0xdavinchee Feb 13, 2023
d9c3cbd
Merge branch 'dev' into erc20x
0xdavinchee Feb 14, 2023
abda29a
remove only test in truffle param
0xdavinchee Feb 14, 2023
17cb49e
cleanup
0xdavinchee Feb 14, 2023
23bb5f1
fix erc20x fuzz test
0xdavinchee Feb 27, 2023
21ceda8
cleanup
0xdavinchee Feb 28, 2023
642d576
fix codeChanged issue
0xdavinchee Feb 28, 2023
7144dd2
Merge branch 'dev' into erc20x
0xdavinchee Mar 1, 2023
b4cbf80
fix bad merge
0xdavinchee Mar 1, 2023
b715bb9
Review comments addressed
0xdavinchee Mar 2, 2023
8564650
remove mapping variable names
0xdavinchee Mar 2, 2023
72bd78a
bump solc to 0.8.19
0xdavinchee Mar 2, 2023
4947b45
fix liquidations test
0xdavinchee Mar 2, 2023
e9d5287
undo bump 0.8.19
0xdavinchee Mar 3, 2023
1ced668
don't import ethers from hardhat
0xdavinchee Mar 3, 2023
b58392c
cleanup
0xdavinchee Mar 3, 2023
39718f9
Merge branch 'dev' into erc20x
0xdavinchee Mar 7, 2023
79085ea
Merge branch 'dev' into erc20x
0xdavinchee Mar 8, 2023
62ba121
Merge branch 'dev' into erc20x
0xdavinchee Mar 8, 2023
dd3c98e
clean up interfaces
0xdavinchee Mar 9, 2023
f5ce61e
add nft's to SDK-Core
0xdavinchee Mar 9, 2023
a446f87
subgraph nft's WIP
0xdavinchee Mar 9, 2023
3767927
unbrick tests
0xdavinchee Mar 9, 2023
37b4ef9
fix build and clean up interfaces
0xdavinchee Mar 10, 2023
a98e0cc
Merge branch 'dev' into erc20x-periphery
0xdavinchee Apr 5, 2023
f657c1a
Merge branch 'dev' into erc20x-periphery
0xdavinchee Apr 12, 2023
9658afa
Merge branch 'dev' into erc20x-periphery
0xdavinchee Apr 20, 2023
85dade6
Merge branch 'dev' into erc20x-periphery
0xdavinchee May 18, 2023
fb2a695
Merge branch 'dev' into erc20x-periphery
0xdavinchee May 29, 2023
7c332cf
sdk-core/subgraph nft changes
0xdavinchee May 29, 2023
ef91c91
Merge branch 'dev' into erc20x-periphery
0xdavinchee Jun 6, 2023
baffe06
Merge branch 'dev' into erc20x-periphery
0xdavinchee Jun 13, 2023
01e6f8f
Merge branch 'dev' into erc20x-periphery
0xdavinchee Jun 27, 2023
d4f901f
Merge branch 'dev' into erc20x-periphery
0xdavinchee Aug 23, 2023
9a95cb6
Merge branch 'dev' into erc20x-periphery
0xdavinchee Sep 21, 2023
bc7dd9f
add nft addresses to config
0xdavinchee Sep 21, 2023
6315f98
fix typechain imports
0xdavinchee Sep 21, 2023
f0f675f
Merge branch 'dev' into erc20x-periphery
0xdavinchee Sep 26, 2023
1655e8b
fix build
0xdavinchee Sep 26, 2023
85d431a
add outflow/inflow address to config
0xdavinchee Sep 26, 2023
5c39250
add nft tests
0xdavinchee Sep 26, 2023
a4b4b63
fix tests
0xdavinchee Sep 26, 2023
9424bea
Merge branch 'dev' into erc20x-periphery
0xdavinchee Sep 26, 2023
0f078db
bring up coverage
0xdavinchee Sep 26, 2023
35a5efd
fix sdk tests
0xdavinchee Sep 27, 2023
8826b73
Merge branch 'dev' into erc20x-periphery
0xdavinchee Sep 27, 2023
8eef83c
fixes
0xdavinchee Sep 27, 2023
f0e450a
Merge branch 'erc20x-periphery' of github.com:superfluid-finance/prot…
0xdavinchee Sep 27, 2023
8f51465
silly typo
0xdavinchee Sep 27, 2023
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 0 additions & 2 deletions packages/ethereum-contracts/contracts/mocks/CFAv1NFTMock.sol
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,6 @@ contract ConstantOutflowNFTMock is ConstantOutflowNFT {
function mockOwnerOf(uint256 _tokenId) public view returns (address) {
return _ownerOf(_tokenId);
}

/// @dev This exposes the _tokenApprovals storage without the requireMinted call
function mockGetApproved(uint256 _tokenId) public view returns (address) {
return _tokenApprovals[_tokenId];
Expand Down Expand Up @@ -70,7 +69,6 @@ contract ConstantInflowNFTMock is ConstantInflowNFT {
) public view returns (FlowNFTData memory flowData) {
return flowDataByTokenId(_tokenId);
}

/// @dev This exposes the _tokenApprovals storage without the requireMinted call
function mockGetApproved(uint256 _tokenId) public view returns (address) {
return _tokenApprovals[_tokenId];
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -423,7 +423,6 @@ abstract contract FlowNFTBase is UUPSProxiable, IFlowNFTBase {
) internal virtual {
_transfer(from, to, tokenId);
}

/// @dev Deletes the tokenApprovals for `tokenId`
/// @param tokenId the token id whose approvals we're clearing
function _burn(uint256 tokenId) internal virtual {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,10 +1,28 @@
const fs = require("fs");
const {ethers} = require("hardhat");
const superTokenFactoryArtifact = require("@superfluid-finance/ethereum-contracts/build/hardhat/contracts/superfluid/SuperTokenFactory.sol/SuperTokenFactory.json");
const superTokenArtifact = require("@superfluid-finance/ethereum-contracts/build/hardhat/contracts/superfluid/SuperToken.sol/SuperToken.json");
const {deployContractsAndToken} = require("./deploy-contracts-and-token");

deployContractsAndToken()
.then(async ({deployer, tokenDeploymentOutput}) => {
const frameworkAddresses = await deployer.getFramework();
hellwolf marked this conversation as resolved.
Show resolved Hide resolved

const superTokenFactory = await ethers.getContractAt(
superTokenFactoryArtifact.abi,
frameworkAddresses.superTokenFactory
);
const superTokenLogicAddress =
await superTokenFactory.getSuperTokenLogic();
const superTokenLogic = await ethers.getContractAt(
superTokenArtifact.abi,
superTokenLogicAddress
);
const constantOutflowNFTAddress =
await superTokenLogic.CONSTANT_OUTFLOW_NFT();
const constantInflowNFTAddress =
await superTokenLogic.CONSTANT_INFLOW_NFT();

const deploymentOutput = {
network: "mainnet",
testNetwork: "hardhat",
Expand All @@ -17,6 +35,8 @@ deployContractsAndToken()
nativeAssetSuperTokenAddress:
tokenDeploymentOutput.nativeAssetSuperTokenData
.nativeAssetSuperTokenAddress,
constantOutflowNFTAddress,
constantInflowNFTAddress,
};

// create json output
Expand Down
3 changes: 3 additions & 0 deletions packages/sdk-core/CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,9 @@ This project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.htm

## [Unreleased]

### Added
- Support for `ConstantOutflowNFT` and `ConstantInflowNFT` functions

## [0.6.9] - 2023-09-11

### Added
Expand Down
18 changes: 18 additions & 0 deletions packages/sdk-core/src/ConstantInflowNFT.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
import { ethers } from "ethers";

import FlowNFTBase from "./FlowNFTBase";
import {
ConstantInflowNFT__factory,
IConstantInflowNFT,
} from "./typechain-types";

export default class ConstantInflowNFT extends FlowNFTBase {
override readonly contract: IConstantInflowNFT;
constructor(address: string) {
super(address);
this.contract = new ethers.Contract(
address,
ConstantInflowNFT__factory.abi
) as IConstantInflowNFT;
}
}
18 changes: 18 additions & 0 deletions packages/sdk-core/src/ConstantOutflowNFT.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
import { ethers } from "ethers";

import FlowNFTBase from "./FlowNFTBase";
import {
ConstantOutflowNFT__factory,
IConstantOutflowNFT,
} from "./typechain-types";

export default class ConstantOutflowNFT extends FlowNFTBase {
override readonly contract: IConstantOutflowNFT;
constructor(address: string) {
super(address);
this.contract = new ethers.Contract(
address,
ConstantOutflowNFT__factory.abi
) as IConstantOutflowNFT;
}
}
25 changes: 12 additions & 13 deletions packages/sdk-core/src/ERC20Token.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,13 @@ import { ethers } from "ethers";

import Operation from "./Operation";
import { SFError } from "./SFError";
import { IBaseSuperTokenParams, ITransferFromParams } from "./interfaces";
import {
ERC20AllowanceParams,
ERC20BalanceOfParams,
IBaseSuperTokenParams,
ITransferFromParams,
ProviderOrSigner,
} from "./interfaces";
import { IERC20Metadata, IERC20Metadata__factory } from "./typechain-types";
import { normalizeAddress } from "./utils";

Expand Down Expand Up @@ -32,11 +38,7 @@ export default class ERC20Token {
owner,
spender,
providerOrSigner,
}: {
owner: string;
spender: string;
providerOrSigner: ethers.providers.Provider | ethers.Signer;
}): Promise<string> => {
}: ERC20AllowanceParams): Promise<string> => {
const normalizedOwner = normalizeAddress(owner);
const normalizedSpender = normalizeAddress(spender);
try {
Expand All @@ -62,10 +64,7 @@ export default class ERC20Token {
balanceOf = async ({
account,
providerOrSigner,
}: {
account: string;
providerOrSigner: ethers.providers.Provider | ethers.Signer;
}): Promise<string> => {
}: ERC20BalanceOfParams): Promise<string> => {
try {
const normalizedAccount = normalizeAddress(account);
const balanceOf = await this.contract
Expand All @@ -89,7 +88,7 @@ export default class ERC20Token {
name = async ({
providerOrSigner,
}: {
providerOrSigner: ethers.providers.Provider | ethers.Signer;
providerOrSigner: ProviderOrSigner;
}): Promise<string> => {
try {
const name = await this.contract.connect(providerOrSigner).name();
Expand All @@ -111,7 +110,7 @@ export default class ERC20Token {
symbol = async ({
providerOrSigner,
}: {
providerOrSigner: ethers.providers.Provider | ethers.Signer;
providerOrSigner: ProviderOrSigner;
}): Promise<string> => {
try {
const symbol = await this.contract
Expand All @@ -135,7 +134,7 @@ export default class ERC20Token {
totalSupply = async ({
providerOrSigner,
}: {
providerOrSigner: ethers.providers.Provider | ethers.Signer;
providerOrSigner: ProviderOrSigner;
}): Promise<string> => {
try {
const totalSupply = await this.contract
Expand Down
Loading
Loading