You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
This project requires developing a smart contract that distributes tokens to multiple addresses as part of an “interaction” that occurs off-chain.
In our case, there is a “sender” who is sending data to a “receiver”. In order for this to work, there are two decentralized applications; the “sender dApp” and the “receiver dApp”.
The sender “pays” for an interaction by using credits stored in the smart contract. The “receiver”, “receiver dApp” and “sender dApp” all receive a portion of the fees paid by the “sender”.
Methods
addFunds(did: string, numTokens: integer) — Add credit for a DID. A user adds VDA tokens to this smart contract for a given DID.
removeFunds(did: string, numTokens: integer, signature: string) — Remove credit from a DID. A user reduces their credits and receives VDA tokens from this smart contract to their address. Verify signature is generated by the DID signing a message (${did} authorizes removing credit of ${numCredits} at ${timestamp}) where ${timestamp} is within 30(?) seconds of the current time.
submitInteraction(interactionId: string, senderDid: string, receiverDid: string, sendingAppDid: string, receivingAppDid: string) — Submit an interaction which distributes credits (see split below).
hasInteraction(interactionId: string) — Read only method that verifies if a particular interaction has been registered
setExchangeRate(rate: decimal) — (owner only) Set the exchange rate of how many VDA tokens are required to pay for an interaction.
Requirements
Interaction distributions
An interaction can be submitted to the smart contract by a “sender”. The sender must also specify the receiving address, sender dApp, receiver dApp.
An interaction will decrease the number of credits owned by the “sender”, by one.
An interaction will credit ETH stored in the smart contract to other addresses involved in the interaction as follows:
Receiver (50%)
Sending dApp (20%)
Receiving dApp (20%)
Network (10%)
Note: For now the Network tokens will accrue in the smart contract. In the future, these will be distributed to a separate network staking contract and distributed to token holders who stake tokens.
Exchange rate
The exchange rate is designed to maintain a stable price of credits in USD. This is achieved by adjusting the exchange rate of how many VDA tokens purchase how many message interactions.
Deliverables
All code submitted to https://github.com/verida/blockchain-contracts/vda-message-interactions
A smart contract that meets the project requirements and provides (at least) the methods above.
Tests that verify the smart contract is working as expected
Deployment to Polygon Testnet
Basic documentation on how to setup, run the code and tests
The text was updated successfully, but these errors were encountered:
This project requires developing a smart contract that distributes tokens to multiple addresses as part of an “interaction” that occurs off-chain.
In our case, there is a “sender” who is sending data to a “receiver”. In order for this to work, there are two decentralized applications; the “sender dApp” and the “receiver dApp”.
The sender “pays” for an interaction by using credits stored in the smart contract. The “receiver”, “receiver dApp” and “sender dApp” all receive a portion of the fees paid by the “sender”.
Methods
addFunds(did: string, numTokens: integer)
— Add credit for a DID. A user adds VDA tokens to this smart contract for a given DID.removeFunds(did: string, numTokens: integer, signature: string)
— Remove credit from a DID. A user reduces their credits and receives VDA tokens from this smart contract to their address. Verifysignature
is generated by the DID signing a message (${did} authorizes removing credit of ${numCredits} at ${timestamp}
) where${timestamp}
is within 30(?) seconds of the current time.submitInteraction(interactionId: string, senderDid: string, receiverDid: string, sendingAppDid: string, receivingAppDid: string)
— Submit an interaction which distributes credits (see split below).hasInteraction(interactionId: string)
— Read only method that verifies if a particular interaction has been registeredsetExchangeRate(rate: decimal)
— (owner only) Set the exchange rate of how many VDA tokens are required to pay for an interaction.Requirements
Interaction distributions
An interaction can be submitted to the smart contract by a “sender”. The sender must also specify the receiving address, sender dApp, receiver dApp.
An interaction will decrease the number of credits owned by the “sender”, by one.
An interaction will credit ETH stored in the smart contract to other addresses involved in the interaction as follows:
Note: For now the
Network
tokens will accrue in the smart contract. In the future, these will be distributed to a separate network staking contract and distributed to token holders who stake tokens.Exchange rate
The exchange rate is designed to maintain a stable price of credits in USD. This is achieved by adjusting the exchange rate of how many VDA tokens purchase how many message interactions.
Deliverables
https://github.com/verida/blockchain-contracts/vda-message-interactions
The text was updated successfully, but these errors were encountered: