Merge pull request #320 from status-im/add_staking_contract

add staking pool contract
This commit is contained in:
Iuri Matias 2019-06-19 09:23:32 -04:00 committed by GitHub
commit 1f302ac2a5
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
8 changed files with 54 additions and 13 deletions

View File

@ -14,6 +14,7 @@ contract License is Ownable, ApproveAndCallFallBack {
uint256 public price;
ERC20Token token;
address burnAddress;
struct LicenseDetails {
uint price;
@ -31,9 +32,10 @@ contract License is Ownable, ApproveAndCallFallBack {
* @param _tokenAddress Address of token used to pay for licenses (SNT)
* @param _price Price of the licenses
*/
constructor(address _tokenAddress, uint256 _price) public {
constructor(address _tokenAddress, uint256 _price, address _burnAddress) public {
price = _price;
token = ERC20Token(_tokenAddress);
burnAddress = _burnAddress;
}
/**

View File

@ -75,7 +75,8 @@ module.exports = {
instanceOf: "License",
args: [
"$SNT",
LICENSE_PRICE
LICENSE_PRICE,
"$StakingPool"
]
},
"MetadataStore": {
@ -85,7 +86,8 @@ module.exports = {
instanceOf: "License",
args: [
"$SNT",
ARB_LICENSE_PRICE
ARB_LICENSE_PRICE,
"$StakingPool"
]
},
Escrow: {
@ -115,6 +117,12 @@ module.exports = {
true
]
},
"StakingPool": {
file: 'staking-pool/contracts/StakingPool.sol',
args: [
"$SNT"
]
},
"RLPReader": {
file: 'tabookey-gasless/contracts/RLPReader.sol'
},

View File

@ -85,6 +85,7 @@
"redux-persist": "^5.10.0",
"redux-saga": "^0.16.2",
"sass-loader": "^7.1.0",
"staking-pool": "^0.0.1",
"tabookey-gasless": "^0.3.3-a",
"web3": "1.0.0-beta.37"
},

View File

@ -58,11 +58,15 @@ config({
},
SellerLicense: {
instanceOf: "License",
args: ["$SNT", 10]
args: ["$SNT", 10, "$StakingPool"]
},
ArbitrationLicense: {
instanceOf: "License",
args: ["$SNT", 10]
args: ["$SNT", 10, "$StakingPool"]
},
StakingPool: {
file: 'staking-pool/contracts/StakingPool.sol',
args: ["$SNT"]
},
MetadataStore: {
args: ["$SellerLicense", "$ArbitrationLicense"]

View File

@ -40,14 +40,18 @@ config({
},
SellerLicense: {
instanceOf: "License",
args: ["$SNT", 10]
args: ["$SNT", 10, "$StakingPool"]
},
MetadataStore: {
args: ["$SellerLicense", "$ArbitrationLicense"]
},
ArbitrationLicense: {
instanceOf: "License",
args: ["$SNT", 10]
args: ["$SNT", 10, "$StakingPool"]
},
StakingPool: {
file: 'staking-pool/contracts/StakingPool.sol',
args: ["$SNT"]
},
Escrow: {
args: ["$SellerLicense", "$ArbitrationLicense", "$MetadataStore", "$SNT", "0x0000000000000000000000000000000000000001", feeAmount],

View File

@ -4,6 +4,7 @@ const TestUtils = require("../utils/testUtils");
const License = require('Embark/contracts/License');
const SNT = require('Embark/contracts/SNT');
const StakingPool = require('Embark/contracts/StakingPool');
let accounts;
@ -27,8 +28,12 @@ config({
]
},
License: {
args: ["$SNT", 10]
}
args: ["$SNT", 10, "$StakingPool"]
},
StakingPool: {
file: 'staking-pool/contracts/StakingPool.sol',
args: ["$SNT"]
},
}
}, (_err, web3_accounts) => {
accounts = web3_accounts;
@ -68,8 +73,8 @@ contract("License", function () {
isLicenseOwner = await License.methods.isLicenseOwner(accounts[0]).call();
assert.strictEqual(isLicenseOwner, true);
const contractBalance = await SNT.methods.balanceOf(License.options.address).call();
assert.strictEqual(contractBalance, "10", "Contract balance is incorrect");
const stakingBalance = await SNT.methods.balanceOf(StakingPool.options.address).call();
assert.strictEqual(stakingBalance, "10", "Contract balance is incorrect");
});
it("should buy license with approveAndCall", async () => {

View File

@ -31,11 +31,15 @@ config({
},
SellerLicense: {
instanceOf: "License",
args: ["$SNT", 10]
args: ["$SNT", 10, "$StakingPool"]
},
ArbitrationLicense: {
instanceOf: "License",
args: ["$SNT", 10]
args: ["$SNT", 10, "$StakingPool"]
},
StakingPool: {
file: 'staking-pool/contracts/StakingPool.sol',
args: ["$SNT"]
},
MetadataStore: {
args: ["$SellerLicense", "$ArbitrationLicense"]

View File

@ -12840,6 +12840,11 @@ onetime@^2.0.0:
dependencies:
mimic-fn "^1.0.0"
openzeppelin-solidity@^2.3.0:
version "2.3.0"
resolved "https://registry.yarnpkg.com/openzeppelin-solidity/-/openzeppelin-solidity-2.3.0.tgz#1ab7b4cc3782a5472ed61eb740c56a8bfdd74119"
integrity sha512-QYeiPLvB1oSbDt6lDQvvpx7k8ODczvE474hb2kLXZBPKMsxKT1WxTCHBYrCU7kS7hfAku4DcJ0jqOyL+jvjwQw==
opn@5.3.0:
version "5.3.0"
resolved "https://registry.yarnpkg.com/opn/-/opn-5.3.0.tgz#64871565c863875f052cfdf53d3e3cb5adb53b1c"
@ -16789,6 +16794,14 @@ stack-utils@^1.0.1:
resolved "https://registry.yarnpkg.com/stack-utils/-/stack-utils-1.0.2.tgz#33eba3897788558bebfc2db059dc158ec36cebb8"
integrity sha512-MTX+MeG5U994cazkjd/9KNAapsHnibjMLnfXodlkXw76JEea0UiNzrqidzo1emMwk7w5Qhc9jd4Bn9TBb1MFwA==
staking-pool@^0.0.1:
version "0.0.1"
resolved "https://registry.yarnpkg.com/staking-pool/-/staking-pool-0.0.1.tgz#1b2d53a232bc2d1385249252759844cef64c1b7d"
integrity sha512-Bom97X4qxL4704ojPFYpuRJNihPcUiEuWb8yIL8ZiUn80daTeFfkf+bFLTRDvKD9cMKicxAoXw5vUNilrpPIJw==
dependencies:
embark "^4.0.2"
openzeppelin-solidity "^2.3.0"
static-extend@^0.1.1:
version "0.1.2"
resolved "https://registry.yarnpkg.com/static-extend/-/static-extend-0.1.2.tgz#60809c39cbff55337226fd5e0b520f341f1fb5c6"