Skip to content

Commit

Permalink
initial support getting logs for single and batch transfers
Browse files Browse the repository at this point in the history
  • Loading branch information
lucasmenendez committed Sep 4, 2024
1 parent 7dc3fca commit 8314c8b
Show file tree
Hide file tree
Showing 9 changed files with 1,814 additions and 3 deletions.
4 changes: 2 additions & 2 deletions api/tokens.go
Original file line number Diff line number Diff line change
Expand Up @@ -250,7 +250,7 @@ func (capi *census3API) createToken(msg *api.APIdata, ctx *httprouter.HTTPContex
tokenType := providers.TokenTypeID(req.Type)
provider, err := capi.holderProviders.GetProvider(internalCtx, tokenType)
if err != nil {
return ErrCantCreateCensus.WithErr(fmt.Errorf("token type not supported: %w", err))
return ErrMalformedToken.WithErr(fmt.Errorf("token type not supported: %w", err))
}
if !provider.IsExternal() {
if err := provider.SetRef(web3.Web3ProviderRef{
Expand Down Expand Up @@ -285,7 +285,7 @@ func (capi *census3API) createToken(msg *api.APIdata, ctx *httprouter.HTTPContex
// init db transaction
tx, err := capi.db.RW.BeginTx(internalCtx, nil)
if err != nil {
return ErrCantCreateStrategy.WithErr(err)
return ErrCantCreateToken.WithErr(err)
}
defer func() {
if err := tx.Rollback(); err != nil && !errors.Is(err, sql.ErrTxDone) {
Expand Down
1 change: 1 addition & 0 deletions cmd/census3/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -163,6 +163,7 @@ func main() {
pm.AddProvider(new(web3provider.ERC20HolderProvider).Type(), web3ProviderConf)
pm.AddProvider(new(web3provider.ERC721HolderProvider).Type(), web3ProviderConf)
pm.AddProvider(new(web3provider.ERC777HolderProvider).Type(), web3ProviderConf)
pm.AddProvider(new(web3provider.ERC1155HolderProvider).Type(), web3ProviderConf)
// init POAP external provider
if config.poapAPIEndpoint != "" {
pm.AddProvider(new(poap.POAPHolderProvider).Type(), poap.POAPConfig{
Expand Down
2 changes: 1 addition & 1 deletion contracts/bindContract.sh
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ abi() {

abi './erc/erc20/ERC20.abi' ERC20Contract './erc/erc20/erc20.go'
abi './erc/erc721/ERC721.abi' ERC721Contract './erc/erc721/erc721.go'
# abi './erc/erc1155/ERC1155.abi' ERC1155Contract './erc/erc1155/erc1155.go'
abi './erc/erc1155/ERC1155.abi' ERC1155Contract './erc/erc1155/erc1155.go'
abi './erc/erc777/ERC777.abi' ERC777Contract './erc/erc777/erc777.go'

# abi './nation3/vestedToken/veNation.abi' Nation3VestedTokenContract './nation3/vestedToken/veNation.go'
Expand Down
340 changes: 340 additions & 0 deletions contracts/erc/erc1155/ERC1155.abi
Original file line number Diff line number Diff line change
@@ -0,0 +1,340 @@
[
{
"anonymous": false,
"inputs": [
{
"indexed": true,
"internalType": "address",
"name": "account",
"type": "address"
},
{
"indexed": true,
"internalType": "address",
"name": "operator",
"type": "address"
},
{
"indexed": false,
"internalType": "bool",
"name": "approved",
"type": "bool"
}
],
"name": "ApprovalForAll",
"type": "event"
},
{
"anonymous": false,
"inputs": [
{
"indexed": true,
"internalType": "address",
"name": "operator",
"type": "address"
},
{
"indexed": true,
"internalType": "address",
"name": "from",
"type": "address"
},
{
"indexed": true,
"internalType": "address",
"name": "to",
"type": "address"
},
{
"indexed": false,
"internalType": "uint256[]",
"name": "ids",
"type": "uint256[]"
},
{
"indexed": false,
"internalType": "uint256[]",
"name": "values",
"type": "uint256[]"
}
],
"name": "TransferBatch",
"type": "event"
},
{
"anonymous": false,
"inputs": [
{
"indexed": true,
"internalType": "address",
"name": "operator",
"type": "address"
},
{
"indexed": true,
"internalType": "address",
"name": "from",
"type": "address"
},
{
"indexed": true,
"internalType": "address",
"name": "to",
"type": "address"
},
{
"indexed": false,
"internalType": "uint256",
"name": "id",
"type": "uint256"
},
{
"indexed": false,
"internalType": "uint256",
"name": "value",
"type": "uint256"
}
],
"name": "TransferSingle",
"type": "event"
},
{
"anonymous": false,
"inputs": [
{
"indexed": false,
"internalType": "string",
"name": "value",
"type": "string"
},
{
"indexed": true,
"internalType": "uint256",
"name": "id",
"type": "uint256"
}
],
"name": "URI",
"type": "event"
},
{
"inputs": [
{
"internalType": "address",
"name": "account",
"type": "address"
},
{
"internalType": "uint256",
"name": "id",
"type": "uint256"
}
],
"name": "balanceOf",
"outputs": [
{
"internalType": "uint256",
"name": "",
"type": "uint256"
}
],
"stateMutability": "view",
"type": "function"
},
{
"inputs": [
{
"internalType": "address[]",
"name": "accounts",
"type": "address[]"
},
{
"internalType": "uint256[]",
"name": "ids",
"type": "uint256[]"
}
],
"name": "balanceOfBatch",
"outputs": [
{
"internalType": "uint256[]",
"name": "",
"type": "uint256[]"
}
],
"stateMutability": "view",
"type": "function"
},
{
"inputs": [
{
"internalType": "address",
"name": "account",
"type": "address"
},
{
"internalType": "address",
"name": "operator",
"type": "address"
}
],
"name": "isApprovedForAll",
"outputs": [
{
"internalType": "bool",
"name": "",
"type": "bool"
}
],
"stateMutability": "view",
"type": "function"
},
{
"inputs": [],
"name": "name",
"outputs": [
{
"internalType": "string",
"name": "",
"type": "string"
}
],
"stateMutability": "view",
"type": "function"
},
{
"inputs": [],
"name": "symbol",
"outputs": [
{
"internalType": "string",
"name": "",
"type": "string"
}
],
"stateMutability": "view",
"type": "function"
},
{
"inputs": [
{
"internalType": "address",
"name": "from",
"type": "address"
},
{
"internalType": "address",
"name": "to",
"type": "address"
},
{
"internalType": "uint256[]",
"name": "ids",
"type": "uint256[]"
},
{
"internalType": "uint256[]",
"name": "amounts",
"type": "uint256[]"
},
{
"internalType": "bytes",
"name": "data",
"type": "bytes"
}
],
"name": "safeBatchTransferFrom",
"outputs": [],
"stateMutability": "nonpayable",
"type": "function"
},
{
"inputs": [
{
"internalType": "address",
"name": "from",
"type": "address"
},
{
"internalType": "address",
"name": "to",
"type": "address"
},
{
"internalType": "uint256",
"name": "id",
"type": "uint256"
},
{
"internalType": "uint256",
"name": "amount",
"type": "uint256"
},
{
"internalType": "bytes",
"name": "data",
"type": "bytes"
}
],
"name": "safeTransferFrom",
"outputs": [],
"stateMutability": "nonpayable",
"type": "function"
},
{
"inputs": [
{
"internalType": "address",
"name": "operator",
"type": "address"
},
{
"internalType": "bool",
"name": "approved",
"type": "bool"
}
],
"name": "setApprovalForAll",
"outputs": [],
"stateMutability": "nonpayable",
"type": "function"
},
{
"inputs": [
{
"internalType": "bytes4",
"name": "interfaceId",
"type": "bytes4"
}
],
"name": "supportsInterface",
"outputs": [
{
"internalType": "bool",
"name": "",
"type": "bool"
}
],
"stateMutability": "view",
"type": "function"
},
{
"inputs": [
{
"internalType": "uint256",
"name": "id",
"type": "uint256"
}
],
"name": "uri",
"outputs": [
{
"internalType": "string",
"name": "",
"type": "string"
}
],
"stateMutability": "view",
"type": "function"
}
]
Loading

0 comments on commit 8314c8b

Please sign in to comment.