mirror of
https://github.com/status-im/contract-notifier.git
synced 2025-02-20 15:08:15 +00:00
fix: email config
This commit is contained in:
parent
036d597c97
commit
3bbf374064
@ -1,3 +1,5 @@
|
||||
const { addressCompare } = require("../../watcher/utils");
|
||||
|
||||
const ERC20_ABI = [
|
||||
{
|
||||
constant: true,
|
||||
@ -23,6 +25,71 @@ const ERC20_ABI = [
|
||||
}
|
||||
];
|
||||
|
||||
const ESCROW_ABI = [
|
||||
{
|
||||
constant: true,
|
||||
inputs: [{ name: "", type: "uint256" }],
|
||||
name: "transactions",
|
||||
outputs: [
|
||||
{ name: "offerId", type: "uint256" },
|
||||
{ name: "token", type: "address" },
|
||||
{ name: "tokenAmount", type: "uint256" },
|
||||
{ name: "expirationTime", type: "uint256" },
|
||||
{ name: "sellerRating", type: "uint256" },
|
||||
{ name: "buyerRating", type: "uint256" },
|
||||
{ name: "fiatAmount", type: "uint256" },
|
||||
{ name: "buyer", type: "address" },
|
||||
{ name: "seller", type: "address" },
|
||||
{ name: "arbitrator", type: "address" },
|
||||
{ name: "destination", type: "address" },
|
||||
{ name: "status", type: "uint8" }
|
||||
],
|
||||
payable: false,
|
||||
stateMutability: "view",
|
||||
type: "function",
|
||||
signature: "0x9ace38c2"
|
||||
}
|
||||
];
|
||||
|
||||
const USERSTORE_ABI = [
|
||||
{
|
||||
constant: true,
|
||||
inputs: [{ name: "", type: "address" }],
|
||||
name: "users",
|
||||
outputs: [
|
||||
{ name: "contactData", type: "string" },
|
||||
{ name: "location", type: "string" },
|
||||
{ name: "username", type: "string" }
|
||||
],
|
||||
payable: false,
|
||||
stateMutability: "view",
|
||||
type: "function",
|
||||
signature: "0xa87430ba"
|
||||
}
|
||||
];
|
||||
|
||||
const ArbitratorLicenseProxy = "0x2724E1d8Ee34477956359B936d594e7FcF749900";
|
||||
const UserStoreProxy = "0x0c4FEf12407A763936827E52cFa06c495Bf24FBe";
|
||||
const EscrowProxy = "0x3305A8797F34D5d92093c8Ea55686314141cC4F2";
|
||||
|
||||
const getArbitratorName = async (web3, returnValues) => {
|
||||
const UserStore = new web3.eth.Contract(USERSTORE_ABI, UserStoreProxy);
|
||||
let arbitratorName = returnValues.arbitrator;
|
||||
try {
|
||||
const userData = await UserStore.methods.users(returnValues.arbitrator).call();
|
||||
arbitratorName = userData.username;
|
||||
} catch (e) {
|
||||
console.log(e);
|
||||
}
|
||||
return { arbitratorName };
|
||||
};
|
||||
|
||||
const isParticipant = participant => async (web3, returnValues, userAddress) => {
|
||||
const EscrowContract = new web3.eth.Contract(ESCROW_ABI, EscrowProxy);
|
||||
const escrow = await EscrowContract.methods.transactions(returnValues.escrowId).call();
|
||||
return addressCompare(escrow[participant], userAddress);
|
||||
};
|
||||
|
||||
module.exports = {
|
||||
from: {
|
||||
email: "noreply@teller.exchange",
|
||||
@ -34,7 +101,7 @@ module.exports = {
|
||||
url: "https://status-im.github.io/status-teller-network/build"
|
||||
},
|
||||
contracts: {
|
||||
"0x23a6F0bdBd6b5e6DBe5768F3aA68DDC3acF610d8": {
|
||||
[EscrowProxy]: {
|
||||
"escrow-creation": {
|
||||
ABI: {
|
||||
name: "Created",
|
||||
@ -48,15 +115,6 @@ module.exports = {
|
||||
},
|
||||
index: "seller",
|
||||
template: "escrow-creation.md"
|
||||
/*,
|
||||
data: async (web3, returnValues) => {
|
||||
// Example obtaining contract data
|
||||
const SNT = new web3.eth.Contract(ERC20_ABI, "0x3C36db79598e7902b5D726af7C7d406d5Da8aF14");
|
||||
return {
|
||||
tokenName: await SNT.methods.name().call(),
|
||||
balance: await SNT.methods.balanceOf(returnValues.seller).call()
|
||||
};
|
||||
}*/
|
||||
},
|
||||
"escrow-funded": {
|
||||
ABI: {
|
||||
@ -92,15 +150,14 @@ module.exports = {
|
||||
{ indexed: true, name: "escrowId", type: "uint256" },
|
||||
{ indexed: true, name: "seller", type: "address" },
|
||||
{ indexed: true, name: "buyer", type: "address" },
|
||||
{ indexed: false, name: "isDispute", type: "bool" },
|
||||
{ indexed: false, name: "isDispute", type: "bool" }
|
||||
]
|
||||
},
|
||||
index: "buyer",
|
||||
filter: async (web3, returnValues) => !returnValues.isDispute,
|
||||
template: "escrow-released.md"
|
||||
},
|
||||
"dispute-release-buyer": {
|
||||
// Dispute won by the buyer
|
||||
"dispute-won-buyer": {
|
||||
ABI: {
|
||||
name: "Released",
|
||||
type: "event",
|
||||
@ -108,12 +165,166 @@ module.exports = {
|
||||
{ indexed: true, name: "escrowId", type: "uint256" },
|
||||
{ indexed: true, name: "seller", type: "address" },
|
||||
{ indexed: true, name: "buyer", type: "address" },
|
||||
{ indexed: false, name: "isDispute", type: "bool" },
|
||||
{ indexed: false, name: "isDispute", type: "bool" }
|
||||
]
|
||||
},
|
||||
index: "buyer", // (web3, returnValues, currentUser) => return true; If we want to use an indexer based on functions
|
||||
index: "buyer",
|
||||
filter: async (web3, returnValues) => returnValues.isDispute,
|
||||
template: "dispute-release-buyer.md"
|
||||
template: "dispute-won-buyer.md"
|
||||
},
|
||||
"dispute-won-seller": {
|
||||
ABI: {
|
||||
name: "Canceled",
|
||||
type: "event",
|
||||
inputs: [
|
||||
{ indexed: true, name: "escrowId", type: "uint256" },
|
||||
{ indexed: true, name: "seller", type: "address" },
|
||||
{ indexed: true, name: "buyer", type: "address" },
|
||||
{ indexed: false, name: "isDispute", type: "bool" }
|
||||
]
|
||||
},
|
||||
index: "seller",
|
||||
filter: async (web3, returnValues) => returnValues.isDispute,
|
||||
template: "dispute-won-seller.md"
|
||||
},
|
||||
"dispute-lost-buyer": {
|
||||
ABI: {
|
||||
name: "Canceled",
|
||||
type: "event",
|
||||
inputs: [
|
||||
{ indexed: true, name: "escrowId", type: "uint256" },
|
||||
{ indexed: true, name: "seller", type: "address" },
|
||||
{ indexed: true, name: "buyer", type: "address" },
|
||||
{ indexed: false, name: "isDispute", type: "bool" }
|
||||
]
|
||||
},
|
||||
index: "buyer",
|
||||
filter: async (web3, returnValues) => returnValues.isDispute,
|
||||
template: "dispute-lost-buyer.md"
|
||||
},
|
||||
"dispute-lost-seller": {
|
||||
ABI: {
|
||||
name: "Released",
|
||||
type: "event",
|
||||
inputs: [
|
||||
{ indexed: true, name: "escrowId", type: "uint256" },
|
||||
{ indexed: true, name: "seller", type: "address" },
|
||||
{ indexed: true, name: "buyer", type: "address" },
|
||||
{ indexed: false, name: "isDispute", type: "bool" }
|
||||
]
|
||||
},
|
||||
index: "seller",
|
||||
filter: async (web3, returnValues) => returnValues.isDispute,
|
||||
template: "dispute-lost-seller.md"
|
||||
},
|
||||
"escrow-canceled-buyer": {
|
||||
ABI: {
|
||||
name: "Canceled",
|
||||
type: "event",
|
||||
inputs: [
|
||||
{ indexed: true, name: "escrowId", type: "uint256" },
|
||||
{ indexed: true, name: "seller", type: "address" },
|
||||
{ indexed: true, name: "buyer", type: "address" },
|
||||
{ indexed: false, name: "isDispute", type: "bool" }
|
||||
]
|
||||
},
|
||||
index: "buyer",
|
||||
filter: async (web3, returnValues) => !returnValues.isDispute,
|
||||
template: "escrow-canceled-buyer.md"
|
||||
},
|
||||
"escrow-canceled-seller": {
|
||||
ABI: {
|
||||
name: "Canceled",
|
||||
type: "event",
|
||||
inputs: [
|
||||
{ indexed: true, name: "escrowId", type: "uint256" },
|
||||
{ indexed: true, name: "seller", type: "address" },
|
||||
{ indexed: true, name: "buyer", type: "address" },
|
||||
{ indexed: false, name: "isDispute", type: "bool" }
|
||||
]
|
||||
},
|
||||
index: "seller",
|
||||
filter: async (web3, returnValues) => !returnValues.isDispute,
|
||||
template: "escrow-canceled-seller.md"
|
||||
},
|
||||
"dispute-open-buyer": {
|
||||
ABI: {
|
||||
name: "ArbitrationRequired",
|
||||
type: "event",
|
||||
inputs: [
|
||||
{ indexed: false, name: "escrowId", type: "uint256" },
|
||||
{ indexed: false, name: "timeout", type: "uint256" }
|
||||
]
|
||||
},
|
||||
index: isParticipant("buyer"),
|
||||
template: "dispute-open-buyer.md"
|
||||
},
|
||||
"dispute-open-seller": {
|
||||
ABI: {
|
||||
name: "ArbitrationRequired",
|
||||
type: "event",
|
||||
inputs: [
|
||||
{ indexed: false, name: "escrowId", type: "uint256" },
|
||||
{ indexed: false, name: "timeout", type: "uint256" }
|
||||
]
|
||||
},
|
||||
index: isParticipant("seller"),
|
||||
template: "dispute-open-seller.md"
|
||||
},
|
||||
"dispute-open-arbitrator": {
|
||||
ABI: {
|
||||
name: "ArbitrationRequired",
|
||||
type: "event",
|
||||
inputs: [
|
||||
{ indexed: false, name: "escrowId", type: "uint256" },
|
||||
{ indexed: false, name: "timeout", type: "uint256" }
|
||||
]
|
||||
},
|
||||
index: isParticipant("arbitrator"),
|
||||
template: "dispute-open-arbitrator.md"
|
||||
}
|
||||
},
|
||||
[ArbitratorLicenseProxy]: {
|
||||
"request-arbitrator": {
|
||||
ABI: {
|
||||
name: "ArbitratorRequested",
|
||||
type: "event",
|
||||
inputs: [
|
||||
{ indexed: false, name: "id", type: "bytes32" },
|
||||
{ indexed: true, name: "seller", type: "address" },
|
||||
{ indexed: true, name: "arbitrator", type: "address" }
|
||||
]
|
||||
},
|
||||
index: "arbitrator",
|
||||
template: "request-arbitrator.md"
|
||||
},
|
||||
"seller-approved": {
|
||||
ABI: {
|
||||
name: "RequestAccepted",
|
||||
type: "event",
|
||||
inputs: [
|
||||
{ indexed: false, name: "id", type: "bytes32" },
|
||||
{ indexed: true, name: "arbitrator", type: "address" },
|
||||
{ indexed: true, name: "seller", type: "address" }
|
||||
]
|
||||
},
|
||||
index: "seller",
|
||||
template: "seller-approved.md",
|
||||
data: getArbitratorName
|
||||
},
|
||||
"seller-denied": {
|
||||
ABI: {
|
||||
name: "RequestRejected",
|
||||
type: "event",
|
||||
inputs: [
|
||||
{ indexed: false, name: "id", type: "bytes32" },
|
||||
{ indexed: true, name: "arbitrator", type: "address" },
|
||||
{ indexed: true, name: "seller", type: "address" }
|
||||
]
|
||||
},
|
||||
index: "seller",
|
||||
template: "seller-denied.md",
|
||||
data: getArbitratorName
|
||||
}
|
||||
}
|
||||
}
|
||||
|
7
dapps/teller-network/dispute-lost-buyer.md
Normal file
7
dapps/teller-network/dispute-lost-buyer.md
Normal file
@ -0,0 +1,7 @@
|
||||
---
|
||||
subject: You lost the dispute...
|
||||
---
|
||||
Unfortunately, the arbitrator concluded that you haven't sent the money to the seller.
|
||||
Therefore, he ruled in you opponent's favor and returned crypto to the seller.
|
||||
The arbitrator's decision can't be changed.
|
||||
[See the escrow]({{url}}/#/escrow/{{escrowId}})
|
7
dapps/teller-network/dispute-lost-seller.md
Normal file
7
dapps/teller-network/dispute-lost-seller.md
Normal file
@ -0,0 +1,7 @@
|
||||
---
|
||||
subject: You lost the dispute...
|
||||
---
|
||||
Unfortunately, the arbitrator concluded that you have received the money from the buyer.
|
||||
Therefore, he ruled in you opponent's favor and credited crypto to the buyer.
|
||||
The arbitrator's decision can't be changed.
|
||||
[See the trade]({{url}}/#/escrow/{{escrowId}})
|
6
dapps/teller-network/dispute-open-arbitrator.md
Normal file
6
dapps/teller-network/dispute-open-arbitrator.md
Normal file
@ -0,0 +1,6 @@
|
||||
---
|
||||
subject: The dispute has been opened
|
||||
---
|
||||
One of the actors of the trade opened a dispute.
|
||||
Get in touch with both, find out where was the problem and make a decision
|
||||
[See the dispute]({{url}}/#/arbitration/{{escrowId}})
|
6
dapps/teller-network/dispute-open-buyer.md
Normal file
6
dapps/teller-network/dispute-open-buyer.md
Normal file
@ -0,0 +1,6 @@
|
||||
---
|
||||
subject: Dispute opened
|
||||
---
|
||||
The seller opened a dispute with you.
|
||||
Please. reach out to the arbitrator dedicated to this trade and explain what happened.
|
||||
[See the trade]({{url}}/#/escrow/{{escrowId}})
|
6
dapps/teller-network/dispute-open-seller.md
Normal file
6
dapps/teller-network/dispute-open-seller.md
Normal file
@ -0,0 +1,6 @@
|
||||
---
|
||||
subject: Dispute opened
|
||||
---
|
||||
The buyer opened a dispute with you.
|
||||
Please. reach out to the arbitrator dedicated to this trade and explain what happened.
|
||||
[See the trade]({{url}}/#/escrow/{{escrowId}})
|
@ -1,5 +0,0 @@
|
||||
---
|
||||
subject: Dispute result - win
|
||||
---
|
||||
You won the dispute.
|
||||
Funds have been released
|
7
dapps/teller-network/dispute-won-buyer.md
Normal file
7
dapps/teller-network/dispute-won-buyer.md
Normal file
@ -0,0 +1,7 @@
|
||||
---
|
||||
subject: You won the dispute!
|
||||
---
|
||||
Congratulations, you have just won the dispute.
|
||||
The trade is now completed.
|
||||
Enjoy your crypto.
|
||||
[See the trade]({{url}}/#/escrow/{{escrowId}})
|
6
dapps/teller-network/dispute-won-seller.md
Normal file
6
dapps/teller-network/dispute-won-seller.md
Normal file
@ -0,0 +1,6 @@
|
||||
---
|
||||
subject: You won the dispute!
|
||||
---
|
||||
Congratulations you have just won the dispute.
|
||||
Your crypto has been returned to your wallet.
|
||||
[See the trade]({{url}}/#/escrow/{{escrowId}})
|
5
dapps/teller-network/escrow-canceled-buyer.md
Normal file
5
dapps/teller-network/escrow-canceled-buyer.md
Normal file
@ -0,0 +1,5 @@
|
||||
---
|
||||
subject: The trade has been cancelled.
|
||||
---
|
||||
The trade has been cancelled
|
||||
[See the trade]({{url}}/#/escrow/{{escrowId}})
|
5
dapps/teller-network/escrow-canceled-seller.md
Normal file
5
dapps/teller-network/escrow-canceled-seller.md
Normal file
@ -0,0 +1,5 @@
|
||||
---
|
||||
subject: The trade has been cancelled.
|
||||
---
|
||||
The trade has been cancelled
|
||||
[See the trade]({{url}}/#/escrow/{{escrowId}})
|
@ -1,4 +1,4 @@
|
||||
---
|
||||
subject: Money is on its way to you
|
||||
---
|
||||
Buyer stated that money has been sent. Verify if you have received the payment and release funds from the [escrow]({{url}}/#/escrow/{{escrowId}}. Note that money might still be on its way, but don't hesitate to contact the buyer for further info about the payment.
|
||||
Buyer stated that money has been sent. Verify if you have received the payment and release funds from the [escrow]({{url}}/#/escrow/{{escrowId}}). Note that money might still be on its way, but don't hesitate to contact the buyer for further info about the payment.
|
||||
|
5
dapps/teller-network/request-arbitrator.md
Normal file
5
dapps/teller-network/request-arbitrator.md
Normal file
@ -0,0 +1,5 @@
|
||||
---
|
||||
subject: New request to become the seller's arbitrator
|
||||
---
|
||||
You have a new request to become the seller's arbitrator.
|
||||
[See the request]({{url}}/#/sellers)
|
6
dapps/teller-network/seller-approved.md
Normal file
6
dapps/teller-network/seller-approved.md
Normal file
@ -0,0 +1,6 @@
|
||||
---
|
||||
subject: You have been approved by the arbitrator
|
||||
---
|
||||
The arbitrator "{{arbitratorName}}" has approved you as a seller.
|
||||
You can now choose him as the arbitrator for your offers.
|
||||
[Create an offer]({{url}}/#/sell)
|
6
dapps/teller-network/seller-denied.md
Normal file
6
dapps/teller-network/seller-denied.md
Normal file
@ -0,0 +1,6 @@
|
||||
---
|
||||
subject: You have been denied by the arbitrator
|
||||
---
|
||||
The arbitrator "{{arbitratorName}}" has denied you as a seller.
|
||||
Please choose from other arbitrators
|
||||
[See all arbitrators]({{url}}/#/profile/arbitrators)
|
@ -39,7 +39,7 @@ events.on("web3:event", ({ dappId, address, event, returnValues }) => {
|
||||
dappConfig.eventConfig(dappId, address, event).forEach(async eventConfig => {
|
||||
const users = await Subscribers.findVerifiedUsersByDapp(dappId);
|
||||
users.forEach(async user => {
|
||||
if ((typeof eventConfig.index === "function" && eventConfig.index(eth.web3, returnValues, user.address)) || addressCompare(returnValues[eventConfig.index], user.address)) {
|
||||
if ((typeof eventConfig.index === "function" && (await eventConfig.index(eth.web3, returnValues, user.address))) || addressCompare(returnValues[eventConfig.index], user.address)) {
|
||||
|
||||
if(eventConfig.filter){
|
||||
const isValid = await eventConfig.filter(eth.web3, returnValues);
|
||||
@ -53,9 +53,9 @@ events.on("web3:event", ({ dappId, address, event, returnValues }) => {
|
||||
...returnValues
|
||||
});
|
||||
|
||||
if (eventConfig.template.data) {
|
||||
if (eventConfig.data) {
|
||||
try {
|
||||
data = Object.assign(data, await eventConfig.template.data(eth.web3, returnValues));
|
||||
data = Object.assign(data, await eventConfig.data(eth.web3, returnValues));
|
||||
} catch (err) {
|
||||
logger.log("error", "Error using data function: ", err);
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user