Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Kosujs/payable functions #179

Merged
merged 4 commits into from Jul 24, 2019
Merged
Changes from 1 commit
Commits
File filter...
Filter file types
Jump to…
Jump to file or symbol
Failed to load files and symbols.

Always

Just for now

Running prettier.

  • Loading branch information
Freydal committed Jul 23, 2019
commit baed8a3f90b1888ffe20ec1523b640fccea49deb
@@ -211,6 +211,8 @@ export class KosuToken {
*/
public async pay(value: BigNumber): Promise<TransactionReceiptWithDecodedLogs> {
const contract = await this.getContract();
return this.web3Wrapper.sendTransactionAsync({ from: await this.web3.eth.getCoinbase(), to: contract.address, value, gas: 70000 }).then(async txHash => this.web3Wrapper.awaitTransactionSuccessAsync(txHash));
return this.web3Wrapper
.sendTransactionAsync({ from: await this.web3.eth.getCoinbase(), to: contract.address, value, gas: 70000 })
.then(async txHash => this.web3Wrapper.awaitTransactionSuccessAsync(txHash));
}
}
@@ -151,6 +151,8 @@ export class PosterRegistry {
*/
public async pay(value: BigNumber): Promise<TransactionReceiptWithDecodedLogs> {
const contract = await this.getContract();
return this.web3Wrapper.sendTransactionAsync({ from: await this.web3.eth.getCoinbase(), to: contract.address, value, gas: 220000 }).then(async txHash => this.web3Wrapper.awaitTransactionSuccessAsync(txHash));
return this.web3Wrapper
.sendTransactionAsync({ from: await this.web3.eth.getCoinbase(), to: contract.address, value, gas: 220000 })
.then(async txHash => this.web3Wrapper.awaitTransactionSuccessAsync(txHash));
}
}
@@ -225,6 +225,8 @@ export class Treasury {
*/
public async pay(value: BigNumber): Promise<TransactionReceiptWithDecodedLogs> {
const contract = await this.getContract();
return this.web3Wrapper.sendTransactionAsync({ from: await this.web3.eth.getCoinbase(), to: contract.address, value, gas: 120000 }).then(async txHash => this.web3Wrapper.awaitTransactionSuccessAsync(txHash));
}
return this.web3Wrapper
.sendTransactionAsync({ from: await this.web3.eth.getCoinbase(), to: contract.address, value, gas: 120000 })
.then(async txHash => this.web3Wrapper.awaitTransactionSuccessAsync(txHash));
}
}
@@ -72,11 +72,13 @@ describe("KosuToken", () => {
const initialEth = await web3Wrapper.getBalanceInWeiAsync(accounts[0]);
await kosu.kosuToken.releaseTokens(difference);
const finalEth = await web3Wrapper.getBalanceInWeiAsync(accounts[0]);
finalEth.minus(initialEth).toNumber().should.be.gt(0);
finalEth
.minus(initialEth)
.toNumber()
.should.be.gt(0);
});
});


describe("estimateEtherToToken", () => {
it("should estimate tokens generated from ether", async () => {
await kosu.kosuToken.estimateEtherToToken(TestValues.oneEther).then(val => val.toNumber().should.be.gt(0));
@@ -89,7 +91,6 @@ describe("KosuToken", () => {
});
});


describe("pay", () => {
it("should generate tokens", async () => {
const initialBalance = await kosu.kosuToken.balanceOf(accounts[0]);
ProTip! Use n and p to navigate between commits in a pull request.
You can’t perform that action at this time.