This repository powers the Aluna smart contract network.
AlunaToken implements the ERC-20 standard with added functionalty which allows the Token to receive payments on behalf of the Aluna Platform.
This extra functionality is implemented on PaymentProcess.
When receiving payments, the PaymentProcess will automatically forward part of the payment to the RewardsPool.
The RewardsPool will be responsible for holding all the ALN which will be used to reward users for their performance on the leaderboard, among other actions that are being implemented on Aluna Social.
The Aluna crowdsale contract will receive eth and give ALN tokens in exchange, it doesn't have a minimum goal but it has a maximum goal of ETH to be raised, the tokens will be distributed after the closingTime.
- Implements the ERC-20 standard
- Provides additional functionality to process payments using the PaymentProcessor contract
- Provices additional groupTransfer function
ZeppelinOS-based initializable ugradable ERC-20 token. Provides additional functionality to process payments using the PaymentProcessor contract.
- ZeppelinOS-based initializable ugradable contract
This method allows Aluna Org to set the percentage of tokens received as payment that will be forwarded to the Rewards Pool.
const web3 = new Web3()
// sets the Pool Percentage to 50%
const tokenContract = new web3.eth.Contract(tokenABI, tokenProxyAddress)
// sets 50% of payments to be forwarded to Rewards Pool
await tokenContract.methods.setRewardsPoolPercentage(50).send({ from: alunaOrg });
This method allows Aluna Org to set the address of the Rewards Pool.
const web3 = new Web3()
const tokenContract = new web3.eth.Contract(tokenABI, tokenProxyAddress)
// sets 50% of payments to be forwarded to Rewards Pool
await tokenContract.methods.setRewardsPoolAddress(rewardsPoolAddress).send({ from: alunaOrg });
This method allows Aluna Org to process a payment.
Part of the payment is automatically sent to the Rewards Pool.
const web3 = new Web3()
const tokenContract = new web3.eth.Contract(tokenABI, tokenProxyAddress)
await tokenContract.methods.processPayment(tokenAmount, paymentId).send();
This method allows Aluna Org to refund a total or partial payment.
const web3 = new Web3()
const tokenContract = new web3.eth.Contract(tokenABI, tokenProxyAddress)
await tokenContract.methods.refundPayment(sender, tokenAmount, paymentId).send();
- ZeppelinOS-based initializable ugradable contract
The Rewards Pool is responsible for keeping all the ALN intended to be used as rewards on the website.
This method allows anyone to deposit ALN Tokens in the RewardsPool.
In order to deposit tokens in the RewardsPool you need to first call approve
on the Token contract and then deposit
in the RewardsPool contract.
const web3 = new Web3()
const tokenContract = new web3.eth.Contract(tokenABI, tokenProxyAddress)
const rewardsContract = new web3.eth.Contract(tokenABI, rewardsProxyAddress)
await tokenContract.methods.approve(rewardsProxyAddress, 1000).send()
await rewardsContract.methods.deposit(100).send()
This method allows Aluna Org to send ALN Tokens to reward users.
const web3 = new Web3()
const rewardsContract = new web3.eth.Contract(tokenABI, rewardsProxyAddress)
await rewardsContract.methods.sendRewards([receiver1, receiver2], [50, 40]).send({ from: alunaOrg });
In order to know how much is currently in the Rewards Pool you can simply check its balance in the Token Contract.
const web3 = new Web3()
const tokenContract = new web3.eth.Contract(tokenABI, tokenProxyAddress)
const balance = await tokenContract.methods.balanceOf(rewardsProxyAddress).call()
ZeppelinOS-based initializable ugradable contract that receives the rewards cut of each payment. Provides withdrawal functionality to administrators.
node scripts/buildGroupTransfer.js "ADDRESS_1,ADDRESS_2" "VALUE_1,VALUE_2"
Node 10 is required for running the tests and contract compilation.
git clone https://github.com/levelkdev/aluna-smart-contracts
nvm install
npm install
npm test
We are using the upgradeability proxy from openzeppelin
and the deployment pipeline is using their system as well. You can read more
about the publishing process and
upgrading in openzeppelin
documentation.
In order to interact with "real" networks such as mainnet
, ropsten
or others,
you need to setup a keys.json
file used by truffle
that does the heavy lifting for openzeppelin.
{
"mnemonic": "<SEED_PHRASE>",
"infura_projectid": "<PROJECT_ID>"
}
Example command for AlunaToken and RewardsPool contract creation from upgradeable instances:
npx openzeppelin create AlunaToken --network ropsten --init initialize --args 25000000000000000000000000,0x0000000000000000000000000000000000000000,10,0x00bBe1f8F6F8032609F151B59ea20a686fbf44b5 --from 0xe3c7725F036B79781Cf8c5246ea7c1fa4AfC9827
npx openzeppelin create RewardsPool --network ropsten --init initialize --args 0x00bBe1f8F6F8032609F151B59ea20a686fbf44b5,0xA405B28c3B70F364a23d573CdF5032871dFcF1F7 --from 0xe3c7725F036B79781Cf8c5246ea7c1fa4AfC9827
What does upgradeability mean?
We can update the logic of ALN Token and RewardsPool contracts while keeping their public address the same and without touching any data.
Who is the proxy admin on mainnet? The proxies are administered by a multisignature wallet.
Who is the owner wt contracts deployed on mainnet? The Token and RewardsPool contract are owned by a multisignature wallet.